Expresso 5-6

com.jcorporate.expresso.core.controller
Class State

java.lang.Object
  extended bycom.jcorporate.expresso.core.controller.State
All Implemented Interfaces:
Cloneable, Serializable
Direct Known Subclasses:
ConfigurationBase, DynamicCmd

public class State
extends Object
implements Cloneable, Serializable

A State embodies a single state in the finite state machine of a Controller object. Transitioning to a new state causes a Controller to generate a set of Input, Output and Action objects. In order to transition to a new state a controller can require that certain parameters be supplied

A state is not inherantly threadsafe. The framework clones the state and hands it off to the multithreaded controller with each state invocation.

See Also:
Serialized Form

Field Summary
static String NOTEMPTY_MASK
          Regular expression to check for at least one character, including newline (?
protected  boolean secure
          Is this state to run within an SSL setting?
 
Constructor Summary
State()
          The no-args constructor is not normally used directly, but only by the mechanism that runs the states in order to invoke a state dynamically.
State(String newName, String newDescrip)
          Convenience constructor to allow us to specify a new state with a name and description.
 
Method Summary
protected  void add(ControllerElement t)
          Convenience method to allow us to add any ControllerElement to this controllers inputs, outputs or transitions
protected  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.
protected  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.
protected  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.
protected  void addBlock(Block newBlock)
          Adds a block to the controller response associated with this state.
 void addError(String newError)
          Adds an error to this controllerResponse's Error Collection
protected  void addInput(Input newInput)
          Adds an input object to the controller response
 void addOptionalParameter(String newParam)
          Add a required parameter to this state
protected  void addOutput(Output newOutput)
          Adds an output object to the controller response
 void addParameter(String newParam, boolean required, String mask)
          Add a new parameter to this state
 void addParameter(String newParam, boolean required, String mask, String maskError)
          Add a new parameter to this state
 void addParameter(String newParam, String mask)
          Add a new parameter to this state
 void addRequiredParameter(String newParam)
          Add a required parameter to this state
 void addTransition(Transition newTransition)
          Adds a transition to the controller response associated with a state.
protected  void autoValidate(String checkClassName, ErrorCollection errorCollection)
          AutoValidate is a quick way to validate the fields of a specified dbobj.
protected  void autoValidate(String checkClassName, ErrorCollection errorCollection, Vector requiredFields)
          AutoValidate is a quick way to validate the fields of a specified dbobj.
protected  void calculateHandlerName(String stateName)
          Calculates the appropriate method name based upon the name of the state to be used in setName. and sets the handlerName String to that value.
protected  void checkMask(String paramName, String paramValue, org.apache.oro.text.regex.Pattern compiledRegExp)
          Checks a parameter given to the controller against a defined regular expression mask.
 void checkParamMasks()
          If any parameters for this state have an associated regular expression "mask", verify that the value for the parameter matches the mask.
protected  void clearFormCache()
          Clears the form cache in the controller response
 Object clone()
          returns a copy of itself
 boolean equals(Object o)
          Deprecated. use direct comparison of state name instead. this algorithm which allows 2 kinds of objects is ugly, and no longer used in expresso as of 5/04, v.5.5.1 LAH
protected  String getAttribute(String attrib)
          get attribute from request
 Controller getController()
          retrieve the controller instance that is associated with this state
protected  ControllerRequest getControllerRequest()
          Gets the ControllerRequest object associated with this state.
protected  ControllerResponse getControllerResponse()
          Retrieves the ControllerResponse object associated with this state
 String getDataContext()
          Return the name of the database connection we use - or null for the default connection
protected  DBController getDBController()
          Deprecated. 4/04 v5.5 use getController and cast.
 String getDBName()
          Return the name of the database connection we use - or null for the default connection
 String getDescription()
          Get the description of this state, as supplied when the state is created.
 ErrorCollection getErrors()
          Returns the errors collection of this current request and current state.
 String getErrorState()
          Retrieves the state that has been set as the error state
 Transition getErrorTransition()
          Return the error transition.
protected  String getFileName(String paramName)
          If a particular parameter represents an uploaded file (which can be determined by the isFileParameter(String) method) then this method retrieves the server-side file name - e.g. the location that has the data that was uploaded stored in it.
protected  String getFormCache(String fieldName)
          Retrieve the form cash value
 String getHandlerName()
          Return the name of the method that will handle transitions to this state.
 String getInitParameter(String paramName)
          ?
 String getName()
          Get the name of this state.
 Object getObjectParameter(String paramName)
          ?
 Vector getOptionalParameters()
          Deprecated. 3/5/04 v5.5 Use getOptionalParametersList instead
 List getOptionalParametersList()
          Returns a list of optional parameters.
 String getParameter(String paramCode)
          Fetch the value for the given parameter.
 Vector getParameters()
          Return the list of parameters required by this State
protected  org.apache.oro.text.regex.PatternMatcher getPatternMatcher()
          Retrieve a thread local instance of the Perl5 pattern matcher.
 List getRequiredParametersList()
          Same as getParameters, but returns a List instead
 ControllerResponse getResponse()
           
 Transition getReturnToSender()
          Return the return-to-sender transition.
 PersistentSession getSession()
           
 String getStateFormClass()
          Return the class name (if any) of the state form associated with this state.
protected  String getString(String key)
          Convenience method - simply passes the request for a string on to the ControllerResponse object associated with this State
protected  String getString(String key, Object[] args)
          Convenience method - simply passes the request for a string on to the ControllerResponse object associated with this State
 Transition getSuccessTransition()
          Return the success transition.
protected  int getUid()
          Retrieve the State user ID.
 String getUser()
          Deprecated. 3/5/04 use ControllerRequest getUid() instead.
 int hashCode()
          Returns a hash code value for the object.
 boolean isFileParameter(String paramName)
          Does a specified parameter refer to an uploaded file?
protected  boolean isParameter(String paramName)
           
 boolean isSecure()
          Should this state be run within an SSL protocol (if SSL is available)
 void perform(StateForm stateForm, ControllerRequest newRequest, ControllerResponse newResponse)
          A state may implement a "perform" method to actually perform it's logic by overriding this method.
 void run(ControllerRequest newRequest, ControllerResponse newResponse)
          A state may implement a "run" method to actually perform it's logic by overriding this method.
protected  void saveErrors(ErrorCollection e)
          Deprecated. 3/4/04 [v5.5] Use response.saveErrors instead.
 void setController(Controller newController)
          Set the 'parent' controller
 void setDescription(String newDescrip)
          Set a description (human-readable) for this state.
 void setErrorState(String newErrorState)
          Sets the state that defines the error state.
 void setErrorTransition(Transition newErrorTransition)
          Set the error transition.
protected  void setFormCache()
          To the form cache in the controller response
 void setHandlerName(String newName)
          Use this function to bypass the automatic function naming that goes on based upon the state
 void setMask(String paramName, String mask)
          Set a regular expression "mask" for a particular parameter The parameter value is checked against this mask before the transition into the new state begins Also precompiles the regular expression to allow for quick parameter checking.
 void setMask(String paramName, String mask, String errorMsg)
          Set a regular expression "mask" for a particular parameter The parameter value is checked against this mask before the transition into the new state begins
 void setMaskError(String paramName, String errorMsg)
          If a state fails a parameter check on a mask, then the error specified will be stored in the error collections
 void setName(String newName)
          Set the internal "name" of this state.
protected  void setResponse(ControllerResponse res)
          Set the ControllerResponse object associated with this state
 void setReturnToSender(Transition newReturnToSender)
          Set the return-to-sender transition.
 void setSecure(boolean newSecure)
          Sets the "should be secure" flag.
 void setStateFormClass(String newStateFormClass)
          Set the class name of the state form associated with this state.
 void setSuccessTransition(Transition newSuccessTransition)
          Set the success transition.
 String toString()
          Returns the string of this state.
protected  void transition(String newState, ControllerRequest req, ControllerResponse res)
           
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

NOTEMPTY_MASK

public static final String NOTEMPTY_MASK
Regular expression to check for at least one character, including newline (?s) puts the expressoion in single-line mode so that . (a period) will match newlines

See Also:
Constant Field Values

secure

protected boolean secure
Is this state to run within an SSL setting?

Constructor Detail

State

public State()
The no-args constructor is not normally used directly, but only by the mechanism that runs the states in order to invoke a state dynamically. Use the detailed constructor instead.


State

public State(String newName,
             String newDescrip)
Convenience constructor to allow us to specify a new state with a name and description. This is the preferred constructor for a controller, and is used within the constructor of a Controller to define the states that this controller has available to it.

Parameters:
newName - The name of the new state
newDescrip - A description for the new state - this may be (preferrably) a key into the local language file in order to facilitate internationalization, or just a simple string.
Method Detail

getPatternMatcher

protected org.apache.oro.text.regex.PatternMatcher getPatternMatcher()
Retrieve a thread local instance of the Perl5 pattern matcher. Allows for optimization of # of instances of pattern matcher vs synchronization.

Returns:
PatternMatcher

setController

public void setController(Controller newController)
                   throws ControllerException
Set the 'parent' controller

Parameters:
newController - The controller instance to set for the state
Throws:
ControllerException - upon error or null parameter

setErrorState

public void setErrorState(String newErrorState)
Sets the state that defines the error state.

Parameters:
newErrorState - The name of the state to set as the error state

getErrorState

public String getErrorState()
Retrieves the state that has been set as the error state

Returns:
java.lang.String

setMask

public void setMask(String paramName,
                    String mask)
Set a regular expression "mask" for a particular parameter The parameter value is checked against this mask before the transition into the new state begins Also precompiles the regular expression to allow for quick parameter checking.

Parameters:
paramName - parameter name to check against the regular expression
mask - The regular Expression
Throws:
IllegalArgumentException - if the paramName or mask is blank.

setMask

public void setMask(String paramName,
                    String mask,
                    String errorMsg)
Set a regular expression "mask" for a particular parameter The parameter value is checked against this mask before the transition into the new state begins

Parameters:
paramName - The parameter name to check against the regular expression
mask - The regular Expression
errorMsg - The error message to use if the state fails.
Throws:
IllegalArgumentException - if the paramName or mask is blank.

setMaskError

public void setMaskError(String paramName,
                         String errorMsg)
If a state fails a parameter check on a mask, then the error specified will be stored in the error collections

Parameters:
paramName - The parameter name to check against the regular expression set in setMask
errorMsg - The error message to display. It may be a string that exists in a resource bundle, in which case that will be displayed instead

setResponse

protected void setResponse(ControllerResponse res)
                    throws ControllerException
Set the ControllerResponse object associated with this state

Parameters:
res - The controller response associated with the state's instance.
Throws:
ControllerException - upon invalid parameter

setReturnToSender

public void setReturnToSender(Transition newReturnToSender)
Set the return-to-sender transition. This is the transition that will be serialized and passed to any state that is invoked via a transition that has return-to-sender enabled.

Parameters:
newReturnToSender - Transition instance.

setStateFormClass

public void setStateFormClass(String newStateFormClass)
Set the class name of the state form associated with this state.

Parameters:
newStateFormClass - The class name of the object to use as an action form.

setSuccessTransition

public void setSuccessTransition(Transition newSuccessTransition)
Set the success transition. This is the transition that will be executed if this state returns without errors in the error collection.

Parameters:
newSuccessTransition - The transition to use for successful state executions.

getResponse

public ControllerResponse getResponse()

getController

public Controller getController()
                         throws ControllerException
retrieve the controller instance that is associated with this state

Returns:
A controller instance.
Throws:
ControllerException - [usually never thrown]

getDBController

protected DBController getDBController()
                                throws ControllerException
Deprecated. 4/04 v5.5 use getController and cast.

A convenience method that allows you to get a secured controller which is a subclass of a regular controller.

Returns:
DBController instance
Throws:
ControllerException - if the controller is not an instance of DBController.

setName

public void setName(String newName)
Set the internal "name" of this state. Normally done via the constructor when the state is "declared" in the appropriate controller.

Parameters:
newName - The new name of the state.

setSecure

public void setSecure(boolean newSecure)
Sets the "should be secure" flag. Ie, if SSL is available, this state should be run within SSL.

Parameters:
newSecure - Such a true if you want to use SSL for the state.

setDescription

public void setDescription(String newDescrip)
Set a description (human-readable) for this state. This is normally done via the constructor. The description may be just a string describing the state in a few words, or (preferrably) it may be a key into the local language file, facilitation internationalization

Parameters:
newDescrip - The new description for the state.

addRequiredParameter

public void addRequiredParameter(String newParam)
Add a required parameter to this state

Parameters:
newParam - The name of the new parameter

addOptionalParameter

public void addOptionalParameter(String newParam)
Add a required parameter to this state

Parameters:
newParam - The name of the new parameter

addParameter

public void addParameter(String newParam,
                         String mask)
Add a new parameter to this state

Parameters:
newParam - The name of the new parameter
mask - The regular expression mask to compare against.

addParameter

public void addParameter(String newParam,
                         boolean required,
                         String mask)
Add a new parameter to this state

Parameters:
newParam - The name of the new parameter
required - should an exception be thrown if this parameter isn't included?
mask - The regular expression mask to compare against.

addParameter

public void addParameter(String newParam,
                         boolean required,
                         String mask,
                         String maskError)
Add a new parameter to this state

Parameters:
newParam - The name of the new parameter
required - should an exception be thrown if this parameter isn't included?
mask - The regular expression mask to compare against.
maskError - The error message to give if mask validation fails.

getDescription

public String getDescription()
Get the description of this state, as supplied when the state is created. Try to use the description as a key in the current local-language file - if available. If we can't do that, or it's not a valid key, just return the description as it was originally specified.

Returns:
A description of this state

getName

public String getName()
Get the name of this state. This is the "internal" name used to refer to the state, not the "human readable" description. This name is suitable as a parameter to the newState method, for example.

Returns:
The name of this state

getParameters

public Vector getParameters()
Return the list of parameters required by this State

Returns:
A Vector of the parameter names required by this State

getRequiredParametersList

public List getRequiredParametersList()
Same as getParameters, but returns a List instead

Returns:
a List collection giving all optional paramaters

getOptionalParameters

public Vector getOptionalParameters()
Deprecated. 3/5/04 v5.5 Use getOptionalParametersList instead

Returns a list of optional parameters

Returns:
a vector of optional parameter names.

getOptionalParametersList

public List getOptionalParametersList()
Returns a list of optional parameters. Same as getOptionalParameters() but returns an List instead

Returns:
a List collection giving all optional parameters

toString

public String toString()
Returns the string of this state. Good for debugging error messages

Returns:
The object class name

equals

public boolean equals(Object o)
Deprecated. use direct comparison of state name instead. this algorithm which allows 2 kinds of objects is ugly, and no longer used in expresso as of 5/04, v.5.5.1 LAH

Overrides default Object.equals(Object) behavior

Parameters:
o - The object to compare against.
Returns:
true if the objects are equal

getErrorTransition

public Transition getErrorTransition()
Return the error transition. This is the transition that will be executed if this state returns any errors in the error collection.

Returns:
The Error Transition

run

public void run(ControllerRequest newRequest,
                ControllerResponse newResponse)
         throws ControllerException,
                NonHandleableException
A state may implement a "run" method to actually perform it's logic by overriding this method.

Parameters:
newRequest - The controller request object that has been prepared by the framework, that contains all the parameters needed to execute state
newResponse - The controller response object that you use to populate with inputs, outputs and transitions.
Throws:
ControllerException - upon error
NonHandleableException - upon fatal error

perform

public void perform(StateForm stateForm,
                    ControllerRequest newRequest,
                    ControllerResponse newResponse)
             throws NonHandleableException,
                    ControllerException
A state may implement a "perform" method to actually perform it's logic by overriding this method. Any associated state form will be passed in with its data populated. If this method is not implemented by a child class then the "run" method will be called to be backwards compatible with previous versions.

Parameters:
stateForm - unused, useful for matching with Struts API
newRequest - The controller request object that has been prepared by the framework, that contains all the parameters needed to execute state
newResponse - The controller response object that you use to populate with inputs, outputs and transitions.
Throws:
ControllerException - upon error
NonHandleableException - upon fatal error

add

protected 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 controller element, either an input an output, a transition, or a block that gets added to the controller response.
Throws:
ControllerException - upon error

addTransition

public void addTransition(Transition newTransition)
                   throws ControllerException
Adds a transition to the controller response associated with a state.

Parameters:
newTransition - The transition to add.
Throws:
ControllerException - upon error

addBlock

protected void addBlock(Block newBlock)
                 throws ControllerException
Adds a block to the controller response associated with this state.

Parameters:
newBlock - The block to add.
Throws:
ControllerException - upon error

addAutoInput

protected 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) author: Adam Rossi, PlatinumSolutions

