Expresso 5-6

com.jcorporate.expresso.core.controller
Class ControllerResponse

java.lang.Object
  extended bycom.jcorporate.expresso.core.controller.ControllerResponse
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
ServletControllerResponse

public class ControllerResponse
extends Object
implements Serializable

A ControllerResponse object contains the vector of Inputs, Outputs and Transitions that results from a call to "newState(String)" for a particular controller.

Once a state has been processed, the ControllerResponse object is usually saved in the Servlet Request Context where it can be retrieved by JSP tags by querying the request context for an object named "controllerResponse"

See Also:
Serialized Form

Field Summary
protected  HashMap blockCache
          A name to value map of blocks
protected  Vector blockCacheOrdered
          A list of all blocks in the order they were added to the response
protected  State currentState
          The current state
protected  boolean customResponse
          NOTE: Any Controller that must access the HttpServletResponse object available from the ControllerRequest object and handle making it's own response to the client (e.g. a custom mime type, multimedia stream, etc), should call setCustomResponse(true) to tell the caller that it should not try to format the Outputs, Inputs, and Transitions from this controller call.
protected  String dataContext
          The data context for this controller response
protected  HashMap inputCache
          The name to value map for inputs
protected  Vector inputCacheOrdered
          A list of all inputs as added to the response
protected  String myControllerClass
          The classname of this controller
protected  ControllerRequest myRequest
          The ControllerRequest object set for this response
protected  String myRequestPath
          The request path
protected  HashMap outputCache
          A name to value map for outputs
protected  Vector outputCacheOrdered
          A list of all outputs in the order they were added to the response
protected  String requestedState
          The requested state name
protected  Locale responseLocale
          Object for setting the Locale object
protected  String style
          The resulting style code
protected  String title
          The title of the ControllerResponse
protected  HashMap transitionCache
          A name to value map for Transitions
protected  Vector transitionCacheOrdered
          A list of all transitions in the order they were added to the response
 
Constructor Summary
ControllerResponse()
          Default constructor for the controller response
 
Method Summary
 void add(ControllerElement t)
          Convenience method to allow us to add any ControllerElement to this controllers inputs, outputs or transitions
 void addAutoInput(DBObject myDBObj)
          Convenience method to add an input for every non-secret field in a db object to the current response, using the default values and valid values provided by the db object itself
 void addAutoInput(String fieldName, DBObject dbobj, String defaultValue)
          addAutoInput is a convenience method that creates a new Input object based on the specified field parameters and adds the input object to this controller object.
 void addAutoInput(String fieldName, String dbClassName, String defaultValue)
          addAutoInput is a convenience method that creates a new Input object based on the specified field parameters and adds the input object to this controller object.
 void addAutoInput(String fieldName, String friendlyName, String defaultValue, int displayLength, int maxLength, Vector validValues)
          addAutoInput is a convenience method that creates a new Input object based on the specified field parameters and adds the input object to this controller object.
 void addAutoInput(String fieldName, String friendlyName, String defaultValue, int displayLength, int maxLength, Vector validValues, String fieldType)
          addAutoInput is a convenience method that creates a new Input object based on the specified field parameters and adds the input object to this controller object.
 void addAutoInput(String fieldName, String friendlyName, String dbClassName, String defaultValue)
          addAutoInput is a convenience method that creates a new Input object based on the specified field parameters and adds the input object to this controller object.
 void addAutoInputRenameField(String fieldName, String renameFieldTo, DBObject dbobj, String defaultValue)
          addAutoInputRenameField is a convenience method that creates a new Input object based on the specified field parameters and adds the input object to this controller object.
 void addBlock(Block newBlock)
          Adds a Block to the response that will be formatted by the controller handler
 void addError(String errorMessage)
           
 void addError(String errorMessage, Object arg)
          add an error code, and an associated arg for translating that error code
 void addError(String errorMessage, Object[] args)
          add an error code, and associated args for translating that error code
 void addError(String propName, String errorMessage)
          Deprecated. 7/04 v5.5 expresso uses only one property name, the default; use addError(String errmsg) instead
 void addInput(Input newInput)
          Add an Input to the ControllerResponse
 void addOutput(Output newOutput)
          Add an Output to the controller response object
 void addTransition(Transition newTransition)
          Add a Transition to this ControllerResponse
 void autoValidate(String checkClassName, ErrorCollection errorCollection)
          AutoValidate is a quick way to validate the fields of a specified dbobj.
 void autoValidate(String checkClassName, ErrorCollection errorCollection, Vector requiredFields)
          AutoValidate is a quick way to validate the fields of a specified dbobj.
 void clearAttributes()
          Clear the Attribute values
 void clearBlockCache()
           
 void clearFormCache()
          Completely clear the internal formResponseCache Creation date: (7/19/00 6:53:58 PM) author: Adam Rossi, PlatinumSolutions
 void clearInputCache()
          Clear the input cache
 void clearOutputCache()
          Clear the output cache
 void clearTransitionCache()
           
