directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1071605 - in /directory/studio/branches/m1/plugins: aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/valueeditors/ connection.core/src/main/java/org/apache/directory/studio/connection/core/ ldapbrowser.common/src/main/...
Date Thu, 17 Feb 2011 13:24:20 GMT
Author: elecharny
Date: Thu Feb 17 13:24:19 2011
New Revision: 1071605

URL: http://svn.apache.org/viewvc?rev=1071605&view=rev
Log:
o Used the Dn.addAll() method to concatenate two DNs
o Removed the composeDn() methods from DnUtils, using the Dn existing methods

Modified:
    directory/studio/branches/m1/plugins/aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/valueeditors/SubtreeSpecificationDialog.java
    directory/studio/branches/m1/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/DnUtils.java
    directory/studio/branches/m1/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/DnBuilderWidget.java
    directory/studio/branches/m1/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/search/EntryWidget.java
    directory/studio/branches/m1/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/wizards/NewEntryDnWizardPage.java
    directory/studio/branches/m1/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/CopyEntriesRunnable.java
    directory/studio/branches/m1/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/ImportLdifRunnable.java
    directory/studio/branches/m1/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/MoveEntriesRunnable.java
    directory/studio/branches/m1/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/RenameEntryRunnable.java
    directory/studio/branches/m1/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/Entry.java

Modified: directory/studio/branches/m1/plugins/aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/valueeditors/SubtreeSpecificationDialog.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/m1/plugins/aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/valueeditors/SubtreeSpecificationDialog.java?rev=1071605&r1=1071604&r2=1071605&view=diff
==============================================================================
--- directory/studio/branches/m1/plugins/aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/valueeditors/SubtreeSpecificationDialog.java
(original)
+++ directory/studio/branches/m1/plugins/aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/valueeditors/SubtreeSpecificationDialog.java
Thu Feb 17 13:24:19 2011
@@ -32,7 +32,6 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.model.subtree.SubtreeSpecificationParser;
 import org.apache.directory.studio.aciitemeditor.Activator;
 import org.apache.directory.studio.common.ui.widgets.BaseWidgetUtils;
-import org.apache.directory.studio.connection.core.DnUtils;
 import org.apache.directory.studio.ldapbrowser.common.dialogs.TextDialog;
 import org.apache.directory.studio.ldapbrowser.common.widgets.WidgetModifyEvent;
 import org.apache.directory.studio.ldapbrowser.common.widgets.WidgetModifyListener;
@@ -659,7 +658,7 @@ class SubtreeSpecificationDialog extends
             
             if ( !Dn.isNullOrEmpty( suffix ) )
             {
-                chopBase = DnUtils.composeDn( chopBase, suffix );
+                chopBase = chopBase.addAll( suffix );
             }
         }
 
@@ -691,7 +690,7 @@ class SubtreeSpecificationDialog extends
                 
                 if ( !Dn.isNullOrEmpty( suffix ) )
                 {
-                    chopBase = DnUtils.composeDn( chopBase, suffix );
+                    chopBase = chopBase.addAll( suffix );
                 }
             }
 

Modified: directory/studio/branches/m1/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/DnUtils.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/m1/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/DnUtils.java?rev=1071605&r1=1071604&r2=1071605&view=diff
==============================================================================
--- directory/studio/branches/m1/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/DnUtils.java
(original)
+++ directory/studio/branches/m1/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/DnUtils.java
Thu Feb 17 13:24:19 2011
@@ -22,7 +22,6 @@ package org.apache.directory.studio.conn
 
 import javax.naming.InvalidNameException;
 
-import org.apache.directory.shared.ldap.model.exception.LdapInvalidDnException;
 import org.apache.directory.shared.ldap.model.name.Dn;
 import org.apache.directory.shared.ldap.model.name.Rdn;
 