Parameters:
fieldName - java.lang.String
friendlyName - the input's label
defaultValue - java.lang.String
displayLength - The size of the input text box
maxLength - The maximum input length of the input.
validValues - The valid value list associated with the input (for drop-down multivalue inputs only)
Throws:
ControllerException - upon error

addInput

protected void addInput(Input newInput)
                 throws ControllerException
Adds an input object to the controller response

Parameters:
newInput - The input object to add
Throws:
ControllerException - upon error

addOutput

protected void addOutput(Output newOutput)
                  throws ControllerException
Adds an output object to the controller response

Parameters:
newOutput - The output object to add
Throws:
ControllerException - upon error

addAutoInput

protected 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

protected 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 label of the new input
dbClassName - java.lang.String
defaultValue - java.lang.String
Throws:
ControllerException - upon error

autoValidate

protected 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) author: Adam Rossi, PlatinumSolutions

Parameters:
checkClassName - The class name to perform the error checking
errorCollection - The error collection to get populated with validation errors if validation on any particular field fails.
Throws:
ValidationException - The exception description.
ControllerException - upon error

autoValidate

protected 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) author: Adam Rossi, PlatinumSolutions

Parameters:
checkClassName - The class name to perform the error checking
errorCollection - The error collection to get populated with validation errors if validation on any particular field fails.
requiredFields - Vector of Strings: which inputs are required.
Throws:
ValidationException - Upon validation error
ControllerException - upon error

