ActionForward actionForwardError = verifySubmissionPreconditions(mapping);
if (actionForwardError != null) {
return actionForwardError;
}
MobilityIndividualApplicationProcessBean bean =
(MobilityIndividualApplicationProcessBean) getIndividualCandidacyProcessBean();
bean.setInternalPersonCandidacy(Boolean.TRUE);
boolean isValid = hasInvalidViewState();
if (!isValid) {
invalidateDocumentFileRelatedViewStates();
request.setAttribute(getIndividualCandidacyProcessBeanName(), getIndividualCandidacyProcessBean());
return mapping.findForward("accept-honour-declaration");
}
if (candidacyIndividualProcessExistsForThisEmail(bean.getPersonBean().getEmail())) {
addActionMessage("error", request, "error.candidacy.hash.code.already.bounded");
invalidateDocumentFileRelatedViewStates();
request.setAttribute(getIndividualCandidacyProcessBeanName(), getIndividualCandidacyProcessBean());
return mapping.findForward("candidacy-continue-creation");
}
if (!bean.getHonorAgreement()) {
addActionMessage("error", request, "error.must.agree.on.declaration.of.honor");
invalidateDocumentFileRelatedViewStates();
request.setAttribute(getIndividualCandidacyProcessBeanName(), getIndividualCandidacyProcessBean());
return mapping.findForward("accept-honour-declaration");
}
if (bean.isToAccessFenix() && bean.getPublicCandidacyHashCode() == null) {
DegreeOfficePublicCandidacyHashCode candidacyHashCode = null;
try {
candidacyHashCode =
DegreeOfficePublicCandidacyHashCodeOperations
.getUnusedOrCreateNewHashCodeAndSendEmailForApplicationSubmissionToCandidate(
getProcessType(), getCurrentOpenParentProcess(), bean.getPersonBean().getEmail());
bean.setPublicCandidacyHashCode(candidacyHashCode);
} catch (HashCodeForEmailAndProcessAlreadyBounded e) {
addActionMessage(request, "error.candidacy.hash.code.already.bounded");
return mapping.findForward("show-pre-creation-candidacy-form");
}
}