static ControllerResponse fromXML(org.w3c.dom.Node n)
          Assemble a ControllerResponse from an xml document (may be document fragment).
 String getAttribute(String attrib)
          Retrieve an attribute as specified from the request
 Map getAttributes()
          Get the attribute Map
 Block getBlock(String blockName)
          Get a specific block.
 Vector getBlocks()
          Return the vector of Blocks for this controller state to the client
 String getControllerClass()
          Retrieve the controller class name
 State getCurrentState()
          Return the current State object, based on the state we last transitioned into
 String getDataContext()
          Get the database from the request, if there is a request available
 String getDBName()
          Get the database from the request, if there is a request available
protected  DefaultForm getDefaultForm()
          Retrieve the DefaultForm object
 ErrorCollection getErrors()
          Retrieve the error collection for this response
 Hashtable getFormCache()
          Get the entire formResponseCache Hashtable Creation date: (7/19/00 7:18:51 PM) author: Adam Rossi, PlatinumSolutions
 String getFormCache(String fieldName)
          Fetch the requested field from the response cache.
 Object getFormCacheAttribute(String fieldName)
          Gets the saved cache attribute.
 Input getInput(String inputName)
          Return a specific Input item.
 Vector getInputs()
          Return the vector of input items for this controller state to the client.
 Locale getLocale()
          Retrieve the Locale for the request
 String getName()
          get title title and name are synonymous--easier for JSTL
 Map getNamedBlocks()
          Retrieve the Blocks as a map so that JSTL can cope with navigating the ControllerResponse through a named fashion
 Map getNamedInputs()
          Retrieve the Inputs as a map so that JSTL can cope with navigating the ControllerResponse through a named fashion
 Map getNamedOutputs()
          Retrieve the Outputs as a map so that JSTL can cope with navigating the ControllerResponse through a named fashion
 Map getNamedTransitions()
          Retrieve the Transitions as a map so that JSTL can cope with navigating the ControllerResponse through a named fashion
 Map getNestedMap()
          Useful for JSTL iteration of all items in response.
 Output getOutput(String outputName)
          Get a specific output item.
 String getOutputContent(String outputName)
          Get the contents of a particular Output item.
 Output getOutputRequired(String outputName)
          Get the named output, but throw if it's not found.
 Vector getOutputs()
          The client calls this method for each state to determine what output to show to the user.
 String getParameter(String paramName)
          Retrieve the parameter
 ControllerRequest getRequest()
          Retrieve the ControllerRequest associated with this object
 String getRequestedState()
          Retrieve the requested state
 String getRequestPath()
          Returns the request path set earlier.
 String getSchema()
          Get the name of the schema object that this Controller belongs to
 Stack getSchemaStack()
          Retrieve the schema stack.
 String getString(String stringCode)
          Convenience version of the above with no arguments.
 String getString(String stringCode, Object[] args)
          retrieve an appropriate localized string from the correct Schema object.
 String getString(String stringCode, String string1)
          Convenience method of getString(String,Object[]) where first (and only) param of args will be string1
 String getString(String stringCode, String string1, String string2)
          Convenience method to retrieve the string with two formatting parameters
 String getString(String stringCode, String string1, String string2, String string3)
          Retrieve a localized string with 3 formatting parameters
 String getString(String stringCode, String string1, String string2, String string3, String string4)
          Retrieve a localized string with 4 formatting parameters
 String getStyle()
          Retrieve the style that the controller response is set to
 String getTitle()
          get title title and name are synonymous--easier for JSTL
 String getTitleKey()
          return raw key, without running through msg bundle string translation--useful for when 'cloning' in Transition
 Transition getTransition(String transitionName)
          Get a specific transition item.
 Vector getTransitions()
          The getTransitions method is called by the client to this controller in order to determine what the possible next states are from the current state.
 String getUser()
          Get the database from the request, if there is a request available
 boolean hasErrors()
          determine whether response has errors
 boolean hasErrors(String label)
          determine whether response has errors of the particular label
 boolean isCustomResponse()
          Did this Controller call directly manipulate the ServletResponse and handle it's own output to the client?
 void restoreForm()
          Restore the controller form
 void saveErrors(ErrorCollection errorCollection)
          This method saves an ErrorCollection object to the request attributes collection.
 void setAttribute(String attrib, String val)
          Set the named attribute of this Controller to the given value
 void setAttributes(Map attributes)
          Set the attribute Map
 void setControllerClass(String newClass)
          Set public so that test classes can get into it.
 void setCustomResponse(boolean newCustom)
          If absolutely necessary the Controller can access the ServletResponse object directly from the ServletControllerRequest object, if the controller is running in a servlet environment.
 void setDBName(String newDBName)
          Set the db name of this ControllerResponse
 void setFormCache()
          Automatically find all input fields and put them in the formCache.
 void setFormCache(String fieldName, String fieldValue)
          Save a name/value pair to the formCache.
 void setFormCacheAttribute(String fieldName, Object fieldAttribute)
          Allows the generic setting of form attributes.
 void setRequest(ControllerRequest newRequest)
          Set the controller request - this is done as part of the processing of the controller so that the response has access to all of the request fields
 void setRequestPath(String newPath)
          Sets the request path
