private StringBuffer deriveOrcidData(String orcid, boolean definitive, List<OrcidWork> orcidWorks) { StringBuffer duplicationString = new StringBuffer(); String definitiveIdentifier = definitive ? "Definitive" : "Duplicate"; for (OrcidWork duplicate : orcidWorks) { String putCode = duplicate.getPutCode(); String title = duplicate.getWorkTitle() != null && duplicate.getWorkTitle().getTitle() != null && StringUtils.isNotBlank(duplicate.getWorkTitle().getTitle().getContent()) ? duplicate.getWorkTitle().getTitle().getContent() : MISSING_ENTRY; String visibility = duplicate.getVisibility() != null ? duplicate.getVisibility().value() : MISSING_ENTRY; duplicationString.append(orcid).append(SEPERATOR); duplicationString.append(definitiveIdentifier).append(SEPERATOR); duplicationString.append(putCode).append(SEPERATOR); duplicationString.append(title).append(SEPERATOR); duplicationString.append(visibility).append(SEPERATOR); duplicationString.append(NEW_LINE); } return duplicationString; }
public Comparator<OrcidWork> workTitleComparator() { return (work1, work2) -> { WorkTitle title1 = work1.getWorkTitle(); WorkTitle title2 = work2.getWorkTitle(); if (title1 != null && title2 != null) { return title1.getTitle().getContent().compareTo(title2.getTitle().getContent()); } else { return NullUtils.compareNulls(title1, title2); } }; }
@Override public OrcidMessage upgradeMessage(OrcidMessage orcidMessage) { if (orcidMessage == null) { return null; } if (orcidMessage.getOrcidProfile() != null) { OrcidProfile op = orcidMessage.getOrcidProfile(); if (op.getOrcidActivities() != null && op.getOrcidActivities().getOrcidWorks() != null) { for (OrcidWork ow : op.getOrcidActivities().getOrcidWorks().getOrcidWork()) { ow.setLanguageCode(Jpa2JaxbAdapterImpl.normalizeLanguageCode(ow.getLanguageCode())); if (ow.getWorkTitle() != null && ow.getWorkTitle().getTranslatedTitle() != null) ow.getWorkTitle().getTranslatedTitle().setLanguageCode(ow.getWorkTitle().getTranslatedTitle().getLanguageCode()); } } } orcidMessage.setMessageVersion(TO_VERSION); return orcidMessage; }
OrcidWork other = (OrcidWork) obj; if (this.getWorkTitle() == null) { if (other.getWorkTitle() != null) return false; } else if (!this.getWorkTitle().equals(other.getWorkTitle())) return false;
public void checkWork(OrcidWork orcidWork) { if (validateTitle) { WorkTitle title = orcidWork.getWorkTitle(); if (title == null || title.getTitle() == null || StringUtils.isEmpty(title.getTitle().getContent())) { throw new OrcidValidationException("Invalid Title: title cannot be null nor emtpy"); } } if (validateWorksHaveExternalIds) { if (orcidWork.getWorkExternalIdentifiers() == null || orcidWork.getWorkExternalIdentifiers().getWorkExternalIdentifier() == null || orcidWork.getWorkExternalIdentifiers().getWorkExternalIdentifier().isEmpty()) { throw new OrcidValidationException("Invalid work: Works added using message version 1.2_rc5 or greater must contain at least one external identifier"); } } }
private void doWorkTypeValidation(OrcidMessage orcidMessage) { if (orcidMessage == null || orcidMessage.getOrcidProfile() == null || orcidMessage.getOrcidProfile().getOrcidActivities() == null || orcidMessage.getOrcidProfile().getOrcidActivities().getOrcidWorks() == null || orcidMessage.getOrcidProfile().getOrcidActivities().getOrcidWorks().getOrcidWork() == null || orcidMessage.getOrcidProfile().getOrcidActivities().getOrcidWorks().getOrcidWork().isEmpty()) return; List<OrcidWork> works = orcidMessage.getOrcidProfile().getOrcidActivities().getOrcidWorks().getOrcidWork(); for (OrcidWork work : works) { if (work.getWorkType() == null) if (work.getWorkTitle() != null && work.getWorkTitle().getTitle() != null && !PojoUtil.isEmpty(work.getWorkTitle().getTitle().getContent())) handleError("work-type is missing or invalid for work: '" + work.getWorkTitle().getTitle().getContent() + "'"); else handleError("work-type is missing or invalid"); } }
if (this.getWorkTitle() == null) { if (other.getWorkTitle() != null) return false; } else if (!this.getWorkTitle().equals(other.getWorkTitle())) return false;
Title title = (newWork.getWorkTitle() == null || newWork.getWorkTitle().getTitle() == null) ? null : newWork.getWorkTitle().getTitle(); Title titleToCompare = (newWorkToCompare.getWorkTitle() == null || newWorkToCompare.getWorkTitle().getTitle() == null) ? null : newWorkToCompare.getWorkTitle().getTitle(); if (!isTheSameTitle(title, titleToCompare) && !areBothExtIdsPartOf(newWork.getWorkType(), workExtId, workExtIdToCompare)) { String extIdContent = (workExtId.getWorkExternalIdentifierId() == null Title title = (orcidWork.getWorkTitle() == null || orcidWork.getWorkTitle().getTitle() == null) ? null : orcidWork.getWorkTitle().getTitle(); Title titleToCompare = (existingWork.getWorkTitle() == null || existingWork.getWorkTitle().getTitle() == null) ? null : existingWork.getWorkTitle().getTitle(); if (!isTheSameTitle(title, titleToCompare) && !areBothExtIdsPartOf(orcidWork.getWorkType(), existingExternalIdentifier, newExternalIdentifier)) {
@Override public int hashCode() { int result = this.orcidWork.getWorkTitle() != null ? this.orcidWork.getWorkTitle().hashCode() : 0; result = 31 * result + (this.orcidWork.getShortDescription() != null ? this.orcidWork.getShortDescription().hashCode() : 0); result = 31 * result + (this.orcidWork.getWorkCitation() != null ? this.orcidWork.getWorkCitation().hashCode() : 0); result = 31 * result + (this.orcidWork.getWorkType() != null ? this.orcidWork.getWorkType().hashCode() : 0); result = 31 * result + (this.orcidWork.getPublicationDate() != null ? this.orcidWork.getPublicationDate().hashCode() : 0); result = 31 * result + (this.orcidWork.getWorkExternalIdentifiers() != null ? this.orcidWork.getWorkExternalIdentifiers().hashCode() : 0); result = 31 * result + (this.orcidWork.getUrl() != null ? this.orcidWork.getUrl().hashCode() : 0); result = 31 * result + (this.orcidWork.getWorkContributors() != null ? this.orcidWork.getWorkContributors().hashCode() : 0); result = 31 * result + (this.orcidWork.getWorkSource() != null ? this.orcidWork.getWorkSource().hashCode() : 0); return result; }
if (orcidWork.getWorkTitle() != null) { Title workMainTitle = orcidWork.getWorkTitle().getTitle(); Subtitle worksubTitle = orcidWork.getWorkTitle().getSubtitle(); TranslatedTitle translatedTitle = orcidWork.getWorkTitle().getTranslatedTitle(); if (workMainTitle != null && !StringUtils.isBlank(workMainTitle.getContent())) { workTitles.add(workMainTitle.getContent());
return false; if (this.orcidWork.getWorkTitle() != null ? !this.orcidWork.getWorkTitle().equals(orcidWork.getWorkTitle()) : orcidWork.getWorkTitle() != null) { return false;
OrcidWork orcidWorkSubset = new OrcidWork(); orcidWorkSubset.setVisibility(fullOrcidWork.getVisibility()); orcidWorkSubset.setWorkTitle(fullOrcidWork.getWorkTitle()); orcidWorkSubset.setWorkExternalIdentifiers(fullOrcidWork.getWorkExternalIdentifiers()); orcidWorksTitlesOnly.getOrcidWork().add(orcidWorkSubset);
OrcidWork orcidWorkSubset = new OrcidWork(); orcidWorkSubset.setVisibility(fullOrcidWork.getVisibility()); orcidWorkSubset.setWorkTitle(fullOrcidWork.getWorkTitle()); orcidWorkSubset.setWorkExternalIdentifiers(fullOrcidWork.getWorkExternalIdentifiers()); orcidWorksTitlesOnly.getOrcidWork().add(orcidWorkSubset);
for (OrcidWork updatedWork : updatedOrcidWorksList) { Item activity = new Item(); activity.setItemName(updatedWork.getWorkTitle().getTitle().getContent()); activity.setItemType(ItemType.WORK); activity.setPutCode(updatedWork.getPutCode());
WorkTitle workTitle = orcidWork.getWorkTitle(); if (workTitle != null) { workEntity.setSubtitle(workTitle.getSubtitle() != null ? workTitle.getSubtitle().getContent() : null);