use of org.apache.directory.api.ldap.codec.decorators.SearchRequestDecorator 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");
}
}
use of org.apache.directory.api.ldap.codec.decorators.SearchRequestDecorator in project directory-ldap-api by apache.
the class InitNotFilter method action.
/**
* {@inheritDoc}
*/
public void action(LdapMessageContainer<SearchRequestDecorator> container) throws DecoderException {
TLV tlv = container.getCurrentTLV();
if (tlv.getLength() == 0) {
String msg = I18n.err(I18n.ERR_04009);
LOG.error(msg);
throw new DecoderException(msg);
}
SearchRequestDecorator searchRequestDecorator = container.getMessage();
// We can allocate the SearchRequest
Filter notFilter = new NotFilter(container.getTlvId());
// Set the filter
searchRequestDecorator.addCurrentFilter(notFilter);
if (IS_DEBUG) {
LOG.debug("Initialize NOT filter");
}
}
use of org.apache.directory.api.ldap.codec.decorators.SearchRequestDecorator in project directory-ldap-api by apache.
the class InitOrFilter method action.
/**
* {@inheritDoc}
*/
public void action(LdapMessageContainer<SearchRequestDecorator> container) throws DecoderException {
TLV tlv = container.getCurrentTLV();
if (tlv.getLength() == 0) {
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");
}
}
use of org.apache.directory.api.ldap.codec.decorators.SearchRequestDecorator in project directory-ldap-api by apache.
the class InitPresentFilter method action.
/**
* {@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");
}
}
use of org.apache.directory.api.ldap.codec.decorators.SearchRequestDecorator in project directory-ldap-api by apache.
the class StoreInitial method action.
/**
* {@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_04108);
LOG.error(msg);
throw new DecoderException(msg);
}
substringFilter.setInitialSubstrings(Strings.utf8ToString(tlv.getValue().getData()));
// We now have to get back to the nearest filter which is
// not terminal.
searchRequestDecorator.unstackFilters(container);
}
Aggregations