Search in sources :

Example 11 with Filter

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

the class InitSubstringsFilter method action.

/**
 * {@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");
    }
}
Also used : DecoderException(org.apache.directory.api.asn1.DecoderException) SubstringFilter(org.apache.directory.api.ldap.codec.search.SubstringFilter) Filter(org.apache.directory.api.ldap.codec.search.Filter) SubstringFilter(org.apache.directory.api.ldap.codec.search.SubstringFilter) SearchRequestDecorator(org.apache.directory.api.ldap.codec.decorators.SearchRequestDecorator) TLV(org.apache.directory.api.asn1.ber.tlv.TLV)

Example 12 with Filter

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

the class InitApproxMatchFilter 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.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");
    }
}
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

Filter (org.apache.directory.api.ldap.codec.search.Filter)12 SearchRequestDecorator (org.apache.directory.api.ldap.codec.decorators.SearchRequestDecorator)9 AttributeValueAssertionFilter (org.apache.directory.api.ldap.codec.search.AttributeValueAssertionFilter)7 DecoderException (org.apache.directory.api.asn1.DecoderException)5 TLV (org.apache.directory.api.asn1.ber.tlv.TLV)5 AndFilter (org.apache.directory.api.ldap.codec.search.AndFilter)4 ExtensibleMatchFilter (org.apache.directory.api.ldap.codec.search.ExtensibleMatchFilter)4 NotFilter (org.apache.directory.api.ldap.codec.search.NotFilter)4 OrFilter (org.apache.directory.api.ldap.codec.search.OrFilter)4 SubstringFilter (org.apache.directory.api.ldap.codec.search.SubstringFilter)4 ConnectorFilter (org.apache.directory.api.ldap.codec.search.ConnectorFilter)3 PresentFilter (org.apache.directory.api.ldap.codec.search.PresentFilter)3 BerValue (org.apache.directory.api.asn1.ber.tlv.BerValue)2 AttributeValueAssertion (org.apache.directory.api.ldap.codec.AttributeValueAssertion)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