Package org.apache.directory.server.core.filtering

Examples of org.apache.directory.server.core.filtering.BaseEntryFilteringCursor


            opContext.getDn(),
            opContext.getAliasDerefMode(),
            opContext.getFilter(),
            searchCtls );

        return new BaseEntryFilteringCursor( new ServerEntryCursorAdaptor( this, underlying ), opContext );
    }
View Full Code Here


                {
                    objectClassOid = registries.getObjectClassRegistry().lookup( objectClass ).getOid();
                }
                else
                {
                    return new BaseEntryFilteringCursor( new EmptyCursor<ServerEntry>(), opContext );
                }

                String nodeOid = registries.getOidRegistry().getOid( node.getAttribute() );

                // see if node attribute is objectClass
                if ( nodeOid.equals( SchemaConstants.OBJECT_CLASS_AT_OID )
                    && ( objectClassOid.equals( SchemaConstants.TOP_OC_OID ) || objectClassOid
                        .equals( SchemaConstants.SUBSCHEMA_OC_OID ) ) && ( node instanceof EqualityNode ) )
                {
                    // call.setBypass( true );
                    ServerEntry serverEntry = schemaService.getSubschemaEntry( searchCtls.getReturningAttributes() );
                    serverEntry.setDn( base );
                    return new BaseEntryFilteringCursor( new SingletonCursor<ServerEntry>( serverEntry ), opContext );
                }
                else
                {
                    return new BaseEntryFilteringCursor( new EmptyCursor<ServerEntry>(), opContext );
                }
            }
            else if ( filter instanceof PresenceNode )
            {
                PresenceNode node = ( PresenceNode ) filter;

                // see if node attribute is objectClass
                if ( node.getAttribute().equals( SchemaConstants.OBJECT_CLASS_AT_OID ) )
                {
                    // call.setBypass( true );
                    ServerEntry serverEntry = schemaService.getSubschemaEntry( searchCtls.getReturningAttributes() );
                    serverEntry.setDn( base );
                    EntryFilteringCursor cursor = new BaseEntryFilteringCursor( new SingletonCursor<ServerEntry>(
                        serverEntry ), opContext );
                    return cursor;
                }
            }
        }

        // In any case not handled previously, just return an empty result
        return new BaseEntryFilteringCursor( new EmptyCursor<ServerEntry>(), opContext );
    }
View Full Code Here

        ExprNode result = ( ExprNode ) filter.accept( normVisitor );

        if ( result == null )
        {
            LOG.warn( "undefined filter based on undefined attributeType not evaluted at all.  Returning empty enumeration." );
            return new BaseEntryFilteringCursor( new EmptyCursor<ServerEntry>(), opContext );
        }
        else
        {
            opContext.setFilter( result );
           
View Full Code Here


        public EntryFilteringCursor search( SearchOperationContext opContext )
            throws NamingException
        {
            return new BaseEntryFilteringCursor( new BogusCursor( count ), opContext );
        }
View Full Code Here

        }


        public EntryFilteringCursor search( SearchOperationContext opContext, Collection<String> bypass ) throws NamingException
        {
            return new BaseEntryFilteringCursor( new BogusCursor( count ), opContext );
        }
View Full Code Here

        {
        }

        public EntryFilteringCursor search( SearchOperationContext opContext ) throws Exception
        {
            return new BaseEntryFilteringCursor( new BogusCursor( count ), opContext );
        }
