private Collection<CourseGroup> getCourseGroupsToEvaluate(final CourseGroup courseGroup,
final EnrolmentContext enrolmentContext) {
if (courseGroup.isRoot()) {
final Collection<CourseGroup> res = new HashSet<CourseGroup>();
for (final CycleType cycleType : enrolmentContext.getStudentCurricularPlan().getDegreeType().getCycleTypes()) {
CycleCurriculumGroup cycleCurriculumGroup =
enrolmentContext.getStudentCurricularPlan().getRoot().getCycleCurriculumGroup(cycleType);
if (cycleCurriculumGroup != null) {
if (cycleCurriculumGroup.isExternal()) {
throw new DomainException("error.cycleCurriculumGroup.cannot.be.external");
}
res.add(cycleCurriculumGroup.getDegreeModule());
}
}
return res;
} else {
return Collections.singleton(courseGroup);