private static StudentCurricularPlan createNewStudentCurricularPlan( Registration registration, String branchID, MasterDegreeCandidate masterDegreeCandidate) { Branch branch = FenixFramework.getDomainObject(branchID); DegreeCurricularPlan degreecurricularPlan = masterDegreeCandidate.getExecutionDegree().getDegreeCurricularPlan(); StudentCurricularPlan studentCurricularPlan = StudentCurricularPlan.createPreBolonhaMasterDegree( registration, degreecurricularPlan, new YearMonthDay(), branch, masterDegreeCandidate.getGivenCredits(), masterDegreeCandidate.getSpecialization()); return studentCurricularPlan; }
private static void updateCandidateSituation(MasterDegreeCandidate masterDegreeCandidate) { masterDegreeCandidate.getActiveCandidateSituation().setValidation(new State(State.INACTIVE)); CandidateSituation candidateSituation = new CandidateSituation(); candidateSituation.setDate(Calendar.getInstance().getTime()); candidateSituation.setMasterDegreeCandidate(masterDegreeCandidate); candidateSituation.setValidation(new State(State.ACTIVE)); candidateSituation.setSituation(SituationName.ENROLLED_OBJ); }
@Atomic public static InfoCandidateRegistration run( String candidateID, String branchID, Integer studentNumber, User userView) throws FenixServiceException { check(RolePredicates.MASTER_DEGREE_ADMINISTRATIVE_OFFICE_PREDICATE); MasterDegreeCandidate masterDegreeCandidate = FenixFramework.getDomainObject(candidateID); Person person = masterDegreeCandidate.getPerson(); checkCandidateSituation(masterDegreeCandidate.getActiveCandidateSituation()); // remove master degree candidate role person.removeRoleByType(RoleType.MASTER_DEGREE_CANDIDATE); // check if old student number is free checkOldStudentNumber(studentNumber, person); // create new student final ExecutionDegree executionDegree = masterDegreeCandidate.getExecutionDegree(); Registration registration = createNewRegistration(person, studentNumber, executionDegree.getDegree()); // person.addPersonRoles(Role.getRoleByRoleType(RoleType.STUDENT)); StudentCurricularPlan studentCurricularPlan = createNewStudentCurricularPlan(registration, branchID, masterDegreeCandidate); // person.addPersonRoles(Role.getRoleByRoleType(RoleType.STUDENT)); createEnrolments(userView, masterDegreeCandidate, studentCurricularPlan); updateCandidateSituation(masterDegreeCandidate); copyQualifications(masterDegreeCandidate, person); createGratuitySituation(masterDegreeCandidate, studentCurricularPlan); return createNewInfoCandidateRegistration(masterDegreeCandidate, studentCurricularPlan); }
private static void createGratuitySituation( MasterDegreeCandidate masterDegreeCandidate, StudentCurricularPlan studentCurricularPlan) throws GratuityValuesNotDefinedServiceException { GratuityValues gratuityValues = masterDegreeCandidate.getExecutionDegree().getGratuityValues(); if (gratuityValues == null) { throw new GratuityValuesNotDefinedServiceException( "error.exception.masterDegree.gratuity.gratuityValuesNotDefined"); } new GratuitySituation(gratuityValues, studentCurricularPlan); }
private static void createEnrolments( User userView, MasterDegreeCandidate masterDegreeCandidate, StudentCurricularPlan studentCurricularPlan) { Collection<CandidateEnrolment> candidateEnrolments = masterDegreeCandidate.getCandidateEnrolments(); ExecutionSemester executionSemester = ExecutionSemester.readActualExecutionSemester(); for (CandidateEnrolment candidateEnrolment : candidateEnrolments) { new Enrolment( studentCurricularPlan, candidateEnrolment.getCurricularCourse(), executionSemester, EnrollmentCondition.FINAL, userView.getUsername()); } }
private static void copyQualifications( MasterDegreeCandidate masterDegreeCandidate, Person person) { Qualification qualification = new Qualification(); if (masterDegreeCandidate.getAverage() != null) { qualification.setMark(masterDegreeCandidate.getAverage().toString()); } qualification.setPerson(person); if (masterDegreeCandidate.getMajorDegreeSchool() == null) { qualification.setSchool(""); } else { qualification.setSchool(masterDegreeCandidate.getMajorDegreeSchool()); } qualification.setTitle(masterDegreeCandidate.getMajorDegree()); Calendar calendar = Calendar.getInstance(); if (masterDegreeCandidate.getMajorDegreeYear() == null) { qualification.setDate(calendar.getTime()); } else { calendar.set(Calendar.YEAR, masterDegreeCandidate.getMajorDegreeYear().intValue()); qualification.setDate(calendar.getTime()); } qualification.setDegree(masterDegreeCandidate.getMajorDegree()); }