Examples of ScopeNode


Examples of org.apache.directory.shared.ldap.filter.ScopeNode

    /**
     * @see Evaluator#evaluate(ExprNode , String, ServerEntry)
     */
    public boolean evaluate( ExprNode node, String dn, ServerEntry record ) throws LdapException
    {
        ScopeNode snode = ( ScopeNode ) node;

        switch ( snode.getScope() )
        {
            case OBJECT:
                return dn.equals( snode.getBaseDn() );
           
            case ONELEVEL:
                if ( dn.endsWith( snode.getBaseDn() ) )
                {
                    DN candidateDn = new DN( dn );
                    DN scopeDn = new DN( snode.getBaseDn() );
                    return ( scopeDn.size() + 1 ) == candidateDn.size();
                }
           
            case SUBTREE:
                return dn.endsWith( snode.getBaseDn() );
           
            default:
                throw new LdapInvalidSearchFilterException( I18n.err( I18n.ERR_247 ) );
        }
    }
View Full Code Here

Examples of org.apache.directory.shared.ldap.filter.ScopeNode

    /**
     * @see Evaluator#evaluate(ExprNode , String, ServerEntry)
     */
    public boolean evaluate( ExprNode node, String dn, ServerEntry record ) throws NamingException
    {
        ScopeNode snode = ( ScopeNode ) node;

        switch ( snode.getScope() )
        {
            case OBJECT:
                return dn.equals( snode.getBaseDn() );
           
            case ONELEVEL:
                if ( dn.endsWith( snode.getBaseDn() ) )
                {
                    LdapDN candidateDn = new LdapDN( dn );
                    LdapDN scopeDn = new LdapDN( snode.getBaseDn() );
                    return ( scopeDn.size() + 1 ) == candidateDn.size();
                }
           
            case SUBTREE:
                return dn.endsWith( snode.getBaseDn() );
           
            default:
                throw new NamingException( "Unrecognized search scope!" );
        }
    }
View Full Code Here

