ExecutionPeriod currentExecutionPeriod = ExecutionPeriod.readActualExecutionPeriod(); ExecutionPeriod previousExecutionPeriod = currentExecutionPeriod.getPreviousExecutionPeriod();
final Set<CurricularCourse> curricularCourses = new HashSet<CurricularCourse>(); for (final DegreeCurricularPlan degreeCurricularPlan : degree.getDegreeCurricularPlans()) { curricularCourses.addAll(degreeCurricularPlan.getCurricularCourses(currentExecutionPeriod)); curricularCourses.addAll(degreeCurricularPlan.getCurricularCourses(previousExecutionPeriod)); }
    public List<ExecutionCourseView> run(Integer degreeOID) {        List<ExecutionCourseView> result = new ArrayList<ExecutionCourseView>();        ExecutionPeriod currentExecutionPeriod = ExecutionPeriod.readActualExecutionPeriod();        ExecutionPeriod previousExecutionPeriod = currentExecutionPeriod.getPreviousExecutionPeriod();        Degree degree = rootDomainObject.readDegreeByOID(degreeOID);        Set<String> processedExecutionCourses = new HashSet<String>();        for (DegreeCurricularPlan degreeCurricularPlan : degree.getDegreeCurricularPlans()) {            for (CurricularCourse curricularCourse : degreeCurricularPlan.getCurricularCourses()) {                for (ExecutionCourse executionCourse : curricularCourse.getAssociatedExecutionCourses()) {                    ExecutionPeriod executionPeriodFromExecutionCourse = executionCourse.getExecutionPeriod();                    if (executionPeriodFromExecutionCourse.equals(currentExecutionPeriod)                            || (previousExecutionPeriod != null && executionPeriodFromExecutionCourse.equals(previousExecutionPeriod))) {                                                for (CurricularCourseScope curricularCourseScope : curricularCourse.getScopes()) {                            String key = generateExecutionCourseKey(executionCourse,curricularCourseScope);                            if (!processedExecutionCourses.contains(key)) {                                ExecutionCourseView executionCourseView = new ExecutionCourseView(executionCourse);                                executionCourseView.setCurricularYear(curricularCourseScope.getCurricularSemester().getCurricularYear().getYear());                                executionCourseView.setAnotation(curricularCourseScope.getAnotation());                                executionCourseView.setDegreeCurricularPlanAnotation(degreeCurricularPlan.getAnotation());                                                                processedExecutionCourses.add(key);                                result.add(executionCourseView);                            }                        }                    }                }            }        }        return result;    }