View Full Code Here

                // 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 ), opContext );
                }
               
                // -----------------------------------------------------------
                // 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 containsAsterisk = false;
                boolean containsPlus = false;
                boolean containsOneDotOne = false;
               
                for ( String id:ids )
                {
                    String idTrimmed = id.trim();
                   
                    if ( idTrimmed.equals( SchemaConstants.ALL_USER_ATTRIBUTES ) )
                    {
                        containsAsterisk = true;
                    }
                    else if ( idTrimmed.equals( SchemaConstants.ALL_OPERATIONAL_ATTRIBUTES ) )
                    {
                        containsPlus = true;
                    }
                    else if ( idTrimmed.equals( SchemaConstants.NO_ATTRIBUTE ) )
                    {
                        containsOneDotOne = true;
                    }
                    else
                    {
                        try
                        {
                            realIds.add( oidRegistry.getOid( idTrimmed ) );
                        }
                        catch ( Exception e )
                        {
                            realIds.add( idTrimmed );
                        }
                    }
                }

                // return nothing
                if ( containsOneDotOne )
                {
                    ServerEntry serverEntry = new DefaultServerEntry( registries, base );
                    return new BaseEntryFilteringCursor( new SingletonCursor<ServerEntry>( serverEntry ), opContext );
                }
               
                // return everything
                if ( containsAsterisk && containsPlus )
                {
                    ServerEntry rootDSE = (ServerEntry)getRootDSE( null ).clone();
                    return new BaseEntryFilteringCursor( new SingletonCursor<ServerEntry>( rootDSE ), opContext );
                }
               
                ServerEntry serverEntry = new DefaultServerEntry( registries, opContext.getDn() );
               
                ServerEntry rootDSE = getRootDSE( new GetRootDSEOperationContext( opContext.getSession() ) );
               
                for ( EntryAttribute attribute:rootDSE )
                {
                    AttributeType type = atRegistry.lookup( attribute.getUpId() );
                   
                    if ( realIds.contains( type.getOid() ) )
                    {
                        serverEntry.put( attribute );
                    }
                    else if ( containsAsterisk && ( type.getUsage() == UsageEnum.USER_APPLICATIONS ) )
                    {
                        serverEntry.put( attribute );
                    }
                    else if ( containsPlus && ( type.getUsage() != UsageEnum.USER_APPLICATIONS ) )
                    {
                        serverEntry.put( attribute );
                    }
                }

                return new BaseEntryFilteringCursor( new SingletonCursor<ServerEntry>( serverEntry ), opContext );
            }

            // TODO : handle searches based on the RootDSE
            throw new LdapNameNotFoundException();
        }
View Full Code Here

                {
                    objectClassOid = schemaManager.getObjectClassRegistry().lookup( objectClass ).getOid();
                }
                else
                {
                    return new BaseEntryFilteringCursor( new EmptyCursor<Entry>(), searchContext );
                }

                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( searchCtls.getReturningAttributes() );
                    serverEntry.setDn( base );
                    return new BaseEntryFilteringCursor( new SingletonCursor<Entry>( serverEntry ), searchContext );
                }
                else
                {
                    return new BaseEntryFilteringCursor( new EmptyCursor<Entry>(), searchContext );
                }
            }
            else if ( filter instanceof PresenceNode )
            {
                PresenceNode node = ( PresenceNode ) filter;

                // see if node attribute is objectClass
                if ( node.getAttributeType().equals( OBJECT_CLASS_AT ) )
                {
                    // call.setBypass( true );
                    Entry serverEntry = schemaService.getSubschemaEntry( searchCtls.getReturningAttributes() );
                    serverEntry.setDn( base );
                    EntryFilteringCursor cursor = new BaseEntryFilteringCursor(
                        new SingletonCursor<Entry>( serverEntry ), searchContext );
                    return cursor;
                }
            }
        }

        // In any case not handled previously, just return an empty result
        return new BaseEntryFilteringCursor( new EmptyCursor<Entry>(), searchContext );
    }
View Full Code Here

        throws LdapException
    {
        if ( listContext.getDn().getNormName().equals( subschemSubentryDn.getNormName() ) )
        {
            // there is nothing under the schema subentry
            return new BaseEntryFilteringCursor( new EmptyCursor<Entry>(), listContext );
        }

        // check if entry to search exists
        String msg = "Attempt to search under non-existant entry: ";
        assertHasEntry( listContext, msg, listContext.getDn() );
View Full Code Here

    public abstract void modify( ModifyOperationContext modifyContext ) throws LdapException;


    public EntryFilteringCursor list( ListOperationContext listContext ) throws LdapException
    {
        return new BaseEntryFilteringCursor( new ServerEntryCursorAdaptor<ID>( this, list( getEntryId( listContext
            .getDn() ) ) ), listContext );
    }
View Full Code Here

TOP

Related Classes of org.apache.directory.server.core.filtering.BaseEntryFilteringCursor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.