getFileName

protected String getFileName(String paramName)
If a particular parameter represents an uploaded file (which can be determined by the isFileParameter(String) method) then this method retrieves the server-side file name - e.g. the location that has the data that was uploaded stored in it.

Parameters:
paramName - The parameter name that is expected to have a file associated with.
Returns:
java.lang.String the location on the filesystem of the temporary stored file.

getAttribute

protected String getAttribute(String attrib)
get attribute from request

Parameters:
attrib - The name of an "attribute" for this ControllerElement item
Returns:
java.lang.String The attribute value

getObjectParameter

public Object getObjectParameter(String paramName)
                          throws ControllerException
?

Parameters:
paramName - The parameter name to retrieve
Returns:
java.lang.Object
Throws:
ControllerException - upon conversion error

getHandlerName

public String getHandlerName()
Return the name of the method that will handle transitions to this state.

Returns:
the handler name, or possibly null if the

setHandlerName

public void setHandlerName(String newName)
Use this function to bypass the automatic function naming that goes on based upon the state

Parameters:
newName - the name that you want the controller to automatically call when transitioning to this state.

getInitParameter

public String getInitParameter(String paramName)
?

Parameters:
paramName - The parameter name to retrieve
Returns:
java.lang.String

getSuccessTransition

public Transition getSuccessTransition()
Return the success transition. This is the transition that will be executed if this state returns without errors in the error collection.

