String baseNormForm = ( base.isSchemaAware() ? base.getNormName() : base.getNormName() );
// Deal with the normal case : searching for a normal value (not subSchemaSubEntry)
if ( !subschemaSubentryDnNorm.equals( baseNormForm ) )
{
EntryFilteringCursor cursor = next( searchContext );
if ( searchContext.getReturningAttributesString() != null )
{
cursor.addEntryFilter( topFilter );
return cursor;
}
for ( EntryFilter ef : filters )
{
cursor.addEntryFilter( ef );
}
return cursor;
}
// The user was searching into the subSchemaSubEntry
// This kind of search _must_ be limited to OBJECT scope (the subSchemaSubEntry
// does not have any sub level)
if ( searchContext.getScope() == SearchScope.OBJECT )
{
// The filter can be an equality or (ObjectClass=*) but nothing else
if ( filter instanceof SimpleNode )
{
// We should get the value for the filter.
// only 'top' and 'subSchema' are valid values
SimpleNode node = ( SimpleNode ) filter;
String objectClass;
objectClass = node.getValue().getString();
String objectClassOid = null;
if ( schemaManager.getObjectClassRegistry().contains( objectClass ) )
{
objectClassOid = schemaManager.lookupObjectClassRegistry( objectClass ).getOid();
}
else
{
return new EntryFilteringCursorImpl( new EmptyCursor<Entry>(), searchContext, schemaManager );
}
AttributeType nodeAt = node.getAttributeType();
// see if node attribute is objectClass
if ( nodeAt.equals( OBJECT_CLASS_AT )
&& ( objectClassOid.equals( SchemaConstants.TOP_OC_OID ) || objectClassOid
.equals( SchemaConstants.SUBSCHEMA_OC_OID ) ) && ( node instanceof EqualityNode ) )
{
// call.setBypass( true );
Entry serverEntry = SchemaService.getSubschemaEntry( directoryService,
searchContext );
serverEntry.setDn( base );
return new EntryFilteringCursorImpl( new SingletonCursor<Entry>( serverEntry ), searchContext,
schemaManager );
}
else
{
return new EntryFilteringCursorImpl( new EmptyCursor<Entry>(), searchContext, schemaManager );
}
}
else if ( filter instanceof ObjectClassNode )
{
// This is (ObjectClass=*)
Entry serverEntry = SchemaService.getSubschemaEntry( directoryService,
searchContext );
serverEntry.setDn( base );
EntryFilteringCursor cursor = new EntryFilteringCursorImpl(
new SingletonCursor<Entry>( serverEntry ), searchContext, schemaManager );
return cursor;
}
}