private Source getUpdatedSource(Source source) { String sourceId = source.retrieveSourcePath(); String updatedSourceId = null; if (sourceId.equals(originalOrcid)) { updatedSourceId = orcid; } else { updatedSourceId = sourcesMap.get(sourceId); if (updatedSourceId == null) { updatedSourceId = getNewClientDetailsSource(); sourcesMap.put(sourceId, updatedSourceId); } } Source updatedSource = new Source(updatedSourceId); updatedSource.setSourceName(new SourceName(updatedSourceId)); return updatedSource; }
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); } } } } }
@Override public void mapBtoA(SourceAwareEntity<?> b, SourceAware a, MappingContext context) { String sourceId = b.getElementSourceId(); if (StringUtils.isEmpty(sourceId)) { return; } Source source = null; if (isClient(sourceId)) { source = createClientSource(sourceId); } else { source = createOrcidSource(sourceId); } a.setSource(source); source.setSourceName(new SourceName(sourceNameCacheManager.retrieve(sourceId))); }