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

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

public class JoinCondition
extends Object

This data class is responsible for holding information about the way two tables are to be joined in a where clause of a select statement. This information is taken from the tags in the PollerDatabaseSchema.xml file for each table. A table may have no joinrefs or many. A join is defined by the oringinal table and column name and the table and column name of the foreign table.

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

Field Summary
private  String foreignColumnName
          Holds the column to join to.
private  String foreignTableName
          Holds the table to join to.
private  String originalColumnName
          Holds the table joining from.
private  String originalTableName
          Holds the column joining from.
 
Constructor Summary
JoinCondition()
          Default constructor, currently does nothing
JoinCondition(String anOriginalTableName, String anOriginalColumnName, String aForeignTableName, String aForeignColumnName)
          Constructs a complete join condtion.
 
Method Summary
 String getForeignColumnAndTable()
          This method returns the foreign table and column in the form of "foreignTable.foreignColumn".
 String getForeignColumnName()
          This method returns the column name that is being joined to.
 String getForeignTableName()
          This method returns the table name that is being joined to.
 String getOriginalColumnAndTable()
          This method returns the originating table and column in the form of "originalTable.originalColumn".
 String getOriginalColumnName()
          This method returns the column name that is the originator of the join.
 String getOriginalTableName()
          This method returns the table name that is the originator of the join.
 void setForeignColumnName(String aForeignColumnName)
          This method sets the column being joined to.
 void setForeignTableName(String aTableName)
          This method sets the table name being joined to.
 void setOriginalColumnName(String anOriginalColumn)
          This method sets the column name being joined from.
 void setOriginalTableName(String anOriginalTableName)
          This method sets the table name being joined from.
 String toString()
          Prints out the join condtion in the form "oringialTable.originalColumn joins to foreignTable.foreignColumn", useful for debugging.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

foreignTableName

private String foreignTableName
Holds the table to join to.

foreignColumnName

private String foreignColumnName
Holds the column to join to.

originalColumnName

private String originalColumnName
Holds the table joining from.

originalTableName

private String originalTableName
Holds the column joining from.
Constructor Detail

JoinCondition

public JoinCondition()
Default constructor, currently does nothing

JoinCondition

public JoinCondition(String anOriginalTableName,
                     String anOriginalColumnName,
                     String aForeignTableName,
                     String aForeignColumnName)
Constructs a complete join condtion.
Parameters:
String - anOriginalTableName, originating table name
String - anOriginalColumnName, originating column name
String - aForeignTableName, table name being joined
String - aForeignColumnName, column name being joined
Method Detail

getForeignTableName

public String getForeignTableName()
This method returns the table name that is being joined to.

getOriginalTableName

public String getOriginalTableName()
This method returns the table name that is the originator of the join.

getOriginalColumnName

public String getOriginalColumnName()
This method returns the column name that is the originator of the join.

getForeignColumnName

public String getForeignColumnName()
This method returns the column name that is being joined to.

getOriginalColumnAndTable

public String getOriginalColumnAndTable()
This method returns the originating table and column in the form of "originalTable.originalColumn".

getForeignColumnAndTable

public String getForeignColumnAndTable()
This method returns the foreign table and column in the form of "foreignTable.foreignColumn".

setForeignColumnName

public void setForeignColumnName(String aForeignColumnName)
This method sets the column being joined to.
Parameters:
String - aForeignColumnName, the name of the column being joined to

setOriginalTableName

public void setOriginalTableName(String anOriginalTableName)
This method sets the table name being joined from.
Parameters:
String - anOriginalTableName, the name of the originating table

setOriginalColumnName

public void setOriginalColumnName(String anOriginalColumn)
This method sets the column name being joined from.
Parameters:
String - anOriginalColumn, the name of the originating column

setForeignTableName

public void setForeignTableName(String aTableName)
This method sets the table name being joined to.
Parameters:
String - aTableName, the name of the table being joined to

toString

public String toString()
Prints out the join condtion in the form "oringialTable.originalColumn joins to foreignTable.foreignColumn", useful for debugging.
Overrides:
toString in class Object
Returns:
String, a string representation of the join condition