From 67a2016c3a19f2982c7296c1b56582aefe6c940a Mon Sep 17 00:00:00 2001 From: Mattias Arthursson Date: Fri, 7 Sep 2007 12:50:27 +0000 Subject: [PATCH] Fix for LDAP-78: add lookupContext and alternate modifyAttributes in LdapOperations --- .../ldap/core/simple/SimpleLdapTemplateITest.java | 2 +- .../ldap/core/simple/SimpleLdapOperations.java | 4 ++-- .../ldap/core/simple/SimpleLdapTemplate.java | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/spring-ldap-tiger/src/itest/java/org/springframework/ldap/core/simple/SimpleLdapTemplateITest.java b/spring-ldap-tiger/src/itest/java/org/springframework/ldap/core/simple/SimpleLdapTemplateITest.java index c3294698..240c5226 100644 --- a/spring-ldap-tiger/src/itest/java/org/springframework/ldap/core/simple/SimpleLdapTemplateITest.java +++ b/spring-ldap-tiger/src/itest/java/org/springframework/ldap/core/simple/SimpleLdapTemplateITest.java @@ -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"); diff --git a/spring-ldap-tiger/src/main/java/org/springframework/ldap/core/simple/SimpleLdapOperations.java b/spring-ldap-tiger/src/main/java/org/springframework/ldap/core/simple/SimpleLdapOperations.java index 23fc2099..bcafddd9 100644 --- a/spring-ldap-tiger/src/main/java/org/springframework/ldap/core/simple/SimpleLdapOperations.java +++ b/spring-ldap-tiger/src/main/java/org/springframework/ldap/core/simple/SimpleLdapOperations.java @@ -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.: * *
diff --git a/spring-ldap-tiger/src/main/java/org/springframework/ldap/core/simple/SimpleLdapTemplate.java b/spring-ldap-tiger/src/main/java/org/springframework/ldap/core/simple/SimpleLdapTemplate.java
index d56b8896..d1ac16ad 100644
--- a/spring-ldap-tiger/src/main/java/org/springframework/ldap/core/simple/SimpleLdapTemplate.java
+++ b/spring-ldap-tiger/src/main/java/org/springframework/ldap/core/simple/SimpleLdapTemplate.java
@@ -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);
 	}
 
 	/*