directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r669072 - /directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/filter/SearchScope.java
Date Wed, 18 Jun 2008 03:42:55 GMT
Author: akarasulu
Date: Tue Jun 17 20:42:54 2008
New Revision: 669072

URL: http://svn.apache.org/viewvc?rev=669072&view=rev
Log:
added convenience method so we do not have to have a searchControl object to get scope from
a JNDI scope int constant value

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

Modified: directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/filter/SearchScope.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/filter/SearchScope.java?rev=669072&r1=669071&r2=669072&view=diff
==============================================================================
--- directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/filter/SearchScope.java
(original)
+++ directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/filter/SearchScope.java
Tue Jun 17 20:42:54 2008
@@ -80,21 +80,29 @@
      */
     public static SearchScope getSearchScope( SearchControls searchControls )
     {
-        SearchScope scope = OBJECT;
-        
-        switch( searchControls.getSearchScope() )
+        return getSearchScope( searchControls.getSearchScope() );
+    }
+    
+    
+    /**
+     * Gets the SearchScope enumerated type for the corresponding 
+     * SearchControls scope setting.
+     *
+     * @param searchControls the search controls to get SearchScope for
+     * @return the SearchScope enumerated type for the SearchControls
+     */
+    public static SearchScope getSearchScope( int jndiScope )
+    {
+        switch( jndiScope )
         {
             case( SearchControls.OBJECT_SCOPE ): 
-                scope = OBJECT;
-                break;
+                return OBJECT;
             case( SearchControls.ONELEVEL_SCOPE ):
-                scope = ONELEVEL;
-                break;
+                return ONELEVEL;
             case( SearchControls.SUBTREE_SCOPE ):
-                scope = SUBTREE;
-                break;
+                return SUBTREE;
+            default:
+                throw new IllegalArgumentException( "Unknown JNDI scope constant value: "
+ jndiScope );
         }
-        
-        return scope;
     }
 }



Mime
View raw message