Examples of org.apache.directory.shared.ldap.filter.ScopeNode


    @Test
    public void testCursorNoDeref() throws Exception
    {
        ScopeNode node = new ScopeNode( AliasDerefMode.NEVER_DEREF_ALIASES, SchemaConstants.OU_AT_OID + "=sales,"
            + SchemaConstants.O_AT_OID + "=good times co.", SearchScope.ONELEVEL );
        OneLevelScopeEvaluator<ServerEntry, Long> evaluator = new OneLevelScopeEvaluator<ServerEntry, Long>( store,
            node );
        OneLevelScopeCursor<Long> cursor = new OneLevelScopeCursor<Long>( store, evaluator );
View Full Code Here

Examples of org.apache.directory.shared.ldap.filter.ScopeNode


    @Test
    public void testCursorNoDerefReturnAliases() throws Exception
    {
        ScopeNode node = new ScopeNode( AliasDerefMode.NEVER_DEREF_ALIASES, SchemaConstants.OU_AT_OID + "=engineering,"
            + SchemaConstants.O_AT_OID + "=good times co.", SearchScope.ONELEVEL );
        OneLevelScopeEvaluator<ServerEntry, Long> evaluator = new OneLevelScopeEvaluator<ServerEntry, Long>( store,
            node );
        OneLevelScopeCursor<Long> cursor = new OneLevelScopeCursor<Long>( store, evaluator );
View Full Code Here

Examples of org.apache.directory.shared.ldap.filter.ScopeNode


    @Test
    public void testCursorWithDereferencing() throws Exception
    {
        ScopeNode node = new ScopeNode( AliasDerefMode.DEREF_IN_SEARCHING, SchemaConstants.OU_AT_OID
            + "=board of directors," + SchemaConstants.O_AT_OID + "=good times co.", SearchScope.ONELEVEL );
        OneLevelScopeEvaluator<ServerEntry, Long> evaluator = new OneLevelScopeEvaluator<ServerEntry, Long>( store,
            node );
        OneLevelScopeCursor<Long> cursor = new OneLevelScopeCursor<Long>( store, evaluator );
View Full Code Here

Examples of org.apache.directory.shared.ldap.filter.ScopeNode


    @Test
    public void testCursorWithDereferencing2() throws Exception
    {
        ScopeNode node = new ScopeNode( AliasDerefMode.DEREF_IN_SEARCHING, SchemaConstants.OU_AT_OID + "=apache,"
            + SchemaConstants.OU_AT_OID + "=board of directors," + SchemaConstants.O_AT_OID + "=good times co.",
            SearchScope.ONELEVEL );
        OneLevelScopeEvaluator<ServerEntry, Long> evaluator = new OneLevelScopeEvaluator<ServerEntry, Long>( store,
            node );
        OneLevelScopeCursor<Long> cursor = new OneLevelScopeCursor<Long>( store, evaluator );
View Full Code Here

Examples of org.apache.directory.shared.ldap.filter.ScopeNode

        attrs.add( "sn", "doe" );
        attrs.add( "entryCSN", new CsnFactory( 1 ).newInstance().toString() );
        attrs.add( "entryUUID", UUID.randomUUID().toString() );
        store.add( attrs );

        ScopeNode node = new ScopeNode( AliasDerefMode.DEREF_IN_SEARCHING, SchemaConstants.OU_AT_OID
            + "=board of directors," + SchemaConstants.O_AT_OID + "=good times co.", SearchScope.ONELEVEL );
        OneLevelScopeEvaluator<ServerEntry, Long> evaluator = new OneLevelScopeEvaluator<ServerEntry, Long>( store,
            node );
        OneLevelScopeCursor<Long> cursor = new OneLevelScopeCursor<Long>( store, evaluator );
View Full Code Here

Examples of org.apache.directory.shared.ldap.filter.ScopeNode


    @Test
    public void testEvaluatorNoDereferencing() throws Exception
    {
        ScopeNode node = new ScopeNode( AliasDerefMode.NEVER_DEREF_ALIASES, SchemaConstants.OU_AT_OID + "=sales,"
            + SchemaConstants.O_AT_OID + "=good times co.", SearchScope.ONELEVEL );
        OneLevelScopeEvaluator<ServerEntry, Long> evaluator = new OneLevelScopeEvaluator<ServerEntry, Long>( store,
            node );

        ForwardIndexEntry<Long, ServerEntry, Long> indexEntry = new ForwardIndexEntry<Long, ServerEntry, Long>();
View Full Code Here

Examples of org.apache.directory.shared.ldap.filter.ScopeNode


    @Test
    public void testEvaluatorWithDereferencing() throws Exception
    {
        ScopeNode node = new ScopeNode( AliasDerefMode.DEREF_ALWAYS, SchemaConstants.OU_AT_OID + "=engineering,"
            + SchemaConstants.O_AT_OID + "=good times co.", SearchScope.ONELEVEL );
        OneLevelScopeEvaluator<ServerEntry, Long> evaluator = new OneLevelScopeEvaluator<ServerEntry, Long>( store,
            node );
        assertEquals( node, evaluator.getExpression() );
View Full Code Here

Examples of org.apache.directory.shared.ldap.filter.ScopeNode


    @Test(expected = InvalidCursorPositionException.class)
    public void testInvalidCursorPositionException() throws Exception
    {
        ScopeNode node = new ScopeNode( AliasDerefMode.NEVER_DEREF_ALIASES, SchemaConstants.OU_AT_OID + "=sales,"
            + SchemaConstants.O_AT_OID + "=good times co.", SearchScope.ONELEVEL );
        OneLevelScopeEvaluator<ServerEntry, Long> evaluator = new OneLevelScopeEvaluator<ServerEntry, Long>( store,
            node );
        OneLevelScopeCursor cursor = new OneLevelScopeCursor( store, evaluator );
        cursor.get();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.