final PrecedentDegreeInformation information = getRefactoredPrecedentDegreeInformation();
Registration previousRegistration = information.getStudentCurricularPlan().getRegistration();
if (previousRegistration.isActive()) {
ExecutionYear candidacyExecutionInterval = getCandidacyExecutionInterval();
ExecutionYear previousExecutionYear = candidacyExecutionInterval.getPreviousExecutionYear();
if (previousRegistration.hasAnyEnrolmentsIn(candidacyExecutionInterval)) {
throw new DomainException(
"error.DegreeTransferIndividualCandidacy.cannot.create.abandon.state.due.enrolments",
previousRegistration.getDegreeCurricularPlanName(), candidacyExecutionInterval.getQualifiedName());
}
RegistrationState.createRegistrationState(previousRegistration, AccessControl.getPerson(), previousExecutionYear
.getEndDateYearMonthDay().toDateTimeAtMidnight(), RegistrationStateType.INTERNAL_ABANDON);
}
}
}