You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2015/09/10 23:01:32 UTC

svn commit: r1702318 - /directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/message/SearchScope.java

Author: elecharny
Date: Thu Sep 10 21:01:32 2015
New Revision: 1702318

URL: http://svn.apache.org/r1702318
Log:
Added the getScope(String) that returns the instance of SearchScope associated with the String parameter

Modified:
    directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/message/SearchScope.java

Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/message/SearchScope.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/message/SearchScope.java?rev=1702318&r1=1702317&r2=1702318&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/message/SearchScope.java (original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/message/SearchScope.java Thu Sep 10 21:01:32 2015
@@ -114,6 +114,32 @@ public enum SearchScope
 
 
     /**
+     * Gets the SeacrhScope associated with a scope String
+     * 
+     * @return the scope
+     */
+    public SearchScope getScope( String scope )
+    {
+        if ( "base".equalsIgnoreCase( scope ) )
+        {
+            return OBJECT;
+        }
+        else if ( "one".equalsIgnoreCase( scope ) )
+        {
+            return ONELEVEL;
+        }
+        else if ( "sub".equalsIgnoreCase( scope ) )
+        {
+            return SUBTREE;
+        }
+        else
+        {
+            throw new IllegalArgumentException( I18n.err( I18n.ERR_04161, scope ) );
+        }
+    }
+
+
+    /**
      * Gets the SearchScope enumerated type for the corresponding 
      * scope value of either base, one or sub.
      *