Examples of SearchRequestDecorator


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();

        // Store the value.
        SubstringFilter substringFilter = ( SubstringFilter ) searchRequestDecorator.getTerminalFilter();

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

            // We now have to get back to the nearest filter which
            // is not terminal.
            searchRequestDecorator.setTerminalFilter( substringFilter );
        }
    }
View Full Code Here

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();

        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

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();

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

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

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

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

        TLV tlv = container.getCurrentTLV();

        if ( tlv.getLength() == 0 )
        {
            String msg = I18n.err( I18n.ERR_04022 );
            LOG.error( msg );
            throw new DecoderException( msg );
        }
        else
        {
            // Store the value.
            ExtensibleMatchFilter extensibleMatchFilter = ( ExtensibleMatchFilter ) searchRequest.getTerminalFilter();

            String type = Strings.utf8ToString(tlv.getValue().getData());
            extensibleMatchFilter.setType( type );

            if ( IS_DEBUG )
View Full Code Here

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

     * {@inheritDoc}
     */
    public void action( LdapMessageContainer<SearchRequestDecorator> container ) throws DecoderException
    {
        // Here, we have to inject the decoded filter into the SearchRequest
        SearchRequestDecorator searchRequestDecorator = container.getMessage();
        SearchRequest searchRequest = searchRequestDecorator.getDecorated();

        searchRequest.setFilter( searchRequestDecorator.getFilterNode() );

        // We can have an END transition
        container.setGrammarEndAllowed( true );

        if ( IS_DEBUG )
View Full Code Here

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

            case MODIFYDN_RESPONSE:
                decorator = new ModifyDnResponseDecorator( codec, ( ModifyDnResponse ) decoratedMessage );
                break;
               
            case SEARCH_REQUEST:
                decorator = new SearchRequestDecorator( codec, ( SearchRequest ) decoratedMessage );
                break;
               
            case SEARCH_RESULT_DONE:
                decorator = new SearchResultDoneDecorator( codec, ( SearchResultDone ) decoratedMessage );
                break;
View Full Code Here

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

        // Now, we can allocate the SearchRequest Object
        TLV tlv = container.getCurrentTLV();

        SearchRequest internalSearchRequest = new SearchRequestImpl();
        internalSearchRequest.setMessageId( container.getMessageId() );
        SearchRequestDecorator searchRequest = new SearchRequestDecorator(
            container.getLdapCodecService(), internalSearchRequest );

        searchRequest.setTlvId( tlv.getId());
        container.setMessage( searchRequest );

        LOG.debug( "Search Request" );
    }
View Full Code Here

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

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

        TLV tlv = container.getCurrentTLV();

        // We have to check that this is a correct Dn
        Dn baseObject = null;
View Full Code Here

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();
        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
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.