public class DegreeCurricularPlansForCreateStudentCurricularPlan implements DataProvider {
@Override
public Object provide(Object source, Object currentValue) {
final StudentCurricularPlanCreator creator = (StudentCurricularPlanCreator) source;
final SortedSet<DegreeCurricularPlan> result = new TreeSet<DegreeCurricularPlan>(DegreeCurricularPlan.COMPARATOR_BY_NAME);
if (creator.getDegree() != null) {
Set<DegreeCurricularPlan> degreeCurricularPlans = creator.getRegistration().getDegreeCurricularPlans();
for (DegreeCurricularPlan degreeCurricularPlan : creator.getDegree().getDegreeCurricularPlansSet()) {
if (!degreeCurricularPlans.contains(degreeCurricularPlan)) {
result.add(degreeCurricularPlan);
}
}
}