protected  void setSchema(String schemaClass)
          Tell this Controller object what Schema it belongs to.
 void setSchemaStack(Stack schemaStack)
          Sets the schema stack for message bundle retrieval
 void setStyle(String newStyle)
          Use setStyle to specify a different Struts ActionForward to send the rendering to rather then the default one.
 void setTitle(String newTitle)
          Sets the title of the controller
 void setUser(String newUser)
          Set the user string value
 String toXML()
          Convert the controller response to an xml document fragment.
 void validate(ValidationSet validSet, ErrorCollection errorCollection)
          Deprecated. See ControllerRequest.validateDBObject instead....
protected  boolean validState()
          Check to see if we are currently in a valid state
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

myRequest

protected ControllerRequest myRequest
The ControllerRequest object set for this response


responseLocale

protected Locale responseLocale
Object for setting the Locale object


blockCache

protected HashMap blockCache
A name to value map of blocks


inputCache

protected HashMap inputCache
The name to value map for inputs


outputCache

protected HashMap outputCache
A name to value map for outputs


transitionCache

protected HashMap transitionCache
A name to value map for Transitions


currentState

protected State currentState
The current state


myControllerClass

protected String myControllerClass
The classname of this controller


dataContext

protected String dataContext
The data context for this controller response


myRequestPath

protected String myRequestPath
The request path


requestedState

protected String requestedState
The requested state name


style

protected String style
The resulting style code


title

protected String title
The title of the ControllerResponse


blockCacheOrdered

protected Vector blockCacheOrdered
A list of all blocks in the order they were added to the response


inputCacheOrdered

protected Vector inputCacheOrdered
A list of all inputs as added to the response


outputCacheOrdered

protected Vector outputCacheOrdered
A list of all outputs in the order they were added to the response


transitionCacheOrdered

protected Vector transitionCacheOrdered
A list of all transitions in the order they were added to the response


customResponse

protected boolean customResponse
NOTE: Any Controller that must access the HttpServletResponse object available from the ControllerRequest object and handle making it's own response to the client (e.g. a custom mime type, multimedia stream, etc), should call setCustomResponse(true) to tell the caller that it should not try to format the Outputs, Inputs, and Transitions from this controller call. Use only when absolutely required!

Constructor Detail

ControllerResponse

public ControllerResponse()
Default constructor for the controller response

Method Detail

setAttribute

public void setAttribute(String attrib,
                         String val)
                  throws ControllerException
Set the named attribute of this Controller to the given value

Parameters:
attrib - The name of an "attribtue" for this ControllerElement item
val - The value for this attribute
Throws:
ControllerException - upon error

getAttribute

public String getAttribute(String attrib)
                    throws ControllerException
Retrieve an attribute as specified from the request

Parameters:
attrib - The name of an "attribute" for this ControllerElement item
Returns:
the attribute value (may be null)
Throws:
ControllerException - upon error

setAttributes

public void setAttributes(Map attributes)
                   throws ControllerException
Set the attribute Map

Parameters:
attributes - the supplied attribute values
Throws:
ControllerException - upon error

getAttributes

public Map getAttributes()
                  throws ControllerException
Get the attribute Map

Returns:
an java.util.Map of Strings
Throws:
ControllerException - upon error

getBlock

public Block getBlock(String blockName)
               throws ControllerException
