// We let other mechanisms filter out operational attributes.
// -----------------------------------------------------------
if ( ( ids == null ) || ( ids.length == 0 ) )
{
ServerEntry rootDSE = (ServerEntry)getRootDSE( null ).clone();
return new BaseEntryFilteringCursor( new SingletonCursor<ServerEntry>( rootDSE ), searchOperationContext );
}
// -----------------------------------------------------------
// Collect all the real attributes besides 1.1, +, and * and
// note if we've seen these special attributes as well.
// -----------------------------------------------------------
Set<String> realIds = new HashSet<String>();
boolean allUserAttributes = searchOperationContext.isAllUserAttributes();
boolean allOperationalAttributes = searchOperationContext.isAllOperationalAttributes();
boolean noAttribute = searchOperationContext.isNoAttributes();
for ( String id:ids )
{
String idTrimmed = id.trim();
try
{
realIds.add( schemaManager.getAttributeTypeRegistry().getOidByName( idTrimmed ) );
}
catch ( Exception e )
{
realIds.add( idTrimmed );
}
}
// return nothing
if ( noAttribute )
{
ServerEntry serverEntry = new DefaultServerEntry( schemaManager, DN.EMPTY_DN );
return new BaseEntryFilteringCursor( new SingletonCursor<ServerEntry>( serverEntry ), searchOperationContext );
}
// return everything
if ( allUserAttributes && allOperationalAttributes )
{
ServerEntry rootDSE = (ServerEntry)getRootDSE( null ).clone();
return new BaseEntryFilteringCursor( new SingletonCursor<ServerEntry>( rootDSE ), searchOperationContext );
}
ServerEntry serverEntry = new DefaultServerEntry( schemaManager, DN.EMPTY_DN );
ServerEntry rootDSE = getRootDSE( new GetRootDSEOperationContext( searchOperationContext.getSession() ) );
for ( EntryAttribute attribute:rootDSE )
{
AttributeType type = schemaManager.lookupAttributeTypeRegistry( attribute.getUpId() );
if ( realIds.contains( type.getOid() ) )
{
serverEntry.put( attribute );
}
else if ( allUserAttributes && ( type.getUsage() == UsageEnum.USER_APPLICATIONS ) )
{
serverEntry.put( attribute );
}
else if ( allOperationalAttributes && ( type.getUsage() != UsageEnum.USER_APPLICATIONS ) )
{
serverEntry.put( attribute );
}
}
return new BaseEntryFilteringCursor( new SingletonCursor<ServerEntry>( serverEntry ), searchOperationContext );
}