/** * Create an instance of {@link Source } * */ public Source createSource() { return new Source(); }
private void upgradeActivity(OrcidWork orcidWork) { WorkSource workSource = orcidWork.getWorkSource(); if (workSource != null) { Source source = new Source(); source.setSourceOrcid(new SourceOrcid(workSource)); } }
private Source getSponsor(ProfileEntity profileEntity) { SourceEntity sourceEntity = profileEntity.getSource(); if (sourceEntity != null) { Source sponsor = new Source(); SourceName sponsorName = new SourceName(SourceEntityUtils.getSourceName(sourceEntity)); sponsor.setSourceName(sponsorName); ClientDetailsEntity sourceClient = sourceEntity.getSourceClient(); if (sourceClient != null && !OrcidStringUtils.isValidOrcid(sourceClient.getClientId())) { SourceClientId sourceClientId = new SourceClientId(getOrcidIdBase(sourceClient.getId())); sponsor.setSourceClientId(sourceClientId); } else { SourceOrcid sponsorOrcid = StringUtils.isNotBlank(SourceEntityUtils.getSourceId(sourceEntity)) ? new SourceOrcid(getOrcidIdBase(SourceEntityUtils.getSourceId(sourceEntity))) : null; sponsor.setSourceOrcid(sponsorOrcid); } return sponsor; } return null; }
private void upgradeProfile(OrcidProfile orcidProfile) { if (orcidProfile != null) { if (orcidProfile.getOrcidBio() != null) { if (orcidProfile.getOrcidBio().getExternalIdentifiers() != null) for (ExternalIdentifier externalIdentifier : orcidProfile.getOrcidBio().getExternalIdentifiers().getExternalIdentifier()) { ExternalIdSource eis = externalIdentifier.getExternalIdSource(); if (eis != null) { externalIdentifier.setSource(new Source(eis.getPath())); externalIdentifier.setExternalIdSource(null); } } } if (orcidProfile.getOrcidActivities() != null) { if (orcidProfile.getOrcidActivities().getOrcidWorks() != null) { for (OrcidWork act : orcidProfile.getOrcidActivities().getOrcidWorks().getOrcidWork()) upgradeActivity(act); } } } }
private Source createSource() { SourceEntity entity = sourceManager.retrieveSourceEntity(); Source source = new Source(); if (entity.getSourceClient() != null && !PojoUtil.isEmpty(entity.getSourceClient().getId())) { if(OrcidStringUtils.isValidOrcid(entity.getSourceClient().getId())) { source.setSourceOrcid(new SourceOrcid(entity.getSourceClient().getId())); } else { source.setSourceClientId(new SourceClientId(entity.getSourceClient().getId())); } } else if(entity.getSourceProfile() != null && !PojoUtil.isEmpty(entity.getSourceProfile().getId())) { source.setSourceClientId(null); source.setSourceOrcid(new SourceOrcid(entity.getSourceProfile().getId())); } return source; }
/** * Get the source of a sowrceAware object * * @param sourceAwareEntity * The entity to obtain the source * @return the source of the object * */ private Source getSource(SourceAwareEntity<?> sourceAwareEntity) { if (sourceAwareEntity == null || PojoUtil.isEmpty(sourceAwareEntity.getElementSourceId())) { return null; } Source source = new Source(); if (!PojoUtil.isEmpty(sourceAwareEntity.getSourceId())) { source.setSourceOrcid(new SourceOrcid(getOrcidIdBase(sourceAwareEntity.getSourceId()))); } String clientSourceId = sourceAwareEntity.getClientSourceId(); if (!PojoUtil.isEmpty(clientSourceId)) { if (OrcidStringUtils.isValidOrcid(clientSourceId)) { source.setSourceOrcid(new SourceOrcid(getOrcidIdBase(clientSourceId))); } else { source.setSourceClientId(new SourceClientId(getOrcidIdBase(clientSourceId))); } } Date createdDate = sourceAwareEntity.getDateCreated(); source.setSourceDate(new SourceDate(DateUtils.convertToXMLGregorianCalendar(createdDate))); return source; }
private Source getSource() { SourceEntity sourceEntity = sourceManager.retrieveSourceEntity(); Source source = new Source(); if (sourceEntity.getSourceProfile() != null && !PojoUtil.isEmpty(sourceEntity.getSourceProfile().getId())) { source.setSourceOrcid(new SourceOrcid(getOrcidIdBase(sourceEntity.getSourceProfile().getId()))); } if (sourceEntity.getSourceClient() != null && !PojoUtil.isEmpty(sourceEntity.getSourceClient().getId())) { if(OrcidStringUtils.isValidOrcid(sourceEntity.getSourceClient().getId())) { source.setSourceOrcid(new SourceOrcid(getOrcidIdBase(sourceEntity.getSourceClient().getId()))); } else { source.setSourceClientId(new SourceClientId(getOrcidIdBase(sourceEntity.getSourceClient().getId()))); } } return source; }