private void copyOtherNamesPreservingVisibility(PersonalDetails existingPersonalDetails, PersonalDetails updatedPersonalDetails) { OtherNames existingOtherNames = existingPersonalDetails.getOtherNames(); OtherNames updatedOtherNames = updatedPersonalDetails.getOtherNames(); // if no update, nothing to do if (updatedOtherNames == null) { return; } // otherwise take into account the visibility of updated and existing Visibility existingVisibility = existingOtherNames.getVisibility() != null ? existingOtherNames.getVisibility() : OrcidVisibilityDefaults.OTHER_NAMES_DEFAULT .getVisibility(); updatedOtherNames.setVisibility(updatedOtherNames.getVisibility() != null ? updatedOtherNames.getVisibility() : existingVisibility); // now visibility has been preserved, overwrite the content existingPersonalDetails.setOtherNames(updatedOtherNames); }
String listVisibilityValue = otherNames.getVisibility() == null ? null : otherNames.getVisibility().name(); if(listVisibilityValue != null && !Objects.equals(existingVisibilityValue, listVisibilityValue)) { existingEntity.setVisibility(listVisibilityValue); newEntity.setVisibility(getDefaultVisibility(profileEntity, otherNames.getVisibility(), OrcidVisibilityDefaults.OTHER_NAMES_DEFAULT)); newEntity.setDisplayIndex(0L); for (OtherNameEntity tempEntity:existingOtherNameEntities)
Visibility listVisibility = orcidProfile.getOrcidBio().getPersonalDetails().getOtherNames().getVisibility(); for (OtherName x : orcidProfile.getOrcidBio().getPersonalDetails().getOtherNames().getOtherName()) { if (isClaimed) {