directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r224571 - /directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/pojo/AttributeValueAssertion.java
Date Sat, 23 Jul 2005 22:58:05 GMT
Author: elecharny
Date: Sat Jul 23 15:58:02 2005
New Revision: 224571

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

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

Modified: directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/pojo/AttributeValueAssertion.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/pojo/AttributeValueAssertion.java?rev=224571&r1=224570&r2=224571&view=diff
==============================================================================
--- directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/pojo/AttributeValueAssertion.java
(original)
+++ directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/pojo/AttributeValueAssertion.java
Sat Jul 23 15:58:02 2005
@@ -16,6 +16,7 @@
  */
 package org.apache.asn1.ldap.pojo;
 
+import org.apache.asn1.ldap.codec.LdapConstants;
 import org.apache.asn1.ldap.codec.primitives.LdapString;
 import org.apache.asn1.primitives.OctetString;
 
@@ -101,6 +102,44 @@
           .append( attributeDesc.toString() ).append( "'\n" );
         sb.append( tabs ).append( "    Assertion value : '" ).append( assertionValue.toString()
)
           .append( "'\n" );
+
+        return sb.toString();
+    }
+
+    /**
+     * Get a String representation of an AttributeValueAssertion,
+     * as of RFC 2254.
+     *
+     * @param filterType The filter type 
+     * @return An AttributeValueAssertion String 
+     */
+    public String toStringRFC2254( int filterType)
+    {
+
+        StringBuffer sb = new StringBuffer();
+
+        sb.append( attributeDesc.toString() );
+        
+        switch (filterType)
+        {
+        	case LdapConstants.EQUALITY_MATCH_FILTER :
+        	    sb.append( '=' );
+        		break;
+        		
+        	case LdapConstants.LESS_OR_EQUAL_FILTER :
+        	    sb.append( "<=" );
+        		break;
+        		
+        	case LdapConstants.GREATER_OR_EQUAL_FILTER :
+        	    sb.append( ">=" );
+        		break;
+        		
+        	case LdapConstants.APPROX_MATCH_FILTER :
+        	    sb.append( "~=" );
+        		break;
+        }
+        
+        sb.append( assertionValue.toString() );
 
         return sb.toString();
     }



Mime
View raw message