Package org.apache.ldap.common.filter

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


   
    public void testRangeOfValues() throws Exception
    {
        Attributes entry = new BasicAttributes();
        entry.put( "attrA", "valueA" );
        Collection tuples = getTuples( new ProtectedItem.RangeOfValues( new PresenceNode( "attrA" ) ) );

        Assert.assertEquals(
                1, filterA.filter(
                        tuples, OperationScope.ENTRY, null, null, USER_NAME,
                        null, null, new LdapName( "ou=testEntry" ),
View Full Code Here


            }
        }
        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

    public NamingEnumeration listBindings( Name name ) throws NamingException
    {
        // Conduct a special one level search at base for all objects
        Name base = buildTarget( name );

        PresenceNode filter = new PresenceNode( "objectClass" );

        SearchControls ctls = new SearchControls();

        ctls.setSearchScope( SearchControls.ONELEVEL_SCOPE );
View Full Code Here

    public NamingEnumeration listBindings( Name name ) throws NamingException
    {
        // Conduct a special one level search at base for all objects
        Name base = buildTarget( name );

        PresenceNode filter = new PresenceNode( "objectClass" );

        SearchControls ctls = new SearchControls();

        ctls.setSearchScope( SearchControls.ONELEVEL_SCOPE );
View Full Code Here

    // ------------------------------------------------------------------------


    public void addNamingListener( Name name, int scope, NamingListener namingListener ) throws NamingException
    {
        ExprNode filter = new PresenceNode( "objectClass" );
        SearchControls controls = new SearchControls();
        controls.setSearchScope( scope );
        ( ( DirectoryPartitionNexusProxy ) this.nexusProxy )
                .addNamingListener( this, buildTarget( name ), filter, controls, namingListener );
        listeners.add( namingListener );
View Full Code Here

        }

        // If matchingAttributes is null/empty use a match for everything filter
        if ( null == matchingAttributes || matchingAttributes.size() <= 0 )
        {
            PresenceNode filter = new PresenceNode( "objectClass" );

            return getNexusProxy().search( target , getEnvironment(), filter, ctls );
        }

        /*
         * 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 );
                }
            }
        }

        return getNexusProxy().search( target , getEnvironment(), filter, ctls );
View Full Code Here

    private final ExprNode childrenFilter;
    private final SearchControls childrenSearchControls;

    public MaxImmSubFilter()
    {
        childrenFilter = new PresenceNode( "objectClass" );
        childrenSearchControls = new SearchControls();
        childrenSearchControls.setSearchScope( SearchControls.ONELEVEL_SCOPE );
    }
View Full Code Here

            }
        }
        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

    public NamingEnumeration listBindings( Name name ) throws NamingException
    {
        // Conduct a special one level search at base for all objects
        Name base = buildTarget( name );

        PresenceNode filter = new PresenceNode( "objectClass" );

        SearchControls ctls = new SearchControls();

        ctls.setSearchScope( SearchControls.ONELEVEL_SCOPE );
View Full Code Here

            }
        }
        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

TOP

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

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.