this();
init(conclusionProcessBean, responsible);
}
protected void init(final PhdConclusionProcessBean conclusionProcessBean, Person responsible) {
PhdIndividualProgramProcess process = conclusionProcessBean.getPhdIndividualProgramProcess();
LocalDate conclusionDate = conclusionProcessBean.getConclusionDate();
PhdThesisFinalGrade grade = conclusionProcessBean.getGrade();
BigDecimal thesisEctsCredits = conclusionProcessBean.getThesisEctsCredits();
BigDecimal studyPlanEctsCredits = conclusionProcessBean.getStudyPlanEctsCredits();
if (!process.isConcluded()) {
throw new DomainException("error.phd.PhdConclusionProcess.process.is.not.concluded");
}
if (responsible == null) {
throw new DomainException("error.phd.PhdConclusionProcess.responsible.is.required");
}
if (conclusionDate == null) {
throw new DomainException("error.phd.PhdConclusionProcess.conclusionDate.is.required");
}
if (grade == null) {
throw new DomainException("error.phd.PhdConclusionProcess.grade.is.required");
}
if (process.getRegistration() != null && !process.getRegistration().isRegistrationConclusionProcessed()) {
throw new DomainException("error.phd.PhdConclusionProcess.registration.must.be.concluded.first");
}
if (thesisEctsCredits == null) {
throw new DomainException("error.phd.PhdConclusionProcess.thesisEctsCredits.is.required");
}
if (!process.getCandidacyProcess().isStudyPlanExempted()) {
if (studyPlanEctsCredits == null) {
throw new DomainException("error.phd.PhdConclusionProcess.studyPlanEctsCredits.is.required");
}
}
setResponsible(responsible);
setConclusionDate(conclusionDate);
setVersion(process.getLastConclusionProcess() != null ? process.getLastConclusionProcess().getVersion() + 1 : 1);
setPhdProcess(process);
setWhenCreated(new DateTime());
setFinalGrade(grade);
setThesisEctsCredits(thesisEctsCredits);
setStudyPlanEctsCredits(studyPlanEctsCredits);