public static List<ExecutionDegree> getAllByExecutionCourseAndTeacher( ExecutionCourse executionCourse, Person person) { List<ExecutionDegree> result = new ArrayList<ExecutionDegree>(); for (ExecutionDegree executionDegree : Bennu.getInstance().getExecutionDegreesSet()) { boolean matchExecutionCourse = false; for (CurricularCourse curricularCourse : executionDegree.getDegreeCurricularPlan().getCurricularCoursesSet()) { if (curricularCourse.getAssociatedExecutionCoursesSet().contains(executionCourse)) { matchExecutionCourse = true; break; } } if (!matchExecutionCourse) { continue; } // if teacher is not a coordinator of the executionDegree if (executionDegree.getCoordinatorByTeacher(person) == null) { continue; } result.add(executionDegree); } return result; }