public class DegreeCurricularPlansForDegreeAndExecutionYear implements DataProvider {
@Override
public Object provide(Object source, Object currentValue) {
final DFACandidacyBean dfaCandidacyBean = (DFACandidacyBean) source;
final List<DegreeCurricularPlan> result = new ArrayList<DegreeCurricularPlan>();
if (dfaCandidacyBean.getDegree() != null && dfaCandidacyBean.getExecutionYear() != null) {
result.addAll(dfaCandidacyBean.getDegree().getDegreeCurricularPlansForYear(dfaCandidacyBean.getExecutionYear()));
Collections.sort(result, new BeanComparator("name"));
} else {
dfaCandidacyBean.setDegreeCurricularPlan(null);
}
return result;
}