public String retrieveDisplayNameIgnoringVisibility() { if (creditName != null) { return creditName.getContent(); } StringBuilder builder = new StringBuilder(); builder.append(givenNames.getContent()); if (familyName != null) { builder.append(" "); builder.append(familyName.getContent()); } return builder.toString(); }
private void setFamilyName(ProfileEntity profileEntity, FamilyName familyName) { if (familyName != null && StringUtils.isNotBlank(familyName.getContent())) { if(profileEntity.getRecordNameEntity() == null) { profileEntity.setRecordNameEntity(new RecordNameEntity()); profileEntity.getRecordNameEntity().setProfile(profileEntity); } profileEntity.getRecordNameEntity().setFamilyName(familyName.getContent()); } }
boolean persistPersonalDetails = personalDetails != null; if (persistPersonalDetails) { profileIndexDocument.setFamilyName(personalDetails.getFamilyName() != null ? personalDetails.getFamilyName().getContent() : null); profileIndexDocument.setGivenNames(personalDetails.getGivenNames() != null ? personalDetails.getGivenNames().getContent() : null); profileIndexDocument.setCreditName(personalDetails.getCreditName() != null ? personalDetails.getCreditName().getContent() : null);
@Override public void copyUpdatedPersonalDetailsToExistingPreservingVisibility(OrcidBio existing, OrcidBio updated) { PersonalDetails existingPersonalDetails = existing.getPersonalDetails(); PersonalDetails updatedPersonalDetails = updated.getPersonalDetails(); // if no update, nothing to do if (updatedPersonalDetails == null) { return; } // if existing null, update unconditionally - we've no previous to // compare to if (existingPersonalDetails == null) { existing.setPersonalDetails(updatedPersonalDetails); return; } // otherwise preserve visibility of other names && credit names copyOtherNamesPreservingVisibility(existingPersonalDetails, updatedPersonalDetails); copyCreditNamePreservingVisibility(existingPersonalDetails, updatedPersonalDetails); if(updatedPersonalDetails.getFamilyName() != null && !PojoUtil.isEmpty(updatedPersonalDetails.getFamilyName().getContent())) { existingPersonalDetails.setFamilyName(updatedPersonalDetails.getFamilyName()); } if(updatedPersonalDetails.getGivenNames() != null && !PojoUtil.isEmpty(updatedPersonalDetails.getGivenNames().getContent())) { existingPersonalDetails.setGivenNames(updatedPersonalDetails.getGivenNames()); } }