Get a specific block.

Parameters:
blockName - the name of the Block
Returns:
Block instance or null if no block found.
Throws:
ControllerException - upon error

getBlocks

public final Vector getBlocks()
Return the vector of Blocks for this controller state to the client

Returns:
Vector of Block objects

setControllerClass

public void setControllerClass(String newClass)
Set public so that test classes can get into it.

Parameters:
newClass - the new controller class name

getControllerClass

public String getControllerClass()
Retrieve the controller class name

Returns:
java.lang.String, the name of the controller class

getCurrentState

public State getCurrentState()
Return the current State object, based on the state we last transitioned into

Returns:
java.lang.String the current state

getInput

public final Input getInput(String inputName)
Return a specific Input item.

Parameters:
inputName - the name of the input to retrieve
Returns:
Input

getInputs

public final Vector getInputs()
Return the vector of input items for this controller state to the client.

Returns:
java.util.Vector of Input objects

setCustomResponse

public void setCustomResponse(boolean newCustom)
If absolutely necessary the Controller can access the ServletResponse object directly from the ServletControllerRequest object, if the controller is running in a servlet environment. For example, if a custom mime-type must be set, a multimedia data stream returned, or other special processing. If this is done, the method below should be called so that the "container" that called this Controller knows that the response object has been manipulated, and that it should not perform the normal processing of Inputs, Outputs and Transitions.

Parameters:
newCustom - set to true if you don't want Struts to render the response through JSP

isCustomResponse

public boolean isCustomResponse()
Did this Controller call directly manipulate the ServletResponse and handle it's own output to the client? (This is NOT recommended)

Returns:
true if the controller IS sending a custom response

setDBName

public void setDBName(String newDBName)
               throws ControllerException
Set the db name of this ControllerResponse

Parameters:
newDBName - the new database name
Throws:
ControllerException - upon error

getDBName

public String getDBName()
                 throws ControllerException
Get the database from the request, if there is a request available

Returns:
the database context that the system is set for.
Throws:
ControllerException - upon error

getDataContext

public String getDataContext()
                      throws ControllerException
Get the database from the request, if there is a request available

Returns:
the database context that the system is set for.
Throws:
ControllerException - upon error

setFormCache

public void setFormCache()
                  throws ControllerException
Automatically find all input fields and put them in the formCache. Creation date: (7/19/00 7:22:11 PM) author: Adam Rossi, PlatinumSolutions

Throws:
ControllerException - upon error

setFormCache

public void setFormCache(String fieldName,
                         String fieldValue)
                  throws ControllerException
Save a name/value pair to the formCache. Creation date: (7/20/00 1:14:14 PM)

Parameters:
fieldName - java.lang.String
fieldValue - java.lang.String
Throws:
ControllerException - upon error

getFormCache

public Hashtable getFormCache()
                       throws ControllerException
Get the entire formResponseCache Hashtable Creation date: (7/19/00 7:18:51 PM) author: Adam Rossi, PlatinumSolutions

Returns:
Hashtable of ControllerElements
Throws:
ControllerException - upon error

getFormCache

public String getFormCache(String fieldName)
                    throws ControllerException
Fetch the requested field from the response cache. Return an empty string if not found. Creation date: (7/19/00 7:18:51 PM) author: Adam Rossi, PlatinumSolutions

Parameters:
fieldName - java.lang.String
Returns:
java.lang.String
Throws:
ControllerException - upon error

setFormCacheAttribute

public void setFormCacheAttribute(String fieldName,
                                  Object fieldAttribute)
                           throws ControllerException
Allows the generic setting of form attributes.

Parameters:
fieldName - the name of the field attribute to set
fieldAttribute - the attribute to set it to
Throws:
ControllerException - if the fieldName is blank or null

getFormCacheAttribute

public Object getFormCacheAttribute(String fieldName)
                             throws ControllerException
Gets the saved cache attribute.

Parameters:
fieldName - the name of the field to retrieve
Returns:
Object the cache attribute
Throws:
ControllerException - if the fieldName specified is blank or null.

getLocale

public Locale getLocale()
                 throws ControllerException
Retrieve the Locale for the request

Returns:
Locale object or default locale if noen was set
Throws:
ControllerException - upon error

getNamedInputs

public Map getNamedInputs()
                   throws ControllerException
Retrieve the Inputs as a map so that JSTL can cope with navigating the ControllerResponse through a named fashion

Returns:
java.util.Map
Throws:
ControllerException - upon error

getOutput

