public class CurricularCoursesForDegreeCurricularPlan implements DataProvider {
@Override
public Object provide(Object source, Object currentValue) {
final MarkSheetManagementBaseBean markSheetManagementBean = (MarkSheetManagementBaseBean) source;
final List<CurricularCourseMarksheetManagementBean> result = new ArrayList<CurricularCourseMarksheetManagementBean>();
if (markSheetManagementBean.hasDegree() && markSheetManagementBean.hasDegreeCurricularPlan()
&& markSheetManagementBean.hasExecutionPeriod()) {
if (markSheetManagementBean.getDegree().getDegreeCurricularPlansSet()
.contains(markSheetManagementBean.getDegreeCurricularPlan())) {
if (markSheetManagementBean.getDegree().isBolonhaDegree()) {
addCurricularCourses(
result,
markSheetManagementBean.getDegreeCurricularPlan().getDcpDegreeModules(CurricularCourse.class,
markSheetManagementBean.getExecutionPeriod().getExecutionYear()),
markSheetManagementBean.getExecutionPeriod());
} else {
addCurricularCourses(result, markSheetManagementBean.getDegreeCurricularPlan().getCurricularCoursesSet(),
markSheetManagementBean.getExecutionPeriod());
}
} else {
markSheetManagementBean.setDegreeCurricularPlan(null);
markSheetManagementBean.setCurricularCourseBean(null);
}
}
Collections.sort(result, CurricularCourseMarksheetManagementBean.COMPARATOR_BY_NAME);
return result;