atg.cortex
Class Query

java.lang.Object
  extended by atg.cortex.PropertyList
      extended by atg.cortex.ResultSetProcessor
          extended by atg.cortex.Query
Direct Known Subclasses:
Cortex

public class Query
extends ResultSetProcessor

A Query is a subclass of ResultSetProcessor that can help construct SQL select statements. When constructing the Query, the Query should be created by adding a set of PropertyColumn objects, which map bean properties to table columns. The query can then construct a "SELECT {columns} FROM {tables}" statement. The application can modify this statement to add appropriate "WHERE" clauses. The ResultSet from the statement can then be processed by calling processResultSet.

Note that there are no restrictions on the property to column mappings. One column can map to several properties, and one property can map to several columsn. The properties can span multiple classes, and the columns can span multiple tables.


Field Summary
static java.lang.String CLASS_VERSION
          Class version string
 
Constructor Summary
Query()
          Constructs a new Query
 
Method Summary
 void addColumnProperties(ColumnProperty[] pProperties)
          Adds a list of properties.
 void addColumnProperty(ColumnProperty pProperty)
          Adds a new ColumnProperty to the list of properties.
 ColumnProperty[] getColumnProperties()
          Returns the list of ColumnProperties as an array
 ColumnProperty getColumnProperty(int pIndex)
          Returns the ColumnProperty at the given index
 int getColumnPropertyCount()
          Returns the number of ColumnProperty objects in the list
 java.lang.String getSelectStatement()
          Returns the "SELECT {columns} FROM {tables}" statement corresponding to the tables and columns referenced by the PropertyColumns added to this Query.
 java.lang.String getTableName()
          Returns the table name referenced by the property columns.
 java.lang.String[] getTableNames()
          Returns the list of tables referenced by the columns added to the Query.
 
Methods inherited from class atg.cortex.ResultSetProcessor
processResultSet, processResultSet, processResultSetRow, processResultSetRow, processResultSetRow
 
Methods inherited from class atg.cortex.PropertyList
addProperties, addProperty, getBeanClass, getBeanClasses, getClassProperties, getProperties, getProperty, getPropertyCount, getPropertyToClassTable
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLASS_VERSION

public static final java.lang.String CLASS_VERSION
Class version string

See Also:
Constant Field Values
Constructor Detail

Query

public Query()
Constructs a new Query

Method Detail

addColumnProperty

public void addColumnProperty(ColumnProperty pProperty)
Adds a new ColumnProperty to the list of properties. The property may be null.


addColumnProperties

public void addColumnProperties(ColumnProperty[] pProperties)
Adds a list of properties.


getColumnPropertyCount

public int getColumnPropertyCount()
Returns the number of ColumnProperty objects in the list


getColumnProperty

public ColumnProperty getColumnProperty(int pIndex)
Returns the ColumnProperty at the given index


getColumnProperties

public ColumnProperty[] getColumnProperties()
Returns the list of ColumnProperties as an array


getTableNames

public java.lang.String[] getTableNames()
Returns the list of tables referenced by the columns added to the Query.


getTableName

public java.lang.String getTableName()
Returns the table name referenced by the property columns. If the property columns reference more than one table, then only one of the table names is returned.


getSelectStatement

public java.lang.String getSelectStatement()
Returns the "SELECT {columns} FROM {tables}" statement corresponding to the tables and columns referenced by the PropertyColumns added to this Query.