public Output getOutput(String outputName)
                 throws ControllerException
Get a specific output item.

Parameters:
outputName - the name of the output to retrieve
Returns:
Output
Throws:
ControllerException - upon error

getOutputContent

public String getOutputContent(String outputName)
                        throws ControllerException
Get the contents of a particular Output item.

Parameters:
outputName - the name of the output to retrieve
Returns:
java.lang.String the content of the named output
Throws:
ControllerException - If there is no such output

getOutputRequired

public Output getOutputRequired(String outputName)
                         throws ControllerException
Get the named output, but throw if it's not found.

Parameters:
outputName - the name of the output to retrieve
Returns:
Output object
Throws:
ControllerException - if the output cannot be found

getOutputs

public final Vector getOutputs()
The client calls this method for each state to determine what output to show to the user.

Returns:
Vector of Output objects

getErrors

public ErrorCollection getErrors()
                          throws ControllerException
Retrieve the error collection for this response

Returns:
ErrorCollection (may be null)
Throws:
ControllerException - upon error reading from the session

getParameter

public String getParameter(String paramName)
                    throws ControllerException
Retrieve the parameter

Parameters:
paramName - the name of the parameter to retrieve
Returns:
java.lang.String or null if the parameter doesn't exist
Throws:
ControllerException - upon error

setRequest

public void setRequest(ControllerRequest newRequest)
                throws ControllerException
Set the controller request - this is done as part of the processing of the controller so that the response has access to all of the request fields

Parameters:
newRequest - the new controller request.
Throws:
ControllerException - upon error

getRequest

public ControllerRequest getRequest()
Retrieve the ControllerRequest associated with this object

Returns:
ControllerRequest object
Throws:
IllegalArgumentException - if the setRequest() object has not been set yet.

setRequestPath

public void setRequestPath(String newPath)
Sets the request path

Parameters:
newPath - the URL path without the .do at the end of it.

getRequestPath

public String getRequestPath()
Returns the request path set earlier. (Note we moved the +".do" to setRequestPath because we set less often than we get, so we do less string allocations)

Returns:
java.lang.String

getRequestedState

public String getRequestedState()
Retrieve the requested state

Returns:
state name requested

getSchema

public String getSchema()
Get the name of the schema object that this Controller belongs to

Returns:
java.lang.String, the Schema classname associated with this ControllerResponse.

setSchemaStack

public void setSchemaStack(Stack schemaStack)
Sets the schema stack for message bundle retrieval

Parameters:
schemaStack - the Stack to use.

getSchemaStack

public Stack getSchemaStack()
Retrieve the schema stack. Walk up the schema stack to check a hierarchy of MessagesBundles for a possible message

Returns:
java.util.Stack

getString

public String getString(String stringCode,
                        Object[] args)
                 throws ControllerException
retrieve an appropriate localized string from the correct Schema object. This version of the call is overridden with more sophisticated versions in DBController (which knows the username)

Parameters:
stringCode - the String code to retrieve
args - the formatting arguments
Returns:
translated string or stringCode if not found
Throws:
ControllerException - upon error

getString

public String getString(String stringCode)
                 throws ControllerException
Convenience version of the above with no arguments.

Parameters:
stringCode - the string code to retrieve
Returns:
java.lang.String
Throws:
ControllerException - upon error

getString

public String getString(String stringCode,
                        String string1)
                 throws ControllerException
Convenience method of getString(String,Object[]) where first (and only) param of args will be string1

Parameters:
stringCode - the string code to retrieve
string1 - a single parameter for message format (the first argument to replace)
Returns:
translated string or stringCode if not found
Throws:
ControllerException - upon error

getString

public String getString(String stringCode,
                        String string1,
                        String string2)
                 throws ControllerException
Convenience method to retrieve the string with two formatting parameters

Parameters:
stringCode - the string code to retrieve
string1 - formatting parameter one
string2 - formatting parameter two
Returns:
java.lang.String
Throws:
ControllerException - upon error

getString

public String getString(String stringCode,
                        String string1,
                        String string2,
                        String string3)
                 throws ControllerException
Retrieve a localized string with 3 formatting parameters

Parameters:
stringCode - the string code to retrieve
string1 - formatting parameter one
string2 - formatting parameter two
string3 - formatting parameter number three
Returns:
java.lang.String
Throws:
ControllerException - upon error

getString

public String getString(String stringCode,
                        String string1,
                        String string2,
                        String string3,
                        String string4)
                 throws ControllerException
Retrieve a localized string with 4 formatting parameters

