com.ibm.etill.ldbcardcassette
Class LdbCardCassetteQuery.OrderQuery

com.ibm.etill.ldbcardcassette.LdbCardCassetteQuery.OrderQuery
Enclosing class:
LdbCardCassetteQuery

public final class LdbCardCassetteQuery.OrderQuery

An order query object automatically selects information from the cassette dependent order table using the same criteria that was used to select information from the framework order table. It is responsible for building the correct SQL statement, performing the query, and collecting the results. Furthermore, it is responsible for combining the information from each cassette order extension with the information already gathered for the framework order.

A query object trades simplicity for efficiency. The simplest technique for acquiring cassette dependent information for each order would be to perform a SQL Select statement for each framework order passed to the cassette query object. Instead, this query object performs a single SQL Select statement, joining the cassette dependent order table with the framework order table using the same criteria used to select the framework orders passed to the cassette query object.


Inner Class Summary
 class LdbCardCassetteQuery.OrderQuery.OrderInfo
          An order information object contains the information gathered from one row of the cassette dependent order table.
 
Field Summary
private  java.util.Hashtable objOrders
          This query attribute is a collection of all the information selected from the cassette dependent order table.
 
Constructor Summary
LdbCardCassetteQuery.OrderQuery(com.ibm.etill.framework.xdm.OrderQueryRequest argRequest)
          This constructor is use by the cassette query object when it is asked to service an OrderQuery request.
 
Method Summary
 void combine(java.util.Vector argFrameworkObjects)
          This method is used by the cassette query object to combine cassette dependent order information with framework order information.
protected  java.lang.String fromClause()
          This method is used by this object to construct the From clause for the SQL Select statement to be performed.
protected  int processQueryResults(java.sql.ResultSet argResultSet)
          This method is used by this class to process the results of the SQL Select statement.
protected  java.lang.String selectStatement()
          This method is used by this object to select the appropriate columns for the query.
protected  java.lang.String tableName()
          This method is used by this object to identify the name of the table to be used in the query.
 java.lang.String whereCondition()
          This method is used by this object to construct the Where clause for the SQL Select statement to be performed.
 

Field Detail

objOrders

private java.util.Hashtable objOrders
This query attribute is a collection of all the information selected from the cassette dependent order table. The key is constructed using the table's primary key columns and the value is an inner order information object.
Constructor Detail

LdbCardCassetteQuery.OrderQuery

public LdbCardCassetteQuery.OrderQuery(com.ibm.etill.framework.xdm.OrderQueryRequest argRequest)
                                throws com.ibm.etill.framework.payapi.ETillAbortOperation
This constructor is use by the cassette query object when it is asked to service an OrderQuery request. During construction, it obtains and collects the cassette dependent order information using same criteria that was used to obtain the framework order information.
Parameters:
argRequest - - the OrderQuery request.
Throws:
ETillAbortOperation - - any error results in this exception.
Method Detail

selectStatement

protected java.lang.String selectStatement()
This method is used by this object to select the appropriate columns for the query.

For this cassette, all columns are selected.

Returns:
- a String that lists the columns to be included in the query's result set.

tableName

protected java.lang.String tableName()
This method is used by this object to identify the name of the table to be used in the query.

For this cassette, the table name is the name of a cassette dependent view that can be found in the database.

Returns:
- a String containing the owner qualified table name.

fromClause

protected java.lang.String fromClause()
This method is used by this object to construct the From clause for the SQL Select statement to be performed. There are three cases:
  1. The merchant has issued a query for orders and provided order selection criteria so this query will obtain order information for the orders selected
  2. The merchant has issued a query for payments and provided payment selection criteria so this query will obtain order information for the payments selected
  3. The merchant has issued a query for credits and provided credit selection criteria so this query will obtain order information for the credits selected.

For this cassette, the correct From clause is built depending on the criteria supplied by the original request.

Returns:
- The string containing the From clause to be used in the query

whereCondition

public java.lang.String whereCondition()
This method is used by this object to construct the Where clause for the SQL Select statement to be performed. There are three cases:
  1. The merchant has issued a query for orders and provided order selection criteria so this query will obtain order information for the orders selected
  2. The merchant has issued a query for payments and provided payment selection criteria so this query will obtain order information for the payments selected
  3. The merchant has issued a query for credits and provided credit selection criteria so this query will obtain order information for the credits selected.

For this cassette, the correct Where clause is built depending on the criteria supplied by the original request.

Returns:
- The string containing the Where clause to be used in the query

processQueryResults

protected int processQueryResults(java.sql.ResultSet argResultSet)
                           throws com.ibm.etill.framework.payapi.ETillAbortOperation
This method is used by this class to process the results of the SQL Select statement. For each row in the result set, it constructs an inner order information object and saves it in a collection using the proper order key.
Parameters:
argResultSet - - The result set produced when the manufactured SQL Select statement was performed.
Returns:
- An integer containing the number of cassette dependent order information objects in the collection.
Throws:
ETillAbortOperation - - Any error results in this exception.

combine

public void combine(java.util.Vector argFrameworkObjects)
This method is used by the cassette query object to combine cassette dependent order information with framework order information. For each framework order object in the collection provided, it determines if there is a matching cassette order information object and, if so, asks the cassette order information object to add its XML fields to the result.
Parameters:
argFrameworkObjects - - a collection of framework order objects previously selected by the framework while processing the merchant's query request.