public static void populateExternalIdentifiers(ExternalIDs extIds, WorkForm workForm, WorkType workType) { if (extIds != null) { List<ActivityExternalIdentifier> workExternalIdentifiersList = new ArrayList<ActivityExternalIdentifier>(); for (ExternalID extId : extIds.getExternalIdentifier()) { if(extId.getRelationship() == null) { if(org.orcid.jaxb.model.message.WorkExternalIdentifierType.ISSN.equals(extId.getType())) { if(WorkType.BOOK.equals(workType)) { extId.setRelationship(Relationship.PART_OF); } else { extId.setRelationship(Relationship.SELF); } } else if(org.orcid.jaxb.model.message.WorkExternalIdentifierType.ISBN.equals(extId.getType())) { if(WorkType.BOOK_CHAPTER.equals(workType) || WorkType.CONFERENCE_PAPER.equals(workType)) { extId.setRelationship(Relationship.PART_OF); } else { extId.setRelationship(Relationship.SELF); } } else { extId.setRelationship(Relationship.SELF); } } workExternalIdentifiersList.add(ActivityExternalIdentifier.valueOf(extId)); } workForm.setWorkExternalIdentifiers(workExternalIdentifiersList); } }
private Work checkWorkAndIdentifierTypes(Work work) { if (WorkType.BOOK_CHAPTER.equals(work.getWorkType())) { for (ExternalID externalID : work.getExternalIdentifiers().getExternalIdentifier()) { if ("isbn".equals(externalID.getType())) { externalID.setRelationship(Relationship.PART_OF); } } } return work; }
arxiv.setRelationship(Relationship.SELF); arxiv.setType("arxiv"); arxiv.setValue(normalizationService.normalise("arxiv", value)); case "arxiv:doi": ExternalID doi = new ExternalID(); doi.setRelationship(Relationship.SELF); doi.setType("doi"); doi.setValue(normalizationService.normalise("doi", value));
public GroupPojo(List<T> summaries, int id, String orcid, ExternalIDs ids){ setGroupId(id); Long maxDisplayIndex = null; setActivities(new ArrayList<T>()); for (T summary : summaries) { getActivities().add(summary); Long displayIndex = Long.parseLong(summary.getDisplayIndex()); if (maxDisplayIndex == null || displayIndex > maxDisplayIndex) { maxDisplayIndex = displayIndex; setActivePutCode(summary.getPutCode()); setActiveVisibility(summary.getVisibility().name()); setDefaultActivity(summary); } if (summary.getSource().retrieveSourcePath().equals(orcid)) { setUserVersionPresent(true); } } if (ids != null) { for (ExternalID extId : ids.getExternalIdentifier()) { if (extId.getRelationship() == null) { extId.setRelationship(Relationship.SELF); } externalIdentifiers.add(ActivityExternalIdentifier.valueOf(extId)); } } }
if (org.orcid.jaxb.model.message.WorkExternalIdentifierType.ISSN.equals(extId.getType())) { if (WorkType.BOOK.equals(workType)) { extId.setRelationship(Relationship.PART_OF); } else { extId.setRelationship(Relationship.SELF); extId.setRelationship(Relationship.PART_OF); } else { extId.setRelationship(Relationship.SELF); extId.setRelationship(Relationship.SELF);
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); } }
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; }
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 ExternalIDs convertFrom(String source, Type<ExternalIDs> destinationType) { JSONFundingExternalIdentifiers fundingExternalIdentifiers = JsonUtils.readObjectFromJsonString(source, JSONFundingExternalIdentifiers.class); ExternalIDs externalIDs = new ExternalIDs(); for (JSONExternalIdentifier externalIdentifier : fundingExternalIdentifiers.getFundingExternalIdentifier()) { ExternalID id = new ExternalID(); if (externalIdentifier.getType() == null) { id.setType(FundingExternalIdentifierType.GRANT_NUMBER.value()); } else { id.setType(externalIdentifier.getType().toLowerCase()); } if (externalIdentifier.getUrl() != null && !PojoUtil.isEmpty(externalIdentifier.getUrl().getValue())) { Url url = new Url(externalIdentifier.getUrl().getValue()); id.setUrl(url); } if (!PojoUtil.isEmpty(externalIdentifier.getValue())) { id.setValue(externalIdentifier.getValue()); } if (externalIdentifier.getRelationship() != null) { id.setRelationship(Relationship.fromValue(conv.convertFrom(externalIdentifier.getRelationship(), null))); } externalIDs.getExternalIdentifier().add(id); } return externalIDs; }
private static void populateExternalIdentifiers(WorkForm workForm, Work work) { ExternalIDs workExternalIds = new ExternalIDs(); if(workForm.getWorkExternalIdentifiers() != null && !workForm.getWorkExternalIdentifiers().isEmpty()) { for(ActivityExternalIdentifier wfExtId : workForm.getWorkExternalIdentifiers()) { ExternalID wExtId = new ExternalID(); if(!PojoUtil.isEmpty(wfExtId.getExternalIdentifierId())) { wExtId.setValue(wfExtId.getExternalIdentifierId().getValue()); } if(!PojoUtil.isEmpty(wfExtId.getExternalIdentifierType())) { wExtId.setType(wfExtId.getExternalIdentifierType().getValue()); } if(!PojoUtil.isEmpty(wfExtId.getRelationship())) { wExtId.setRelationship(Relationship.fromValue(wfExtId.getRelationship().getValue())); } if(!PojoUtil.isEmpty(wfExtId.getUrl())) { wExtId.setUrl(new org.orcid.jaxb.model.v3.rc2.common.Url(wfExtId.getUrl().getValue())); } workExternalIds.getExternalIdentifier().add(wExtId); } } work.setWorkExternalIdentifiers(workExternalIds); }
public ExternalID toExternalIdentifier() { ExternalID we = new ExternalID(); if (!PojoUtil.isEmpty(this.getExternalIdentifierId())) we.setValue(this.getExternalIdentifierId().getValue()); if (!PojoUtil.isEmpty(this.getExternalIdentifierType())) we.setType(this.getExternalIdentifierType().getValue()); if(!PojoUtil.isEmpty(this.getRelationship())) we.setRelationship(Relationship.fromValue(this.getRelationship().getValue())); if(!PojoUtil.isEmpty(this.getUrl())) we.setUrl(new Url(this.getUrl().getValue())); return we; }
@Override public ExternalIDs convertFrom(String source, Type<ExternalIDs> destinationType) { JSONExternalIdentifiers externalIdentifiers = JsonUtils.readObjectFromJsonString(source, JSONExternalIdentifiers.class); ExternalIDs externalIDs = new ExternalIDs(); for (JSONExternalIdentifier externalIdentifier : externalIdentifiers.getExternalIdentifier()) { ExternalID id = new ExternalID(); if (externalIdentifier.getType() == null) { id.setType(FundingExternalIdentifierType.GRANT_NUMBER.value()); } else { id.setType(externalIdentifier.getType().toLowerCase()); } if (externalIdentifier.getUrl() != null && !PojoUtil.isEmpty(externalIdentifier.getUrl().getValue())) { Url url = new Url(externalIdentifier.getUrl().getValue()); id.setUrl(url); } if (!PojoUtil.isEmpty(externalIdentifier.getValue())) { id.setValue(externalIdentifier.getValue()); id.setNormalized(new TransientNonEmptyString(norm.normalise(id.getType(), externalIdentifier.getValue()))); if (StringUtils.isEmpty(id.getNormalized().getValue())){ id.setNormalizedError(new TransientError(localeManager.resolveMessage("transientError.normalization_failed.code"),localeManager.resolveMessage("transientError.normalization_failed.message", id.getType(), externalIdentifier.getValue()))); } } if (externalIdentifier.getRelationship() != null) { id.setRelationship(Relationship.fromValue(conv.convertFrom(externalIdentifier.getRelationship(), null))); } externalIDs.getExternalIdentifier().add(id); } return externalIDs; }
@Override public ExternalID convertFrom(String source, Type<ExternalID> destinationType) { JSONWorkExternalIdentifier workExternalIdentifier = JsonUtils.readObjectFromJsonString(source, JSONWorkExternalIdentifier.class); ExternalID id = new ExternalID(); if (workExternalIdentifier.getWorkExternalIdentifierType() == null) { id.setType(WorkExternalIdentifierType.OTHER_ID.value()); } else { id.setType(conv.convertFrom(workExternalIdentifier.getWorkExternalIdentifierType(), null)); } if (workExternalIdentifier.getWorkExternalIdentifierId() != null) { id.setValue(workExternalIdentifier.getWorkExternalIdentifierId().content); } if (workExternalIdentifier.getUrl() != null) { id.setUrl(new Url(workExternalIdentifier.getUrl().getValue())); } if (workExternalIdentifier.getRelationship() != null) { id.setRelationship(Relationship.fromValue(conv.convertFrom(workExternalIdentifier.getRelationship(), null))); } return id; }
ExternalID extId = new ExternalID(); extId.setType("doi"); extId.setRelationship(Relationship.SELF); extId.setValue(doi); IdentifierType idType = identifierTypeManager.fetchIdentifierTypeByDatabaseName("DOI", locale); ExternalID extId = new ExternalID(); extId.setType("isbn"); extId.setRelationship(Relationship.SELF); extId.setValue(isbn); if (idType != null && !PojoUtil.isEmpty(idType.getResolutionPrefix())) { ExternalID extId = new ExternalID(); extId.setType("issn"); extId.setRelationship(Relationship.PART_OF); extId.setValue(issn); if (idType != null && !PojoUtil.isEmpty(idType.getResolutionPrefix())) {
id.setRelationship(Relationship.fromValue(conv.convertFrom(workExternalIdentifier.getRelationship(), null)));