directory-commits mailing list archives

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

URL: http://svn.apache.org/viewcvs?rev=224578&view=rev
Log:
- Added a toString() method
- The addFilter method now throws a DecoderException 

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

Modified: directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/pojo/filters/ConnectorFilter.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/pojo/filters/ConnectorFilter.java?rev=224578&r1=224577&r2=224578&view=diff
==============================================================================
--- directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/pojo/filters/ConnectorFilter.java
(original)
+++ directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/pojo/filters/ConnectorFilter.java
Sat Jul 23 16:04:21 2005
@@ -16,7 +16,10 @@
  */
 package org.apache.asn1.ldap.pojo.filters;
 
+import org.apache.asn1.DecoderException;
+
 import java.util.ArrayList;
+import java.util.Iterator;
 
 
 /**
@@ -47,7 +50,7 @@
      * Add a new Filter to the list.
      * @param filter The filter to add
      */
-    public void addFilter( Filter filter )
+    public void addFilter( Filter filter ) throws DecoderException
     {
 
         if ( this.filterSet == null )
@@ -56,5 +59,43 @@
         }
 
         this.filterSet.add( filter );
+    }
+
+    /**
+     * Get the list of filters stored in the composite filter
+     *
+     * @return And array of filters
+     */
+    public ArrayList getFilterSet()
+    {
+        return filterSet;
+    }
+
+    /**
+     * Return a string compliant with RFC 2254 representing a composite
+     * filter, one of AND, OR and NOT
+     *
+     * @return The composite filter string
+     */
+    public String toString()
+    {
+
+        StringBuffer sb = new StringBuffer();
+
+        if ( ( filterSet != null ) && ( filterSet.size() != 0 ) )
+        {
+
+            Iterator filterIterator = filterSet.iterator();
+
+            while ( filterIterator.hasNext() )
+            {
+
+                Filter filter = ( Filter ) filterIterator.next();
+
+                sb.append( '(' ).append( filter.toString() ).append( ')' );
+            }
+        }
+
+        return sb.toString();
     }
 }



Mime
View raw message