throw new FenixServiceException("nullCurricularCourse");
}
if (stringExecutionYear == null || stringExecutionYear.length() == 0) {
throw new FenixServiceException("nullExecutionYearName");
}
CurricularCourse curricularCourse = (CurricularCourse) FenixFramework.getDomainObject(curricularCourseCode);
if (curricularCourse == null) {
throw new NonExistingServiceException("noCurricularCourse");
}
final ExecutionYear executionYear = ExecutionYear.readExecutionYearByName(stringExecutionYear);
if (executionYear == null) {
throw new NonExistingServiceException("noExecutionYear");
}
Curriculum curriculumExecutionYear = curricularCourse.findLatestCurriculumModifiedBefore(executionYear.getEndDate());
if (curriculumExecutionYear != null) {
List allCurricularCourseScopes = new ArrayList();
List allExecutionCourses = new ArrayList();
Collection executionPeriods = executionYear.getExecutionPeriodsSet();
Iterator iterExecutionPeriods = executionPeriods.iterator();
while (iterExecutionPeriods.hasNext()) {
ExecutionSemester executionSemester = (ExecutionSemester) iterExecutionPeriods.next();
Set<CurricularCourseScope> curricularCourseScopes =
curricularCourse.findCurricularCourseScopesIntersectingPeriod(executionSemester.getBeginDate(),
executionSemester.getEndDate());
if (curricularCourseScopes != null) {
List disjunctionCurricularCourseScopes =
(List) CollectionUtils.disjunction(allCurricularCourseScopes, curricularCourseScopes);
List intersectionCurricularCourseScopes =
(List) CollectionUtils.intersection(allCurricularCourseScopes, curricularCourseScopes);
allCurricularCourseScopes =
(List) CollectionUtils.union(disjunctionCurricularCourseScopes, intersectionCurricularCourseScopes);
}
List associatedExecutionCourses = new ArrayList();
Collection<ExecutionCourse> executionCourses = curricularCourse.getAssociatedExecutionCoursesSet();
for (ExecutionCourse executionCourse : executionCourses) {
if (executionCourse.getExecutionPeriod().equals(executionSemester)) {
associatedExecutionCourses.add(executionCourse);
}
}