@Override public Set<User> getMembers() { Set<User> users = new HashSet<User>(); Set<Degree> degrees = new HashSet<>(); for (CompetenceCourse competenceCourse : executionCourse.getCompetenceCourses()) { for (CurricularCourse curricularCourse : competenceCourse.getAssociatedCurricularCoursesSet()) { degrees.add(curricularCourse.getDegree()); } } // students of any degree sharing the same competence of the given execution course for (Degree degree : degrees) { for (Registration registration : degree.getActiveRegistrations()) { User user = registration.getPerson().getUser(); if (user != null) { users.add(user); } } } // students attending the given execution course (most will be in the previous case but some may // not) for (Attends attends : executionCourse.getAttendsSet()) { User user = attends.getRegistration().getPerson().getUser(); if (user != null) { users.add(user); } } return users; }
@Atomic public static void run( final String attendsID, final Integer contact, final Integer autonomousStudy, final Integer other) { check(RolePredicates.STUDENT_PREDICATE); final Attends attends = FenixFramework.getDomainObject(attendsID); attends.createWeeklyWorkLoad(contact, autonomousStudy, other); }