Search in sources :

Example 6 with SourceClientId

use of org.orcid.jaxb.model.message.SourceClientId in project ORCID-Source by ORCID.

the class OrcidJaxbCopyManagerImpl method createSource.

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;
}
Also used : SourceEntity(org.orcid.persistence.jpa.entities.SourceEntity) SourceClientId(org.orcid.jaxb.model.message.SourceClientId) SourceOrcid(org.orcid.jaxb.model.message.SourceOrcid) Source(org.orcid.jaxb.model.message.Source)

Aggregations

Source (org.orcid.jaxb.model.message.Source)6 SourceClientId (org.orcid.jaxb.model.message.SourceClientId)6 SourceOrcid (org.orcid.jaxb.model.message.SourceOrcid)5 SourceEntity (org.orcid.persistence.jpa.entities.SourceEntity)2 Authentication (org.springframework.security.core.Authentication)2 OAuth2Authentication (org.springframework.security.oauth2.provider.OAuth2Authentication)2 OAuth2Request (org.springframework.security.oauth2.provider.OAuth2Request)2 Date (java.util.Date)1 HashMap (java.util.HashMap)1 OrcidBadRequestException (org.orcid.core.exception.OrcidBadRequestException)1 OrcidNotFoundException (org.orcid.core.exception.OrcidNotFoundException)1 AccessControl (org.orcid.core.security.visibility.aop.AccessControl)1 ExternalIdentifier (org.orcid.jaxb.model.message.ExternalIdentifier)1 ExternalIdentifiers (org.orcid.jaxb.model.message.ExternalIdentifiers)1 OrcidHistory (org.orcid.jaxb.model.message.OrcidHistory)1 OrcidProfile (org.orcid.jaxb.model.message.OrcidProfile)1 SourceName (org.orcid.jaxb.model.message.SourceName)1 SubmissionDate (org.orcid.jaxb.model.message.SubmissionDate)1 ClientDetailsEntity (org.orcid.persistence.jpa.entities.ClientDetailsEntity)1 DataAccessException (org.springframework.dao.DataAccessException)1