// TODO - determine if comaparator and index entry should have the Value
// wrapper or the raw normalized value
private boolean evaluateWithoutIndex( IndexEntry<String, ServerEntry, ID> indexEntry ) throws Exception
{
ServerEntry entry = indexEntry.getObject();
// resuscitate the entry if it has not been and set entry in IndexEntry
if ( null == entry )
{
entry = db.lookup( indexEntry.getId() );
indexEntry.setObject( entry );
}
/*
* Don't make a call here to evaluateWithoutIndex( ServerEntry ) for
* code reuse since we do want to set the value on the indexEntry on
* matches.
*/
// get the attribute
EntryAttribute attr = entry.get( type );
// if the attribute exists and the pattern matches return true
if ( attr != null )
{
/*
* Cycle through the attribute values testing normalized version
* obtained from using the substring matching rule's normalizer.
* The test uses the comparator obtained from the appropriate
* substring matching rule.
*/
for ( Value<?> value : attr )
{
value.normalize( normalizer );
String strValue = ( String ) value.getNormalizedValue();
// Once match is found cleanup and return true
if ( regex.matcher( strValue ).matches() )
{
// before returning we set the normalized value
indexEntry.setValue( strValue );
return true;
}
}
// Fall through as we didn't find any matching value for this attribute.
// We will have to check in the potential descendant, if any.
}
// If we do not have the attribute, loop through the descendant
// May be the node Attribute has descendant ?
if ( schemaManager.getAttributeTypeRegistry().hasDescendants( node.getAttribute() ) )
{
// TODO check to see if descendant handling is necessary for the
// index so we can match properly even when for example a name
// attribute is used instead of more specific commonName
Iterator<AttributeType> descendants = schemaManager.getAttributeTypeRegistry().descendants(
node.getAttribute() );
while ( descendants.hasNext() )
{
AttributeType descendant = descendants.next();
attr = entry.get( descendant );
if ( null != attr )
{
/*