/** * 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; }