exclusions = new HashSet<String>();
for ( Value<?> value:collectiveExclusions )
{
AttributeType attrType = schemaManager.lookupAttributeTypeRegistry( value.getString() );
exclusions.add( attrType.getOid() );
}
}
/*
* If no attributes are requested specifically
* then it means all user attributes are requested.
* So populate the array with all user attributes indicator: "*".
*/
if ( retAttrs == null )
{
retAttrs = SchemaConstants.ALL_USER_ATTRIBUTES_ARRAY;
}
/*
* Construct a set of requested attributes for easier tracking.
*/
Set<String> retIdsSet = new HashSet<String>( retAttrs.length );
for ( String retAttr:retAttrs )
{
if ( retAttr.equals( SchemaConstants.ALL_USER_ATTRIBUTES ) ||
retAttr.equals( SchemaConstants.ALL_OPERATIONAL_ATTRIBUTES ) )
{
retIdsSet.add( retAttr );
}
else
{
retIdsSet.add( schemaManager.lookupAttributeTypeRegistry( retAttr ).getOid() );
}
}
/*
* 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 = new DN( subentryDnStr );
/*
* 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.
*/
ServerEntry subentry = opContext.lookup( subentryDn, ByPassConstants.LOOKUP_COLLECTIVE_BYPASS );
for ( AttributeType attributeType:subentry.getAttributeTypes() )
{
String attrId = attributeType.getName();
if ( !attributeType.isCollective() )
{
continue;
}
/*
* Skip the addition of this collective attribute if it is excluded
* in the 'collectiveAttributes' attribute.
*/
if ( exclusions.contains( attributeType.getOid() ) )
{
continue;
}
Set<AttributeType> allSuperTypes = getAllSuperTypes( attributeType );
for ( String retId : retIdsSet )
{
if ( retId.equals( SchemaConstants.ALL_USER_ATTRIBUTES ) || retId.equals( SchemaConstants.ALL_OPERATIONAL_ATTRIBUTES ) )
{
continue;
}
AttributeType retType = schemaManager.lookupAttributeTypeRegistry( retId );
if ( allSuperTypes.contains( retType ) )
{
retIdsSet.add( schemaManager.lookupAttributeTypeRegistry( attrId ).getOid() );
break;