// There's more than one person, throw an error
addErrorMessage(request, "error.phd.public.candidacy.fill.personal.information.and.institution.id.more.than.one");
return fillPersonalDataInvalid(mapping, form, request, response);
}
final Person person = !personsFoundByDocumentId.isEmpty() ? personsFoundByDocumentId.iterator().next() : null;
if (!StringUtils.isEmpty(personBean.getFiscalCode())) {
final Party partyFoundBySocialSecurityNumber =
PartySocialSecurityNumber.readPartyBySocialSecurityNumber(personBean.getFiscalCode());
// Second case : person found by documentId and person found by
// social
// security number must be equal
if (person != null || partyFoundBySocialSecurityNumber != null) {
if (person != partyFoundBySocialSecurityNumber) {
addErrorMessage(request,
"error.phd.public.candidacy.fill.personal.information.and.institution.id.different.ssn");
return fillPersonalDataInvalid(mapping, form, request, response);
}
}
}
if (bean.hasInstitutionId()) {
Person personByIstId = Person.readPersonByUsername(bean.getInstitutionId());
if (personByIstId == null) {
addErrorMessage(request, "error.phd.public.candidacy.fill.personal.information.and.institution.id.noIstIdPerson");
return fillPersonalDataInvalid(mapping, form, request, response);
}