public class SqlMatchRuleVisitor extends java.lang.Object implements MatchRuleVisitor
Modifier and Type | Field and Description |
---|---|
protected static java.lang.String |
CLOSE_PARENTHESIS |
protected static java.lang.String |
COMMA |
protected static java.lang.String |
END_QUOTE |
protected static char |
MULTICHAR_WILDCARD |
protected static java.lang.String |
OPEN_PARENTHESIS |
protected static java.lang.String |
SQL_OPERATOR_AND |
protected static java.lang.String |
SQL_OPERATOR_EQUAL |
protected static java.lang.String |
SQL_OPERATOR_GE |
protected static java.lang.String |
SQL_OPERATOR_GREATER |
protected static java.lang.String |
SQL_OPERATOR_IN |
protected static java.lang.String |
SQL_OPERATOR_LE |
protected static java.lang.String |
SQL_OPERATOR_LESS |
protected static java.lang.String |
SQL_OPERATOR_LIKE |
protected static java.lang.String |
SQL_OPERATOR_NOT |
protected static java.lang.String |
SQL_OPERATOR_OR |
protected static java.lang.String |
START_QUOTE |
Constructor and Description |
---|
SqlMatchRuleVisitor()
Initialize the new instance with default values.
|
Modifier and Type | Method and Description |
---|---|
protected void |
append_IN(java.lang.String attrName,
java.lang.String[] values) |
protected void |
appendAttribute(java.lang.String name,
MatchRuleCompareOperator compareOperator,
java.lang.String attrValue) |
protected void |
appendAttributeValues(java.lang.String name,
MatchRuleCompareOperator compareOperator,
java.lang.String[] values) |
protected void |
appendOperators(boolean andOperator,
boolean notOperator) |
protected void |
appendValue(java.lang.String value) |
java.lang.String |
asSqlClause(MatchRule matchRule)
Converts the given match rule into a SQL conditional clause.
|
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 boolean |
canBeInOperator(MatchRuleCompareOperator compareOperator,
java.lang.String[] values) |
void |
endGroup()
This method will be called for each group end occurrence.
|
protected java.lang.StringBuffer |
getBuffer() |
protected boolean |
groupStarted() |
protected void |
groupStarted(boolean newValue) |
protected void |
setBuffer(java.lang.StringBuffer 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.
|
protected static final char MULTICHAR_WILDCARD
protected static final java.lang.String SQL_OPERATOR_NOT
protected static final java.lang.String SQL_OPERATOR_AND
protected static final java.lang.String SQL_OPERATOR_OR
protected static final java.lang.String SQL_OPERATOR_IN
protected static final java.lang.String SQL_OPERATOR_LIKE
protected static final java.lang.String SQL_OPERATOR_EQUAL
protected static final java.lang.String SQL_OPERATOR_GE
protected static final java.lang.String SQL_OPERATOR_LE
protected static final java.lang.String SQL_OPERATOR_GREATER
protected static final java.lang.String SQL_OPERATOR_LESS
protected static final java.lang.String OPEN_PARENTHESIS
protected static final java.lang.String CLOSE_PARENTHESIS
protected static final java.lang.String COMMA
protected static final java.lang.String START_QUOTE
protected static final java.lang.String END_QUOTE
public SqlMatchRuleVisitor()
public void walkThroughInit()
walkThroughInit
in interface MatchRuleVisitor
public void walkThroughFinished()
walkThroughFinished
in interface MatchRuleVisitor
public void startGroup(boolean andOperator, boolean notOperator)
startGroup
in interface MatchRuleVisitor
andOperator
- If true it is an AND combination otherwise it is ORnotOperator
- Is only true for a NOT operationpublic void endGroup()
endGroup
in interface MatchRuleVisitor
public void attribute(java.lang.String name, MatchRuleCompareOperator compareOperator, java.lang.String[] values, boolean andOperator, boolean notOperator)
attribute
in interface MatchRuleVisitor
name
- The attribute's namecompareOperator
- The operator used to compare valuesvalues
- All values the attrubute my match (implicit OR combination !)andOperator
- If true it is an AND combination otherwise it is ORnotOperator
- Is only true for a NOT operationpublic java.lang.String asSqlClause(MatchRule matchRule)
matchRule
- The rule to be convertedprotected void appendOperators(boolean andOperator, boolean notOperator)
protected void appendAttribute(java.lang.String name, MatchRuleCompareOperator compareOperator, java.lang.String attrValue)
protected void appendValue(java.lang.String value)
protected void appendAttributeValues(java.lang.String name, MatchRuleCompareOperator compareOperator, java.lang.String[] values)
protected void append_IN(java.lang.String attrName, java.lang.String[] values)
protected boolean canBeInOperator(MatchRuleCompareOperator compareOperator, java.lang.String[] values)
protected java.lang.StringBuffer getBuffer()
protected void setBuffer(java.lang.StringBuffer newValue)
protected boolean groupStarted()
protected void groupStarted(boolean newValue)