* Go through the set of attributes using each attribute value pair as
* an attribute value assertion within one big AND filter expression.
*/
javax.naming.directory.Attribute attr;
SimpleNode node;
BranchNode filter = new AndNode();
NamingEnumeration<? extends javax.naming.directory.Attribute> list = matchingAttributes.getAll();
// Loop through each attribute value pair
while ( list.hasMore() )
{
attr = list.next();
/*
* According to JNDI if an attribute in the matchingAttributes
* list does not have any values then we match for just the presence
* of the attribute in the entry
*/
if ( attr.size() == 0 )
{
filter.addNode( new PresenceNode( attr.getID() ) );
continue;
}
/*
* With 1 or more value we build a set of simple nodes and add them
* to the AND node - each attribute value pair is a simple Ava node.
*/
for ( int ii = 0; ii < attr.size(); ii++ )
{
Object val = attr.get( ii );
// Add simpel Ava node if its value is a String
if ( val instanceof String )
{
node = new EqualityNode<String>( attr.getID(), new org.apache.directory.shared.ldap.model.entry.StringValue( ( String ) val ) );
filter.addNode( node );
}
}
}
AliasDerefMode aliasDerefMode = AliasDerefMode.getEnum( getEnvironment() );