directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r954151 - in /directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api: LdapConnection.java LdapNetworkConnection.java
Date Sun, 13 Jun 2010 00:40:30 GMT
Author: elecharny
Date: Sun Jun 13 00:40:29 2010
New Revision: 954151

URL: http://svn.apache.org/viewvc?rev=954151&view=rev
Log:
Added moveAndRename(-) methods

Modified:
    directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapConnection.java
    directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapNetworkConnection.java

Modified: directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapConnection.java
URL: http://svn.apache.org/viewvc/directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapConnection.java?rev=954151&r1=954150&r2=954151&view=diff
==============================================================================
--- directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapConnection.java
(original)
+++ directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapConnection.java
Sun Jun 13 00:40:29 2010
@@ -280,6 +280,42 @@ public interface LdapConnection
 
 
     /**
+     * Moves and renames the given entryDn.The old RDN will be deleted
+     * 
+     * @see #moveAndRename(DN, DN, boolean)
+     */
+    public abstract ModifyDnResponse moveAndRename( DN entryDn, DN newDn ) throws LdapException;
+
+
+    /**
+     * Moves and renames the given entryDn.The old RDN will be deleted
+     * 
+     * @see #moveAndRename(DN, DN, boolean)
+     */
+    public abstract ModifyDnResponse moveAndRename( String entryDn, String newDn ) throws
LdapException;
+
+
+    /**
+     * Moves and renames the given entryDn.The old RDN will be deleted if requested
+     * 
+     * @param entryDn The original entry DN
+     * @param newDn The new Entry DN
+     * @param deleteOldRdn Tells if the old RDN must be removed
+     */
+    public abstract ModifyDnResponse moveAndRename( DN entryDn, DN newDn, boolean deleteOldRdn
) throws LdapException;
+
+
+    /**
+     * Moves and renames the given entryDn.The old RDN will be deleted if requested
+     * 
+     * @param entryDn The original entry DN
+     * @param newDn The new Entry DN
+     * @param deleteOldRdn Tells if the old RDN must be removed
+     */
+    public abstract ModifyDnResponse moveAndRename( String entryDn, String newDn, boolean
deleteOldRdn ) throws LdapException;
+
+
+    /**
      * 
      * performs the modifyDn operation based on the given ModifyDnRequest.
      *

Modified: directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapNetworkConnection.java
URL: http://svn.apache.org/viewvc/directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapNetworkConnection.java?rev=954151&r1=954150&r2=954151&view=diff
==============================================================================
--- directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapNetworkConnection.java
(original)
+++ directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapNetworkConnection.java
Sun Jun 13 00:40:29 2010
@@ -2095,6 +2095,82 @@ public class LdapNetworkConnection exten
 
 
     /**
+     * Moves and renames the given entryDn.The old RDN will be deleted
+     * 
+     * @see #moveAndRename(DN, DN, boolean)
+     */
+    public ModifyDnResponse moveAndRename( DN entryDn, DN newDn ) throws LdapException
+    {
+        return moveAndRename( entryDn, newDn, true );
+    }
+
+
+    /**
+     * Moves and renames the given entryDn.The old RDN will be deleted
+     * 
+     * @see #moveAndRename(DN, DN, boolean)
+     */
+    public ModifyDnResponse moveAndRename( String entryDn, String newDn ) throws LdapException
+    {
+        return moveAndRename( new DN( entryDn ), new DN( newDn ), true );
+    }
+
+
+    /**
+     * Moves and renames the given entryDn.The old RDN will be deleted if requested
+     * 
+     * @param entryDn The original entry DN
+     * @param newDn The new Entry DN
+     * @param deleteOldRdn Tells if the old RDN must be removed
+     */
+    public ModifyDnResponse moveAndRename( DN entryDn, DN newDn, boolean deleteOldRdn ) throws
LdapException
+    {
+        // Check the parameters first
+        if ( entryDn == null ) 
+        {
+            throw new IllegalArgumentException( "The entry DN must not be null" );
+        }
+        
+        if ( entryDn.isRootDSE() )
+        {
+            throw new IllegalArgumentException( "The RootDSE cannot be moved" );
+        }
+        
+        if ( newDn == null ) 
+        {
+            throw new IllegalArgumentException( "The new DN must not be null" );
+        }
+        
+        if ( newDn.isRootDSE() )
+        {
+            throw new IllegalArgumentException( "The RootDSE cannot be the target" );
+        }
+        
+        // Create the request
+        ModifyDnRequest modDnRequest = new ModifyDnRequest();
+        modDnRequest.setEntryDn( entryDn );
+        modDnRequest.setNewRdn( newDn.getRdn() );
+        modDnRequest.setNewSuperior( newDn.getParent() );
+        modDnRequest.setDeleteOldRdn( deleteOldRdn );
+        
+        return modifyDn( modDnRequest );
+    }
+
+
+    /**
+     * Moves and renames the given entryDn.The old RDN will be deleted if requested
+     * 
+     * @param entryDn The original entry DN
+     * @param newDn The new Entry DN
+     * @param deleteOldRdn Tells if the old RDN must be removed
+     */
+    public ModifyDnResponse moveAndRename( String entryDn, String newDn, boolean deleteOldRdn
) throws LdapException
+    {
+        return moveAndRename( new DN( entryDn ), new DN( newDn ), true );
+    }
+
+
+    /**
      * {@inheritDoc}
      */
     public ModifyDnResponse modifyDn( ModifyDnRequest modDnRequest ) throws LdapException



Mime
View raw message