org.apache.directory.shared.ldap.entry.Modification Java Examples

The following examples show how to use org.apache.directory.shared.ldap.entry.Modification. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: LdapTestServer.java    From gemfirexd-oss with Apache License 2.0 5 votes vote down vote up
public void addAttribute(String dn, String attrName, String attrValue)
    throws Exception {
  EntryAttribute attr = new DefaultClientAttribute(attrName, attrValue);
  Modification addValue = new ClientModification(
      ModificationOperation.ADD_ATTRIBUTE, attr);
  service.getAdminSession().modify(new DN(dn),
      Collections.singletonList(addValue));
}
 
Example #2
Source File: LdapTestServer.java    From gemfirexd-oss with Apache License 2.0 5 votes vote down vote up
public void removeAttribute(String dn, String attrName, String attrValue)
    throws Exception {
  EntryAttribute attr = new DefaultClientAttribute(attrName, attrValue);
  Modification removeValue = new ClientModification(
      ModificationOperation.REMOVE_ATTRIBUTE, attr);
  service.getAdminSession().modify(new DN(dn),
      Collections.singletonList(removeValue));
}
 
Example #3
Source File: LdapTestServer.java    From gemfirexd-oss with Apache License 2.0 5 votes vote down vote up
public void addAttribute(String dn, String attrName, String attrValue)
    throws Exception {
  EntryAttribute attr = new DefaultClientAttribute(attrName, attrValue);
  Modification addValue = new ClientModification(
      ModificationOperation.ADD_ATTRIBUTE, attr);
  service.getAdminSession().modify(new DN(dn),
      Collections.singletonList(addValue));
}
 
Example #4
Source File: LdapTestServer.java    From gemfirexd-oss with Apache License 2.0 5 votes vote down vote up
public void removeAttribute(String dn, String attrName, String attrValue)
    throws Exception {
  EntryAttribute attr = new DefaultClientAttribute(attrName, attrValue);
  Modification removeValue = new ClientModification(
      ModificationOperation.REMOVE_ATTRIBUTE, attr);
  service.getAdminSession().modify(new DN(dn),
      Collections.singletonList(removeValue));
}
 
Example #5
Source File: LdapSynchronizationFlowTest.java    From codenvy with Eclipse Public License 1.0 4 votes vote down vote up
private static Modification replaceMod(String attrName, String newValue) {
  return new ClientModification(
      REPLACE_ATTRIBUTE, new DefaultClientAttribute(attrName, newValue));
}
 
Example #6
Source File: EmbeddedLdapServer.java    From codenvy with Eclipse Public License 1.0 4 votes vote down vote up
/** Applies given modifications on the entity with rdn {rdnKey}={rdnValue} in base dn. */
public void modify(String rdnKey, String rdnValue, Modification... mods) throws Exception {
  service
      .getAdminSession()
      .modify(new DN(rdnKey + '=' + rdnValue + ',' + baseDn), Arrays.asList(mods));
}