edu.jhu.tmaj.servlet.request.impl
Class DetailsRequest

java.lang.Object
  extended by edu.jhu.tmaj.servlet.request.BaseRequest
      extended by edu.jhu.tmaj.servlet.request.impl.DetailsRequest
All Implemented Interfaces:
CommandRequest, java.io.Serializable
Direct Known Subclasses:
ArrayCoreDetailsRequest, ScoredImageDetailsRequest

public abstract class DetailsRequest
extends BaseRequest
implements java.io.Serializable

A Details request generally returns a response that is put into a table format. The table format is often exported to a tab-delimited file. First, a Main Query is performed. Other queries, such as queries of dynamic data, add data to rows in the main query. The extra queries find the proper row in the Main Query by using a getRowIdentifier() on a ResultSet from the query. Notes: A rowIdentifier represents the fields that uniquely identify one row. For the scoredImages, the fields are ArrayImageID and SessionID

See Also:
Serialized Form

Field Summary
protected  UserBean userBean
           
 
Fields inherited from class edu.jhu.tmaj.servlet.request.BaseRequest
password, username
 
Constructor Summary
protected DetailsRequest()
           
 
Method Summary
protected abstract  void doMetaDataQueries()
          Queries the Dynamic tables to add data obtained from the "Main" query.
protected  void doMetaDataQuery(java.lang.String sql, TableField primaryKeyField, TableField typeField, MainTableSection tableSection, DynamicMetaData dynamicMetaData)
          Adds MetaData (for example from the Specimens table) to the data obtained from the Main query
protected  ExpandingMap getExpandingMap()
           
protected abstract  java.lang.String getMainQuerySQL()
          Returns the non-dynamic SQL.
protected abstract  ExpandingMap getNewExpandingMap()
           
protected abstract  StaticFields getStaticFields()
          Returns fields and their table-names from non-dynamic tables.
protected  Messages getWarnings()
           
protected static void lookupStaticField(java.util.Map field_idValue, java.lang.Object field, java.util.Map<java.lang.Integer,LookupRecord> id_name)
          Given a Map and a key of that Map, changes the value of the key based on a Map lookup.
protected abstract  void lookupStaticValuesInRecord(java.util.Map<TableField,java.lang.Object> field_value)
           
 CommandResponse processRequest(UserBean userBean)
          This request is executed on the server assuming the username and password returns a valid UserBean.
protected  void renameFields(java.util.List<TableField> fieldNamesList)
           
protected abstract  java.util.List<java.util.Map> sortListOfMaps(java.util.List<java.util.Map> listOfMaps)
          Sorts the final List, usually by rowIdentifiers.
protected abstract  void verifyUser(UserBean userBean)
          Throws an exception if the user is not allowed to make this Request
 
Methods inherited from class edu.jhu.tmaj.servlet.request.BaseRequest
executeCommand, getPassword, getUsername
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

userBean

protected UserBean userBean
Constructor Detail

DetailsRequest

protected DetailsRequest()
Method Detail

getWarnings

protected Messages getWarnings()

getExpandingMap

protected ExpandingMap getExpandingMap()

getNewExpandingMap

protected abstract ExpandingMap getNewExpandingMap()

getStaticFields

protected abstract StaticFields getStaticFields()
Returns fields and their table-names from non-dynamic tables.


getMainQuerySQL

protected abstract java.lang.String getMainQuerySQL()
                                             throws java.sql.SQLException
Returns the non-dynamic SQL. Each row in this SQL statement returns a different RowIdentifier() from getRowIdentifier(ResultSet).

Throws:
java.sql.SQLException

doMetaDataQueries

protected abstract void doMetaDataQueries()
                                   throws java.sql.SQLException
Queries the Dynamic tables to add data obtained from the "Main" query.

Throws:
java.sql.SQLException

lookupStaticValuesInRecord

protected abstract void lookupStaticValuesInRecord(java.util.Map<TableField,java.lang.Object> field_value)

sortListOfMaps

protected abstract java.util.List<java.util.Map> sortListOfMaps(java.util.List<java.util.Map> listOfMaps)
Sorts the final List, usually by rowIdentifiers. For example, sort by y, then by x.


processRequest

public final CommandResponse processRequest(UserBean userBean)
                                     throws java.sql.SQLException
Description copied from class: BaseRequest
This request is executed on the server assuming the username and password returns a valid UserBean.

Specified by:
processRequest in class BaseRequest
Throws:
java.sql.SQLException

verifyUser

protected abstract void verifyUser(UserBean userBean)
                            throws java.sql.SQLException
Throws an exception if the user is not allowed to make this Request

Throws:
java.sql.SQLException

renameFields

protected void renameFields(java.util.List<TableField> fieldNamesList)

doMetaDataQuery

protected final void doMetaDataQuery(java.lang.String sql,
                                     TableField primaryKeyField,
                                     TableField typeField,
                                     MainTableSection tableSection,
                                     DynamicMetaData dynamicMetaData)
                              throws java.sql.SQLException
Adds MetaData (for example from the Specimens table) to the data obtained from the Main query

Parameters:
sql - the sql statement to retreive the metadata
primaryKeyTableField -
tableName - the TableName of the MetaData section, used only for sorting the columnnames.
Throws:
java.sql.SQLException

lookupStaticField

protected static void lookupStaticField(java.util.Map field_idValue,
                                        java.lang.Object field,
                                        java.util.Map<java.lang.Integer,LookupRecord> id_name)
Given a Map and a key of that Map, changes the value of the key based on a Map lookup.

Parameters:
field_idValue - a Map containing fieldnames and values ex: {specimenid=2; tissueTypeID=5;}
field - the field of the Map whose value is to be looked-up ex:"TissueTypeID"
id_name - the lookup Map. ex: {1="Prostate",2="Bladder"}