* @throws javax.naming.NamingException if there is a database access failure
*/
@SuppressWarnings("unchecked")
private boolean evalEquality( EqualityNode<?> node, ServerEntry entry ) throws NamingException
{
Normalizer normalizer = getNormalizer( node.getAttribute() );
Comparator comparator = getComparator( node.getAttribute() );
// get the attribute associated with the node
EntryAttribute attr = entry.get( node.getAttribute() );
// If we do not have the attribute just return false
if ( null == attr )
{
return false;
}
// check if AVA value exists in attribute
AttributeType at = schemaManager.lookupAttributeTypeRegistry( node.getAttribute() );
Value<?> value = null;
if ( at.getSyntax().isHumanReadable() )
{
if ( node.getValue().isBinary() )
{
value = new ClientStringValue( node.getValue().getString() );
}
else
{
value = node.getValue();
}
}
else
{
value = node.getValue();
}
if ( attr.contains( value ) )
{
return true;
}
// get the normalized AVA filter value
Value<?> filterValue = normalizer.normalize( value );
// check if the normalized value is present
if ( attr.contains( filterValue ) )
{
return true;
}
/*
* We need to now iterate through all values because we could not get
* a lookup to work. For each value we normalize and use the comparator
* to determine if a match exists.
*/
for ( Value<?> val : attr )
{
Value<?> normValue = normalizer.normalize( val );
if ( 0 == comparator.compare( normValue.get(), filterValue.get() ) )
{
return true;
}