|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.opennms.bb.common.filter.sql.SQLExpressionMapper
This class is responsible for mapping the different parts of the filter expressions into the SQL equivalent. As pieces of the expression are parsed the from and where clauses will be built. This information will be passed on to a SQLConstruct object by the parser when the expression has been fully parsed.
Field Summary | |
private HashMap |
columnsNeeded
This map holds the list of all columns that need to appear in the SELECT clause of the SQL statement being built. |
private Hashtable |
columnTableMap
This table holds the list of all non-hidden columns that can appear in the tables in PollerDatabaseSchema.xml. |
private Hashtable |
columnViewRef
This table holds the list of all columns that reference a view in PollerDatabaseSchema.xml. |
static int |
IDENT
|
static int |
NUMBER
Constants to identify the different types of terminals that can appear in an expression. |
private FilterSchemaParser |
schema
This holds the instance of the parser of the PollerDatabaseSchema.xml file. |
static int |
STRING
|
private Hashtable |
tableList
This table holds the list of table names and FilterTable objects associated with them that were extracted from the PollerDatabaseSchema.xml file. |
private HashMap |
tablesNeeded
This map holds the list of all tables that need to appear in the FROM clause of the SQL statement being built. |
private Hashtable |
viewList
This table holds the list of view names and FilterTable objects associated with all views that were extracted from the PollerDatabaseSchema.xml file. |
private Hashtable |
virtualColumns
This table holds the list of all virtual columns that can appear in the tables in PollerDatabaseSchema.xml. |
Constructor Summary | |
SQLExpressionMapper()
Default constructor, initalizes the data structures and grabs an instance of the FilterSchemaParser to match table and column names. |
Method Summary | |
void |
addSelectColumn(String columnName)
This method takes a column name and adds it to the data structure keeping the list of columns to include in the SELECT clause along with the table name associated with this column (later the column name will be appended to the table name in the actual SQL statement). |
void |
addTable(FilterTable aTable)
This method adds a table keyed by its name to the tableList hashmap. |
void |
addTableByColumnName(String aColumnName)
This method adds a table to the list of tables needed if only a column in the table name is known. |
void |
addTableByTableName(String aTableName)
This method adds a table to the list of tables needed if only the table name is known. |
void |
checkIPNumber(Integer n)
This method checks to ensure that a number appearing in an IP address is within the 0-255 range. |
private String |
formRangeCompare(Range range,
String column)
Deprecated. |
HashMap |
getColumnsNeeded()
This method returns the list of all columns that need to appear in the SELECT clause. |
StringBuffer |
getComparisonOp(int op)
This method converts a comparision operator to the SQL equivalent. |
StringBuffer |
getIPSelect(String columnName,
String ipLikeString)
Deprecated. |
StringBuffer |
getLogicalClause(int op)
This method converts the logical operation symbols into the SQL equivalent. |
StringBuffer |
getSubSelect(String columnName,
FilterTable view,
String ipLikeString)
Deprecated. |
HashMap |
getTablesNeeded()
This method returns the list of all tables that need to appear in the FROM clause. |
StringBuffer |
getValueString(int type,
String value)
This method converts a terminal value from an expression into what it should be in the SQL statement. |
Methods inherited from class java.lang.Object |
|
Field Detail |
public static final int NUMBER
public static final int IDENT
public static final int STRING
private Hashtable tableList
private Hashtable viewList
private HashMap tablesNeeded
private HashMap columnsNeeded
private Hashtable columnTableMap
private Hashtable virtualColumns
private Hashtable columnViewRef
private FilterSchemaParser schema
Constructor Detail |
public SQLExpressionMapper()
Method Detail |
public void addSelectColumn(String columnName)
String
- columnName, column name to be added to the select clausepublic StringBuffer getLogicalClause(int op)
int
- op, constant BBRulesSymbol identifier for a logical operandpublic StringBuffer getValueString(int type, String value) throws FailedParseException
int
- type, the type of data of the terminalString
- value, an terminal from the expression ruleFailedParseException
- public void addTable(FilterTable aTable)
FilterTable
- aTable, table object to be added to the hashmappublic void addTableByColumnName(String aColumnName)
String
- aColumnName, the name of the column of the table
to be added to the hashmappublic void addTableByTableName(String aTableName)
String
- aTableName, the name of the table to be added
to the hashmappublic StringBuffer getComparisonOp(int op)
int
- op, constant BBRulesSymbol identifier for a logical operandpublic void checkIPNumber(Integer n) throws IPOutOfRangeException
Integer
- n, an integer from an ip octetIPOutOfRangeException
- public StringBuffer getSubSelect(String columnName, FilterTable view, String ipLikeString)
String
- columnName, the name of the ip similar column being searchedFilterTable
- view, the view object from the schema parserString
- ipLikeString, the ip mask stringprivate String formRangeCompare(Range range, String column)
Range
- range, the range object encapulating the octet informationString
- column, the name of the octet column being comparedpublic StringBuffer getIPSelect(String columnName, String ipLikeString)
String
- columnName, the column name occuring in the IPLIKE operationString
- ipLikeString, the ip mask occuring in the IPLIKE operationpublic HashMap getTablesNeeded()
public HashMap getColumnsNeeded()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |