org.pf.text
Class SqlMatchRuleVisitor

java.lang.Object
  extended by org.pf.text.SqlMatchRuleVisitor
All Implemented Interfaces:
MatchRuleVisitor

public class SqlMatchRuleVisitor
extends java.lang.Object
implements MatchRuleVisitor

Walks over a MatchRule to create a SQL WHERE clause out of it.

Version:
1.3
Author:
Manfred Duchrow

Constructor Summary
SqlMatchRuleVisitor()
          Initialize the new instance with default values.
 
Method Summary
 java.lang.String asSqlClause(MatchRule matchRule)
          Converts the given match rule into a SQL conditional clause.
 void attribute(java.lang.String name, int compareOperator, java.lang.String[] values, boolean andOperator, boolean notOperator)
          This method will be called for each attribute.
 void endGroup()
          This method will be called for each group end occurence.
 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
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SqlMatchRuleVisitor

public SqlMatchRuleVisitor()
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 occurence.

Specified by:
endGroup in interface MatchRuleVisitor

attribute

public void attribute(java.lang.String name,
                      int 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 attrubute 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

asSqlClause

public java.lang.String asSqlClause(MatchRule matchRule)
Converts the given match rule into a SQL conditional clause.

Parameters:
matchRule - The rule to be converted