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;
}
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;
}
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;
}
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;
}
Aggregations