final ExecutionYear currentYear = ExecutionYear.readCurrentExecutionYear();
final ExecutionYear previousYear = currentYear.getPreviousExecutionYear();
final List<ExecutionSemester> executionSemesters = new ArrayList<ExecutionSemester>();
SpecialSeasonStudentEnrollmentBean bean = (SpecialSeasonStudentEnrollmentBean) source;
if (bean.getScp().getDegreeCurricularPlan().hasOpenSpecialSeasonEnrolmentPeriod(currentYear.getLastExecutionPeriod())) {
executionSemesters.add(currentYear.getLastExecutionPeriod());
}
if (bean.getScp().getDegreeCurricularPlan().hasOpenSpecialSeasonEnrolmentPeriod(currentYear.getFirstExecutionPeriod())) {
executionSemesters.add(currentYear.getFirstExecutionPeriod());
}
if (bean.getScp().getDegreeCurricularPlan().hasOpenSpecialSeasonEnrolmentPeriod(previousYear.getLastExecutionPeriod())) {
executionSemesters.add(previousYear.getLastExecutionPeriod());
}
if (bean.getScp().getDegreeCurricularPlan().hasOpenSpecialSeasonEnrolmentPeriod(previousYear.getFirstExecutionPeriod())) {
executionSemesters.add(previousYear.getFirstExecutionPeriod());
}
Collections.sort(executionSemesters, ExecutionSemester.COMPARATOR_BY_SEMESTER_AND_YEAR);
Collections.reverse(executionSemesters);