Beispiel #1
0
  public static Client valueOf(OrcidClient orcidClient) {
    Client client = new Client();
    client.setClientId(Text.valueOf(orcidClient.getClientId()));
    client.setClientSecret(Text.valueOf(orcidClient.getClientSecret()));
    client.setDisplayName(Text.valueOf(orcidClient.getDisplayName()));
    client.setShortDescription(Text.valueOf(orcidClient.getShortDescription()));
    if (orcidClient.getType() != null) client.setType(Text.valueOf(orcidClient.getType().value()));
    client.setWebsite(Text.valueOf(orcidClient.getWebsite()));

    Checkbox persistentTokenEnabled = new Checkbox();
    persistentTokenEnabled.setValue(orcidClient.isPersistentTokenEnabled());
    client.setPersistentTokenEnabled(persistentTokenEnabled);

    List<RedirectUri> redirectUris = new ArrayList<RedirectUri>();
    RedirectUris orcidRedirectUris = orcidClient.getRedirectUris();
    if (orcidRedirectUris != null && orcidRedirectUris.getRedirectUri() != null) {
      for (org.orcid.jaxb.model.clientgroup.RedirectUri orcidRedirectUri :
          orcidRedirectUris.getRedirectUri()) {
        redirectUris.add(RedirectUri.toRedirectUri(orcidRedirectUri));
      }
    }

    client.setRedirectUris(redirectUris);

    return client;
  }
Beispiel #2
0
 public static List<Client> valueOf(List<ClientDetailsEntity> clientDetails) {
   List<Client> clients = new ArrayList<Client>();
   for (ClientDetailsEntity entity : clientDetails) {
     clients.add(Client.valueOf(entity));
   }
   return clients;
 }
Beispiel #3
0
  public static Client valueOf(ClientDetailsEntity clientDetails) {
    Client client = new Client();
    if (clientDetails != null) {
      client.setClientId(Text.valueOf(clientDetails.getClientId()));
      client.setDisplayName(Text.valueOf(clientDetails.getClientName()));
      client.setShortDescription(Text.valueOf(clientDetails.getClientDescription()));
      client.setWebsite(Text.valueOf(clientDetails.getClientWebsite()));
      client.redirectUris = new ArrayList<RedirectUri>();
      if (clientDetails.getClientRegisteredRedirectUris() != null) {
        for (ClientRedirectUriEntity rUri : clientDetails.getClientRegisteredRedirectUris()) {
          client.redirectUris.add(RedirectUri.valueOf(rUri));
        }
      }

      client.persistentTokenEnabled = new Checkbox();
      client.persistentTokenEnabled.setValue(clientDetails.isPersistentTokensEnabled());
      client.setType(Text.valueOf(clientDetails.getClientType().value()));

      if (clientDetails.isScoped()) client.setScopes(clientDetails.getScope());

      client.setMemberId(Text.valueOf(clientDetails.getGroupProfileId()));
    }
    return client;
  }