protected void internalChangeState(AcademicServiceRequestBean academicServiceRequestBean) {
try {
verifyIsToProcessAndHasPersonalInfo(academicServiceRequestBean);
verifyIsToDeliveredAndIsPayed(academicServiceRequestBean);
} catch (DomainException e) {
throw new PhdDomainOperationException(e.getKey(), e, e.getArgs());
}
super.internalChangeState(academicServiceRequestBean);
if (academicServiceRequestBean.isToProcess()) {
PhdRegistryDiplomaRequest registryDiplomaRequest = getPhdIndividualProgramProcess().getRegistryDiplomaRequest();
if (registryDiplomaRequest == null) {
throw new PhdDomainOperationException("error.PhdFinalizationCertificateRequest.registry.diploma.request.none");
}
RectorateSubmissionBatch rectorateSubmissionBatch = registryDiplomaRequest.getRectorateSubmissionBatch();
if (rectorateSubmissionBatch == null) {
throw new PhdDomainOperationException(
"error.PhdFinalizationCertificateRequest.registry.diploma.submission.batch.not.sent");
}
if (!rectorateSubmissionBatch.isSent() && !rectorateSubmissionBatch.isReceived()) {
throw new PhdDomainOperationException(
"error.PhdFinalizationCertificateRequest.registry.diploma.submission.batch.not.sent");
}
if (!getPhdIndividualProgramProcess().isConcluded()) {
throw new PhdDomainOperationException(
"error.PhdFinalizationCertificateRequest.phd.process.not.submited.to.conclusion.process");
}
if (getLastGeneratedDocument() == null) {
generateDocument();