@@ -34,65 +33,6 @@ import org.apache.directory.shared.ldap.
  */
 public class DnUtils
 {
-
-    /**
-     * Composes an Dn based on the given Rdn and Dn.
-     * 
-     * @param rdn the Rdn
-     * @param parent the parent Dn
-     * 
-     * @return the composed Dn
-     */
-    public static Dn composeDn( Rdn rdn, Dn parent )
-    {
-        return parent.add( rdn );
-    }
-
-
-    /**
-     * Compose an Dn based on the given Rdn and Dn.
-     * 
-     * @param rdn the Rdn
-     * @param parent the parent Dn
-     * 
-     * @return the composed Rdn
-     * 
-     * @throws InvalidNameException the invalid name exception
-     */
-    public static Dn composeDn( String rdn, String parent ) throws InvalidNameException
-    {
-        try
-        {
-            return composeDn( new Rdn( rdn ), new Dn( parent ) );
-        }
-        catch ( LdapInvalidDnException e )
-        {
-            throw new InvalidNameException( e.getMessage() );
-        }
-    }
-
-
-    /**
-     * Composes an Dn based on the given prefix and suffix.
-     * 
-     * @param prefix the prefix
-     * @param suffix the suffix
-     * 
-     * @return the composed Dn
-     */
-    public static Dn composeDn( Dn prefix, Dn suffix )
-    {
-        Dn ldapDn = suffix;
-
-        for ( int i = 0; i < prefix.size(); i++ )
-        {
-            ldapDn = ldapDn.add( (Rdn) prefix.getRdn( i ).clone() );
-        }
-
-        return ldapDn;
-    }
-
-
     /**
      * Gets the prefix, cuts the suffix from the given Dn.
      * 

Modified: directory/studio/branches/m1/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/DnBuilderWidget.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/m1/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/DnBuilderWidget.java?rev=1071605&r1=1071604&r2=1071605&view=diff
==============================================================================
--- directory/studio/branches/m1/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/DnBuilderWidget.java
(original)
+++ directory/studio/branches/m1/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/DnBuilderWidget.java
Thu Feb 17 13:24:19 2011
@@ -370,7 +370,7 @@ public class DnBuilderWidget extends Bro
                 Dn dn;
                 if ( showParent && showRDN )
                 {
-                    dn = DnUtils.composeDn( rdn, parentDn );
+                    dn = parentDn.add( rdn );
                 }
                 else if ( showParent )
                 {

Modified: directory/studio/branches/m1/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/search/EntryWidget.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/m1/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/search/EntryWidget.java?rev=1071605&r1=1071604&r2=1071605&view=diff
==============================================================================
--- directory/studio/branches/m1/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/search/EntryWidget.java
(original)
+++ directory/studio/branches/m1/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/search/EntryWidget.java
Thu Feb 17 13:24:19 2011
@@ -205,7 +205,7 @@ public class EntryWidget extends Browser
                     {
                         if ( initialDn != null && initialDn.size() > 0 )
                         {
-                            initialDn = DnUtils.composeDn(initialDn, suffix );
+                            initialDn = initialDn.addAll( suffix );
                         }
                     }
 

Modified: directory/studio/branches/m1/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/wizards/NewEntryDnWizardPage.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/m1/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/wizards/NewEntryDnWizardPage.java?rev=1071605&r1=1071604&r2=1071605&view=diff
==============================================================================
--- directory/studio/branches/m1/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/wizards/NewEntryDnWizardPage.java
(original)
+++ directory/studio/branches/m1/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/wizards/NewEntryDnWizardPage.java
Thu Feb 17 13:24:19 2011
@@ -33,7 +33,6 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.model.name.Rdn;
 import org.apache.directory.shared.ldap.model.schema.AttributeType;
 import org.apache.directory.studio.common.ui.widgets.BaseWidgetUtils;
-import org.apache.directory.studio.connection.core.DnUtils;
 import org.apache.directory.studio.connection.ui.RunnableContextRunner;
 import org.apache.directory.studio.ldapbrowser.common.BrowserCommonActivator;
 import org.apache.directory.studio.ldapbrowser.common.BrowserCommonConstants;
@@ -255,7 +254,7 @@ public class NewEntryDnWizardPage extend
             }
             else
             {
-                dn = DnUtils.composeDn( dnBuilderWidget.getRdn(), dnBuilderWidget.getParentDn()
);
+                dn = dnBuilderWidget.getParentDn().add( dnBuilderWidget.getRdn() );
             }
             newEntry.setDn( dn );
 
@@ -339,7 +338,7 @@ public class NewEntryDnWizardPage extend
 
             Rdn rdn = dnBuilderWidget.getRdn();
             Dn parentDn = dnBuilderWidget.getParentDn();
-            final Dn dn = DnUtils.composeDn( rdn, parentDn );
+            final Dn dn = parentDn.add(  rdn );
 
             // check if parent exists
             ReadEntryRunnable readEntryRunnable1 = new ReadEntryRunnable( wizard.getSelectedConnection(),
parentDn );

Modified: directory/studio/branches/m1/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/CopyEntriesRunnable.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/m1/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/CopyEntriesRunnable.java?rev=1071605&r1=1071604&r2=1071605&view=diff
==============================================================================
--- directory/studio/branches/m1/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/CopyEntriesRunnable.java
(original)
+++ directory/studio/branches/m1/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/CopyEntriesRunnable.java
Thu Feb 17 13:24:19 2011
@@ -46,7 +46,6 @@ import org.apache.directory.studio.commo
 import org.apache.directory.studio.connection.core.Connection;
 import org.apache.directory.studio.connection.core.Connection.AliasDereferencingMethod;
 import org.apache.directory.studio.connection.core.Connection.ReferralHandlingMethod;
-import org.apache.directory.studio.connection.core.DnUtils;
 import org.apache.directory.studio.connection.core.jobs.StudioConnectionBulkRunnableWithProgress;
 import org.apache.directory.studio.ldapbrowser.core.BrowserCoreMessages;
 import org.apache.directory.studio.ldapbrowser.core.events.BulkModificationEvent;
@@ -297,7 +296,7 @@ public class CopyEntriesRunnable impleme
                 {
                     newRdn = forceNewRdn;
                 }
-                Dn newLdapDn = DnUtils.composeDn( newRdn, parentDn );
+                Dn newLdapDn = parentDn.add( newRdn );
 
                 // apply new Rdn to the attributes
                 applyNewRdn( newAttributes, oldRdn, newRdn );
@@ -372,7 +371,7 @@ public class CopyEntriesRunnable impleme
                                     applyNewRdn( newAttributes, newRdn, renamedRdn );
 
                                     // compose new Dn
-                                    newLdapDn = DnUtils.composeDn( renamedRdn, parentDn );
+                                    newLdapDn = parentDn.add( renamedRdn );
 
                                     // create entry
                                     targetBrowserConnection.getConnection().getConnectionWrapper()

Modified: directory/studio/branches/m1/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/ImportLdifRunnable.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/m1/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/ImportLdifRunnable.java?rev=1071605&r1=1071604&r2=1071605&view=diff
==============================================================================
--- directory/studio/branches/m1/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/ImportLdifRunnable.java
(original)
+++ directory/studio/branches/m1/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/ImportLdifRunnable.java
Thu Feb 17 13:24:19 2011
@@ -52,7 +52,6 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.studio.common.core.jobs.StudioProgressMonitor;
 import org.apache.directory.studio.connection.core.Connection;
 import org.apache.directory.studio.connection.core.ConnectionCoreConstants;
-import org.apache.directory.studio.connection.core.DnUtils;
 import org.apache.directory.studio.connection.core.jobs.StudioConnectionBulkRunnableWithProgress;
 import org.apache.directory.studio.ldapbrowser.core.BrowserCoreMessages;
 import org.apache.directory.studio.ldapbrowser.core.events.BulkModificationEvent;
@@ -525,13 +524,13 @@ public class ImportLdifRunnable implemen
                 Dn newDn;
                 if ( modDnRecord.getNewsuperiorLine() != null )
                 {
-                    newDn = DnUtils.composeDn( newRdn, modDnRecord.getNewsuperiorLine().getValueAsString()
);
+                    newDn = new Dn( newRdn, modDnRecord.getNewsuperiorLine().getValueAsString()
);
                 }
                 else
                 {
                     Dn dnObject = new Dn( dn );
                     Dn parent = dnObject.getParent();
-                    newDn = DnUtils.composeDn( newRdn, parent.getName() );
+                    newDn = new Dn( newRdn, parent.getName() );
                 }
 
                 browserConnection.getConnection().getConnectionWrapper()

Modified: directory/studio/branches/m1/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/MoveEntriesRunnable.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/m1/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/MoveEntriesRunnable.java?rev=1071605&r1=1071604&r2=1071605&view=diff
==============================================================================
--- directory/studio/branches/m1/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/MoveEntriesRunnable.java
(original)
+++ directory/studio/branches/m1/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/MoveEntriesRunnable.java
Thu Feb 17 13:24:19 2011
@@ -33,7 +33,6 @@ import javax.naming.directory.SearchCont
 import org.apache.directory.shared.ldap.model.name.Dn;
 import org.apache.directory.studio.common.core.jobs.StudioProgressMonitor;
 import org.apache.directory.studio.connection.core.Connection;
-import org.apache.directory.studio.connection.core.DnUtils;
 import org.apache.directory.studio.connection.core.StudioControl;
 import org.apache.directory.studio.connection.core.jobs.StudioConnectionBulkRunnableWithProgress;
 import org.apache.directory.studio.ldapbrowser.core.BrowserCoreMessages;
@@ -162,7 +161,7 @@ public class MoveEntriesRunnable impleme
 
             IEntry oldEntry = oldEntries[i];
             Dn oldDn = oldEntry.getDn();
-            Dn newDn = DnUtils.composeDn( oldDn.getRdn(), parentDn );
+            Dn newDn = parentDn.add( oldDn.getRdn() );
 
             // try to move entry
             RenameEntryRunnable.renameEntry( browserConnection, oldEntry, newDn, dummyMonitor
);

Modified: directory/studio/branches/m1/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/RenameEntryRunnable.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/m1/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/RenameEntryRunnable.java?rev=1071605&r1=1071604&r2=1071605&view=diff
==============================================================================
--- directory/studio/branches/m1/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/RenameEntryRunnable.java
(original)
+++ directory/studio/branches/m1/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/RenameEntryRunnable.java
Thu Feb 17 13:24:19 2011
@@ -35,7 +35,6 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.model.name.Rdn;
 import org.apache.directory.studio.common.core.jobs.StudioProgressMonitor;
 import org.apache.directory.studio.connection.core.Connection;
-import org.apache.directory.studio.connection.core.DnUtils;
 import org.apache.directory.studio.connection.core.StudioControl;
 import org.apache.directory.studio.connection.core.jobs.StudioConnectionBulkRunnableWithProgress;
 import org.apache.directory.studio.ldapbrowser.core.BrowserCoreMessages;
@@ -147,7 +146,7 @@ public class RenameEntryRunnable impleme
 
         Dn oldDn = oldEntry.getDn();
         Dn parentDn = oldDn.getParent();
-        Dn newDn = DnUtils.composeDn( newRdn, parentDn );
+        Dn newDn = parentDn.add( newRdn );
 
         // use a dummy monitor to be able to handle exceptions
         StudioProgressMonitor dummyMonitor = new StudioProgressMonitor( monitor );

Modified: directory/studio/branches/m1/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/Entry.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/m1/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/Entry.java?rev=1071605&r1=1071604&r2=1071605&view=diff
==============================================================================
--- directory/studio/branches/m1/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/Entry.java
(original)
+++ directory/studio/branches/m1/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/Entry.java
Thu Feb 17 13:24:19 2011
@@ -21,9 +21,8 @@
 package org.apache.directory.studio.ldapbrowser.core.model.impl;
 
 
-import org.apache.directory.shared.ldap.model.name.Rdn;
 import org.apache.directory.shared.ldap.model.name.Dn;
-import org.apache.directory.studio.connection.core.DnUtils;
+import org.apache.directory.shared.ldap.model.name.Rdn;
 import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection;
 import org.apache.directory.studio.ldapbrowser.core.model.IEntry;
 
@@ -82,7 +81,7 @@ public class Entry extends AbstractEntry
      */
     public Dn getDn()
     {
-        Dn dn = DnUtils.composeDn( rdn, parent.getDn() );
+        Dn dn = parent.getDn().add( rdn );
         return dn;
     }
 



Mime
View raw message