directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seelm...@apache.org
Subject svn commit: r784444 - /directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/SearchScope.java
Date Sat, 13 Jun 2009 18:11:51 GMT
Author: seelmann
Date: Sat Jun 13 18:11:50 2009
New Revision: 784444

URL: http://svn.apache.org/viewvc?rev=784444&view=rev
Log:
Added method to get SearchScope enum from LDAP URL value

Modified:
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/SearchScope.java

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/SearchScope.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/SearchScope.java?rev=784444&r1=784443&r2=784444&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/SearchScope.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/SearchScope.java
Sat Jun 13 18:11:50 2009
@@ -108,10 +108,10 @@
     
     /**
      * Gets the SearchScope enumerated type for the corresponding 
-     * SearchControls scope setting.
+     * JNDI numeric value.
      *
-     * @param searchControls the search controls to get SearchScope for
-     * @return the SearchScope enumerated type for the SearchControls
+     * @param jndiScope the JNDI numeric value to get SearchScope for
+     * @return the SearchScope enumerated type for JNDI numeric value
      */
     public static SearchScope getSearchScope( int jndiScope )
     {
@@ -127,4 +127,33 @@
                 throw new IllegalArgumentException( "Unknown JNDI scope constant value: "
+ jndiScope );
         }
     }
+
+
+    /**
+     * Gets the SearchScope enumerated type for the corresponding 
+     * LDAP URL scope value of either base, one or sub.
+     *
+     * @param ldapUrlValue the LDAP URL scope value to get SearchScope for
+     * @return the SearchScope enumerated type for the LDAP URL scope value
+     */
+    public static SearchScope getSearchScope( String ldapUrlValue )
+    {
+        if ( "base".equalsIgnoreCase( ldapUrlValue ) )
+        {
+            return OBJECT;
+        }
+        else if ( "one".equalsIgnoreCase( ldapUrlValue ) )
+        {
+            return ONELEVEL;
+        }
+        else if ( "sub".equalsIgnoreCase( ldapUrlValue ) )
+        {
+            return SUBTREE;
+        }
+        else
+        {
+            throw new IllegalArgumentException( "Unknown LDAP URL scope value: " + ldapUrlValue
);
+        }
+    }
+
 }



Mime
View raw message