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