org.opennms.bb.common.filter.sql
Class FilterTable

java.lang.Object
  |
  +--org.opennms.bb.common.filter.sql.FilterTable

public class FilterTable
extends Object

This data class is responsible for holding information needed by the Fitler module about the tables that are defined by the PollerDatabaseSchema.xml file. As that file is parsed by the FilterSchemaParser object the information for each table will be stored in on of these class instances.

Version:
$Revision: 1.6 $
Author:
Jason Johns, OpenNMS

Field Summary
private  Hashtable columns
          Data structure to hold the column names associated with this table.
private  boolean driver
          Indicates if this table is to be used as the driver for determining the join conditions.
private  HashMap joinConditions
          Data structure to hold the join conditions associated with this table.
private  String tableName
          Holds the table name.
 
Constructor Summary
FilterTable()
          Defaut constructor, initializes data structures and sets driver to false as defaut.
FilterTable(String aTableName)
          Initializes a new FilterTable with the table name.
 
Method Summary
 void addColumn(String aColumn)
          This method adds a column name the hashmap.
 void addJoinCondition(JoinCondition aJoinCondition)
          This method adds a JoinCondition object to the joinConditions hashmap, keyed on the name of the foreign table (from a foreign key type relationship).
 String[] getColumnNames()
          This method returns a list of the column names belonging to this table.
 Hashtable getColumnsHash()
          This method returns the hashtable of columns
 HashMap getJoinConditions()
          This method returns the list of join conditions for this table.
 JoinCondition getJoinConditions(String aTableName)
          Returns the Join Condition object associated with the table name supplied.
 String getTableName()
          This method returns the table name.
 boolean isDriver()
          This method returns the value of the variable driver.
 void setDriver()
          This method sets the driver variable to true.
 String toString()
          This method returns a string representation of the table
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

tableName

private String tableName
Holds the table name.

driver

private boolean driver
Indicates if this table is to be used as the driver for determining the join conditions. This variable is set by determining if a table has a key="primary" attribute in the PollerDatabaseSchema.xml file.

columns

private Hashtable columns
Data structure to hold the column names associated with this table.

joinConditions

private HashMap joinConditions
Data structure to hold the join conditions associated with this table.
Constructor Detail

FilterTable

public FilterTable()
Defaut constructor, initializes data structures and sets driver to false as defaut.

FilterTable

public FilterTable(String aTableName)
Initializes a new FilterTable with the table name.
Parameters:
String - aTableName, name of the new table
Method Detail

addJoinCondition

public void addJoinCondition(JoinCondition aJoinCondition)
This method adds a JoinCondition object to the joinConditions hashmap, keyed on the name of the foreign table (from a foreign key type relationship).
Parameters:
JoinCondition - aJoinCondition, new join condition to be added

getJoinConditions

public HashMap getJoinConditions()
This method returns the list of join conditions for this table.
Returns:
HashMap, the map of all JoinCondition objects currently in this table

getJoinConditions

public JoinCondition getJoinConditions(String aTableName)
Returns the Join Condition object associated with the table name supplied.
Parameters:
String - aTableName, name of the table to get the join condition for
Returns:
JoinCondition, the particular JoinCondition object between the current table and the table name passed in

setDriver

public void setDriver()
This method sets the driver variable to true.

isDriver

public boolean isDriver()
This method returns the value of the variable driver.
Returns:
boolean, indicating if this is the driver table

addColumn

public void addColumn(String aColumn)
This method adds a column name the hashmap. A null is inserted in place of an object (the null could be replaced by a data structure if more information is needed about the column).
Parameters:
String - aColumn, the name of the new column to be added

getColumnNames

public String[] getColumnNames()
This method returns a list of the column names belonging to this table.
Returns:
String [], an array of all the column names in this table

getColumnsHash

public Hashtable getColumnsHash()
This method returns the hashtable of columns
Returns:
Hashtable, the hashtable of columns

getTableName

public String getTableName()
This method returns the table name.
Returns:
String, the table name

toString

public String toString()
This method returns a string representation of the table
Overrides:
toString in class Object
Returns:
String, a string representation of this table