final int numberOfCompletedCourses = student.getActiveStudentCurricularPlan().numberCompletedCoursesForSpecifiedDegrees(degrees);
final StudentCurricularPlan studentCurricularPlan = student.getActiveStudentCurricularPlan(); final Degree degree = studentCurricularPlan.getDegreeCurricularPlan().getDegree();
    public boolean run(IUserView userView, Integer executionDegreeOID) throws ExcepcaoPersistencia,            FenixServiceException {    	final ExecutionDegree executionDegree = rootDomainObject.readExecutionDegreeByOID(executionDegreeOID);        Scheduleing scheduleing = executionDegree.getScheduling();        if (scheduleing == null || scheduleing.getStartOfCandidacyPeriod() == null                || scheduleing.getEndOfCandidacyPeriod() == null) {            throw new CandidacyPeriodNotDefinedException();        }        Calendar now = Calendar.getInstance();        if (scheduleing.getStartOfCandidacyPeriod().after(now.getTime())                || scheduleing.getEndOfCandidacyPeriod().before(now.getTime())) {            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("dd/MM/yyyy HH:mm");            String start = simpleDateFormat.format(new Date(scheduleing.getStartOfCandidacyPeriod()                    .getTime()));            String end = simpleDateFormat.format(new Date(scheduleing.getEndOfCandidacyPeriod()                    .getTime()));            throw new OutOfCandidacyPeriodException(start + " - " + end);        }        Student student = findStudent(userView.getPerson());        //int numberOfCompletedCourses = student.countCompletedCoursesForActiveUndergraduateCurricularPlan();        final Set<Degree> degrees = new HashSet<Degree>();        for (final ExecutionDegree someExecutionDegree : scheduleing.getExecutionDegreesSet()) {        	degrees.add(someExecutionDegree.getDegreeCurricularPlan().getDegree());        }        final int numberOfCompletedCourses = student.getActiveStudentCurricularPlan().numberCompletedCoursesForSpecifiedDegrees(degrees);        Integer numberOfNecessaryCompletedCourses = scheduleing.getMinimumNumberOfCompletedCourses();        if (numberOfNecessaryCompletedCourses == null) {        	throw new NumberOfNecessaryCompletedCoursesNotSpecifiedException();        }        if (numberOfCompletedCourses < numberOfNecessaryCompletedCourses.intValue()) {            throw new InsufficientCompletedCoursesException(numberOfNecessaryCompletedCourses.toString());        }        return true;    }