public class CurriculumGroupsProviderForOptionalEnrolmentsLocationManagement implements DataProvider {
@Override
public Object provide(Object source, Object currentValue) {
final OptionalEnrolmentLocationBean bean = (OptionalEnrolmentLocationBean) source;
final Collection<CurriculumGroup> result =
new TreeSet<CurriculumGroup>(CurriculumGroup.COMPARATOR_BY_FULL_PATH_NAME_AND_ID);
final Set<AcademicProgram> programs =
AcademicAccessRule.getProgramsAccessibleToFunction(AcademicOperationType.STUDENT_ENROLMENTS,
Authenticate.getUser()).collect(Collectors.toSet());
for (final Registration registration : bean.getStudent().getRegistrationsSet()) {
if (!registration.isBolonha()) {
continue;
}
if (!programs.contains(registration.getDegree())) {
continue;
}
final StudentCurricularPlan studentCurricularPlan = registration.getLastStudentCurricularPlan();
result.addAll(studentCurricularPlan.getCurricularCoursePossibleGroups(bean.getEnrolment().getCurricularCourse()));
}
return result;
}