arxiv.setType("arxiv"); arxiv.setValue(normalizationService.normalise("arxiv", value)); arxiv.setUrl(new Url(value)); work.getWorkExternalIdentifiers().getExternalIdentifier().add(arxiv); break; doi.setType("doi"); doi.setValue(normalizationService.normalise("doi", value)); doi.setUrl(new Url(normalizationService.generateNormalisedURL("doi", value))); work.getWorkExternalIdentifiers().getExternalIdentifier().add(doi); break;
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; ResearcherUrl other = (ResearcherUrl) obj; if (path == null) { if (other.path != null) return false; } else if (!path.equals(other.path)) return false; if (url == null) { if (other.url != null) return false; } else if (!url.equals(other.url)) return false; if (urlName == null) { if (other.urlName != null) return false; } else if (!urlName.equals(other.urlName)) return false; if (visibility != other.visibility) return false; return true; }
public ExternalID clone() { ExternalID id = new ExternalID(); id.type = this.getType(); id.value = this.getValue(); if (this.getNormalized() != null) id.setNormalized(this.getNormalized()); if (this.getNormalizedError() != null) id.setNormalizedError(this.getNormalizedError()); if (this.getUrl() != null) id.url = new Url(this.getUrl().getValue()); if (this.getRelationship() != null) id.relationship = this.getRelationship(); if (this.getNormalizedUrl() != null) id.setNormalizedUrl(this.getNormalizedUrl()); if (this.getNormalizedUrlError() != null) id.setNormalizedUrlError(this.getNormalizedUrlError()); return id; }
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((path == null) ? 0 : path.hashCode()); result = prime * result + ((url == null) ? 0 : url.hashCode()); result = prime * result + ((urlName == null) ? 0 : urlName.hashCode()); result = prime * result + ((visibility == null) ? 0 : visibility.hashCode()); return result; }
@Override public int compareTo(ResearcherUrl o) { if(o == null || o.getUrlName() == null) { return 1; } if(getUrlName() == null) { return -1; } int urlNameComp = this.getUrlName().compareTo(o.getUrlName()); if(urlNameComp == 0) { if(o.getUrl() == null) { return 1; } if(this.getUrl() == null) { return -1; } return this.getUrl().compareTo(o.getUrl()); } return 0; } }
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((externalIdentifiers == null) ? 0 : externalIdentifiers.hashCode()); result = prime * result + ((hosts == null) ? 0 : hosts.hashCode()); result = prime * result + ((resourceName == null) ? 0 : resourceName.hashCode()); result = prime * result + ((resourceType == null) ? 0 : resourceType.hashCode()); result = prime * result + ((url == null) ? 0 : url.hashCode()); return result; }
public ExternalID toFundingExternalIdentifier() { ExternalID result = new ExternalID(); if (!PojoUtil.isEmpty(type)) result.setType(type.getValue()); if (!PojoUtil.isEmpty(url)) result.setUrl(new Url(url.getValue())); else result.setUrl(new Url()); if (!PojoUtil.isEmpty(value)) result.setValue(value.getValue()); if(!PojoUtil.isEmpty(relationship)) result.setRelationship(Relationship.fromValue(relationship.getValue())); return result; }
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((type == null) ? 0 : type.hashCode()); result = prime * result + ((createdDate == null) ? 0 : createdDate.hashCode()); result = prime * result + ((lastModifiedDate == null) ? 0 : lastModifiedDate.hashCode()); result = prime * result + ((path == null) ? 0 : path.hashCode()); result = prime * result + ((putCode == null) ? 0 : putCode.hashCode()); result = prime * result + ((value == null) ? 0 : value.hashCode()); result = prime * result + ((relationship == null) ? 0 : relationship.hashCode()); result = prime * result + ((source == null) ? 0 : source.hashCode()); result = prime * result + ((url == null) ? 0 : url.hashCode()); result = prime * result + ((visibility == null) ? 0 : visibility.hashCode()); return result; } @Override
if (other.url != null) return false; } else if (!url.equals(other.url)) return false; return true;
private boolean isDuplicated(ResearcherUrlEntity existing, ResearcherUrl newResearcherUrl, Source activeSource) { if (!existing.getId().equals(newResearcherUrl.getPutCode())) { //If they have the same source String existingSourceId = existing.getElementSourceId(); // If they have the same source if (!PojoUtil.isEmpty(existingSourceId) && SourceEntityUtils.isTheSameForDuplicateChecking(activeSource,existing)) { // If the url is the same if (existing.getUrl() != null && existing.getUrl().equals(newResearcherUrl.getUrl().getValue())) { return true; } } } return false; }
public ExternalID toRecordFundingExternalIdentifier() { ExternalID result = new ExternalID(); if (!PojoUtil.isEmpty(type)) result.setType(type.getValue()); if (!PojoUtil.isEmpty(url)) result.setUrl(new Url(url.getValue())); else result.setUrl(new Url()); if (!PojoUtil.isEmpty(value)) result.setValue(value.getValue()); if(!PojoUtil.isEmpty(relationship)) result.setRelationship(Relationship.fromValue(relationship.getValue())); return result; } }
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((externalIdentifiers == null) ? 0 : externalIdentifiers.hashCode()); result = prime * result + ((journalTitle == null) ? 0 : journalTitle.hashCode()); result = prime * result + ((title == null) ? 0 : title.hashCode()); result = prime * result + ((type == null) ? 0 : type.hashCode()); result = prime * result + ((url == null) ? 0 : url.hashCode()); return result; }
if (other.url != null) return false; } else if (!url.equals(other.url)) return false; return true;
return; if(PojoUtil.isEmpty(researcherUrl.getUrl().getValue())) { String message = "Url field must not be empty"; LOGGER.error(message); throw new OrcidValidationException(message); } else { if(SiteConstants.URL_MAX_LENGTH < researcherUrl.getUrl().getValue().length()) { String message = "Url field must not be longer than " + SiteConstants.URL_MAX_LENGTH + " characters"; LOGGER.error(message);
private void addExternalIdentifier(Work work, String type, String value, Locale locale) { ExternalID extId = new ExternalID(); extId.setType(type); extId.setValue(value); extId.setRelationship(Relationship.SELF); IdentifierType idType = identifierTypeManager.fetchIdentifierTypeByDatabaseName(type.toUpperCase(), locale); if (idType != null && !PojoUtil.isEmpty(idType.getResolutionPrefix())) { extId.setUrl(new Url(idType.getResolutionPrefix() + value)); } if(work.getExternalIdentifiers() == null) { work.setWorkExternalIdentifiers(new ExternalIDs()); } work.getExternalIdentifiers().getExternalIdentifier().add(extId); } }
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((createdDate == null) ? 0 : createdDate.hashCode()); result = prime * result + ((departmentName == null) ? 0 : departmentName.hashCode()); result = prime * result + ((endDate == null) ? 0 : endDate.hashCode()); result = prime * result + ((lastModifiedDate == null) ? 0 : lastModifiedDate.hashCode()); result = prime * result + ((putCode == null) ? 0 : putCode.hashCode()); result = prime * result + ((roleTitle == null) ? 0 : roleTitle.hashCode()); result = prime * result + ((source == null) ? 0 : source.hashCode()); result = prime * result + ((startDate == null) ? 0 : startDate.hashCode()); result = prime * result + ((visibility == null) ? 0 : visibility.hashCode()); result = prime * result + ((organization == null) ? 0 : organization.hashCode()); result = prime * result + ((url == null) ? 0 : url.hashCode()); result = prime * result + ((externalIdentifiers == null) ? 0 : externalIdentifiers.hashCode()); return result; }
if (other.url != null) return false; } else if (!url.equals(other.url)) return false; if (visibility != other.visibility)
@Override public PersonExternalIdentifier createExternalIdentifier(String orcid, PersonExternalIdentifier externalIdentifier, boolean isApiRequest) { Source activeSource = sourceManager.retrieveActiveSource(); // Validate external identifier PersonValidator.validateExternalIdentifier(externalIdentifier, activeSource, true, isApiRequest, null, requireRelationshipOnExternalIdentifier); // Validate it is not duplicated List<ExternalIdentifierEntity> existingExternalIdentifiers = externalIdentifierDao.getExternalIdentifiers(orcid, getLastModified(orcid)); for (ExternalIdentifierEntity existing : existingExternalIdentifiers) { if (isDuplicated(existing, externalIdentifier, activeSource)) { Map<String, String> params = new HashMap<String, String>(); params.put("type", "external-identifier"); params.put("value", externalIdentifier.getUrl().getValue()); throw new OrcidDuplicatedElementException(params); } } ExternalIdentifierEntity newEntity = jpaJaxbExternalIdentifierAdapter.toExternalIdentifierEntity(externalIdentifier); ProfileEntity profile = profileEntityCacheManager.retrieve(orcid); newEntity.setOwner(profile); newEntity.setDateCreated(new Date()); SourceEntityUtils.populateSourceAwareEntityFromSource(activeSource, newEntity); setIncomingPrivacy(newEntity, profile); DisplayIndexCalculatorHelper.setDisplayIndexOnNewEntity(newEntity, isApiRequest); externalIdentifierDao.persist(newEntity); return jpaJaxbExternalIdentifierAdapter.toExternalIdentifier(newEntity); }