public void unstackFilters( Asn1Container container )
{
LdapMessageContainer<MessageDecorator<Message>> ldapMessageContainer =
( LdapMessageContainer<MessageDecorator<Message>> ) container;
TLV tlv = ldapMessageContainer.getCurrentTLV();
TLV localParent = tlv.getParent();
Filter localFilter = terminalFilter;
// The parent has been completed, so fold it
while ( ( localParent != null ) && ( localParent.getExpectedLength() == 0 ) )
{
int parentTlvId = localFilter.getParent() != null ? localFilter.getParent().getTlvId() : localFilter
.getParentTlvId();
if ( localParent.getId() != parentTlvId )
{
localParent = localParent.getParent();
}
else
{
Filter filterParent = localFilter.getParent();
// We have a special case with PresentFilter, which has not been
// pushed on the stack, so we need to get its parent's parent
if ( localFilter instanceof PresentFilter )
{
if ( filterParent == null )
{
// We don't have parent, get out
break;
}
filterParent = filterParent.getParent();
}
else if ( filterParent instanceof Filter )
{
filterParent = filterParent.getParent();
}
if ( filterParent instanceof Filter )
{
// The parent is a filter ; it will become the new currentFilter
// and we will loop again.
currentFilter = ( Filter ) filterParent;
localFilter = currentFilter;
localParent = localParent.getParent();
}
else
{
// We can stop the recursion, we have reached the searchResult Object
break;