final EnrolmentDeclarationRequest enrolmentDeclarationRequest = (EnrolmentDeclarationRequest) getDocumentRequest();
if (enrolmentDeclarationRequest.getDocumentPurposeType() == DocumentPurposeType.PPRE) {
final Registration registration = getDocumentRequest().getRegistration();
final ExecutionYear executionYear = enrolmentDeclarationRequest.getExecutionYear();
final boolean transition = registration.isTransition(executionYear);
if (registration.isFirstTime(executionYear) && !transition) {
result.append(BundleUtil.getString(Bundle.ACADEMIC, getLocale(),
"message.academicDocument.enrolment.declaration.approvement.firstTime"));
} else {
final Registration registrationToInspect = transition ? registration.getSourceRegistration() : registration;
if (registrationToInspect.hasApprovement(executionYear.getPreviousExecutionYear())) {
result.append(BundleUtil.getString(Bundle.ACADEMIC, getLocale(),
"message.academicDocument.enrolment.declaration.approvement.have")
+ executionYear.getPreviousExecutionYear().getYear());
} else {
result.append(BundleUtil.getString(Bundle.ACADEMIC, getLocale(),
"message.academicDocument.enrolment.declaration.approvement.notHave")
+ executionYear.getPreviousExecutionYear().getYear());
}
}
}
return result.toString();
}