Package org.apache.directory.shared.ldap.codec.decorators

Examples of org.apache.directory.shared.ldap.codec.decorators.SearchRequestDecorator


    /**
     * {@inheritDoc}
     */
    public void action( LdapMessageContainer<SearchRequestDecorator> container ) throws DecoderException
    {
        SearchRequestDecorator searchRequestDecorator = container.getMessage();

        TLV tlv = container.getCurrentTLV();

        // We can allocate the Attribute Value Assertion
        PresentFilter presentFilter = new PresentFilter( container.getTlvId() );

        // add the filter to the request filter
        searchRequestDecorator.addCurrentFilter( presentFilter );
        searchRequestDecorator.setTerminalFilter( presentFilter );

        String value = Strings.utf8ToString(tlv.getValue().getData());

        if ( Strings.isEmpty(value) )
        {
            presentFilter.setAttributeDescription( "" );
        }
        else
        {
            // Store the value.
            String type = Strings.utf8ToString(tlv.getValue().getData());
            presentFilter.setAttributeDescription( type );
        }

        // We now have to get back to the nearest filter which is
        // not terminal.
        searchRequestDecorator.unstackFilters( container );

        if ( IS_DEBUG )
        {
            LOG.debug( "Initialize Present filter" );
        }
View Full Code Here


    /**
     * {@inheritDoc}
     */
    public void action( LdapMessageContainer<SearchRequestDecorator> container ) throws DecoderException
    {
        SearchRequestDecorator searchRequestDecorator = container.getMessage();

        // We can allocate the Attribute Value Assertion
        Filter filter = new AttributeValueAssertionFilter( container.getTlvId(),
            LdapConstants.EQUALITY_MATCH_FILTER );

        searchRequestDecorator.addCurrentFilter( filter );

        // Store the filter structure that still has to be
        // fulfilled
        searchRequestDecorator.setTerminalFilter( filter );

        if ( IS_DEBUG )
        {
            LOG.debug( "Initialize Equality Match filter" );
        }
View Full Code Here

    /**
     * {@inheritDoc}
     */
    public void action( LdapMessageContainer<SearchRequestDecorator> container ) throws DecoderException
    {
        SearchRequestDecorator searchRequestDecorator = container.getMessage();

        TLV tlv = container.getCurrentTLV();

        int expectedLength = tlv.getLength();

        if ( expectedLength == 0 )
        {
            String msg = I18n.err( I18n.ERR_04012 );
            LOG.error( msg );
            throw new DecoderException( msg );
        }

        // We can allocate the SearchRequest
        Filter substringFilter = new SubstringFilter( container.getTlvId() );

        searchRequestDecorator.addCurrentFilter( substringFilter );
        searchRequestDecorator.setTerminalFilter( substringFilter );

        if ( IS_DEBUG )
        {
            LOG.debug( "Initialize Substrings filter" );
        }
View Full Code Here

    /**
     * {@inheritDoc}
     */
    public void action( LdapMessageContainer<SearchRequestDecorator> container ) throws DecoderException
    {
        SearchRequestDecorator searchRequestDecorator = container.getMessage();

        TLV tlv = container.getCurrentTLV();

        // The value can be null.
        Value<?> assertionValue = null;

        if ( tlv.getLength() != 0 )
        {
            assertionValue = new BinaryValue( tlv.getValue().getData() );
        }
        else
        {
            assertionValue = new BinaryValue( StringConstants.EMPTY_BYTES );
        }

        AttributeValueAssertionFilter terminalFilter = ( AttributeValueAssertionFilter )
                searchRequestDecorator.getTerminalFilter();
        AttributeValueAssertion assertion = terminalFilter.getAssertion();

        if ( container.isBinary( assertion.getAttributeDesc() ) )
        {
            if ( tlv.getLength() != 0 )
            {
                assertionValue = new BinaryValue( tlv.getValue().getData() );
            }
            else
            {
                assertionValue = new BinaryValue( StringConstants.EMPTY_BYTES );
            }

            assertion.setAssertionValue( assertionValue );
        }
        else
        {
            if ( tlv.getLength() != 0 )
            {
                assertionValue = new StringValue( Strings.utf8ToString(tlv.getValue().getData()) );
            }
            else
            {
                assertionValue = new StringValue( "" );
            }

            assertion.setAssertionValue( assertionValue );
        }

        // We now have to get back to the nearest filter which is
        // not terminal.
        searchRequestDecorator.unstackFilters( container );

        if ( IS_DEBUG )
        {
            LOG.debug( "Initialize Assertion Value filter" );
        }
View Full Code Here

    /**
     * {@inheritDoc}
     */
    public void action( LdapMessageContainer<SearchRequestDecorator> container ) throws DecoderException
    {
        SearchRequestDecorator searchRequestDecorator = container.getMessage();

        // We can allocate the Attribute Value Assertion
        Filter filter = new AttributeValueAssertionFilter( container.getTlvId(),
            LdapConstants.GREATER_OR_EQUAL_FILTER );

        searchRequestDecorator.addCurrentFilter( filter );

        // Store the filter structure that still has to be
        // fulfilled
        searchRequestDecorator.setTerminalFilter( filter );

        if ( IS_DEBUG )
        {
            LOG.debug( "Initialize Greater Or Equal filter" );
        }
View Full Code Here

    /**
     * {@inheritDoc}
     */
    public void action( LdapMessageContainer<SearchRequestDecorator> container ) throws DecoderException
    {
        SearchRequestDecorator searchRequestDecorator = container.getMessage();

        // We can allocate the Attribute Value Assertion
        Filter filter = new AttributeValueAssertionFilter( container.getTlvId(),
            LdapConstants.APPROX_MATCH_FILTER );

        searchRequestDecorator.addCurrentFilter( filter );

        // Store the filter structure that still has to be
        // fulfilled
        searchRequestDecorator.setTerminalFilter( filter );

        if ( IS_DEBUG )
        {
            LOG.debug( "Initialize Approx Match filter" );
        }
View Full Code Here

    /**
     * {@inheritDoc}
     */
    public void action( LdapMessageContainer<SearchRequestDecorator> container ) throws DecoderException
    {
        SearchRequestDecorator searchRequestDecorator = container.getMessage();

        TLV tlv = container.getCurrentTLV();

        AttributeValueAssertion assertion = new AttributeValueAssertion();

        if ( tlv.getLength() == 0 )
        {
            String msg = I18n.err( I18n.ERR_04007 );
            LOG.error( msg );
            throw new DecoderException( msg );
        }
        else
        {
            String type = Strings.utf8ToString(tlv.getValue().getData());
            assertion.setAttributeDesc( type );

            AttributeValueAssertionFilter terminalFilter = ( AttributeValueAssertionFilter )
                    searchRequestDecorator.getTerminalFilter();
            terminalFilter.setAssertion( assertion );
        }

        if ( IS_DEBUG )
        {
View Full Code Here

            String msg = I18n.err( I18n.ERR_04006 );
            LOG.error( msg );
            throw new DecoderException( msg );
        }

        SearchRequestDecorator searchRequestDecorator = container.getMessage();

        // We can allocate the SearchRequest
        Filter andFilter = new AndFilter( container.getTlvId() );

        // Set the filter
        searchRequestDecorator.addCurrentFilter( andFilter );

        if ( IS_DEBUG )
        {
            LOG.debug( "Initialize AND filter" );
        }
View Full Code Here

            String msg = I18n.err( I18n.ERR_04010 );
            LOG.error( msg );
            throw new DecoderException( msg );
        }

        SearchRequestDecorator searchRequestDecorator = container.getMessage();

        // We can allocate the SearchRequest
        Filter orFilter = new OrFilter( container.getTlvId() );

        // Set the filter
        searchRequestDecorator.addCurrentFilter( orFilter );

        if ( IS_DEBUG )
        {
            LOG.debug( "Initialize OR filter" );
        }
View Full Code Here

    /**
     * {@inheritDoc}
     */
    public void action( LdapMessageContainer<SearchRequestDecorator> container ) throws DecoderException
    {
        SearchRequestDecorator searchRequestDecorator = container.getMessage();
        TLV tlv = container.getCurrentTLV();
        String attributeDescription = null;

        if ( tlv.getLength() != 0 )
        {
            attributeDescription = Strings.utf8ToString(tlv.getValue().getData());

            // If the attributeDescription is empty, we won't add it
            if ( !Strings.isEmpty(attributeDescription.trim()) )
            {
                searchRequestDecorator.getDecorated().addAttributes( attributeDescription );
            }
        }

        // We can have an END transition
        container.setGrammarEndAllowed( true );
View Full Code Here

TOP

Related Classes of org.apache.directory.shared.ldap.codec.decorators.SearchRequestDecorator

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.