Fix for LDAP-78: add lookupContext and alternate modifyAttributes in LdapOperations
This commit is contained in:
@@ -46,7 +46,7 @@ public class SimpleLdapTemplateITest extends AbstractLdapTemplateIntegrationTest
|
||||
}
|
||||
|
||||
public void testModifyAttributes() {
|
||||
DirContextOperations ctx = ldapTemplate.lookup("cn=Some Person,ou=company1,c=Sweden");
|
||||
DirContextOperations ctx = ldapTemplate.lookupContext("cn=Some Person,ou=company1,c=Sweden");
|
||||
|
||||
ctx.setAttributeValue("description", "updated description");
|
||||
ctx.setAttributeValue("telephoneNumber", "0000001");
|
||||
|
||||
@@ -94,7 +94,7 @@ public interface SimpleLdapOperations {
|
||||
* found entry.
|
||||
* @throws NamingException if any error occurs.
|
||||
*/
|
||||
DirContextOperations lookup(String dn);
|
||||
DirContextOperations lookupContext(String dn);
|
||||
|
||||
/**
|
||||
* Create an entry in the LDAP tree. The attributes used to create the entry
|
||||
@@ -123,7 +123,7 @@ public interface SimpleLdapOperations {
|
||||
/**
|
||||
* Modify the Attributes of the entry corresponsing to the supplied
|
||||
* {@link DirContextOperations} instance. The instance should have been
|
||||
* received from the {@link #lookup(String)} operation, and then modified to
|
||||
* received from the {@link #lookupContext(String)} operation, and then modified to
|
||||
* match the current state of the matching domain object, e.g.:
|
||||
*
|
||||
* <pre>
|
||||
|
||||
@@ -105,8 +105,8 @@ public class SimpleLdapTemplate implements SimpleLdapOperations {
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.ldap.core.simple.SimpleLdapOperations#lookup(java.lang.String)
|
||||
*/
|
||||
public DirContextOperations lookup(String dn) {
|
||||
return (DirContextOperations) ldapOperations.lookup(dn);
|
||||
public DirContextOperations lookupContext(String dn) {
|
||||
return ldapOperations.lookupContext(dn);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -114,7 +114,7 @@ public class SimpleLdapTemplate implements SimpleLdapOperations {
|
||||
* @see org.springframework.ldap.core.simple.SimpleLdapOperations#modifyAttributes(org.springframework.ldap.core.DirContextOperations)
|
||||
*/
|
||||
public void modifyAttributes(DirContextOperations ctx) {
|
||||
ldapOperations.modifyAttributes(ctx.getDn(), ctx.getModificationItems());
|
||||
ldapOperations.modifyAttributes(ctx);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user