Returns:
Transition object

getUser

public String getUser()
Deprecated. 3/5/04 use ControllerRequest getUid() instead.

Get the user name

Returns:
java.lang.String login name of the user

getParameter

public String getParameter(String paramCode)
                    throws ControllerException
Fetch the value for the given parameter. Return null if there is no such parameter

Parameters:
paramCode - Code of the parameter desired
Returns:
java.lang.String The parameter value.
Throws:
ControllerException - upon error

isFileParameter

public boolean isFileParameter(String paramName)
Does a specified parameter refer to an uploaded file?

Parameters:
paramName - The parameter name to check.
Returns:
true if the parameter is a file parameter.

isSecure

public boolean isSecure()
Should this state be run within an SSL protocol (if SSL is available)

Returns:
true if SSL should be used for this state

getDBName

public String getDBName()
Return the name of the database connection we use - or null for the default connection

Returns:
java.lang.String

getDataContext

public String getDataContext()
Return the name of the database connection we use - or null for the default connection

Returns:
java.lang.String

getControllerRequest

protected ControllerRequest getControllerRequest()
Gets the ControllerRequest object associated with this state.

Returns:
the ControllerRequest Object associated with this state.

getControllerResponse

protected ControllerResponse getControllerResponse()
Retrieves the ControllerResponse object associated with this state

