@Override public int compareTo(OtherName o) { if(o == null || o.getContent() == null) { return 1; } if(getContent() == null) { return -1; } return this.getContent().compareTo(o.getContent()); } }
public static void setPathToOtherName(OtherName otherName, String orcid) { if(otherName != null) { otherName.setPath(OTHER_NAMES.replace("{orcid}", orcid) + '/' + otherName.getPutCode()); } }
/** * Create an instance of {@link OtherName } * */ public OtherName createOtherName() { return new OtherName(); }
if(otherNames.getOtherNames() != null) { for(OtherName updatedOrNew : otherNames.getOtherNames()) { if(existingOtherName.getId().equals(updatedOrNew.getPutCode())) { deleteMe = false; break; if(updatedOrNew.getPutCode() != null) { if(existingOtherName.getId().equals(updatedOrNew.getPutCode())) { existingOtherName.setLastModified(new Date()); existingOtherName.setVisibility(updatedOrNew.getVisibility().name()); existingOtherName.setDisplayName(updatedOrNew.getContent()); existingOtherName.setDisplayIndex(updatedOrNew.getDisplayIndex()); otherNameDao.merge(existingOtherName); newOtherName.setClientSourceId(sourceEntity.getSourceClient().getId()); newOtherName.setVisibility(updatedOrNew.getVisibility().name()); newOtherName.setDisplayIndex(updatedOrNew.getDisplayIndex()); otherNameDao.persist(newOtherName);
private boolean isDuplicated(OtherNameEntity existing, OtherName otherName, SourceEntity source) { if (!existing.getId().equals(otherName.getPutCode())) { String existingSourceId = existing.getElementSourceId(); if (!PojoUtil.isEmpty(existingSourceId) && existingSourceId.equals(SourceEntityUtils.getSourceId(source))) { if (existing.getDisplayName() != null && existing.getDisplayName().equals(otherName.getContent())) { return true; } } } return false; }
@Override public OtherNames toMinimizedOtherNameList(Collection<OtherNameEntity> entities) { if (entities == null) { return null; } List<OtherName> otherNameList = mapperFacade.mapAsList(entities, OtherName.class); for(OtherName otherName : otherNameList) { otherName.setCreatedDate(null); otherName.setSource(null); } OtherNames otherNames = new OtherNames(); otherNames.setOtherNames(otherNameList); return otherNames; }
public static void validateOtherName(OtherName otherName, SourceEntity sourceEntity, boolean createFlag, boolean isApiRequest, Visibility originalVisibility) { if(createFlag) { if(otherName.getPutCode() != null) { Map<String, String> params = new HashMap<String, String>(); if (sourceEntity != null) { params.put("clientName", SourceEntityUtils.getSourceName(sourceEntity)); } throw new InvalidPutCodeException(params); } } else { if(otherName.getPutCode() == null) { Map<String, String> params = new HashMap<String, String>(); throw new PutCodeRequiredException(params); } } //Check that we are not changing the visibility validateAndFixVisibility(otherName, createFlag, isApiRequest, originalVisibility); }
@Generated(value = "com.sun.tools.xjc.Driver", date = "2018-04-24T11:17:38-05:00", comments = "JAXB RI v2.2.11") public String toString() { final ToStringStrategy strategy = JAXBToStringStrategy.INSTANCE; final StringBuilder buffer = new StringBuilder(); append(null, buffer, strategy); return buffer.toString(); }
public static void calculateLastModified(OtherNames otherNames) { if (otherNames != null && otherNames.getOtherNames() != null && !otherNames.getOtherNames().isEmpty()) { LastModifiedDate latest = null; for (OtherName otherName : otherNames.getOtherNames()) { if (otherName.getLastModifiedDate() != null && otherName.getLastModifiedDate().after(latest)) { latest = otherName.getLastModifiedDate(); } } otherNames.setLastModifiedDate(latest); } }
@Generated(value = "com.sun.tools.xjc.Driver", date = "2018-04-24T11:17:38-05:00", comments = "JAXB RI v2.2.11") public StringBuilder append(ObjectLocator locator, StringBuilder buffer, ToStringStrategy strategy) { strategy.appendStart(locator, this, buffer); appendFields(locator, buffer, strategy); strategy.appendEnd(locator, this, buffer); return buffer; }
Map<String, String> params = new HashMap<String, String>(); params.put("type", "otherName"); params.put("value", otherName.getContent()); throw new OrcidDuplicatedElementException(params);
Map<String, String> params = new HashMap<String, String>(); params.put("type", "other-name"); params.put("value", otherName.getContent()); throw new OrcidDuplicatedElementException(params);
doc.alternateName.add(n.getContent());