Parameters:
stringCode - the string code to retrieve
string1 - formatting parameter one
string2 - formatting parameter two
string3 - formatting parameter number three
string4 - formatting parameter number four
Returns:
java.lang.String
Throws:
ControllerException - upon error

setStyle

public void setStyle(String newStyle)
Use setStyle to specify a different Struts ActionForward to send the rendering to rather then the default one.

Parameters:
newStyle - the new style string. Must be in one of the struts-config.xml files.

getStyle

public String getStyle()
Retrieve the style that the controller response is set to

Returns:
java.lang.String

setTitle

public void setTitle(String newTitle)
Sets the title of the controller

Parameters:
newTitle - the new title for the controller

fromXML

public static ControllerResponse fromXML(org.w3c.dom.Node n)
                                  throws ControllerException
Assemble a ControllerResponse from an xml document (may be document fragment).

Parameters:
n - a DOM node to assemble the response from.
Returns:
an instantiated ControllerResponse object
Throws:
ControllerException - upon error

getName

public String getName()
get title title and name are synonymous--easier for JSTL

Returns:
java.lang.String The Title of the controller

getTitle

public String getTitle()
get title title and name are synonymous--easier for JSTL

Returns:
java.lang.String The Title of the controller

getTransition

public Transition getTransition(String transitionName)
                         throws ControllerException
Get a specific transition item.

Parameters:
transitionName - the name of the transition
Returns:
Transition named in parameter
Throws:
ControllerException - upon error

getTransitions

public final Vector getTransitions()
The getTransitions method is called by the client to this controller in order to determine what the possible next states are from the current state. The controller uses the contents of the current state (e.g. parameters) to determine where it is possible for this user to go next.

Returns:
A Vector of Transition objects representing the transitions that can be taken by the user at this point to select new states

getNamedBlocks

public Map getNamedBlocks()
                   throws ControllerException
Retrieve the Blocks as a map so that JSTL can cope with navigating the ControllerResponse through a named fashion

Returns:
java.util.Map
Throws:
ControllerException - upon error

getNamedOutputs

public Map getNamedOutputs()
                    throws ControllerException
Retrieve the Outputs as a map so that JSTL can cope with navigating the ControllerResponse through a named fashion

Returns:
java.util.Map
Throws:
ControllerException - upon error

getNamedTransitions

public Map getNamedTransitions()
                        throws ControllerException
Retrieve the Transitions as a map so that JSTL can cope with navigating the ControllerResponse through a named fashion

Returns:
java.util.Map
Throws:
ControllerException - upon error

setUser

public void setUser(String newUser)
             throws ControllerException
Set the user string value

Parameters:
newUser - the new user.
Throws:
ControllerException - upon error

getUser

public String getUser()
               throws ControllerException
Get the database from the request, if there is a request available

Returns:
the User as specified by the request.
Throws:
ControllerException - upon error

add

public void add(ControllerElement t)
         throws ControllerException
Convenience method to allow us to add any ControllerElement to this controllers inputs, outputs or transitions

Parameters:
t - the new ControllerElement
Throws:
ControllerException - upon error [Such as if the ControllerElement is an unrecognized type]

addAutoInput

public void addAutoInput(String fieldName,
                         String friendlyName,
                         String defaultValue,
                         int displayLength,
                         int maxLength,
                         Vector validValues)
                  throws ControllerException
addAutoInput is a convenience method that creates a new Input object based on the specified field parameters and adds the input object to this controller object. Creation date: (7/20/00 3:43:14 PM)

Parameters:
fieldName - java.lang.String
friendlyName - the friendly name
defaultValue - java.lang.String
displayLength - the length of the display
maxLength - the maximum length of the input
validValues - a Vector of valid value objects for dropdowns
Throws:
ControllerException - upon error

addAutoInput

public void addAutoInput(String fieldName,
                         DBObject dbobj,
                         String defaultValue)
                  throws ControllerException
addAutoInput is a convenience method that creates a new Input object based on the specified field parameters and adds the input object to this controller object. Creation date: (7/20/00 3:43:14 PM) author: Shash Chatterjee

Parameters:
fieldName - java.lang.String
dbobj - com.jcorporate.expresso.core.dbobj.DBObject
defaultValue - java.lang.String
Throws:
ControllerException - upon error

addAutoInput

public void addAutoInput(String fieldName,
                         String dbClassName,
                         String defaultValue)
                  throws ControllerException
