@Override public boolean isMember(User user) { if (user == null) { return false; } if (user.getPerson().getStudent() != null) { final Set<CompetenceCourse> competenceCourses = executionCourse.getCompetenceCourses(); for (Registration registration : user.getPerson().getStudent().getRegistrationsSet()) { // students of any degree sharing the same competence of the given execution course for (StudentCurricularPlan studentCurricularPlan : registration.getStudentCurricularPlansSet()) { for (Enrolment enrolment : studentCurricularPlan.getEnrolmentsSet()) { CompetenceCourse competenceCourse = enrolment.getCurricularCourse().getCompetenceCourse(); if (competenceCourses.contains(competenceCourse)) { return true; } } } // students attending the given execution course (most will be in the previous case but some // may not) if (registration.getAttendingExecutionCoursesFor().contains(executionCourse)) { return true; } } } return false; }
@Atomic public static void run(final String studentCurricularPlanId) throws DomainException, NonExistingServiceException { final StudentCurricularPlan studentCurricularPlan = FenixFramework.getDomainObject(studentCurricularPlanId); if (studentCurricularPlan != null) { for (Enrolment enrolment : studentCurricularPlan.getEnrolmentsSet()) { for (EnrolmentEvaluation evaluation : enrolment.getEvaluationsSet()) { evaluation.setEnrolmentEvaluationState(EnrolmentEvaluationState.TEMPORARY_OBJ); } } studentCurricularPlan.delete(); } else { throw new NonExistingServiceException(); } }