public Collection<DegreeModuleToEnrol> getModulesToEnrolForFirstSemester() {
final Registration registration = getRegistration();
final ExecutionYear executionYear = (ExecutionYear) getCandidacyExecutionInterval();
final ExecutionSemester semesterToEnrol = executionYear.getFirstExecutionPeriod();
final StudentCurricularPlan studentCurricularPlan = registration.getActiveStudentCurricularPlan();
final DegreeCurricularPlan degreeCurricularPlan = registration.getLastDegreeCurricularPlan();
Set<DegreeModuleToEnrol> degreeModulesToEnrol = new HashSet<DegreeModuleToEnrol>();
for (CurricularCourse selectedCurricularCourse : getCurricularCoursesSet()) {
List<Context> contextList = selectedCurricularCourse.getParentContextsByExecutionSemester(semesterToEnrol);
if (contextList.isEmpty()) {
continue;
}
Context selectedContext = contextList.iterator().next(); // WTF?.. /facepalm
CurriculumGroup curriculumGroup = null;
if (selectedCurricularCourse.getDegreeCurricularPlan().equals(degreeCurricularPlan)) {
curriculumGroup = studentCurricularPlan.getRoot().findCurriculumGroupFor(selectedContext.getParentCourseGroup());
} else {
// Enrol on standalone curriculum group
curriculumGroup = studentCurricularPlan.getStandaloneCurriculumGroup();
}
if (curriculumGroup == null) {
continue;
}