コード例 #1
0
  public OpenAMUpdate(
      final ObjectClass oc,
      final OpenAMConfiguration configuration,
      final Uid uid,
      final Set<Attribute> attrs)
      throws UnsupportedEncodingException {

    super(configuration);

    adminToken = new AdminToken(configuration);

    objectClass = oc;
    this.uid = uid;
    this.attrs = attrs;
    connection = OpenAMConnection.openConnection(configuration);
  }
コード例 #2
0
  private Uid doUpdate() throws IOException {

    if (!objectClass.equals(ObjectClass.ACCOUNT) && (!objectClass.equals(ObjectClass.GROUP))) {
      throw new IllegalStateException("Wrong object class");
    }

    if (!userExists(
        uid.getUidValue(), configuration.getOpenamRealm(), adminToken.getToken(), connection)) {
      LOG.error("User " + uid.getUidValue() + " do not exists");
      throw new ConnectorException("User " + uid.getUidValue() + " do not exists");
    }

    try {
      connection.update(createUpdateQueryString(uid, attrs, adminToken).toString());
      LOG.ok("User " + uid.getUidValue() + " updated");
    } catch (HttpClientErrorException hcee) {
      throw hcee;
    }
    return uid;
  }