directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r224579 - /directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/pojo/SearchRequest.java
Date Sat, 23 Jul 2005 23:04:46 GMT
Author: elecharny
Date: Sat Jul 23 16:04:44 2005
New Revision: 224579

URL: http://svn.apache.org/viewcvs?rev=224579&view=rev
Log:
- Added a toString() method

Modified:
    directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/pojo/SearchRequest.java

Modified: directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/pojo/SearchRequest.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/pojo/SearchRequest.java?rev=224579&r1=224578&r2=224579&view=diff
==============================================================================
--- directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/pojo/SearchRequest.java
(original)
+++ directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/pojo/SearchRequest.java
Sat Jul 23 16:04:44 2005
@@ -17,9 +17,15 @@
 package org.apache.asn1.ldap.pojo;
 
 import org.apache.asn1.Asn1Object;
+import org.apache.asn1.ldap.codec.LdapConstants;
 import org.apache.asn1.ldap.codec.primitives.LdapDN;
 import org.apache.asn1.ldap.codec.primitives.LdapString;
+import org.apache.asn1.ldap.pojo.filters.AttributeValueAssertionFilter;
+import org.apache.asn1.ldap.pojo.filters.ConnectorFilter;
+import org.apache.asn1.ldap.pojo.filters.ExtensibleMatchFilter;
 import org.apache.asn1.ldap.pojo.filters.Filter;
+import org.apache.asn1.ldap.pojo.filters.PresentFilter;
+import org.apache.asn1.ldap.pojo.filters.SubstringFilter;
 
 import java.util.ArrayList;
 
@@ -267,5 +273,103 @@
     public void setCurrentFilter( Filter currentFilter )
     {
         this.currentFilter = currentFilter;
+    }
+    
+    private String buildFilter()
+    {
+        if (filter == null)
+        {
+            return "";
+        }
+        
+        StringBuffer sb = new StringBuffer();
+        
+        sb.append("(");
+
+        sb.append( filter.toString() );
+        
+        sb.append(")");
+        
+        return sb.toString();
+    }
+    
+    public String toString()
+    {
+        StringBuffer sb = new StringBuffer();
+        
+        sb.append( "    Search Request\n" );
+        sb.append( "        Base Object : '" ).append( baseObject ).append( "'\n" );
+        sb.append( "        Scope : " );
+        
+        switch (scope)
+        {
+        	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( "        Deref Aliases : " );
+        
+        switch (derefAliases)
+        {
+    		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( "        Size Limit : " );
+        
+        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( "        Types Only : " ).append( typesOnly ).append( "\n" );
+        sb.append( "        Filter : '" ).append( buildFilter() ).append( "'\n" );
+        
+        return sb.toString();
     }
 }



Mime
View raw message