org.pfsw.text
Class LdapMatchRuleVisitor

java.lang.Object
  extended by org.pfsw.text.LdapMatchRuleVisitor
All Implemented Interfaces:
MatchRuleVisitor

public class LdapMatchRuleVisitor
extends java.lang.Object
implements MatchRuleVisitor

Walks over a MatchRule to create a LDAP filter string out of it.


Constructor Summary
LdapMatchRuleVisitor()
          Initialize the new instance with default values.
 
Method Summary
protected  void addElementToCurrentGroup(org.pfsw.text.LdapMatchRuleVisitor.ElementInfo element, boolean andOperator)
           
protected  void appendAttribute(org.pfsw.text.LdapMatchRuleVisitor.AttributeInfo element)
           
protected  void appendAttribute(java.lang.String name, MatchRuleCompareOperator operator, java.lang.String value)
           
protected  void appendAttribute(java.lang.String name, MatchRuleCompareOperator operator, java.lang.String[] values, boolean notOperator)
           
 void appendGroup(org.pfsw.text.LdapMatchRuleVisitor.GroupInfo group)
           
protected  void appendGroupElement(org.pfsw.text.LdapMatchRuleVisitor.ElementInfo element)
           
protected  void appendGroupElements(java.util.List<org.pfsw.text.LdapMatchRuleVisitor.ElementInfo> elements, boolean andOperator)
           
 java.lang.String asSearchString(MatchRule matchRule)
          Converts the given match rule into a LDAP search string compliant to RFC 1558.
 void attribute(java.lang.String name, MatchRuleCompareOperator compareOperator, java.lang.String[] values, boolean andOperator, boolean notOperator)
          This method will be called for each attribute.
protected  org.pfsw.text.LdapMatchRuleVisitor.GroupInfo createGroup()
           
protected  org.pfsw.text.LdapMatchRuleVisitor.GroupInfo currentGroup()
           
 void endGroup()
          This method will be called for each group end occurrence.
protected  java.lang.StringBuffer getBuffer()
           
protected  org.pfsw.text.LdapMatchRuleVisitor.GroupInfo getRootGroup()
           
protected  java.util.Stack<org.pfsw.text.LdapMatchRuleVisitor.GroupInfo> getStack()
           
protected  boolean isFirstGroup()
           
protected  org.pfsw.text.LdapMatchRuleVisitor.GroupInfo pop()
           
protected  void push(org.pfsw.text.LdapMatchRuleVisitor.GroupInfo obj)
           
protected  void setBuffer(java.lang.StringBuffer newValue)
           
protected  void setRootGroup(org.pfsw.text.LdapMatchRuleVisitor.GroupInfo newValue)
           
protected  void setStack(java.util.Stack<org.pfsw.text.LdapMatchRuleVisitor.GroupInfo> newValue)
           
 void startGroup(boolean andOperator, boolean notOperator)
          This method will be called for each start of a new group.
 void walkThroughFinished()
          This method will be called when the MatchRule has finished to walk through its elements.
 void walkThroughInit()
          This method will be called right before the MatchRule walks through its elements.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LdapMatchRuleVisitor

public LdapMatchRuleVisitor()
Initialize the new instance with default values.

Method Detail

walkThroughInit

public void walkThroughInit()
This method will be called right before the MatchRule walks through its elements.

Specified by:
walkThroughInit in interface MatchRuleVisitor

walkThroughFinished

public void walkThroughFinished()
This method will be called when the MatchRule has finished to walk through its elements.

Specified by:
walkThroughFinished in interface MatchRuleVisitor

startGroup

public void startGroup(boolean andOperator,
                       boolean notOperator)
This method will be called for each start of a new group.

Specified by:
startGroup in interface MatchRuleVisitor
Parameters:
andOperator - If true it is an AND combination otherwise it is OR
notOperator - Is only true for a NOT operation

endGroup

public void endGroup()
This method will be called for each group end occurrence.

Specified by:
endGroup in interface MatchRuleVisitor

attribute

public void attribute(java.lang.String name,
                      MatchRuleCompareOperator compareOperator,
                      java.lang.String[] values,
                      boolean andOperator,
                      boolean notOperator)
This method will be called for each attribute.

Specified by:
attribute in interface MatchRuleVisitor
Parameters:
name - The attribute's name
compareOperator - The operator used to compare values
values - All values the attribute my match (implicit OR combination !)
andOperator - If true it is an AND combination otherwise it is OR
notOperator - Is only true for a NOT operation

asSearchString

public java.lang.String asSearchString(MatchRule matchRule)
Converts the given match rule into a LDAP search string compliant to RFC 1558.

Parameters:
matchRule - The rule to be converted

appendGroup

public void appendGroup(org.pfsw.text.LdapMatchRuleVisitor.GroupInfo group)

appendGroupElement

protected void appendGroupElement(org.pfsw.text.LdapMatchRuleVisitor.ElementInfo element)

appendGroupElements

protected void appendGroupElements(java.util.List<org.pfsw.text.LdapMatchRuleVisitor.ElementInfo> elements,
                                   boolean andOperator)

appendAttribute

protected void appendAttribute(org.pfsw.text.LdapMatchRuleVisitor.AttributeInfo element)

appendAttribute

protected void appendAttribute(java.lang.String name,
                               MatchRuleCompareOperator operator,
                               java.lang.String[] values,
                               boolean notOperator)

appendAttribute

protected void appendAttribute(java.lang.String name,
                               MatchRuleCompareOperator operator,
                               java.lang.String value)

addElementToCurrentGroup

protected void addElementToCurrentGroup(org.pfsw.text.LdapMatchRuleVisitor.ElementInfo element,
                                        boolean andOperator)

createGroup

protected org.pfsw.text.LdapMatchRuleVisitor.GroupInfo createGroup()

pop

protected org.pfsw.text.LdapMatchRuleVisitor.GroupInfo pop()

push

protected void push(org.pfsw.text.LdapMatchRuleVisitor.GroupInfo obj)

currentGroup

protected org.pfsw.text.LdapMatchRuleVisitor.GroupInfo currentGroup()

isFirstGroup

protected boolean isFirstGroup()

getBuffer

protected java.lang.StringBuffer getBuffer()

setBuffer

protected void setBuffer(java.lang.StringBuffer newValue)

getRootGroup

protected org.pfsw.text.LdapMatchRuleVisitor.GroupInfo getRootGroup()

setRootGroup

protected void setRootGroup(org.pfsw.text.LdapMatchRuleVisitor.GroupInfo newValue)

getStack

protected java.util.Stack<org.pfsw.text.LdapMatchRuleVisitor.GroupInfo> getStack()

setStack

protected void setStack(java.util.Stack<org.pfsw.text.LdapMatchRuleVisitor.GroupInfo> newValue)