directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r379612 - /directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/SearchRequestImpl.java
Date Tue, 21 Feb 2006 23:01:53 GMT
Author: elecharny
Date: Tue Feb 21 15:01:43 2006
New Revision: 379612

URL: http://svn.apache.org/viewcvs?rev=379612&view=rev
Log:
Added a toString method, applying a mixed version of Norbert's
patch and Twix searchRequest toString() method.

Modified:
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/SearchRequestImpl.java

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/SearchRequestImpl.java
URL: http://svn.apache.org/viewcvs/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/SearchRequestImpl.java?rev=379612&r1=379611&r2=379612&view=diff
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/SearchRequestImpl.java
(original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/SearchRequestImpl.java
Tue Feb 21 15:01:43 2006
@@ -22,6 +22,7 @@
 import java.util.Collections;
 import java.util.Iterator;
 
+import org.apache.directory.shared.ldap.codec.LdapConstants;
 import org.apache.directory.shared.ldap.filter.BranchNormalizedVisitor;
 import org.apache.directory.shared.ldap.filter.ExprNode;
 
@@ -447,4 +448,117 @@
 
         return myFilterString.equals( reqFilterString );
     }
-}
+
+    /**
+     * Return a string the represent a SearchRequest
+     */
+    public String toString()
+    {
+        StringBuffer    sb = new StringBuffer();
+
+        sb.append( "    SearchRequest\n" );
+        sb.append( "        baseDn : '" ).append( baseDn ).append( "'\n" );
+        
+        if ( filter != null )
+        {
+            sb.append( "        filter : '" );
+            filter.printToBuffer( sb );
+            sb.append( "'\n" );
+        }
+        
+        sb.append( "        scope : " );
+        
+        switch ( scope.getValue() )
+        {
+            case LdapConstants.SCOPE_BASE_OBJECT:
+                sb.append( "base object" );
+                break;
+
+            case LdapConstants.SCOPE_SINGLE_LEVEL:
+                sb.append( "single level" );
+                break;
+
+            case LdapConstants.SCOPE_WHOLE_SUBTREE:
+                sb.append( "whole subtree" );
+                break;
+        }
+        
+        sb.append( '\n' );
+        
+        sb.append( "        typesOnly : " ).append( typesOnly ).append( '\n' );
+
+        if ( sizeLimit == 0 )
+        {
+            sb.append( "no limit" );
+        }
+        else
+        {
+            sb.append( sizeLimit );
+        }
+
+        sb.append( '\n' );
+
+        sb.append( "        Time Limit : " );
+
+        if ( timeLimit == 0 )
+        {
+            sb.append( "no limit" );
+        }
+        else
+        {
+            sb.append( timeLimit );
+        }
+
+        sb.append( '\n' );
+
+        sb.append( "        Deref Aliases : " );
+
+        switch ( derefAliases.getValue() )
+        {
+            case LdapConstants.NEVER_DEREF_ALIASES:
+                sb.append( "never Deref Aliases" );
+                break;
+
+            case LdapConstants.DEREF_IN_SEARCHING:
+                sb.append( "deref In Searching" );
+                break;
+
+            case LdapConstants.DEREF_FINDING_BASE_OBJ:
+                sb.append( "deref Finding Base Obj" );
+                break;
+
+            case LdapConstants.DEREF_ALWAYS:
+                sb.append( "deref Always" );
+                break;
+        }
+
+        sb.append( '\n' );
+        sb.append( "        attributes : " );
+
+        boolean         isFirst = true;
+
+        if ( attributes != null )
+        {
+            Iterator it = attributes.iterator();
+            
+            while ( it.hasNext() )
+            {
+                if ( isFirst )
+                {
+                    isFirst = false;
+                }
+                else
+                {
+                    sb.append( ", " );
+                }
+                
+                sb.append( '\'' ).append( (String)it.next() ).append( '\'' );
+            }
+            
+        }
+
+        sb.append( '\n' );
+
+        return sb.toString();
+    }
+}
\ No newline at end of file



Mime
View raw message