/*
  * This is a convenience method, until RenderTimeTableTag support proper domain classes...
  */
 @Deprecated
 public static List<InfoLesson> newInfosForSchoolClass(SchoolClass schoolClass) {
   List<InfoLesson> lessons = new ArrayList<>();
   for (Shift shift : schoolClass.getAssociatedShiftsSet()) {
     for (Lesson lesson : shift.getAssociatedLessonsSet()) {
       lessons.add(new InfoLesson(lesson));
     }
   }
   return lessons;
 }
  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);
  }