/**
* {@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" );
}