Returns:
ControllerResponse object associated with this state.

calculateHandlerName

protected void calculateHandlerName(String stateName)
Calculates the appropriate method name based upon the name of the state to be used in setName. and sets the handlerName String to that value.

Parameters:
stateName - The name of the state to calculate the handler name.

clone

public Object clone()
             throws CloneNotSupportedException
returns a copy of itself

Returns:
a State instance
Throws:
CloneNotSupportedException - as specified by the object API

saveErrors

protected void saveErrors(ErrorCollection e)
                   throws ControllerException
Deprecated. 3/4/04 [v5.5] Use response.saveErrors instead.

Saves the errors to the controller response

Parameters:
e - The error collection to save
Throws:
ControllerException - upon error

setErrorTransition

public void setErrorTransition(Transition newErrorTransition)
Set the error transition. This is the transition that will be executed if this state returns any errors in the error collection.

Parameters:
newErrorTransition - A new transition object pointing to the error state

setFormCache

protected void setFormCache()
                     throws ControllerException
To the form cache in the controller response

Throws:
ControllerException - upon error

clearFormCache

protected void clearFormCache()
                       throws ControllerException
Clears the form cache in the controller response

Throws:
ControllerException - upon error

getFormCache

protected String getFormCache(String fieldName)
                       throws ControllerException
