Integer curricularYear = (Integer) indexForm.get("curYear");
indexForm.set("indice", indexForm.get("indice"));
indexForm.set("curYear", curricularYear);
InfoCurriculum infoCurriculum = null;
try {
infoCurriculum = ReadCurriculumByCurricularCourseCode.run(curricularCourseId);
} catch (NonExistingServiceException e) {
errors.add("chosenCurricularCourse", new ActionError("error.coordinator.chosenCurricularCourse"));
} catch (FenixServiceException e) {
if (e.getMessage().equals("nullCurricularCourse")) {
errors.add("nullCode", new ActionError("error.coordinator.noCurricularCourse"));
} else {
throw new FenixActionException(e);
}
}
if (infoCurriculum == null) {
errors.add("noCurriculum", new ActionError("error.coordinator.noCurriculum"));
}
if (!errors.isEmpty()) {
saveErrors(request, errors);
return (new ActionForward(mapping.getInput()));
}
// order list of execution courses by name
if (infoCurriculum.getInfoCurricularCourse() != null
&& infoCurriculum.getInfoCurricularCourse().getInfoAssociatedExecutionCourses() != null) {
ComparatorChain comparatorChain = new ComparatorChain();
comparatorChain.addComparator(new BeanComparator("infoExecutionPeriod.infoExecutionYear.beginDate"), true);
comparatorChain.addComparator(new BeanComparator("infoExecutionPeriod.beginDate"), true);
Collections.sort(infoCurriculum.getInfoCurricularCourse().getInfoAssociatedExecutionCourses(), comparatorChain);
}
// order list by year, semester
if (infoCurriculum.getInfoCurricularCourse() != null
&& infoCurriculum.getInfoCurricularCourse().getCurricularCourseExecutionScope() != null) {
ComparatorChain comparatorChain = new ComparatorChain();
comparatorChain.addComparator(new BeanComparator("infoCurricularSemester.infoCurricularYear.year"));
comparatorChain.addComparator(new BeanComparator("infoCurricularSemester.semester"));
comparatorChain.addComparator(new BeanComparator("infoCurricularCourse.name"));
Collections.sort(infoCurriculum.getInfoCurricularCourse().getInfoScopes(), comparatorChain);
}
infoCurriculum.prepareEnglishPresentation(getLocale(request));
request.setAttribute("infoCurriculum", infoCurriculum);
return mapping.findForward("showCurricularCourseSite");
}