{
Index idx = db.getUserIndex( node.getAttribute() );
return idx.hasValue( node.getValue(), rec.getEntryId() );
}
Normalizer normalizer = getNormalizer( node.getAttribute() );
Comparator comparator = getComparator( node.getAttribute() );
/*
* Get the attribute and if it is not set in rec then resusitate it
* from the master table and set it in rec for use later if at all.
* Before iterating through all values for a match check to see if the
* AVA value is contained or the normalized form of the AVA value is
* contained.
*/
// resusitate entry if need be
if ( null == rec.getAttributes() )
{
rec.setAttributes( db.lookup( rec.getEntryId() ) );
}
// get the attribute associated with the node
Attribute attr = rec.getAttributes().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
if ( attr.contains( node.getValue() ) )
{
return true;
}
// get the normalized AVA filter value
Object filterValue = normalizer.normalize( node.getValue() );
// 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.
*/
NamingEnumeration list = attr.getAll();
while ( list.hasMore() )
{
Object value = normalizer.normalize( list.next() );
if ( 0 == comparator.compare( value, filterValue ) )
{
return true;
}