addAutoInput is a convenience method that creates a new Input object based on the specified field parameters and adds the input object to this controller object. Creation date: (7/20/00 3:43:14 PM) author: Adam Rossi, PlatinumSolutions

Parameters:
fieldName - java.lang.String
dbClassName - java.lang.String
defaultValue - java.lang.String
Throws:
ControllerException - upon error

addAutoInput

public void addAutoInput(DBObject myDBObj)
                  throws ControllerException
Convenience method to add an input for every non-secret field in a db object to the current response, using the default values and valid values provided by the db object itself

Parameters:
myDBObj - the dbobject to render to the controller response
Throws:
ControllerException - upon error

addAutoInput

public void addAutoInput(String fieldName,
                         String friendlyName,
                         String dbClassName,
                         String defaultValue)
                  throws ControllerException
addAutoInput is a convenience method that creates a new Input object based on the specified field parameters and adds the input object to this controller object. Creation date: (7/20/00 3:43:14 PM) author: Adam Rossi, PlatinumSolutions

Parameters:
fieldName - java.lang.String
friendlyName - the description of the Input to set.
dbClassName - java.lang.String
defaultValue - java.lang.String
Throws:
ControllerException - upon error

addAutoInput

public void addAutoInput(String fieldName,
                         String friendlyName,
                         String defaultValue,
                         int displayLength,
                         int maxLength,
                         Vector validValues,
                         String fieldType)
                  throws ControllerException
addAutoInput is a convenience method that creates a new Input object based on the specified field parameters and adds the input object to this controller object. Creation date: (7/20/00 3:43:14 PM)

Parameters:
fieldName - java.lang.String
friendlyName - the description of the input
defaultValue - java.lang.String
displayLength - display size of the Input
maxLength - the maximum input length
validValues - valid value Vector if needed for dropdown boxes
fieldType - the type of the field such as "datetime", "varchar", etc
Throws:
ControllerException - upon error

addAutoInputRenameField

public void addAutoInputRenameField(String fieldName,
                                    String renameFieldTo,
                                    DBObject dbobj,
                                    String defaultValue)
                             throws ControllerException
addAutoInputRenameField is a convenience method that creates a new Input object based on the specified field parameters and adds the input object to this controller object. This variation on addAutoInput allows a user to force a field to be renamed in the INPUT object. This is important when you have two DBOBjects with the same field name rendering on the same page, and you still want to use AddAutoInput. Creation date: 1/17/2002

Parameters:
fieldName - java.lang.String
renameFieldTo - the field to rename to
dbobj - com.jcorporate.expresso.core.dbobj.DBObject
defaultValue - java.lang.String
Throws:
ControllerException - upon error

addBlock

public void addBlock(Block newBlock)
              throws ControllerException
Adds a Block to the response that will be formatted by the controller handler

Parameters:
newBlock - the block instance to add
Throws:
ControllerException - upon error

addError

public void addError(String errorMessage)
              throws ControllerException
Parameters:
errorMessage -
Throws:
ControllerException

addError

public void addError(String errorMessage,
                     Object arg)
              throws ControllerException
add an error code, and an associated arg for translating that error code

Parameters:
errorMessage - key to error msg found in message bundle
arg - a replacement value to use in ${} replacement template
Throws:
ControllerException
See Also:
MessageBundle.getString(java.lang.String, java.lang.Object[])

addError

public void addError(String errorMessage,
                     Object[] args)
              throws ControllerException
add an error code, and associated args for translating that error code

Parameters:
errorMessage - key to error msg found in message bundle
args - an array of replacement value to use in ${} replacement templates
Throws:
ControllerException
See Also:
MessageBundle.getString(java.lang.String, java.lang.Object[])

addError

public void addError(String propName,
                     String errorMessage)
              throws ControllerException
Deprecated. 7/04 v5.5 expresso uses only one property name, the default; use addError(String errmsg) instead

Parameters:
propName -
errorMessage -
Throws:
ControllerException

addInput

public void addInput(Input newInput)
              throws ControllerException
Add an Input to the ControllerResponse

Parameters:
newInput - the Input to add to the ControllerResponse
Throws:
ControllerException - upon error

addOutput

public void addOutput(Output newOutput)
               throws ControllerException
Add an Output to the controller response object

Parameters:
newOutput - the new output to add
Throws:
ControllerException - upon error

addTransition

public void addTransition(Transition newTransition)
                   throws ControllerException
Add a Transition to this ControllerResponse

Parameters:
newTransition - the new Transition to add
Throws:
ControllerException - upon error

autoValidate

