Search in sources :

Example 6 with ClientRedirectUri

use of org.orcid.jaxb.model.v3.dev1.client.ClientRedirectUri in project ORCID-Source by ORCID.

the class Client method fromModelObject.

public static Client fromModelObject(org.orcid.jaxb.model.client_v2.Client modelObject) {
    Client client = new Client();
    client.setClientId(Text.valueOf(modelObject.getId()));
    client.setAllowAutoDeprecate(Checkbox.valueOf(modelObject.isAllowAutoDeprecate()));
    client.setPersistentTokenEnabled(Checkbox.valueOf(modelObject.isPersistentTokensEnabled()));
    if (modelObject.getAuthenticationProviderId() != null) {
        client.setAuthenticationProviderId(Text.valueOf(modelObject.getAuthenticationProviderId()));
    }
    List<RedirectUri> redirectUris = new ArrayList<RedirectUri>();
    if (modelObject.getClientRedirectUris() != null) {
        for (org.orcid.jaxb.model.client_v2.ClientRedirectUri element : modelObject.getClientRedirectUris()) {
            RedirectUri rUri = RedirectUri.fromModelObject(element);
            redirectUris.add(rUri);
        }
    }
    client.setRedirectUris(redirectUris);
    client.setType(Text.valueOf(modelObject.getClientType().value()));
    client.setClientSecret(Text.valueOf(modelObject.getDecryptedSecret()));
    client.setShortDescription(Text.valueOf(modelObject.getDescription()));
    client.setMemberId(Text.valueOf(modelObject.getGroupProfileId()));
    client.setDisplayName(Text.valueOf(modelObject.getName()));
    client.setWebsite(Text.valueOf(modelObject.getWebsite()));
    return client;
}
Also used : ArrayList(java.util.ArrayList) ClientRedirectUri(org.orcid.jaxb.model.v3.dev1.client.ClientRedirectUri)

Example 7 with ClientRedirectUri

use of org.orcid.jaxb.model.v3.dev1.client.ClientRedirectUri in project ORCID-Source by ORCID.

the class RedirectUri method fromModelObject.

public static RedirectUri fromModelObject(ClientRedirectUri modelObject) {
    RedirectUri redirectUri = new RedirectUri();
    if (modelObject.getPredefinedClientScopes() != null) {
        for (ScopePathType scope : modelObject.getPredefinedClientScopes()) {
            redirectUri.getScopes().add(scope.value());
        }
    }
    redirectUri.setValue(Text.valueOf(modelObject.getRedirectUri()));
    redirectUri.setType(Text.valueOf(modelObject.getRedirectUriType()));
    redirectUri.setActType(Text.valueOf(modelObject.getUriActType()));
    redirectUri.setGeoArea(Text.valueOf(modelObject.getUriGeoArea()));
    return redirectUri;
}
Also used : ScopePathType(org.orcid.jaxb.model.message.ScopePathType) ClientRedirectUri(org.orcid.jaxb.model.v3.dev1.client.ClientRedirectUri)

Example 8 with ClientRedirectUri

use of org.orcid.jaxb.model.v3.dev1.client.ClientRedirectUri in project ORCID-Source by ORCID.

the class RedirectUri method fromModelObject.

public static RedirectUri fromModelObject(org.orcid.jaxb.model.client_v2.ClientRedirectUri modelObject) {
    RedirectUri redirectUri = new RedirectUri();
    if (modelObject.getPredefinedClientScopes() != null) {
        for (ScopePathType scope : modelObject.getPredefinedClientScopes()) {
            redirectUri.getScopes().add(scope.value());
        }
    }
    redirectUri.setValue(Text.valueOf(modelObject.getRedirectUri()));
    redirectUri.setType(Text.valueOf(modelObject.getRedirectUriType()));
    redirectUri.setActType(Text.valueOf(modelObject.getUriActType()));
    redirectUri.setGeoArea(Text.valueOf(modelObject.getUriGeoArea()));
    return redirectUri;
}
Also used : ScopePathType(org.orcid.jaxb.model.message.ScopePathType) ClientRedirectUri(org.orcid.jaxb.model.v3.dev1.client.ClientRedirectUri)

