directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seelm...@apache.org
Subject svn commit: r494592 - in /directory/trunks/ldapstudio/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/actions: LocateDnInDitAction.java LocateEntryInDitAction.java LocateInDitAction.java
Date Tue, 09 Jan 2007 21:27:51 GMT
Author: seelmann
Date: Tue Jan  9 13:27:50 2007
New Revision: 494592

URL: http://svn.apache.org/viewvc?view=rev&rev=494592
Log:
Replaced Object[] by a bean.

Modified:
    directory/trunks/ldapstudio/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/actions/LocateDnInDitAction.java
    directory/trunks/ldapstudio/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/actions/LocateEntryInDitAction.java
    directory/trunks/ldapstudio/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/actions/LocateInDitAction.java

Modified: directory/trunks/ldapstudio/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/actions/LocateDnInDitAction.java
URL: http://svn.apache.org/viewvc/directory/trunks/ldapstudio/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/actions/LocateDnInDitAction.java?view=diff&rev=494592&r1=494591&r2=494592
==============================================================================
--- directory/trunks/ldapstudio/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/actions/LocateDnInDitAction.java
(original)
+++ directory/trunks/ldapstudio/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/actions/LocateDnInDitAction.java
Tue Jan  9 13:27:50 2007
@@ -73,7 +73,7 @@
      * This implementation returns a connection and DN if the selected attribute or value
      * contains a valid DN.
      */
-    protected Object[] getConnectionAndDn()
+    protected ConnectionAndDn getConnectionAndDn()
     {
 
         if ( getSelectedAttributeHierarchies().length == 1
@@ -85,8 +85,8 @@
                 IValue value = getSelectedAttributeHierarchies()[0].getAttribute().getValues()[0];
                 if ( value.isString() && new DN( value.getStringValue() ) != null
)
                 {
-                    return new Object[]
-                        { value.getAttribute().getEntry().getConnection(), new DN( value.getStringValue()
) };
+                    return new ConnectionAndDn( value.getAttribute().getEntry().getConnection(),
new DN( value
+                        .getStringValue() ) );
                 }
             }
             catch ( NameException e )
@@ -102,8 +102,8 @@
                 IValue value = getSelectedValues()[0];
                 if ( value.isString() && new DN( value.getStringValue() ) != null
)
                 {
-                    return new Object[]
-                        { value.getAttribute().getEntry().getConnection(), new DN( value.getStringValue()
) };
+                    return new ConnectionAndDn( value.getAttribute().getEntry().getConnection(),
new DN( value
+                        .getStringValue() ) );
                 }
             }
             catch ( NameException e )
@@ -115,8 +115,7 @@
         if ( getSelectedSearchResults().length == 1 && getSelectedAttributeHierarchies().length
== 0 )
         {
             ISearchResult result = getSelectedSearchResults()[0];
-            return new Object[]
-                { result.getEntry().getConnection(), result.getEntry().getDn() };
+            return new ConnectionAndDn( result.getEntry().getConnection(), result.getEntry().getDn()
);
         }
 
         return null;

Modified: directory/trunks/ldapstudio/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/actions/LocateEntryInDitAction.java
URL: http://svn.apache.org/viewvc/directory/trunks/ldapstudio/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/actions/LocateEntryInDitAction.java?view=diff&rev=494592&r1=494591&r2=494592
==============================================================================
--- directory/trunks/ldapstudio/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/actions/LocateEntryInDitAction.java
(original)
+++ directory/trunks/ldapstudio/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/actions/LocateEntryInDitAction.java
Tue Jan  9 13:27:50 2007
@@ -94,21 +94,19 @@
      * This implementation returns a connection and DN if the a search result or bookmark
      * is selected.
      */
-    protected Object[] getConnectionAndDn()
+    protected ConnectionAndDn getConnectionAndDn()
     {
         if ( getSelectedSearchResults().length == 1
             && getSelectedBookmarks().length + getSelectedEntries().length + getSelectedBrowserViewCategories().length
== 0 )
         {
-            return new Object[]
-                { getSelectedSearchResults()[0].getEntry().getConnection(),
-                    getSelectedSearchResults()[0].getEntry().getDn() };
+            return new ConnectionAndDn( getSelectedSearchResults()[0].getEntry().getConnection(),
+                getSelectedSearchResults()[0].getEntry().getDn() );
         }
         else if ( getSelectedBookmarks().length == 1
             && getSelectedSearchResults().length + getSelectedEntries().length
                 + getSelectedBrowserViewCategories().length == 0 )
         {
-            return new Object[]
-                { getSelectedBookmarks()[0].getConnection(), getSelectedBookmarks()[0].getDn()
};
+            return new ConnectionAndDn( getSelectedBookmarks()[0].getConnection(), getSelectedBookmarks()[0].getDn()
);
         }
         else
         {

Modified: directory/trunks/ldapstudio/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/actions/LocateInDitAction.java
URL: http://svn.apache.org/viewvc/directory/trunks/ldapstudio/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/actions/LocateInDitAction.java?view=diff&rev=494592&r1=494591&r2=494592
==============================================================================
--- directory/trunks/ldapstudio/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/actions/LocateInDitAction.java
(original)
+++ directory/trunks/ldapstudio/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/actions/LocateInDitAction.java
Tue Jan  9 13:27:50 2007
@@ -47,11 +47,11 @@
      */
     public final void run()
     {
-        Object[] connectionAndDn = getConnectionAndDn();
+        ConnectionAndDn connectionAndDn = getConnectionAndDn();
         if ( connectionAndDn != null )
         {
-            IConnection connection = ( IConnection ) connectionAndDn[0];
-            DN dn = ( DN ) connectionAndDn[1];
+            IConnection connection = connectionAndDn.connection;
+            DN dn = connectionAndDn.dn;
 
             IEntry entry = connection.getEntryFromCache( dn );
             if ( entry == null )
@@ -106,12 +106,38 @@
 
 
     /**
-     * Get the connection and DN to open. It must be an array of size 2.
-     * The first element must be the IConnection object. The second
-     * element must be the DN.
+     * Get the connection and DN to open.
      * 
-     * @return an array with the connection and DN to open, or null.
+     * @return a ConnectionAndDn bean, or null.
      */
-    protected abstract Object[] getConnectionAndDn();
+    protected abstract ConnectionAndDn getConnectionAndDn();
 
+    
+    /**
+     * Inner class to get connection and DN of the entry to locate.
+     *
+     * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+     * @version $Rev$, $Date$
+     */
+    protected class ConnectionAndDn
+    {
+        /** The connection */
+        private IConnection connection;
+
+        /** The DN */
+        private DN dn;
+
+
+        /**
+         * Creates a new instance of ConnectionAndDn.
+         *
+         * @param connection the connection
+         * @param dn the DN
+         */
+        protected ConnectionAndDn( IConnection connection, DN dn )
+        {
+            this.connection = connection;
+            this.dn = dn;
+        }
+    }
 }



Mime
View raw message