Package org.apache.ldap.common.filter

Examples of org.apache.ldap.common.filter.SimpleNode


        {
        }

        try
        {
            assertFalse( evaluator.evaluate( new SimpleNode( "", "", LeafNode.GREATEREQ ), objectClasses ) );
            fail( "should never get here due to an NE" );
        }
        catch ( NamingException ne )
        {
        }

        try
        {
            assertFalse( evaluator.evaluate( new SimpleNode( "", "", LeafNode.EQUALITY ), objectClasses ) );
            fail( "should never get here due to an NE" );
        }
        catch ( NamingException ne )
        {
        }

        try
        {
            assertFalse( evaluator.evaluate( new SimpleNode( "objectClass", "", LeafNode.EQUALITY ), objectClasses ) );
            fail( "should never get here due to an IAE" );
        }
        catch ( IllegalArgumentException iae )
        {
        }

        try
        {
            objectClasses = new BasicAttribute( "incorrectAttrId" );
            assertFalse( evaluator.evaluate( new SimpleNode( "objectClass", "", LeafNode.EQUALITY ), objectClasses ) );
            fail( "should never get here due to an IAE" );
        }
        catch ( IllegalArgumentException iae )
        {
        }
View Full Code Here


    {
        BasicAttribute objectClasses = null;

        // positive test
        objectClasses = new BasicAttribute( "objectClass", "person" );
        assertTrue( evaluator.evaluate( new SimpleNode( "objectClass", "person", LeafNode.EQUALITY ),
                objectClasses ) );

        objectClasses = new BasicAttribute( "objectClass" );
        objectClasses.add( "person" );
        objectClasses.add( "blah" );
        assertTrue( evaluator.evaluate( new SimpleNode( "objectClass", "person", LeafNode.EQUALITY ),
                objectClasses ) );

        // negative tests
        objectClasses = new BasicAttribute( "objectClass", "person" );
        assertFalse( evaluator.evaluate( new SimpleNode( "objectClass", "blah", LeafNode.EQUALITY ),
                objectClasses ) );

        objectClasses = new BasicAttribute( "objectClass", "blah" );
        assertFalse( evaluator.evaluate( new SimpleNode( "objectClass", "person", LeafNode.EQUALITY ),
                objectClasses ) );
    }
View Full Code Here

    {
        BasicAttribute objectClasses = null;

        // positive test
        objectClasses = new BasicAttribute( "objectClass", "person" );
        assertTrue( evaluator.evaluate( new SimpleNode( "objectClass", "2.5.6.6", LeafNode.EQUALITY ),
                objectClasses ) );

        objectClasses = new BasicAttribute( "objectClass" );
        objectClasses.add( "person" );
        objectClasses.add( "blah" );
        assertTrue( evaluator.evaluate( new SimpleNode( "objectClass", "2.5.6.6", LeafNode.EQUALITY ),
                objectClasses ) );

        // negative tests
        objectClasses = new BasicAttribute( "objectClass", "person" );
        assertFalse( evaluator.evaluate( new SimpleNode( "objectClass", "2.5.6.5", LeafNode.EQUALITY ),
                objectClasses ) );

        objectClasses = new BasicAttribute( "objectClass", "blah" );
        assertFalse( evaluator.evaluate( new SimpleNode( "objectClass", "2.5.6.5", LeafNode.EQUALITY ),
                objectClasses ) );
    }
