private String executionDegreesCompareHash(final Set<ExecutionDegree> executionDegreeSet) {
   final SortedSet<String> strings = new TreeSet<String>();
   for (final ExecutionDegree executionDegree : executionDegreeSet) {
     strings.add(executionDegree.getDegree().getSigla());
   }
   final StringBuilder builder = new StringBuilder();
   for (final String string : strings) {
     builder.append(string);
   }
   return builder.toString();
 }
 public Registration findBestRegistration(final Student student) {
   for (final Registration registration : student.getRegistrationsSet()) {
     for (final ExecutionDegree executionDegree :
         getOutboundMobilityCandidacyContestGroup().getExecutionDegreeSet()) {
       if (executionDegree.getDegree() == registration.getDegree()) {
         final ExecutionYear executionYear =
             (ExecutionYear) getOutboundMobilityCandidacyPeriod().getExecutionInterval();
         final RegistrationState registrationState =
             registration.getLastRegistrationState(executionYear);
         if (registrationState != null && registrationState.getStateType().isActive()) {
           return registration;
         }
       }
     }
   }
   return null;
 }
  public ActionForward listClasses(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {
    AcademicInterval academicInterval =
        AcademicInterval.getAcademicIntervalFromResumedString(
            (String) request.getAttribute(PresentationConstants.ACADEMIC_INTERVAL));
    InfoCurricularYear infoCurricularYear =
        (InfoCurricularYear) request.getAttribute(PresentationConstants.CURRICULAR_YEAR);
    InfoExecutionDegree infoExecutionDegree =
        (InfoExecutionDegree) request.getAttribute(PresentationConstants.EXECUTION_DEGREE);

    final ExecutionDegree executionDegree =
        FenixFramework.getDomainObject(infoExecutionDegree.getExternalId());

    final Set<SchoolClass> classes;
    Integer curricularYear = infoCurricularYear.getYear();
    if (curricularYear != null) {
      classes =
          executionDegree.findSchoolClassesByAcademicIntervalAndCurricularYear(
              academicInterval, curricularYear);
    } else {
      classes = executionDegree.findSchoolClassesByAcademicInterval(academicInterval);
    }

    final List<InfoClass> infoClassesList = new ArrayList<InfoClass>();

    for (final SchoolClass schoolClass : classes) {
      InfoClass infoClass = InfoClass.newInfoFromDomain(schoolClass);
      infoClassesList.add(infoClass);
    }

    if (infoClassesList != null && !infoClassesList.isEmpty()) {
      BeanComparator nameComparator = new BeanComparator("nome");
      Collections.sort(infoClassesList, nameComparator);

      request.setAttribute(PresentationConstants.CLASSES, infoClassesList);
    }
    request.setAttribute("executionDegreeD", executionDegree);

    return mapping.findForward("ShowClassList");
  }
 @Override
 public boolean isMember(User user) {
   if (user == null || user.getPerson().getCoordinatorsSet().isEmpty()) {
     return false;
   }
   for (Coordinator coordinator : user.getPerson().getCoordinatorsSet()) {
     ExecutionDegree executionDegree = coordinator.getExecutionDegree();
     if (executionDegree.getExecutionYear().isCurrent()) {
       if (degreeType != null && degreeType != executionDegree.getDegree().getDegreeType()) {
         continue;
       }
       if (degree != null && !executionDegree.getDegree().equals(degree)) {
         continue;
       }
       return true;
     }
   }
   return false;
 }
  @Override
  public Collection<ExecutionDegree> getSearchResults(
      Map<String, String> argsMap, String value, int maxCount) {
    final String executionYearOid = argsMap.get("executionYearOid");
    final ExecutionYear executionYear = FenixFramework.getDomainObject(executionYearOid);

    final String searchValue = StringNormalizer.normalize(value);

    final List<ExecutionDegree> result = new ArrayList<ExecutionDegree>();
    for (final ExecutionDegree executionDegree : executionYear.getExecutionDegreesSet()) {
      final DegreeCurricularPlan degreeCurricularPlan = executionDegree.getDegreeCurricularPlan();
      final Degree degree = degreeCurricularPlan.getDegree();
      if (match(searchValue, degreeCurricularPlan.getName())
          || match(searchValue, degree.getNameI18N(executionYear).getContent())
          || match(searchValue, degree.getSigla())) {
        result.add(executionDegree);
        if (result.size() >= maxCount) {
          break;
        }
      }
    }
    return result;
  }
 @Override
 public Set<User> getMembers() {
   Set<User> users = new HashSet<>();
   if (degreeType != null) {
     ExecutionYear year = ExecutionYear.readCurrentExecutionYear();
     for (final ExecutionDegree executionDegree : year.getExecutionDegreesSet()) {
       final DegreeCurricularPlan degreeCurricularPlan = executionDegree.getDegreeCurricularPlan();
       final Degree degree = degreeCurricularPlan.getDegree();
       if (degree.getDegreeType().equals(degreeType)) {
         for (final Coordinator coordinator : executionDegree.getCoordinatorsListSet()) {
           User user = coordinator.getPerson().getUser();
           if (user != null) {
             users.add(user);
           }
         }
       }
     }
     //            for (Degree degree : Degree.readAllByDegreeType(degreeType)) {
     //                users.addAll(getCoordinators(degree));
     //            }
   }
   if (degree != null) {
     users.addAll(getCoordinators(degree));
   }
   if (degree == null && degreeType == null) {
     final ExecutionYear executionYear = ExecutionYear.readCurrentExecutionYear();
     for (final ExecutionDegree executionDegree : executionYear.getExecutionDegreesSet()) {
       for (final Coordinator coordinator : executionDegree.getCoordinatorsListSet()) {
         User user = coordinator.getPerson().getUser();
         if (user != null) {
           users.add(user);
         }
       }
     }
   }
   return users;
 }
  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);
  }