/** 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; }
/** 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; }
source.setSourceOrcid(new SourceOrcid(userOrcid)); return source;
source.setSourceClientId(new SourceClientId(this.getSource())); } else { source.setSourceOrcid(new SourceOrcid(this.getSource()));
source.setSourceClientId(new SourceClientId(this.getSource())); } else { source.setSourceOrcid(new SourceOrcid(this.getSource()));