View Full Code Here

        SearchControls searchControls = call.getControls();
        ExprNode filter = call.getFilter();
        if ( searchControls.getSearchScope() == SearchControls.OBJECT_SCOPE &&
                filter instanceof SimpleNode )
        {
            SimpleNode node = ( SimpleNode ) filter;

            if ( node.getAttribute().equalsIgnoreCase( "objectClass" ) &&
                    node.getValue().equalsIgnoreCase( "subschema" ) &&
                    node.getAssertionType() == SimpleNode.EQUALITY
            )
            {
                // call.setBypass( true );
                Attributes attrs = getSubschemaEntry( searchControls.getReturningAttributes() );
                SearchResult result = new SearchResult( call.getBaseName().toString(), null, attrs );
                SingletonEnumeration e = new SingletonEnumeration( result );
                call.setReturnValue( e );
                bypass = true;
            }
        }
        else if ( searchControls.getSearchScope() == SearchControls.OBJECT_SCOPE &&
                filter instanceof PresenceNode )
        {
            PresenceNode node = ( PresenceNode ) filter;

            if ( node.getAttribute().equalsIgnoreCase( "objectClass" ) )
            {
                // call.setBypass( true );
                Attributes attrs = getSubschemaEntry( searchControls.getReturningAttributes() );
                SearchResult result = new SearchResult( call.getBaseName().toString(), null, attrs );
                SingletonEnumeration e = new SingletonEnumeration( result );
View Full Code Here

        /*
         * Go through the set of attributes using each attribute value pair as
         * an attribute value assertion within one big AND filter expression.
         */
        Attribute attr;
        SimpleNode node;
        BranchNode filter = new BranchNode( BranchNode.AND );
        NamingEnumeration list = matchingAttributes.getAll();

        // Loop through each attribute value pair
        while ( list.hasMore() )
        {
            attr = ( Attribute ) list.next();
           
            /*
             * According to JNDI if an attribute in the matchingAttributes
             * list does not have any values then we match for just the presence
             * of the attribute in the entry
             */
            if ( attr.size() == 0 )
            {
                filter.addNode( new PresenceNode( attr.getID() ) );

                continue;
            }
           
            /*
             * With 1 or more value we build a set of simple nodes and add them
             * to the AND node - each attribute value pair is a simple AVA node.
             */
            for ( int ii = 0; ii < attr.size(); ii++ )
            {
                Object val = attr.get( ii );
               
                // Add simpel AVA node if its value is a String
                if ( val instanceof String )
                {
                    node = new SimpleNode( attr.getID(), ( String ) val, SimpleNode.EQUALITY );

                    filter.addNode( node );
                }
            }
        }
View Full Code Here

        Iterator suffixes = nexus.listSuffixes( true );
        while ( suffixes.hasNext() )
        {
            String suffix = ( String ) suffixes.next();
            Name baseDn = new LdapName( suffix );
            ExprNode filter = new SimpleNode( OC_ATTR, ACSUBENTRY_OC, SimpleNode.EQUALITY );
            SearchControls ctls = new SearchControls();
            ctls.setSearchScope( SearchControls.SUBTREE_SCOPE );
            NamingEnumeration results = nexus.search( baseDn, env, filter, ctls );
            while ( results.hasMore() )
            {
View Full Code Here

    {
        // search all naming contexts for static groups and generate
        // normalized sets of members to cache within the map

        BranchNode filter = new BranchNode( BranchNode.OR );
        filter.addNode( new SimpleNode( OC_ATTR, GROUPOFNAMES_OC, SimpleNode.EQUALITY ) );
        filter.addNode( new SimpleNode( OC_ATTR, GROUPOFUNIQUENAMES_OC, SimpleNode.EQUALITY ) );

        Iterator suffixes = nexus.listSuffixes( true );
        while ( suffixes.hasNext() )
        {
            String suffix = ( String ) suffixes.next();
View Full Code Here

        }

        if ( searchCtls.getSearchScope() == SearchControls.OBJECT_SCOPE &&
                filter instanceof SimpleNode )
        {
            SimpleNode node = ( SimpleNode ) filter;

            if ( node.getAttribute().equalsIgnoreCase( "objectClass" ) &&
                    node.getValue().equalsIgnoreCase( "subschema" ) &&
                    node.getAssertionType() == SimpleNode.EQUALITY
            )
            {
                // call.setBypass( true );
                Attributes attrs = getSubschemaEntry( searchCtls.getReturningAttributes() );
                SearchResult result = new SearchResult( base.toString(), null, attrs );
                return new SingletonEnumeration( result );
            }
        }
        else if ( searchCtls.getSearchScope() == SearchControls.OBJECT_SCOPE &&
                filter instanceof PresenceNode )
        {
            PresenceNode node = ( PresenceNode ) filter;

            if ( node.getAttribute().equalsIgnoreCase( "objectClass" ) )
            {
                // call.setBypass( true );
                Attributes attrs = getSubschemaEntry( searchCtls.getReturningAttributes() );
                SearchResult result = new SearchResult( base.toString(), null, attrs );
                return new SingletonEnumeration( result );
View Full Code Here

        }

        if ( searchCtls.getSearchScope() == SearchControls.OBJECT_SCOPE &&
                filter instanceof SimpleNode )
        {
            SimpleNode node = ( SimpleNode ) filter;

            if ( node.getAttribute().equalsIgnoreCase( "objectClass" ) &&
                    node.getValue().equalsIgnoreCase( "subschema" ) &&
                    node.getAssertionType() == SimpleNode.EQUALITY
            )
            {
                // call.setBypass( true );
                Attributes attrs = getSubschemaEntry( searchCtls.getReturningAttributes() );
                SearchResult result = new SearchResult( base.toString(), null, attrs );
                return new SingletonEnumeration( result );
            }
        }
        else if ( searchCtls.getSearchScope() == SearchControls.OBJECT_SCOPE &&
                filter instanceof PresenceNode )
        {
            PresenceNode node = ( PresenceNode ) filter;

            if ( node.getAttribute().equalsIgnoreCase( "objectClass" ) )
            {
                // call.setBypass( true );
                Attributes attrs = getSubschemaEntry( searchCtls.getReturningAttributes() );
                SearchResult result = new SearchResult( base.toString(), null, attrs );
                return new SingletonEnumeration( result );
View Full Code Here

         * Go through the set of attributes using each attribute value pair as
         * an attribute value assertion within one big AND filter expression.
         */
        Attribute attr = null;

        SimpleNode node = null;

        BranchNode filter = new BranchNode( BranchNode.AND );

        NamingEnumeration list = matchingAttributes.getAll();

        // Loop through each attribute value pair
        while ( list.hasMore() )
        {
            attr = ( Attribute ) list.next();
           
            /*
             * According to JNDI if an attribute in the matchingAttributes
             * list does not have any values then we match for just the presence
             * of the attribute in the entry
             */
            if ( attr.size() == 0 )
            {
                filter.addNode( new PresenceNode( attr.getID() ) );

                continue;
            }
           
            /*
             * With 1 or more value we build a set of simple nodes and add them
             * to the AND node - each attribute value pair is a simple AVA node.
             */
            for ( int ii = 0; ii < attr.size(); ii++ )
            {
                Object val = attr.get( ii );
               
                // Add simpel AVA node if its value is a String
                if ( val instanceof String )
                {
                    node = new SimpleNode( attr.getID(), ( String ) val, SimpleNode.EQUALITY );

                    filter.addNode( node );
                }
            }
        }
View Full Code Here

TOP

Related Classes of org.apache.ldap.common.filter.SimpleNode

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.