Retrieve the form cash value

Parameters:
fieldName - The name of the field to retrieve
Returns:
The field's value, may be null.
Throws:
ControllerException - upon error

isParameter

protected boolean isParameter(String paramName)
                       throws ControllerException
Throws:
ControllerException

transition

protected void transition(String newState,
                          ControllerRequest req,
                          ControllerResponse res)
                   throws ControllerException,
                          NonHandleableException
Throws:
ControllerException
NonHandleableException

getReturnToSender

public Transition getReturnToSender()
Return the return-to-sender transition. This is the transition that will serialized and passed to any state that is invoked via a transition that has return-to-sender enabled.

Returns:
Transition object

getSession

public PersistentSession getSession()
                             throws ControllerException
Throws:
ControllerException

getStateFormClass

public String getStateFormClass()
Return the class name (if any) of the state form associated with this state.

Returns:
java.lang.String

getUid

protected int getUid()
              throws ControllerException
Retrieve the State user ID.

Returns:
integer user ID
Throws:
ControllerException - upon error

checkParamMasks

public void checkParamMasks()
                     throws ControllerException
If any parameters for this state have an associated regular expression "mask", verify that the value for the parameter matches the mask.

Throws:
ControllerException - upon error

getErrors

public ErrorCollection getErrors()
                          throws ControllerException
Returns the errors collection of this current request and current state.

Returns:
The ControllerResponse error collection
Throws:
ControllerException - upon error

addError

public void addError(String newError)
              throws ControllerException
Adds an error to this controllerResponse's Error Collection

Parameters:
newError - The error string to add.
Throws:
ControllerException - upon error

checkMask

protected void checkMask(String paramName,
                         String paramValue,
                         org.apache.oro.text.regex.Pattern compiledRegExp)
                  throws ControllerException
Checks a parameter given to the controller against a defined regular expression mask. Puts an error in the error collection if there is a problem.

Parameters:
paramName - The state parameter name to check
paramValue - The value given the state to check against
compiledRegExp - The compiled Perl 5 regular expression.
Throws:
ControllerException - if there's an error with the regular expression mask.

getString

protected String getString(String key,
                           Object[] args)
                    throws ControllerException
Convenience method - simply passes the request for a string on to the ControllerResponse object associated with this State

Parameters:
key - The key to format
args - The formatting arguments for the key.
Returns:
The i18n message that key points to.
Throws:
ControllerException - upon error

getString

protected String getString(String key)
                    throws ControllerException
Convenience method - simply passes the request for a string on to the ControllerResponse object associated with this State

Parameters:
key - the message bundle key
Returns:
java.lang.String
Throws:
ControllerException - upon error

hashCode

public int hashCode()
Returns a hash code value for the object.

Returns:
a hash code value for this object.

Expresso 5-6

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