* SeparationCyclesManagement
*/
checkConditionsToEnrol(studentCurricularPlan, executionSemester);
final CycleCurriculumGroup secondCycle = studentCurricularPlan.getSecondCycle();
if (secondCycle == null) {
if (studentCurricularPlanAllowAffinityCycle(studentCurricularPlan, cycleCourseGroupToEnrol)) {
studentCurricularPlan.enrolInAffinityCycle(cycleCourseGroupToEnrol, executionSemester);
return studentCurricularPlan.getRegistration();
} else {
final Student student = studentCurricularPlan.getRegistration().getStudent();
if (student.hasActiveRegistrationFor(cycleCourseGroupToEnrol.getParentDegreeCurricularPlan())) {
throw new FenixServiceException("error");
}
final MDCandidacy candidacy = createMDCandidacy(student, cycleCourseGroupToEnrol, executionSemester);
final Registration newRegistration =
new Registration(student.getPerson(), cycleCourseGroupToEnrol.getParentDegreeCurricularPlan(), candidacy,
RegistrationProtocol.getDefault(), cycleCourseGroupToEnrol.getCycleType());
newRegistration.setSourceRegistration(studentCurricularPlan.getRegistration());
newRegistration.getActiveState().setResponsiblePerson(null);
newRegistration.setIngression(Ingression.DA1C);
markOldRegistrationWithConcludedState(studentCurricularPlan);
return newRegistration;
}
} else if (secondCycle.isExternal()) {
return new AffinityCyclesManagement(studentCurricularPlan).enrol(cycleCourseGroupToEnrol);
} else {
return studentCurricularPlan.getRegistration();
}
}