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); } }; }
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 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"); } }
Subtitle worksubTitle = orcidWork.getWorkTitle().getSubtitle(); TranslatedTitle translatedTitle = orcidWork.getWorkTitle().getTranslatedTitle(); if (workMainTitle != null && !StringUtils.isBlank(workMainTitle.getContent())) { workTitles.add(workMainTitle.getContent()); FundingTitle title = orcidFunding.getTitle(); if (title != null) { if (title.getTitle() != null && !StringUtils.isBlank(title.getTitle().getContent())) { fundingTitle.add(title.getTitle().getContent());
|| PojoUtil.isEmpty(workExtId.getWorkExternalIdentifierId().getContent())) ? "" : workExtId.getWorkExternalIdentifierId().getContent(); String title1 = (title == null) ? "" : title.getContent(); String title2 = (titleToCompare == null) ? "" : titleToCompare.getContent(); String errorMessage = String.format("Works \"%s\" and \"%s\" have the same external id \"%s\"", title1, title2, extIdContent); || PojoUtil.isEmpty(existingExternalIdentifier.getWorkExternalIdentifierId().getContent())) ? "" : existingExternalIdentifier.getWorkExternalIdentifierId().getContent(); String title1 = (title == null) ? "" : title.getContent(); String title2 = (titleToCompare == null) ? "" : titleToCompare.getContent(); String errorMessage = String.format("Works \"%s\" and \"%s\"(put-code '%s') have the same external id \"%s\"", title1, title2, existingWork.getPutCode(), extIdContent);
String title = null, translatedTitle = null, languageCode = null; if (fundingTitle.getTitle() != null) title = fundingTitle.getTitle().getContent(); if (fundingTitle.getTranslatedTitle() != null) { translatedTitle = fundingTitle.getTranslatedTitle().getContent();
if (workTitle != null) { workEntity.setSubtitle(workTitle.getSubtitle() != null ? workTitle.getSubtitle().getContent() : null); workEntity.setTitle(workTitle.getTitle() != null ? workTitle.getTitle().getContent().trim() : null); TranslatedTitle translatedTitle = workTitle.getTranslatedTitle(); if (translatedTitle != null) { workEntity.setJournalTitle(orcidWork.getJournalTitle() != null ? orcidWork.getJournalTitle().getContent() : null); workEntity.setLanguageCode(orcidWork.getLanguageCode() != null ? orcidWork.getLanguageCode() : null); if(orcidWork.getCountry() != null && orcidWork.getCountry().getValue() != null) {
for (OrcidWork updatedWork : updatedOrcidWorksList) { Item activity = new Item(); activity.setItemName(updatedWork.getWorkTitle().getTitle().getContent()); activity.setItemType(ItemType.WORK); activity.setPutCode(updatedWork.getPutCode());