| java.lang.Object com.jcorporate.expresso.core.controller.State com.jcorporate.expresso.services.controller.dbmaint.DynamicCmd
All known Subclasses: com.jcorporate.expresso.services.controller.dbmaint.ViewBlob, com.jcorporate.expresso.services.controller.dbmaint.GetBase, com.jcorporate.expresso.services.controller.dbmaint.ListBase, com.jcorporate.expresso.services.controller.dbmaint.UpdateBase,
DynamicCmd | abstract public class DynamicCmd extends State (Code) | | 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.
author: Michael Nash, contributions by Kevin King et al |
Method Summary | |
protected void | addParams(Transition t) | protected String | decode(String orig) | protected String | getControllerName() Retrieve the name of the controller we use. | protected DBObject | getCurrentDBObj() Return the current database object. | protected DataObject | getDataObject() | protected String | getFieldsParam() | protected Map | getFixedFields() Fixed fields are a hastable of field values keyed to field names that
should not be modified. | protected String | getKeyParameter(DataObject srcDBObj) Create a key parameter for locating the DBObject. | protected DataObject | getMyDataObject() Retrieves an instance of my dataobject instance. | public int | getPageNumber() | protected String | getSearchParam() | protected void | initializeDBObj() Given a class name that contains a DBObject, instantiate an
instance of the object & return it. | protected boolean | isKeyField(String fieldName) | protected DataObject | retrieveMyDBObject() Retrieves the DBObject as specified in the criteria key fields passed
to the DBMaint controller. | public void | run(ControllerRequest newParams, ControllerResponse newResponse) 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. | protected void | setFields(DataObject myDBObj, String fieldPairs) Sets the fields in the production environment. | protected void | setFieldsParam(String newParam) | protected void | setMyDataObject(DataObject myDBObj) Set the 'myDBObj' variable which is, in turn, used by the rest of the
DBMaint controller. | protected void | setSearchParam(String newParam) | protected void | showBlobViewLink(String fieldName, DataObject dbobj, Input myElement, String controller) Create a link that is nested to myElement that is for displaying
a BLOB field. | protected synchronized void | showEditLink(String fieldName, String oneFieldValue, DataObject currentRecord, Output myElement) Show the edit link as often used by the List state or updateupdate state. | protected synchronized void | showEditLink(String fieldName, String oneFieldValue, DataObject currentRecord, Output myElement, String controller) | 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(String theDescrip) |
countTotalRecords | protected boolean countTotalRecords(Code) | | Allows counting total records to be skipped so we can improve
performance on large tables.
|
masterObjKey | public static String masterObjKey(Code) | | 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
|
showNext | protected boolean showNext(Code) | | Flag to determine if we need to show the 'next page' icon
|
showPrev | protected boolean showPrev(Code) | | Flag to determine if we need to show the 'previous page' icon
|
DynamicCmd | public DynamicCmd()(Code) | | Default constructor
|
DynamicCmd | public DynamicCmd(String code, String descrip)(Code) | | Constructor most often used
Parameters: code - The internal name of the state Parameters: descrip - The friendly name of the state |
addParams | protected void addParams(Transition t) throws ControllerException(Code) | | Add the fields, details, search and dbobj parameters to a given transition object
Parameters: t - The Transition to add the appropriate parameters to. throws: ControllerException - upon error |
decode | protected String decode(String orig)(Code) | | Remove %20 from a string replacing it with spaces
Parameters: orig - Original string String Result string with %20 replaced by spaces |
getControllerName | protected String getControllerName() throws ControllerException(Code) | | Retrieve the name of the controller we use. This is much faster than
getController().getClass().getName() because we precalc things once.
java.lang.String throws: ControllerException - upon error |
getCurrentDBObj | protected DBObject getCurrentDBObj() throws ControllerException(Code) | | Return the current database object. It is an error to request this if the
current database object is not initialized
the appropriate DBObject throws: ControllerException - if there is no dbobject associated with thecontroller state |
getFieldsParam | protected String getFieldsParam() throws ControllerException(Code) | | Return the "decoded" 'fields' parameter,
consisting of a series of pipe-delimited fields and values
The fields Parameter as java.lang.String |
getFixedFields | protected Map getFixedFields() throws ControllerException(Code) | | 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
java.util.Map |
getKeyParameter | protected String getKeyParameter(DataObject srcDBObj) throws ControllerException(Code) | | Create a key parameter for locating the DBObject. Used in generating transitions
Parameters: srcDBObj - the DBObject to generate the key for. java.lang.String, the pipe delimited URL encoded keys throws: ControllerException - upon error getting the keys for the DBObject |
getMyDataObject | protected DataObject getMyDataObject()(Code) | | Retrieves an instance of my dataobject instance. Use this in derived
classes to directly access the 'myDataObject' variable.
DataObject instance. |
getPageNumber | public int getPageNumber() throws ControllerException(Code) | | Returns the current page number as specified in the 'page' parameter
integer representing the current page number |
getSearchParam | protected String getSearchParam() throws ControllerException(Code) | | Return the "decoded" search parameter, consisting of a series
of fields and values pipe-delimited
The decoded URL serach parameter throws: ControllerException - upon error |
initializeDBObj | protected void initializeDBObj() throws ControllerException(Code) | | 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)
throws: ControllerException - if the object cannot be created or set up |
isKeyField | protected boolean isKeyField(String fieldName) throws DBException, ControllerException(Code) | | Base class
Is this field a key in the given database object?
Parameters: fieldName - The name of the field to check boolean True if the fieldname is a key field for thecurrent object throws: DBException - If unable to determine if the field is a keydue to other errors |
run | public void run(ControllerRequest newParams, ControllerResponse newResponse) throws ControllerException, NonHandleableException(Code) | | 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
Parameters: newParams - The ControllerRequest object Parameters: newResponse - The ControllerResponse object throws: NonHandleableException - upon fatal error |
setFields | protected void setFields(DataObject myDBObj, String fieldPairs) throws DBException(Code) | | Sets the fields in the production environment.
Parameters: myDBObj - the data object to set the fields to Parameters: fieldPairs - the piped field name|field value parameters throws: DBException - upon error |
setFieldsParam | protected void setFieldsParam(String newParam)(Code) | | Set a encoded 'fields' parameter,
consisting of a series of pipe-delimited fields and values
Parameters: newParam - ?? |
setMyDataObject | protected void setMyDataObject(DataObject myDBObj)(Code) | | 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.
Parameters: myDBObj - the new dataobject to set. |
setSearchParam | protected void setSearchParam(String newParam)(Code) | | Parameters: newParam - The new searching paramter String |
showBlobViewLink | protected void showBlobViewLink(String fieldName, DataObject dbobj, Input myElement, String controller) throws DBException, ControllerException(Code) | | Create a link that is nested to myElement that is for displaying
a BLOB field.
Parameters: fieldName - The name of the field to render the link for. Parameters: dbobj - The DBobject that the field nests in. Parameters: myElement - The Input object that is getting the nested Transition Parameters: controller - The name of the controller to link to |
showEditLink | protected synchronized void showEditLink(String fieldName, String oneFieldValue, DataObject currentRecord, Output myElement) throws DBException, ControllerException(Code) | | Show the edit link as often used by the List state or updateupdate state.
Parameters: fieldName - the name of the field to render as a link Parameters: oneFieldValue - the field's value Parameters: currentRecord - the current data object that the field should beretrieved from. Parameters: myElement - the output element that is going to be decorated throws: DBException - upon data access error throws: ControllerException - upon controller error |
showEditLink | protected synchronized void showEditLink(String fieldName, String oneFieldValue, DataObject currentRecord, Output myElement, String controller) throws DBException, ControllerException(Code) | | Write a hyperlink command that allows edit of the current key
Parameters: fieldName - The name of the field to have the hyperlink Parameters: oneFieldValue - The value of the field Parameters: currentRecord - A DBObject of the current record Parameters: myElement - The cell in the table representing the currentfield of the current record Parameters: controller - the name of the controller to use for the edit link (maybe null) throws: DBException - If the information to build the link cannot beretrieved from the database object |
showOptions | protected void showOptions() throws DBException, ControllerException(Code) | | 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
throws: DBException - If an error occurrs determining what functionsthis user is allowed to perform |
Methods inherited from com.jcorporate.expresso.core.controller.State | protected void add(ControllerElement t) throws ControllerException(Code)(Java Doc) protected void addAutoInput(String fieldName, String friendlyName, String defaultValue, int displayLength, int maxLength, Vector validValues) throws ControllerException(Code)(Java Doc) protected void addAutoInput(String fieldName, String dbClassName, String defaultValue) throws ControllerException(Code)(Java Doc) protected void addAutoInput(String fieldName, String friendlyName, String dbClassName, String defaultValue) throws ControllerException(Code)(Java Doc) protected void addBlock(Block newBlock) throws ControllerException(Code)(Java Doc) public void addError(String newError) throws ControllerException(Code)(Java Doc) protected void addInput(Input newInput) throws ControllerException(Code)(Java Doc) public void addOptionalParameter(String newParam)(Code)(Java Doc) protected void addOutput(Output newOutput) throws ControllerException(Code)(Java Doc) public void addParameter(String newParam, String mask)(Code)(Java Doc) public void addParameter(String newParam, boolean required, String mask)(Code)(Java Doc) public void addParameter(String newParam, boolean required, String mask, String maskError)(Code)(Java Doc) public void addRequiredParameter(String newParam)(Code)(Java Doc) public void addTransition(Transition newTransition) throws ControllerException(Code)(Java Doc) protected void autoValidate(String checkClassName, ErrorCollection errorCollection) throws ValidationException, ControllerException(Code)(Java Doc) protected void autoValidate(String checkClassName, ErrorCollection errorCollection, Vector requiredFields) throws ValidationException, ControllerException(Code)(Java Doc) protected void calculateHandlerName(String stateName)(Code)(Java Doc) protected void checkMask(String paramName, String paramValue, Pattern compiledRegExp) throws ControllerException(Code)(Java Doc) public void checkParamMasks() throws ControllerException(Code)(Java Doc) protected void clearFormCache() throws ControllerException(Code)(Java Doc) public Object clone() throws java.lang.CloneNotSupportedException(Code)(Java Doc) public boolean equals(Object o)(Code)(Java Doc) protected String getAttribute(String attrib)(Code)(Java Doc) public Controller getController() throws ControllerException(Code)(Java Doc) protected ControllerRequest getControllerRequest()(Code)(Java Doc) protected ControllerResponse getControllerResponse()(Code)(Java Doc) protected DBController getDBController() throws ControllerException(Code)(Java Doc) public String getDBName()(Code)(Java Doc) public String getDataContext()(Code)(Java Doc) public String getDescription()(Code)(Java Doc) public String getErrorState()(Code)(Java Doc) public Transition getErrorTransition()(Code)(Java Doc) public ErrorCollection getErrors() throws ControllerException(Code)(Java Doc) protected String getFileName(String paramName)(Code)(Java Doc) protected String getFormCache(String fieldName) throws ControllerException(Code)(Java Doc) public String getHandlerName()(Code)(Java Doc) public String getInitParameter(String paramName)(Code)(Java Doc) public String getName()(Code)(Java Doc) public Object getObjectParameter(String paramName) throws ControllerException(Code)(Java Doc) public Vector getOptionalParameters()(Code)(Java Doc) public List getOptionalParametersList()(Code)(Java Doc) public String getParameter(String paramCode) throws ControllerException(Code)(Java Doc) public Vector getParameters()(Code)(Java Doc) protected PatternMatcher getPatternMatcher()(Code)(Java Doc) public List getRequiredParametersList()(Code)(Java Doc) public ControllerResponse getResponse()(Code)(Java Doc) public Transition getReturnToSender()(Code)(Java Doc) public PersistentSession getSession() throws ControllerException(Code)(Java Doc) public String getStateFormClass()(Code)(Java Doc) protected String getString(String key, Object[] args) throws ControllerException(Code)(Java Doc) protected String getString(String key) throws ControllerException(Code)(Java Doc) public Transition getSuccessTransition()(Code)(Java Doc) protected int getUid() throws ControllerException(Code)(Java Doc) public String getUser()(Code)(Java Doc) public int hashCode()(Code)(Java Doc) public boolean isFileParameter(String paramName)(Code)(Java Doc) protected boolean isParameter(String paramName) throws ControllerException(Code)(Java Doc) public boolean isSecure()(Code)(Java Doc) public void perform(StateForm stateForm, ControllerRequest newRequest, ControllerResponse newResponse) throws NonHandleableException, ControllerException(Code)(Java Doc) public void run(ControllerRequest newRequest, ControllerResponse newResponse) throws ControllerException, NonHandleableException(Code)(Java Doc) protected void saveErrors(ErrorCollection e) throws ControllerException(Code)(Java Doc) public void setController(Controller newController) throws ControllerException(Code)(Java Doc) public void setDescription(String newDescrip)(Code)(Java Doc) public synchronized void setErrorState(String newErrorState)(Code)(Java Doc) public void setErrorTransition(Transition newErrorTransition)(Code)(Java Doc) protected void setFormCache() throws ControllerException(Code)(Java Doc) public void setHandlerName(String newName)(Code)(Java Doc) public synchronized void setMask(String paramName, String mask)(Code)(Java Doc) public synchronized void setMask(String paramName, String mask, String errorMsg)(Code)(Java Doc) public void setMaskError(String paramName, String errorMsg)(Code)(Java Doc) public void setName(String newName)(Code)(Java Doc) protected void setResponse(ControllerResponse res) throws ControllerException(Code)(Java Doc) public void setReturnToSender(Transition newReturnToSender)(Code)(Java Doc) public void setSecure(boolean newSecure)(Code)(Java Doc) public void setStateFormClass(String newStateFormClass)(Code)(Java Doc) public void setSuccessTransition(Transition newSuccessTransition)(Code)(Java Doc) public String toString()(Code)(Java Doc) protected void transition(String newState, ControllerRequest req, ControllerResponse res) throws ControllerException, NonHandleableException(Code)(Java Doc)
|
|
|