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 2006/08/27 10:14:50 UTC
svn commit: r437333 -
/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/TwixTransformer.java
Author: elecharny
Date: Sun Aug 27 01:14:49 2006
New Revision: 437333
URL: http://svn.apache.org/viewvc?rev=437333&view=rev
Log:
Last modification to make DIRSERVER-714 working : the value is not
transformed to a String, but to a String or byte[] depending
on the type (it can be binary)
Modified:
directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/TwixTransformer.java
Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/TwixTransformer.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/TwixTransformer.java?rev=437333&r1=437332&r2=437333&view=diff
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/TwixTransformer.java (original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/TwixTransformer.java Sun Aug 27 01:14:49 2006
@@ -464,23 +464,67 @@
switch ( ( ( AttributeValueAssertionFilter ) twixFilter ).getFilterType() )
{
case LdapConstants.EQUALITY_MATCH_FILTER:
- branch = new SimpleNode( ava.getAttributeDesc().toString(), ava.getAssertionValue()
- .toString(), AbstractExprNode.EQUALITY );
+ if ( ava.getAssertionValue() instanceof String )
+ {
+ branch = new SimpleNode( ava.getAttributeDesc().toString(),
+ (String)ava.getAssertionValue(),
+ AbstractExprNode.EQUALITY );
+ }
+ else
+ {
+ branch = new SimpleNode( ava.getAttributeDesc().toString(),
+ (byte[])ava.getAssertionValue(),
+ AbstractExprNode.EQUALITY );
+ }
+
break;
case LdapConstants.GREATER_OR_EQUAL_FILTER:
- branch = new SimpleNode( ava.getAttributeDesc().toString(), ava.getAssertionValue()
- .toString(), AbstractExprNode.GREATEREQ );
+ if ( ava.getAssertionValue() instanceof String )
+ {
+ branch = new SimpleNode( ava.getAttributeDesc().toString(),
+ (String)ava.getAssertionValue(),
+ AbstractExprNode.GREATEREQ );
+ }
+ else
+ {
+ branch = new SimpleNode( ava.getAttributeDesc().toString(),
+ (byte[])ava.getAssertionValue(),
+ AbstractExprNode.GREATEREQ );
+ }
+
break;
case LdapConstants.LESS_OR_EQUAL_FILTER:
- branch = new SimpleNode( ava.getAttributeDesc().toString(), ava.getAssertionValue()
- .toString(), AbstractExprNode.LESSEQ );
+ if ( ava.getAssertionValue() instanceof String )
+ {
+ branch = new SimpleNode( ava.getAttributeDesc().toString(),
+ (String)ava.getAssertionValue(),
+ AbstractExprNode.LESSEQ );
+ }
+ else
+ {
+ branch = new SimpleNode( ava.getAttributeDesc().toString(),
+ (byte[])ava.getAssertionValue(),
+ AbstractExprNode.LESSEQ );
+ }
+
break;
case LdapConstants.APPROX_MATCH_FILTER:
- branch = new SimpleNode( ava.getAttributeDesc().toString(), ava.getAssertionValue()
- .toString(), AbstractExprNode.APPROXIMATE );
+ if ( ava.getAssertionValue() instanceof String )
+ {
+ branch = new SimpleNode( ava.getAttributeDesc().toString(),
+ (String)ava.getAssertionValue(),
+ AbstractExprNode.APPROXIMATE );
+ }
+ else
+ {
+ branch = new SimpleNode( ava.getAttributeDesc().toString(),
+ (byte[])ava.getAssertionValue(),
+ AbstractExprNode.APPROXIMATE );
+ }
+
break;
}
@@ -521,7 +565,6 @@
// Transform Extensible Match Filter
ExtensibleMatchFilter filter = ( ExtensibleMatchFilter ) twixFilter;
String attribute = null;
- String value = null;
String matchingRule = null;
if ( filter.getType() != null )
@@ -529,17 +572,28 @@
attribute = filter.getType().toString();
}
- if ( filter.getMatchValue() != null )
- {
- value = filter.getMatchValue().toString();
- }
+ Object value = filter.getMatchValue();
if ( filter.getMatchingRule() != null )
{
matchingRule = filter.getMatchingRule().toString();
}
- branch = new ExtensibleNode( attribute, value, matchingRule, filter.isDnAttributes() );
+ if ( value instanceof String )
+ {
+ branch = new ExtensibleNode( attribute, (String)value, matchingRule, filter.isDnAttributes() );
+ }
+ else
+ {
+ if ( value != null )
+ {
+ branch = new ExtensibleNode( attribute, (byte[])value, matchingRule, filter.isDnAttributes() );
+ }
+ else
+ {
+ branch = new ExtensibleNode( attribute, (byte[])null, matchingRule, filter.isDnAttributes() );
+ }
+ }
}
return branch;