Search in sources :

Example 1 with AttributeValueAssertionFilter

use of org.apache.directory.api.ldap.codec.search.AttributeValueAssertionFilter in project directory-ldap-api by apache.

the class InitAssertionValueFilter method action.

/**
 * {@inheritDoc}
 */
public void action(LdapMessageContainer<SearchRequestDecorator> container) throws DecoderException {
    SearchRequestDecorator searchRequestDecorator = container.getMessage();
    TLV tlv = container.getCurrentTLV();
    // The value can be null.
    byte[] assertion = tlv.getValue().getData();
    AttributeValueAssertionFilter terminalFilter = (AttributeValueAssertionFilter) searchRequestDecorator.getTerminalFilter();
    AttributeValueAssertion attributeValueAssertion = terminalFilter.getAssertion();
    if (assertion == null) {
        attributeValueAssertion.setAssertion(Strings.EMPTY_BYTES);
    } else {
        attributeValueAssertion.setAssertion(assertion);
    }
    // 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");
    }
}
Also used : AttributeValueAssertionFilter(org.apache.directory.api.ldap.codec.search.AttributeValueAssertionFilter) AttributeValueAssertion(org.apache.directory.api.ldap.codec.AttributeValueAssertion) SearchRequestDecorator(org.apache.directory.api.ldap.codec.decorators.SearchRequestDecorator) TLV(org.apache.directory.api.asn1.ber.tlv.TLV)

Example 2 with AttributeValueAssertionFilter

use of org.apache.directory.api.ldap.codec.search.AttributeValueAssertionFilter in project directory-ldap-api by apache.

the class InitAttributeDescFilter method action.

/**
 * {@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) {
        LOG.debug("Initialize AttributeDesc filter");
    }
}
Also used : DecoderException(org.apache.directory.api.asn1.DecoderException) AttributeValueAssertionFilter(org.apache.directory.api.ldap.codec.search.AttributeValueAssertionFilter) AttributeValueAssertion(org.apache.directory.api.ldap.codec.AttributeValueAssertion) SearchRequestDecorator(org.apache.directory.api.ldap.codec.decorators.SearchRequestDecorator) TLV(org.apache.directory.api.asn1.ber.tlv.TLV)

Example 3 with AttributeValueAssertionFilter

use of org.apache.directory.api.ldap.codec.search.AttributeValueAssertionFilter in project directory-ldap-api by apache.

the class InitEqualityMatchFilter method action.

/**
 * {@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(), LdapCodecConstants.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");
    }
}
Also used : AttributeValueAssertionFilter(org.apache.directory.api.ldap.codec.search.AttributeValueAssertionFilter) Filter(org.apache.directory.api.ldap.codec.search.Filter) AttributeValueAssertionFilter(org.apache.directory.api.ldap.codec.search.AttributeValueAssertionFilter) SearchRequestDecorator(org.apache.directory.api.ldap.codec.decorators.SearchRequestDecorator)

Example 4 with AttributeValueAssertionFilter

use of org.apache.directory.api.ldap.codec.search.AttributeValueAssertionFilter in project directory-ldap-api by apache.

the class InitGreaterOrEqualFilter method action.

/**
 * {@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(), LdapCodecConstants.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");
    }
}
Also used : AttributeValueAssertionFilter(org.apache.directory.api.ldap.codec.search.AttributeValueAssertionFilter) Filter(org.apache.directory.api.ldap.codec.search.Filter) AttributeValueAssertionFilter(org.apache.directory.api.ldap.codec.search.AttributeValueAssertionFilter) SearchRequestDecorator(org.apache.directory.api.ldap.codec.decorators.SearchRequestDecorator)

Example 5 with AttributeValueAssertionFilter

use of org.apache.directory.api.ldap.codec.search.AttributeValueAssertionFilter in project directory-ldap-api by apache.

the class InitLessOrEqualFilter method action.

/**
 * {@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(), LdapCodecConstants.LESS_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 Less Or Equal filter");
    }
}
Also used : AttributeValueAssertionFilter(org.apache.directory.api.ldap.codec.search.AttributeValueAssertionFilter) Filter(org.apache.directory.api.ldap.codec.search.Filter) AttributeValueAssertionFilter(org.apache.directory.api.ldap.codec.search.AttributeValueAssertionFilter) SearchRequestDecorator(org.apache.directory.api.ldap.codec.decorators.SearchRequestDecorator)

Aggregations

AttributeValueAssertionFilter (org.apache.directory.api.ldap.codec.search.AttributeValueAssertionFilter)8 SearchRequestDecorator (org.apache.directory.api.ldap.codec.decorators.SearchRequestDecorator)6 Filter (org.apache.directory.api.ldap.codec.search.Filter)6 AttributeValueAssertion (org.apache.directory.api.ldap.codec.AttributeValueAssertion)4 DecoderException (org.apache.directory.api.asn1.DecoderException)2 BerValue (org.apache.directory.api.asn1.ber.tlv.BerValue)2 TLV (org.apache.directory.api.asn1.ber.tlv.TLV)2 AndFilter (org.apache.directory.api.ldap.codec.search.AndFilter)2 ConnectorFilter (org.apache.directory.api.ldap.codec.search.ConnectorFilter)2 ExtensibleMatchFilter (org.apache.directory.api.ldap.codec.search.ExtensibleMatchFilter)2 NotFilter (org.apache.directory.api.ldap.codec.search.NotFilter)2 OrFilter (org.apache.directory.api.ldap.codec.search.OrFilter)2 PresentFilter (org.apache.directory.api.ldap.codec.search.PresentFilter)2 SubstringFilter (org.apache.directory.api.ldap.codec.search.SubstringFilter)2 Value (org.apache.directory.api.ldap.model.entry.Value)2 AndNode (org.apache.directory.api.ldap.model.filter.AndNode)2 ApproximateNode (org.apache.directory.api.ldap.model.filter.ApproximateNode)2 BranchNode (org.apache.directory.api.ldap.model.filter.BranchNode)2 EqualityNode (org.apache.directory.api.ldap.model.filter.EqualityNode)2 ExtensibleNode (org.apache.directory.api.ldap.model.filter.ExtensibleNode)2