return isValid;
}
public ActionForward editCandidacyProcess(ActionMapping mapping, ActionForm form, HttpServletRequest request,
HttpServletResponse response) throws FenixServiceException {
Over23IndividualCandidacyProcessBean bean = (Over23IndividualCandidacyProcessBean) getIndividualCandidacyProcessBean();
PersonBean personBean = bean.getPersonBean();
try {
ActionForward actionForwardError = verifySubmissionPreconditions(mapping);
if (actionForwardError != null) {
return actionForwardError;
}
if (!isApplicationSubmissionPeriodValid()) {
return beginCandidacyProcessIntro(mapping, form, request, response);
}
final Set<Person> persons = new HashSet<Person>(Person.readByDocumentIdNumber(personBean.getDocumentIdNumber()));
if (persons.size() > 1) {
addActionMessage("individualCandidacyMessages", request, getProcessType().getSimpleName()
+ ".error.public.candidacies.fill.personal.information.and.institution.id.person.already.exist");
return prepareEditCandidacyProcess(mapping, form, request, response);
}
final Person person = persons.size() == 1 ? persons.iterator().next() : null;
// check if person already exists
if (person != null) {
if (isPersonStudentAndNumberIsCorrect(person, bean.getPersonNumber())) {
if (!person.getDateOfBirthYearMonthDay().equals(personBean.getDateOfBirth())) {
// found person with diff date
addActionMessage("individualCandidacyMessages", request, getProcessType().getSimpleName()
+ ".error.public.candidacies.fill.personal.information.and.institution.id.birth");
return prepareEditCandidacyProcess(mapping, form, request, response);
} else if (!StringUtils.isEmpty(personBean.getSocialSecurityNumber())
&& !StringUtils.isEmpty(person.getSocialSecurityNumber())
&& !person.getSocialSecurityNumber().equals(personBean.getSocialSecurityNumber())) {
// found person with diff social security number
addActionMessage("individualCandidacyMessages", request, getProcessType().getSimpleName()
+ ".error.public.candidacies.fill.personal.information.and.institution.id.contributorNumber");
return prepareEditCandidacyProcess(mapping, form, request, response);
} else {
personBean.setPerson(person);
}
} else {
// found person with diff ist userid
addActionMessage("individualCandidacyMessages", request, getProcessType().getSimpleName()
+ ".error.public.candidacies.fill.personal.information.and.institution.id.userId");
return prepareEditCandidacyProcess(mapping, form, request, response);
}
} else {
if (Person.readByContributorNumber(personBean.getSocialSecurityNumber()) != null) {
// found person with same contributor number
addActionMessage("individualCandidacyMessages", request, getProcessType().getSimpleName()
+ ".error.public.candidacies.fill.personal.information.and.institution.id.contributorNumber");
return prepareEditCandidacyProcess(mapping, form, request, response);
}
}
executeActivity(bean.getIndividualCandidacyProcess(), "EditPublicCandidacyPersonalInformation",
getIndividualCandidacyProcessBean());
} catch (final DomainException e) {
addActionMessage(request, e.getMessage(), e.getArgs());
request.setAttribute(getIndividualCandidacyProcessBeanName(), getIndividualCandidacyProcessBean());
return mapping.findForward("edit-candidacy");
}
request.setAttribute("individualCandidacyProcess", bean.getIndividualCandidacyProcess());
return backToViewCandidacyInternal(mapping, form, request, response);
}