/** Logic taken from SourceEntity constructor * * @param clientId * @return */ public static Source forClient(String clientId) { Source s = new Source(); if (clientId != null) { if (clientId.startsWith("APP-")) { s.setSourceClientId(new SourceClientId(clientId)); } else { s.setSourceOrcid(new SourceOrcid(clientId)); } } return s; }
public static boolean isTheSameForDuplicateChecking(Source active,Source existing) { return existing.equals(active); }
@Override public String retrieveSourcePath() { if (source != null) { return source.retrieveSourcePath(); } return null; }
public static Source forClient(String clientId, String oboId) { Source s = forClient(clientId); if (oboId != null) { if (oboId.startsWith("APP-")) { s.setAssertionOriginClientId(new SourceClientId(oboId)); } else { s.setAssertionOriginOrcid(new SourceOrcid(oboId)); } } return s; } }
/** Utility method that copies from model to entity, as entity can't see model and vis-versa. * * @param from * @param to */ @SuppressWarnings("deprecation") public static void populateSourceAwareEntityFromSource(Source from, SourceAwareEntity<?> to) { //Set the source if(from.getSourceOrcid() != null && from.getSourceOrcid().getPath() != null) { to.setSourceId(from.getSourceOrcid().getPath()); } if(from.getSourceClientId() != null && from.getSourceClientId().getPath() != null) { to.setClientSourceId(from.getSourceClientId().getPath()); } //Set the OBO if(from.getAssertionOriginOrcid() != null && from.getAssertionOriginOrcid().getPath() != null) { to.setAssertionOriginSourceId(from.getAssertionOriginOrcid().getPath()); } if(from.getAssertionOriginClientId() != null && from.getAssertionOriginClientId().getPath() != null) { to.setAssertionOriginClientSourceId(from.getAssertionOriginClientId().getPath()); } }
/** Utility that copies source ids from entity into new Source model. * */ public static Source extractSourceFromEntity(SourceAwareEntity<?> e) { Source source = new Source(); //orcid if (!StringUtils.isEmpty(e.getSourceId())) source.setSourceOrcid(new SourceOrcid(e.getSourceId())); //client if (!StringUtils.isEmpty(e.getClientSourceId())) source.setSourceClientId(new SourceClientId(e.getClientSourceId())); //obo if (!StringUtils.isEmpty(e.getAssertionOriginSourceId())) source.setAssertionOriginOrcid(new SourceOrcid(e.getAssertionOriginSourceId())); if (!StringUtils.isEmpty(e.getAssertionOriginClientSourceId())) source.setAssertionOriginClientId(new SourceClientId(e.getAssertionOriginClientSourceId())); return source; }
form.setSource(extId.getSource().retrieveSourcePath()); if (extId.getSource().getSourceName() != null) { form.setSourceName(extId.getSource().getSourceName().getContent());
String clientId = authorizationRequest.getClientId(); ClientDetailsEntity clientDetails = clientDetailsManager.findByClientId(clientId); Source source = new Source(); source.setSourceClientId(new SourceClientId(clientId)); source.setSourceName(new SourceName(clientDetails.getClientName())); if (!StringUtils.isEmpty(tokenDetail.getOboClientDetailsId())){ ClientDetailsEntity oboClientDetails = clientDetailsManager.findByClientId(tokenDetail.getOboClientDetailsId()); source.setAssertionOriginClientId(new SourceClientId(oboClientDetails.getClientId())); source.setAssertionOriginName(new SourceName(oboClientDetails.getClientName())); Source source = new Source(); source.setSourceOrcid(new SourceOrcid(userOrcid)); return source;
if(s.getSourceOrcid() != null && s.getSourceOrcid().getPath() != null) { s.getSourceOrcid().setHost(orcidUrlManager.getBaseHost()); s.getSourceOrcid().setUri(orcidUrlManager.getBaseUrl() + "/" + s.getSourceOrcid().getPath()); String sourceNameValue = sourceNameCacheManager.retrieve(s.getSourceOrcid().getPath()); if (sourceNameValue != null) { s.setSourceName(new SourceName(sourceNameValue)); if(s.getSourceClientId() != null && s.getSourceClientId().getPath() != null) { s.getSourceClientId().setHost(orcidUrlManager.getBaseHost()); s.getSourceClientId().setUri(orcidUrlManager.getBaseUrl() + "/client/" + s.getSourceClientId().getPath()); String sourceNameValue = sourceNameCacheManager.retrieve(s.getSourceClientId().getPath()); if (sourceNameValue != null) { s.setSourceName(new SourceName(sourceNameValue)); if(s.getAssertionOriginOrcid() != null && s.getAssertionOriginOrcid().getPath() != null) { s.getAssertionOriginOrcid().setHost(orcidUrlManager.getBaseHost()); s.getAssertionOriginOrcid().setUri(orcidUrlManager.getBaseUrl() + "/" + s.getAssertionOriginOrcid().getPath()); String sourceNameValue = sourceNameCacheManager.retrieve(s.getAssertionOriginOrcid().getPath()); if (sourceNameValue != null) { s.setAssertionOriginName(new SourceName(sourceNameValue)); if(s.getAssertionOriginClientId() != null && s.getAssertionOriginClientId().getPath() != null) { s.getAssertionOriginClientId().setHost(orcidUrlManager.getBaseHost()); s.getAssertionOriginClientId().setUri(orcidUrlManager.getBaseUrl() + "/client/" + s.getAssertionOriginClientId().getPath()); String sourceNameValue = sourceNameCacheManager.retrieve(s.getAssertionOriginClientId().getPath()); if (sourceNameValue != null) { s.setAssertionOriginName(new SourceName(sourceNameValue));
public OtherName toOtherName() { OtherName otherName = new OtherName(); if (!PojoUtil.isEmpty(this.getContent())) { otherName.setContent(this.getContent()); } if (this.visibility != null && this.visibility.getVisibility() != null) { otherName.setVisibility(org.orcid.jaxb.model.v3.rc2.common.Visibility.fromValue(this.getVisibility().getVisibility().value())); } if (!PojoUtil.isEmpty(this.getPutCode())) { otherName.setPutCode(Long.valueOf(this.getPutCode())); } if (displayIndex != null) { otherName.setDisplayIndex(displayIndex); } else { otherName.setDisplayIndex(0L); } otherName.setSource(new Source(source)); return otherName; }
public void setSourceName(SourceAware sourceAware) { if (sourceAware != null) { Source source = sourceAware.getSource(); if (source != null) { String sourceId = source.retrieveSourcePath(); if (!PojoUtil.isEmpty(sourceId)) { String sourceName = sourceNameCacheManager.retrieve(sourceId); if (!PojoUtil.isEmpty(sourceName)) { source.setSourceName(new SourceName(sourceName)); } else { source.setSourceName(null); } } } } }
form.setSource(otherName.getSource().retrieveSourcePath()); if (otherName.getSource().getSourceName() != null) { form.setSourceName(otherName.getSource().getSourceName().getContent());
public Address toAddress() { Address address = new Address(); if (this.iso2Country != null && this.iso2Country.getValue() != null) { Country country = new Country(); country.setValue(Iso3166Country.fromValue(this.iso2Country.getValue().value())); address.setCountry(country); } if (this.visibility != null && this.visibility.getVisibility() != null) { address.setVisibility(org.orcid.jaxb.model.v3.rc2.common.Visibility.fromValue(this.getVisibility().getVisibility().value())); } if (!PojoUtil.isEmpty(this.getPutCode())) { address.setPutCode(Long.valueOf(this.getPutCode())); } if (displayIndex != null) { address.setDisplayIndex(displayIndex); } else { address.setDisplayIndex(0L); } address.setSource(new Source(source)); return address; }
form.setSource(address.getSource().retrieveSourcePath()); if (address.getSource().getSourceName() != null) { form.setSourceName(address.getSource().getSourceName().getContent());
org.orcid.jaxb.model.v3.rc2.common.Source source = new org.orcid.jaxb.model.v3.rc2.common.Source(); source.setSourceClientId(new SourceClientId(this.getSource())); } else { source.setSourceOrcid(new SourceOrcid(this.getSource()));
@Override public String retrieveSourcePath() { if (source == null) { return null; } return source.retrieveSourcePath(); }
/** Used to check for duplicates adding via API. * * @param active * @param existing * @return */ public static boolean isTheSameForDuplicateChecking(Source activeSource,SourceAwareEntity<?> existingEntity) { Source existing = extractSourceFromEntity(existingEntity); return existing.equals(activeSource); }
public ResearcherUrl toResearcherUrl() { ResearcherUrl researcherUrl = new ResearcherUrl(); if (!PojoUtil.isEmpty(this.getUrl())) { researcherUrl.setUrl(new Url(this.getUrl().getValue())); } if (!PojoUtil.isEmpty(this.getUrlName())) { researcherUrl.setUrlName(this.getUrlName()); } if (this.visibility != null && this.visibility.getVisibility() != null) { researcherUrl.setVisibility(org.orcid.jaxb.model.v3.rc2.common.Visibility.fromValue(this.getVisibility().getVisibility().value())); } if (!PojoUtil.isEmpty(this.getPutCode())) { researcherUrl.setPutCode(Long.valueOf(this.getPutCode())); } if (displayIndex != null) { researcherUrl.setDisplayIndex(displayIndex); } else { researcherUrl.setDisplayIndex(0L); } researcherUrl.setSource(new Source(source)); return researcherUrl; }
private static WorkForm getWorkForm(WorkSummary workSummary) { WorkForm workForm = new WorkForm(); workForm.setPutCode(Text.valueOf(workSummary.getPutCode())); String title = workSummary.getTitle() != null && workSummary.getTitle().getTitle() != null ? workSummary.getTitle().getTitle().getContent() : ""; workForm.setTitle(Text.valueOf(title)); if (workSummary.getJournalTitle() != null) { workForm.setJournalTitle(Text.valueOf(workSummary.getJournalTitle().getContent())); } if (workSummary.getPublicationDate() != null) { workForm.setPublicationDate(getPublicationDate(workSummary.getPublicationDate())); } workForm.setSource(workSummary.getSource().retrieveSourcePath()); if (workSummary.getSource().getSourceName() != null) { workForm.setSourceName(workSummary.getSource().getSourceName().getContent()); } workForm.setWorkType(Text.valueOf(workSummary.getType().value())); workForm.setVisibility(org.orcid.pojo.ajaxForm.Visibility.valueOf(workSummary.getVisibility())); WorkForm.populateExternalIdentifiers(workSummary.getExternalIdentifiers(), workForm, workSummary.getType()); return workForm; }
org.orcid.jaxb.model.v3.rc2.common.Source source = new org.orcid.jaxb.model.v3.rc2.common.Source(); source.setSourceClientId(new SourceClientId(this.getSource())); } else { source.setSourceOrcid(new SourceOrcid(this.getSource()));