Example 9 with ClientRedirectUri

use of org.orcid.jaxb.model.v3.dev1.client.ClientRedirectUri in project ORCID-Source by ORCID.

the class JpaJaxbClientAdapterTest method getClient.

private Client getClient() {
    Client client = new Client();
    client.setAllowAutoDeprecate(true);
    client.setPersistentTokensEnabled(true);
    client.setClientType(ClientType.CREATOR);
    client.setDescription("description");
    client.setGroupProfileId("group-profile-id");
    client.setId("id");
    client.setName("client-name");
    client.setWebsite("client-website");
    client.setAuthenticationProviderId("authentication-provider-id");
    Set<ClientRedirectUri> clientRedirectUris = new HashSet<ClientRedirectUri>();
    ClientRedirectUri rUri1 = new ClientRedirectUri();
    Set<ScopePathType> scopes1 = new HashSet<ScopePathType>();
    scopes1.add(ScopePathType.ACTIVITIES_READ_LIMITED);
    rUri1.setPredefinedClientScopes(scopes1);
    rUri1.setRedirectUri("redirect-uri-1");
    rUri1.setRedirectUriType("type-1");
    rUri1.setUriActType("uri-act-type-1");
    rUri1.setUriGeoArea("uri-geo-area-1");
    ClientRedirectUri rUri2 = new ClientRedirectUri();
    Set<ScopePathType> scopes2 = new HashSet<ScopePathType>();
    scopes2.add(ScopePathType.ACTIVITIES_UPDATE);
    rUri2.setPredefinedClientScopes(scopes2);
    rUri2.setRedirectUri("redirect-uri-2");
    rUri2.setRedirectUriType("type-2");
    rUri2.setUriActType("uri-act-type-2");
    rUri2.setUriGeoArea("uri-geo-area-2");
    ClientRedirectUri rUri3 = new ClientRedirectUri();
    Set<ScopePathType> scopes3 = new HashSet<ScopePathType>();
    scopes3.add(ScopePathType.AFFILIATIONS_CREATE);
    rUri3.setPredefinedClientScopes(scopes3);
    rUri3.setRedirectUri("redirect-uri-3");
    rUri3.setRedirectUriType("type-3");
    rUri3.setUriActType("uri-act-type-3");
    rUri3.setUriGeoArea("uri-geo-area-3");
    clientRedirectUris.add(rUri1);
    clientRedirectUris.add(rUri2);
    clientRedirectUris.add(rUri3);
    client.setClientRedirectUris(clientRedirectUris);
    return client;
}
Also used : ClientRedirectUri(org.orcid.jaxb.model.v3.dev1.client.ClientRedirectUri) ScopePathType(org.orcid.jaxb.model.message.ScopePathType) Client(org.orcid.jaxb.model.v3.dev1.client.Client) HashSet(java.util.HashSet)

Aggregations

ClientRedirectUri (org.orcid.jaxb.model.v3.dev1.client.ClientRedirectUri)9 ScopePathType (org.orcid.jaxb.model.message.ScopePathType)6 HashSet (java.util.HashSet)5 Client (org.orcid.jaxb.model.v3.dev1.client.Client)3 ArrayList (java.util.ArrayList)2 Date (java.util.Date)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 TreeSet (java.util.TreeSet)1 MapperFactory (ma.glasnost.orika.MapperFactory)1 MappingContext (ma.glasnost.orika.MappingContext)1 DefaultMapperFactory (ma.glasnost.orika.impl.DefaultMapperFactory)1 ClientSummary (org.orcid.jaxb.model.v3.dev1.client.ClientSummary)1 FuzzyDate (org.orcid.jaxb.model.v3.dev1.common.FuzzyDate)1 PublicationDate (org.orcid.jaxb.model.v3.dev1.common.PublicationDate)1 ClientDetailsEntity (org.orcid.persistence.jpa.entities.ClientDetailsEntity)1 ClientRedirectUriEntity (org.orcid.persistence.jpa.entities.ClientRedirectUriEntity)1 ClientSecretEntity (org.orcid.persistence.jpa.entities.ClientSecretEntity)1