return;
}
for ( Value<?> value : collectiveExclusions )
{
AttributeType attrType = schemaManager.lookupAttributeTypeRegistry( value.getString() );
exclusions.add( attrType );
LOG.debug( "Adding {} in the list of excluded collectiveAttributes", attrType.getName() );
}
}
/*
* For each collective subentry referenced by the entry we lookup the
* attributes of the subentry and copy collective attributes from the
* subentry into the entry.
*/
for ( Value<?> value : collectiveAttributeSubentries )
{
String subentryDnStr = value.getString();
Dn subentryDn = dnFactory.create( subentryDnStr );
LOG.debug( "Applying subentries {}", subentryDn.getName() );
/*
* TODO - Instead of hitting disk here can't we leverage the
* SubentryService to get us cached sub-entries so we're not
* wasting time with a lookup here? It is ridiculous to waste
* time looking up this sub-entry.
*/
LookupOperationContext lookupContext = new LookupOperationContext( session, subentryDn,
SchemaConstants.ALL_ATTRIBUTES_ARRAY );
Entry subentry = directoryService.getPartitionNexus().lookup( lookupContext );
//LOG.debug( "Fetched the subentry : {}", subentry.getDn().getName() );
for ( Attribute attribute : subentry.getAttributes() )
{
AttributeType attributeType = attribute.getAttributeType();
// Skip the attributes which are not collective
if ( !attributeType.isCollective() )
{
//LOG.debug( "The {} subentry attribute is not collective", attributeType.getName() );
continue;
}
/*
* Skip the addition of this collective attribute if it is excluded
* in the 'collectiveAttributes' attribute.
*/
if ( exclusions.contains( attributeType ) )
{
LOG.debug( "The {} subentry attribute has been removed, it's in the exclusion list",
attributeType.getName() );
continue;
}
/*
* If not all attributes or this collective attribute requested specifically
* then bypass the inclusion process.
*/
if ( !opContext.isAllUserAttributes() && !opContext.contains( schemaManager, attributeType ) )
{
LOG.debug( "The {} subentry attribute is not in the list of attributes to return",
attributeType.getName() );
continue;
}
Attribute subentryColAttr = subentry.get( attributeType );
Attribute entryColAttr = entry.get( attributeType );