/** * Create an instance of {@link OtherNames } * */ public OtherNames createOtherNames() { return new OtherNames(); }
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; OtherNames that = (OtherNames) o; if (getOtherName() != null ? !getOtherName().equals(that.getOtherName()) : that.getOtherName() != null) return false; if (visibility != that.visibility) return false; return true; }
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); }
public void addOtherName(String value, Visibility vis) { if (getOtherName() == null) { setOtherName(new ArrayList<OtherName>()); } getOtherName().add(new OtherName(value, vis)); }
private OtherNames getOtherNames(ProfileEntity profile) { OtherNames otherNames = new OtherNames(); Visibility mostRestrictive = Visibility.PUBLIC; Set<OtherNameEntity> otherNamesEntitiy = profile.getOtherNames(); if (otherNamesEntitiy != null && otherNamesEntitiy.size() > 0) { for (OtherNameEntity otherNameEntity : otherNamesEntitiy) { //will only be null if there's an issue with the data or you're using this layer directly Visibility vis = (otherNameEntity.getVisibility() != null)?Visibility.valueOf(otherNameEntity.getVisibility()):Visibility.PRIVATE; if (vis.isMoreRestrictiveThan(mostRestrictive)) mostRestrictive = vis; OtherName otherName = new OtherName(otherNameEntity.getDisplayName(), vis); if(!PojoUtil.isEmpty(otherNameEntity.getElementSourceId())) { Source source = getSource(otherNameEntity); otherName.setSource(source); } otherNames.getOtherName().add(otherName); } } otherNames.setVisibility(mostRestrictive); return otherNames; }
if(otherNames != null && otherNames.getOtherName() != null) { for(OtherName newOtherName : otherNames.getOtherName()){ if(Objects.equals(value, newOtherName.getContent())) { found = true; if(otherNames != null && otherNames.getOtherName() != null) { for(OtherName newOtherName : otherNames.getOtherName()) { boolean exists = false; if(existingOtherNameEntities != null) { 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)
OtherNames n = orcidMessage.getOrcidProfile().getOrcidBio().getPersonalDetails().getOtherNames(); if(n != null) { n.setVisibility(getMostFromCollection(n.getOtherName()));
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((creditName == null) ? 0 : creditName.hashCode()); result = prime * result + ((familyName == null) ? 0 : familyName.hashCode()); result = prime * result + ((givenNames == null) ? 0 : givenNames.hashCode()); result = prime * result + ((otherNames == null) ? 0 : otherNames.hashCode()); return result; }
if (other.otherNames != null) return false; } else if (!otherNames.equals(other.otherNames)) return false; return true;
Visibility listVisibility = orcidProfile.getOrcidBio().getPersonalDetails().getOtherNames().getVisibility(); for (OtherName x : orcidProfile.getOrcidBio().getPersonalDetails().getOtherNames().getOtherName()) { if (isClaimed) { x.setVisibility(defaultActivityVis);
@Override public int hashCode() { int result = getOtherName() != null ? getOtherName().hashCode() : 0; result = 31 * result + (visibility != null ? visibility.hashCode() : 0); return result; }
public List<String> getOtherNamesAsStrings() { List<OtherName> otherNames = getOtherName(); List<String> strings = new ArrayList<String>(otherNames.size()); for (OtherName otherName : otherNames) { strings.add(otherName.getContent()); } return strings; }
profileIndexDocument.setGivenNames(personalDetails.getGivenNames() != null ? personalDetails.getGivenNames().getContent() : null); profileIndexDocument.setCreditName(personalDetails.getCreditName() != null ? personalDetails.getCreditName().getContent() : null); List<OtherName> otherNames = personalDetails.getOtherNames() != null ? personalDetails.getOtherNames().getOtherName() : null; if (otherNames != null && !otherNames.isEmpty()) { List<String> names = new ArrayList<String>();
OrcidBio bio = orcidProfile.getOrcidBio(); if (bio.getPersonalDetails() != null && bio.getPersonalDetails().getOtherNames() != null && bio.getPersonalDetails().getOtherNames().getOtherName() != null && !bio.getPersonalDetails().getOtherNames().getOtherName().isEmpty()) { for (OtherName otherName : bio.getPersonalDetails().getOtherNames().getOtherName()) { if (otherName.getSource() == null || PojoUtil.isEmpty(otherName.getSource().retrieveSourcePath())) { otherName.setSource(source);
OtherNames otherNames = orcidBio.getPersonalDetails().getOtherNames(); if(otherNames != null) { List<OtherName> otherNameList = otherNames.getOtherName(); if(otherNameList != null) { for(OtherName otherName : otherNameList) {