Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.jcorporate.expresso.services.controller.dbmaint
Class DynamicCmd  view DynamicCmd download DynamicCmd.java

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

public abstract class DynamicCmd
extends com.jcorporate.expresso.core.controller.State

Base class for all command classes. This class provides the execute() method which all subclasses need to override. IT does some basic functionality that all the DBMaint states need, such as load the given DBObject as specified.


Field Summary
private  java.lang.String controllerName
           
protected  boolean countTotalRecords
          Allows counting total records to be skipped so we can improve performance on large tables.
private  java.lang.String fieldsParam
           
private  java.util.Map fixedFields
          A map of fields that have fixed values (ie cannot be modified by user input)
private static org.apache.log4j.Logger log
          The log4j logger for this system.
static java.lang.String masterObjKey
          If we are handing master/detail DB objects, then the block containing /* the transitions to navigate the master/detail records is stored in session /* under this key
private  com.jcorporate.expresso.core.dataobjects.DataObject myDataObject
          The current dataobject used by the DBMaint subclasses.
private  java.lang.String searchParam
           
protected  boolean showNext
          Flag to determine if we need to show the 'next page' icon
protected  boolean showPrev
          Flag to determine if we need to show the 'previous page' icon
 
Fields inherited from class com.jcorporate.expresso.core.controller.State
NOTEMPTY_MASK, secure
 
Constructor Summary
DynamicCmd()
          Default constructor
DynamicCmd(java.lang.String code, java.lang.String descrip)
          Constructor most often used
 
Method Summary
protected  void addParams(com.jcorporate.expresso.core.controller.Transition t)
          Add the fields, details, search and dbobj parameters to a given transition object
protected  java.lang.String decode(java.lang.String orig)
          Remove %20 from a string replacing it with spaces
protected  java.lang.String getControllerName()
          Retrieve the name of the controller we use.
protected  com.jcorporate.expresso.core.dbobj.DBObject getCurrentDBObj()
          Deprecated. Since Expresso 5.1 Use getDataObject() for compatibility with AutoDBObject, JoinedDataObject, etc. Will be removed in Expresso 5.2
protected  com.jcorporate.expresso.core.dataobjects.DataObject getDataObject()
          Retrieve the data object
protected  java.lang.String getFieldsParam()
          Return the "decoded" 'fields' parameter, consisting of a series of pipe-delimited fields and values
protected  java.util.Map getFixedFields()
          Fixed fields are a hastable of field values keyed to field names that should not be modified.
protected  java.lang.String getKeyParameter(com.jcorporate.expresso.core.dataobjects.DataObject srcDBObj)
          Create a key parameter for locating the DBObject.
protected  com.jcorporate.expresso.core.dataobjects.DataObject getMyDataObject()
          Retrieves an instance of my dataobject instance.
 int getPageNumber()
          Returns the current page number as specified in the 'page' parameter
protected  java.lang.String getSearchParam()
          Return the "decoded" search parameter, consisting of a series of fields and values pipe-delimited
protected  void initializeDBObj()
          Given a class name that contains a DBObject, instantiate an instance of the object & return it.
protected  boolean isKeyField(java.lang.String fieldName)
          Base class Is this field a key in the given database object?
protected  com.jcorporate.expresso.core.dataobjects.DataObject retrieveMyDBObject()
          Retrieves the DBObject as specified in the criteria key fields passed to the DBMaint controller.
 void run(com.jcorporate.expresso.core.controller.ControllerRequest newParams, com.jcorporate.expresso.core.controller.ControllerResponse newResponse)
          All of the sub-classes of DynamicCmd extend the run method to perform their functionality.
protected  void setFields(com.jcorporate.expresso.core.dataobjects.DataObject myDBObj, java.lang.String fieldPairs)
          Sets the fields in the production environment.
protected  void setFieldsParam(java.lang.String newParam)
          Set a encoded 'fields' parameter, consisting of a series of pipe-delimited fields and values
protected  void setMyDataObject(com.jcorporate.expresso.core.dataobjects.DataObject myDBObj)
          Set the 'myDBObj' variable which is, in turn, used by the rest of the DBMaint controller.
protected  void setSearchParam(java.lang.String newParam)
           
protected  void showBlobViewLink(java.lang.String fieldName, com.jcorporate.expresso.core.dataobjects.DataObject dbobj, com.jcorporate.expresso.core.controller.Input myElement, java.lang.String controller)
          Create a link that is nested to myElement that is for displaying a BLOB field.
protected  void showEditLink(java.lang.String fieldName, java.lang.String oneFieldValue, com.jcorporate.expresso.core.dataobjects.DataObject currentRecord, com.jcorporate.expresso.core.controller.Output myElement)
          Show the edit link as often used by the List state or updateupdate state.
protected  void showEditLink(java.lang.String fieldName, java.lang.String oneFieldValue, com.jcorporate.expresso.core.dataobjects.DataObject currentRecord, com.jcorporate.expresso.core.controller.Output myElement, java.lang.String controller)
          Write a hyperlink command that allows edit of the current key
protected  void showOptions()
          Display a small table of icons giving the user the option to proceed directly to a search, add, or list function from this form.
protected  void showUserName(java.lang.String theDescrip)
           
 
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
 

Field Detail

showNext

protected boolean showNext
Flag to determine if we need to show the 'next page' icon


showPrev

protected boolean showPrev
Flag to determine if we need to show the 'previous page' icon


searchParam

private java.lang.String searchParam

masterObjKey

public static java.lang.String masterObjKey
If we are handing master/detail DB objects, then the block containing /* the transitions to navigate the master/detail records is stored in session /* under this key


fieldsParam

private java.lang.String fieldsParam

myDataObject

private com.jcorporate.expresso.core.dataobjects.DataObject myDataObject
The current dataobject used by the DBMaint subclasses.


log

private static transient org.apache.log4j.Logger log
The log4j logger for this system.


fixedFields

private java.util.Map fixedFields
A map of fields that have fixed values (ie cannot be modified by user input)


countTotalRecords

protected boolean countTotalRecords
Allows counting total records to be skipped so we can improve performance on large tables.


controllerName

private java.lang.String controllerName
Constructor Detail

DynamicCmd

public DynamicCmd()
Default constructor


DynamicCmd

public DynamicCmd(java.lang.String code,
                  java.lang.String descrip)
Constructor most often used

Method Detail

setSearchParam

protected void setSearchParam(java.lang.String newParam)

getSearchParam

protected java.lang.String getSearchParam()
                                   throws com.jcorporate.expresso.core.controller.ControllerException
Return the "decoded" search parameter, consisting of a series of fields and values pipe-delimited


setFieldsParam

protected void setFieldsParam(java.lang.String newParam)
Set a encoded 'fields' parameter, consisting of a series of pipe-delimited fields and values


getFieldsParam

protected java.lang.String getFieldsParam()
                                   throws com.jcorporate.expresso.core.controller.ControllerException
Return the "decoded" 'fields' parameter, consisting of a series of pipe-delimited fields and values


getFixedFields

protected java.util.Map getFixedFields()
                                throws com.jcorporate.expresso.core.controller.ControllerException

Fixed fields are a hastable of field values keyed to field names that should not be modified. The Input of a fixed field should be rendered read only.

The fields that are fixed can be defined in the 'fields' parameter by specifying which fields should be fixed. This is useful for master/ detail relationship specifications


decode

protected java.lang.String decode(java.lang.String orig)
Remove %20 from a string replacing it with spaces


run

public void run(com.jcorporate.expresso.core.controller.ControllerRequest newParams,
                com.jcorporate.expresso.core.controller.ControllerResponse newResponse)
         throws com.jcorporate.expresso.core.controller.ControllerException,
                com.jcorporate.expresso.core.controller.NonHandleableException
All of the sub-classes of DynamicCmd extend the run method to perform their functionality.

This part of run is an important part in the it adds what is known as the 'nav block' to the jsp pages. It also loads a dbobject into memory corresponding to the dbobject specified by the DBMaint parameters


isKeyField

protected boolean isKeyField(java.lang.String fieldName)
                      throws com.jcorporate.expresso.core.db.DBException,
                             com.jcorporate.expresso.core.controller.ControllerException
Base class Is this field a key in the given database object?


showOptions

protected void showOptions()
                    throws com.jcorporate.expresso.core.db.DBException,
                           com.jcorporate.expresso.core.controller.ControllerException

Display a small table of icons giving the user the option to proceed directly to a search, add, or list function from this form. Only the functions this user are allowed to do are shown

If the record being displayed is a 'detail' record, then 'search' and 'fields' paramters are added. This helps specify the criteria (meaning all items here must have the same key as the master

*


showUserName

protected void showUserName(java.lang.String theDescrip)
                     throws com.jcorporate.expresso.core.controller.ControllerException

initializeDBObj

protected void initializeDBObj()
                        throws com.jcorporate.expresso.core.controller.ControllerException
Given a class name that contains a DBObject, instantiate an instance of the object & return it. Also associates the current user name (from the session) with the object so that requests to maniupluate the object can be passed through appropriate security (If the DBObject is of type SecuredDBObject)


getCurrentDBObj

protected com.jcorporate.expresso.core.dbobj.DBObject getCurrentDBObj()
                                                               throws com.jcorporate.expresso.core.controller.ControllerException
Deprecated. Since Expresso 5.1 Use getDataObject() for compatibility with AutoDBObject, JoinedDataObject, etc. Will be removed in Expresso 5.2

Return the current database object. It is an error to request this if the current database object is not initialized


getDataObject

protected com.jcorporate.expresso.core.dataobjects.DataObject getDataObject()
                                                                     throws com.jcorporate.expresso.core.controller.ControllerException
Retrieve the data object


getPageNumber

public int getPageNumber()
                  throws com.jcorporate.expresso.core.controller.ControllerException
Returns the current page number as specified in the 'page' parameter


setFields

protected void setFields(com.jcorporate.expresso.core.dataobjects.DataObject myDBObj,
                         java.lang.String fieldPairs)
                  throws com.jcorporate.expresso.core.db.DBException
Sets the fields in the production environment.


addParams

protected void addParams(com.jcorporate.expresso.core.controller.Transition t)
                  throws com.jcorporate.expresso.core.controller.ControllerException
Add the fields, details, search and dbobj parameters to a given transition object


showEditLink

protected void showEditLink(java.lang.String fieldName,
                            java.lang.String oneFieldValue,
                            com.jcorporate.expresso.core.dataobjects.DataObject currentRecord,
                            com.jcorporate.expresso.core.controller.Output myElement)
                     throws com.jcorporate.expresso.core.db.DBException,
                            com.jcorporate.expresso.core.controller.ControllerException
Show the edit link as often used by the List state or updateupdate state.


showBlobViewLink

protected void showBlobViewLink(java.lang.String fieldName,
                                com.jcorporate.expresso.core.dataobjects.DataObject dbobj,
                                com.jcorporate.expresso.core.controller.Input myElement,
                                java.lang.String controller)
                         throws com.jcorporate.expresso.core.db.DBException,
                                com.jcorporate.expresso.core.controller.ControllerException
Create a link that is nested to myElement that is for displaying a BLOB field.


showEditLink

protected void showEditLink(java.lang.String fieldName,
                            java.lang.String oneFieldValue,
                            com.jcorporate.expresso.core.dataobjects.DataObject currentRecord,
                            com.jcorporate.expresso.core.controller.Output myElement,
                            java.lang.String controller)
                     throws com.jcorporate.expresso.core.db.DBException,
                            com.jcorporate.expresso.core.controller.ControllerException
Write a hyperlink command that allows edit of the current key


getKeyParameter

protected java.lang.String getKeyParameter(com.jcorporate.expresso.core.dataobjects.DataObject srcDBObj)
                                    throws com.jcorporate.expresso.core.controller.ControllerException
Create a key parameter for locating the DBObject. Used in generating transitions


retrieveMyDBObject

protected com.jcorporate.expresso.core.dataobjects.DataObject retrieveMyDBObject()
                                                                          throws com.jcorporate.expresso.core.db.DBException,
                                                                                 com.jcorporate.expresso.core.controller.ControllerException
Retrieves the DBObject as specified in the criteria key fields passed to the DBMaint controller.


setMyDataObject

protected void setMyDataObject(com.jcorporate.expresso.core.dataobjects.DataObject myDBObj)
Set the 'myDBObj' variable which is, in turn, used by the rest of the DBMaint controller. Use this in derived classes to directly manipulate the dbobject.


getMyDataObject

protected com.jcorporate.expresso.core.dataobjects.DataObject getMyDataObject()
Retrieves an instance of my dataobject instance. Use this in derived classes to directly access the 'myDataObject' variable.


getControllerName

protected java.lang.String getControllerName()
                                      throws com.jcorporate.expresso.core.controller.ControllerException
Retrieve the name of the controller we use. This is much faster than getController().getClass().getName() because we precalc things once.