/ Published in: Java
Expand |
Embed | Plain Text
import com.unboundid.ldap.sdk.LDAPConnection; import com.unboundid.ldap.sdk.LDAPException; import com.unboundid.ldap.sdk.persist.LDAPPersister; import com.unboundid.ldap.sdk.persist.PersistedObjects; public class main4 { /** * @param args * @throws LDAPException */ LDAPConnection connection = new LDAPConnection("localhost", 389, "cn=Directory Manager", "secret"); InetOrgPerson person = new InetOrgPerson(); person.setSn("test"); person.setCn("test"); person.setUid("test"); // Create an LDAPPersister instance for MyObject objects. LDAPPersister<InetOrgPerson> persister = LDAPPersister.getInstance(InetOrgPerson.class); //persister.add(person, connection, null); // Perform a search to find all instances with a string value of "test", // then delete them from the server. InetOrgPerson o = new InetOrgPerson(); o.setUid("test"); PersistedObjects<InetOrgPerson> results = persister.search(o, connection); while (true) { o = results.next(); if (o == null) { break; } } } }
You need to login to post a comment.