public void autoValidate(String checkClassName,
                         ErrorCollection errorCollection)
                  throws ValidationException,
                         ControllerException
AutoValidate is a quick way to validate the fields of a specified dbobj. Creation date: (7/19/00 6:06:21 PM)

Parameters:
checkClassName - the class name to validate
errorCollection - where Errors are saved to
Throws:
ValidationException - The exception description.
ControllerException - upon error

autoValidate

public void autoValidate(String checkClassName,
                         ErrorCollection errorCollection,
                         Vector requiredFields)
                  throws ValidationException,
                         ControllerException
AutoValidate is a quick way to validate the fields of a specified dbobj. This method has not been tested and may not be correct. This methods takes an optional requiredFields vector, which just tells the validation routine which inputs are required. Creation date: (7/19/00 6:06:21 PM)

Parameters:
checkClassName - the class name to cehck
errorCollection - the error collection to save errors to
requiredFields - the field anmes that are required
Throws:
ValidationException - The exception description.
ControllerException - upon error

clearAttributes

public void clearAttributes()
Clear the Attribute values


clearBlockCache

public void clearBlockCache()

clearFormCache

public void clearFormCache()
                    throws ControllerException
Completely clear the internal formResponseCache Creation date: (7/19/00 6:53:58 PM) author: Adam Rossi, PlatinumSolutions

Throws:
ControllerException - upon error

clearInputCache

public void clearInputCache()
Clear the input cache


clearOutputCache

public void clearOutputCache()
Clear the output cache


clearTransitionCache

public void clearTransitionCache()

hasErrors

public boolean hasErrors()
                  throws ControllerException
determine whether response has errors

Returns:
true if response has errors
Throws:
ControllerException - if there is a problem

hasErrors

public boolean hasErrors(String label)
                  throws ControllerException
determine whether response has errors of the particular label

Returns:
true if response has errors of the particular label
Throws:
ControllerException - if there is a problem

restoreForm

public void restoreForm()
                 throws ControllerException
Restore the controller form

Throws:
ControllerException

saveErrors

public void saveErrors(ErrorCollection errorCollection)
                throws ControllerException
This method saves an ErrorCollection object to the request attributes collection. The ErrorCollection is saved with the ErrorCollection.ERRORCOLLECTIONKEY key. To retrieve the ErrorCollection in a JSP or servlet: ErrorCollection errors = (ErrorCollection)pageContext.getValue( ErrorCollection.ERRORCOLLECTIONKEY, PageContext.REQUEST_SCOPE); Note: This method does not need to be updated to GenericSession...it is saving to the pageContext, not the session. Creation date: (7/19/00 7:25:05 PM) author: Adam Rossi, PlatinumSolutions

Parameters:
errorCollection - java.jcorporate.expresso.core.controller.ErrorCollection
Throws:
ControllerException - upon error

toXML

public String toXML()
             throws ControllerException
Convert the controller response to an xml document fragment.

Returns:
an xml document
Throws:
ControllerException - upon error

validate

public void validate(ValidationSet validSet,
                     ErrorCollection errorCollection)
              throws ValidationException
Deprecated. See ControllerRequest.validateDBObject instead....

The validate method is a quick and easy way to test user input. We are trying to ensure that required fields are completed, and that the input is correct based on the corresponding dbobj.checkField() method. Creation date: (7/19/00 3:49:16 PM)

Parameters:
validSet - com.jcorporate.expresso.core.controller.ValidationSet
errorCollection - com.jcorporate.expresso.core.controller.ErrorCollection
Throws:
ValidationException - upon error

getDefaultForm

protected DefaultForm getDefaultForm()
                              throws ControllerException
Retrieve the DefaultForm object

Returns:
DefaultForm
Throws:
ControllerException - upon error

setSchema

protected void setSchema(String schemaClass)
Tell this Controller object what Schema it belongs to. This is used when the Controller tries to use it's "getString(String, Object[])" method to prepare internationalized messages - it passes the call along to the appropriate schema which knows how to locate the proper message file.

Parameters:
schemaClass - the schema class name to associate with this controllerresposne

validState

protected boolean validState()
Check to see if we are currently in a valid state

Returns:
true if the state name is valid

getNestedMap

public Map getNestedMap()
                 throws ControllerException
Useful for JSTL iteration of all items in response.

Returns:
a Map of all nested elements keyed by controllerElement name.
Throws:
ControllerException

getTitleKey

public String getTitleKey()
return raw key, without running through msg bundle string translation--useful for when 'cloning' in Transition


Expresso 5-6

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