public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
throws Exception {
final String executionPeriodIDString = request.getParameter("executionPeriodID");
final ExecutionSemester selectedExecutionPeriod;
if (executionPeriodIDString == null) {
selectedExecutionPeriod = ExecutionSemester.readActualExecutionSemester();
} else if (executionPeriodIDString.isEmpty()) {
selectedExecutionPeriod = null;
} else {
selectedExecutionPeriod = FenixFramework.getDomainObject(executionPeriodIDString);
}
request.setAttribute("executionPeriod", selectedExecutionPeriod);
final List<ExecutionCourse> executionCourses = new ArrayList<ExecutionCourse>();
request.setAttribute("executionCourses", executionCourses);
final Person person = AccessControl.getPerson();
final SortedSet<ExecutionSemester> executionSemesters =
new TreeSet<ExecutionSemester>(Ordering.from(ExecutionSemester.COMPARATOR_BY_SEMESTER_AND_YEAR).reverse());
if (person != null) {
for (final Professorship professorship : person.getProfessorshipsSet()) {
final ExecutionCourse executionCourse = professorship.getExecutionCourse();
final ExecutionSemester executionSemester = executionCourse.getExecutionPeriod();
executionSemesters.add(executionSemester);
if (selectedExecutionPeriod == null || selectedExecutionPeriod == executionSemester) {
executionCourses.add(executionCourse);
}