Expresso 5-6

com.jcorporate.expresso.services.controller.dbmaint
Class ListBase

java.lang.Object
  extended bycom.jcorporate.expresso.core.controller.State
      extended bycom.jcorporate.expresso.services.controller.dbmaint.DynamicCmd
          extended bycom.jcorporate.expresso.services.controller.dbmaint.ListBase
All Implemented Interfaces:
Cloneable, Serializable
Direct Known Subclasses:
List, SearchList

public abstract class ListBase
extends DynamicCmd

Base class for the DBMaint commands that display lists of records, such as Search and List.

Author:
Michael Nash
See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.jcorporate.expresso.services.controller.dbmaint.DynamicCmd
countTotalRecords, masterObjKey, showNext, showPrev
 
Fields inherited from class com.jcorporate.expresso.core.controller.State
NOTEMPTY_MASK, secure
 
Constructor Summary
ListBase()
           
ListBase(String code, String descrip)
          Constructor
 
Method Summary
protected  void addRecordsToBlock(ArrayList i_AllRecords, Block myTable)
          Given an interator containing database objects add all of those objects to the given output block as rows.
protected  Block generatePageTransitions(ControllerRequest request, RecordPaginator rp, int pageLimit)
          Generates an arrayList of transitions to allow direct jumping to a page.
protected  RecordPaginator getRecordPaginator()
          Gets the currently used paginator
protected  String getSortKey()
          This method determines how the list is sorted.
protected  long listRecords(String sortKey, Block myTable)
          Lists the records for display
protected  void setupListSearchCriteria()
          This method sets the search conditions on the current DBObject.
protected  void showList()
          Base class Show a list of database records to the user, allowing the key to be clicked on to request an edit of the object
 
Methods inherited from class com.jcorporate.expresso.services.controller.dbmaint.DynamicCmd
addParams, decode, getControllerName, getCurrentDBObj, getDataObject, getFieldsParam, getFixedFields, getKeyParameter, getMyDataObject, getPageNumber, getSearchParam, initializeDBObj, isKeyField, retrieveMyDBObject, run, setFields, setFieldsParam, setMyDataObject, setSearchParam, showBlobViewLink, showEditLink, showEditLink, showOptions, showUserName
 
Methods inherited from class com.jcorporate.expresso.core.controller.State
add, addAutoInput, addAutoInput, addAutoInput, addBlock, addError, addInput, addOptionalParameter, addOutput, addParameter, addParameter, addParameter, addRequiredParameter, addTransition, autoValidate, autoValidate, calculateHandlerName, checkMask, checkParamMasks, clearFormCache, clone, equals, getAttribute, getController, getControllerRequest, getControllerResponse, getDataContext, getDBController, getDBName, getDescription, getErrors, getErrorState, getErrorTransition, getFileName, getFormCache, getHandlerName, getInitParameter, getName, getObjectParameter, getOptionalParameters, getOptionalParametersList, getParameter, getParameters, getPatternMatcher, getRequiredParametersList, getResponse, getReturnToSender, getSession, getStateFormClass, getString, getString, getSuccessTransition, getUid, getUser, hashCode, isFileParameter, isParameter, isSecure, perform, saveErrors, setController, setDescription, setErrorState, setErrorTransition, setFormCache, setHandlerName, setMask, setMask, setMaskError, setName, setResponse, setReturnToSender, setSecure, setStateFormClass, setSuccessTransition, toString, transition
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ListBase

public ListBase()

ListBase

public ListBase(String code,
                String descrip)
Constructor

Parameters:
code - The name of the state.
descrip - The friendly name of the state
Method Detail

getRecordPaginator

protected RecordPaginator getRecordPaginator()
                                      throws ControllerException
Gets the currently used paginator

Returns:
RecordPaginator instance
Throws:
ControllerException

listRecords

protected long listRecords(String sortKey,
                           Block myTable)
                    throws DBException,
                           ControllerException
Lists the records for display

Parameters:
sortKey - The key to sort against
myTable - The Block to insert the table into.
Returns:
the total number of records listed
Throws:
DBException - Upon error communicating with the DBObject
ControllerException - upon other errors

getSortKey

protected String getSortKey()
                     throws DBException,
                            ControllerException
This method determines how the list is sorted. The default sort order is by the key fields of the underlying DBObject. To change the default just override this method in a derived class.

Returns:
String the sort key coded with pipes.
Throws:
DBException - upon error communicating with the DBObject
ControllerException - upon other errors

setupListSearchCriteria

protected void setupListSearchCriteria()
                                throws DBException,
                                       ControllerException
This method sets the search conditions on the current DBObject. The implementation at this level uses the searchParam if it has been set, you can override this method to use other criteria, like a custom where clause.

Throws:
DBException - upon error communicating with the DBObject
ControllerException - upon other errors

generatePageTransitions

protected Block generatePageTransitions(ControllerRequest request,
                                        RecordPaginator rp,
                                        int pageLimit)
                                 throws ControllerException
Generates an arrayList of transitions to allow direct jumping to a page.

Parameters:
request - The controllerRequest object so we can set the appropriate parameters from the previous page.
rp - a queried and instantiated RecordPaginator object
pageLimit - the maximum number of records per screen.
Returns:
Block of Transition objects.
Throws:
IllegalArgumentException - if isCountRecords() == false or if no search has been run yet.
ControllerException - upon all other errors

addRecordsToBlock

protected void addRecordsToBlock(ArrayList i_AllRecords,
                                 Block myTable)
                          throws DBException,
                                 ControllerException
Given an interator containing database objects add all of those objects to the given output block as rows. All non-secret fields of each object should be added to the row.

Parameters:
i_AllRecords - an arrayList of DBObjects to add to the specified block
myTable - the Block obejct to add the records to.
Throws:
DBException - upon error communicating with the DBObjects
ControllerException - upon other error.

showList

protected void showList()
                 throws DBException,
                        ControllerException
Base class Show a list of database records to the user, allowing the key to be clicked on to request an edit of the object

Throws:
DBException - If a problem occurs retrieving the list
ControllerException

Expresso 5-6

Please see www.jcorporate.com for information about new Expresso releases.