@EntryPoint
  public ActionForward monitor(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {

    request.setAttribute("properties", System.getProperties());

    request.setAttribute(
        "startMillis",
        ""
            + ExecutionSemester.readActualExecutionSemester()
                .getAcademicInterval()
                .getStartMillis());
    request.setAttribute(
        "endMillis",
        "" + ExecutionSemester.readActualExecutionSemester().getAcademicInterval().getEndMillis());
    request.setAttribute(
        "chronology",
        ""
            + ExecutionSemester.readActualExecutionSemester()
                .getAcademicInterval()
                .getChronology()
                .toString());
    request.setAttribute("cacheSize", SharedIdentityMap.getCache().size());

    return mapping.findForward("Show");
  }
  public static void editDepartmentOfficeCreditsPeriod(
      ExecutionSemester executionSemester, DateTime begin, DateTime end) {
    TeacherCreditsFillingForDepartmentAdmOfficeCE creditsFillingCE =
        TeacherCreditsFillingForDepartmentAdmOfficeCE
            .getTeacherCreditsFillingForDepartmentAdmOffice(
                executionSemester.getAcademicInterval());

    if (creditsFillingCE == null) {

      AcademicCalendarEntry parentEntry =
          executionSemester.getAcademicInterval().getAcademicCalendarEntry();
      AcademicCalendarRootEntry rootEntry =
          executionSemester.getAcademicInterval().getAcademicCalendar();

      new TeacherCreditsFillingForDepartmentAdmOfficeCE(
          parentEntry,
          new MultiLanguageString(
              BundleUtil.getString(
                  Bundle.APPLICATION, "label.TeacherCreditsFillingCE.entry.title")),
          null,
          begin,
          end,
          rootEntry);

    } else {
      creditsFillingCE.edit(begin, end);
    }
  }
Пример #3
0
  private static ExecutionSemester getExecutionPeriod(String year, Integer semester)
      throws NonExistingServiceException {

    if (year != null && semester != null) {
      return ExecutionSemester.readBySemesterAndExecutionYear(semester, year);
    } else if (year == null && semester == null) {
      return ExecutionSemester.readActualExecutionSemester();
    } else {
      throw new NonExistingServiceException();
    }
  }
 public static TeacherCreditsFillingCE getValidCreditsPeriod(
     ExecutionSemester executionSemester, User user) {
   if (org.fenixedu.bennu.core.groups.Group.parse("creditsManager").isMember(user)) {
     return TeacherCreditsFillingForDepartmentAdmOfficeCE
         .getTeacherCreditsFillingForDepartmentAdmOffice(executionSemester.getAcademicInterval());
   }
   if (RoleType.TEACHER.isMember(user)) {
     return TeacherCreditsFillingForTeacherCE.getTeacherCreditsFillingForTeacher(
         executionSemester.getAcademicInterval());
   }
   throw new DomainException("invalid.role.type");
 }
Пример #5
0
 @Override
 public int compare(
     final ExecutionCourseSender executionCourseSender1,
     final ExecutionCourseSender executionCourseSender2) {
   final ExecutionCourse executionCourse1 = executionCourseSender1.getCourse();
   final ExecutionCourse executionCourse2 = executionCourseSender2.getCourse();
   final ExecutionSemester executionSemester1 = executionCourse1.getExecutionPeriod();
   final ExecutionSemester executionSemester2 = executionCourse2.getExecutionPeriod();
   final int p = executionSemester1.compareTo(executionSemester2);
   if (p == 0) {
     final int n = executionCourse1.getName().compareTo(executionCourse2.getName());
     return n == 0
         ? executionCourseSender1.hashCode() - executionCourseSender2.hashCode()
         : n;
   }
   return p;
 }
  @Override
  public ExecutionDegree getExecutionDegree() {
    if (semester != null && degreeCurricularPlan != null) {
      ExecutionDegree degree =
          degreeCurricularPlan.getExecutionDegreeByAcademicInterval(semester.getAcademicInterval());

      return degree;
    }

    return null;
  }
  private List<ExecutionSemester> readPossibleExecutionSemestersForStudentCurricularPlan(
      HttpServletRequest request) {
    StudentCurricularPlan studentCurricularPlan = readStudentCurricularPlan(request);
    final List<ExecutionSemester> executionPeriodsInTimePeriod =
        ExecutionSemester.readExecutionPeriodsInTimePeriod(
            studentCurricularPlan.getStartDate(), getCurrentExecutionSemesterEndDate());

    Collections.sort(
        executionPeriodsInTimePeriod,
        new ReverseComparator(ExecutionSemester.COMPARATOR_BY_SEMESTER_AND_YEAR));
    return executionPeriodsInTimePeriod;
  }
  @Atomic
  public static List run(String degreeCurricularPlanID) {

    // Start date of the DegreeCurricularPlan
    final Date startDate =
        FenixFramework.<DegreeCurricularPlan>getDomainObject(degreeCurricularPlanID)
            .getInitialDate();

    // End date of the current year
    final Date endDate = ExecutionYear.readCurrentExecutionYear().getEndDate();

    final List<InfoExecutionPeriod> infoExecutionPeriods = new ArrayList<InfoExecutionPeriod>();
    for (final ExecutionSemester executionSemester :
        ExecutionSemester.readExecutionPeriodsInTimePeriod(startDate, endDate)) {
      infoExecutionPeriods.add(InfoExecutionPeriod.newInfoFromDomain(executionSemester));
    }
    return infoExecutionPeriods;
  }
 public static boolean isInValidTeacherCreditsPeriod(ExecutionSemester executionSemester) {
   TeacherCreditsFillingCE validCreditsPerid =
       TeacherCreditsFillingForTeacherCE.getTeacherCreditsFillingForTeacher(
           executionSemester.getAcademicInterval());
   return validCreditsPerid != null && validCreditsPerid.containsNow();
 }
 @Atomic
 public static InfoExecutionPeriod run() {
   return InfoExecutionPeriod.newInfoFromDomain(ExecutionSemester.readActualExecutionSemester());
 }
  public ActionForward warmUpCacheForEnrolmentPeriodStart(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {

    final ExecutionSemester ces = ExecutionSemester.readActualExecutionSemester();
    final ExecutionSemester pes = ces == null ? null : ces.getPreviousExecutionPeriod();

    if (ces != null && pes != null) {
      long s = System.currentTimeMillis();
      for (final ExecutionCourse executionCourse : ces.getAssociatedExecutionCoursesSet()) {
        executionCourse.getName();
        for (final CourseLoad courseLoad : executionCourse.getCourseLoadsSet()) {
          courseLoad.getType();
          for (final Shift shift : courseLoad.getShiftsSet()) {
            shift.getNome();
            for (final SchoolClass schoolClass : shift.getAssociatedClassesSet()) {
              schoolClass.getNome();
              final ExecutionDegree executionDegree = schoolClass.getExecutionDegree();
              final DegreeCurricularPlan degreeCurricularPlan =
                  executionDegree.getDegreeCurricularPlan();
              degreeCurricularPlan.getName();
              final Degree degree = degreeCurricularPlan.getDegree();
              degree.getDegreeType();
              final RootCourseGroup root = degreeCurricularPlan.getRoot();
              load(root);
            }
            for (final Lesson lesson : shift.getAssociatedLessonsSet()) {
              lesson.getBeginHourMinuteSecond();
              for (OccupationPeriod period = lesson.getPeriod();
                  period != null;
                  period = period.getNextPeriod()) {
                period.getStartDate();
              }
              for (final LessonInstance lessonInstance : lesson.getLessonInstancesSet()) {
                lessonInstance.getBeginDateTime();
              }
            }
          }
        }
      }
      long e = System.currentTimeMillis();
      logger.info(
          "Warming up cache for enrolment period. Load of current semester information took {}ms.",
          e - s);

      s = System.currentTimeMillis();
      //            for (final RoomClassification roomClassification :
      // rootDomainObject.getRoomClassificationSet()) {
      //                for (final RoomInformation roomInformation :
      // roomClassification.getRoomInformationsSet()) {
      //                    roomInformation.getDescription();
      //                    final Room room = roomInformation.getRoom();
      //                    room.getNormalCapacity();
      //                }
      //            }
      e = System.currentTimeMillis();
      logger.info("Warming up cache for enrolment period. Load of room listing took {}ms.", e - s);

      final Set<Student> students = new HashSet<Student>();
      s = System.currentTimeMillis();
      for (final Enrolment enrolment : pes.getEnrolmentsSet()) {
        students.add(enrolment.getStudent());
      }
      e = System.currentTimeMillis();
      logger.info("Warming up cache for enrolment period. Search for students took {}ms.", e - s);

      s = System.currentTimeMillis();
      for (final Student student : students) {
        student.getNumber();
        for (final Registration registration : student.getRegistrationsSet()) {
          registration.getNumber();
          for (final StudentCurricularPlan studentCurricularPlan :
              registration.getStudentCurricularPlansSet()) {
            final RootCurriculumGroup root = studentCurricularPlan.getRoot();
            load(root);
          }
        }
      }
      e = System.currentTimeMillis();
      logger.info(
          "Warming up cache for enrolment period. Load of student curriculum took {}ms.", e - s);
    }

    return monitor(mapping, form, request, response);
  }