|
Expresso 5-6 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.jcorporate.expresso.core.controller.ControllerResponse
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"
| 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 |
protected ControllerRequest myRequest
protected Locale responseLocale
protected HashMap blockCache
protected HashMap inputCache
protected HashMap outputCache
protected HashMap transitionCache
protected State currentState
protected String myControllerClass
protected String dataContext
protected String myRequestPath
protected String requestedState
protected String style
protected String title
protected Vector blockCacheOrdered
protected Vector inputCacheOrdered
protected Vector outputCacheOrdered
protected Vector transitionCacheOrdered
protected boolean customResponse
| Constructor Detail |
public ControllerResponse()
| Method Detail |
public void setAttribute(String attrib,
String val)
throws ControllerException
attrib - The name of an "attribtue" for this ControllerElement itemval - The value for this attribute
ControllerException - upon error
public String getAttribute(String attrib)
throws ControllerException
attrib - The name of an "attribute" for this ControllerElement item
ControllerException - upon error
public void setAttributes(Map attributes)
throws ControllerException
attributes - the supplied attribute values
ControllerException - upon error
public Map getAttributes()
throws ControllerException
ControllerException - upon error
public Block getBlock(String blockName)
throws ControllerException
blockName - the name of the Block
ControllerException - upon errorpublic final Vector getBlocks()
public void setControllerClass(String newClass)
newClass - the new controller class namepublic String getControllerClass()
public State getCurrentState()
public final Input getInput(String inputName)
inputName - the name of the input to retrieve
public final Vector getInputs()
public void setCustomResponse(boolean newCustom)
newCustom - set to true if you don't want Struts to render the
response through JSPpublic boolean isCustomResponse()
public void setDBName(String newDBName)
throws ControllerException
newDBName - the new database name
ControllerException - upon error
public String getDBName()
throws ControllerException
ControllerException - upon error
public String getDataContext()
throws ControllerException
ControllerException - upon error
public void setFormCache()
throws ControllerException
ControllerException - upon error
public void setFormCache(String fieldName,
String fieldValue)
throws ControllerException
fieldName - java.lang.StringfieldValue - java.lang.String
ControllerException - upon error
public Hashtable getFormCache()
throws ControllerException
ControllerException - upon error
public String getFormCache(String fieldName)
throws ControllerException
fieldName - java.lang.String
ControllerException - upon error
public void setFormCacheAttribute(String fieldName,
Object fieldAttribute)
throws ControllerException
fieldName - the name of the field attribute to setfieldAttribute - the attribute to set it to
ControllerException - if the fieldName is blank or null
public Object getFormCacheAttribute(String fieldName)
throws ControllerException
fieldName - the name of the field to retrieve
ControllerException - if the fieldName specified is blank or null.
public Locale getLocale()
throws ControllerException
ControllerException - upon error
public Map getNamedInputs()
throws ControllerException
ControllerException - upon error
public Output getOutput(String outputName)
throws ControllerException
outputName - the name of the output to retrieve
Output
ControllerException - upon error
public String getOutputContent(String outputName)
throws ControllerException
outputName - the name of the output to retrieve
ControllerException - If there is no such output
public Output getOutputRequired(String outputName)
throws ControllerException
outputName - the name of the output to retrieve
ControllerException - if the output cannot be foundpublic final Vector getOutputs()
public ErrorCollection getErrors()
throws ControllerException
ControllerException - upon error reading from the session
public String getParameter(String paramName)
throws ControllerException
paramName - the name of the parameter to retrieve
ControllerException - upon error
public void setRequest(ControllerRequest newRequest)
throws ControllerException
newRequest - the new controller request.
ControllerException - upon errorpublic ControllerRequest getRequest()
ControllerRequest object
IllegalArgumentException - if the setRequest() object has not
been set yet.public void setRequestPath(String newPath)
newPath - the URL path without the .do at the end of it.public String getRequestPath()
public String getRequestedState()
public String getSchema()
public void setSchemaStack(Stack schemaStack)
schemaStack - the Stack to use.public Stack getSchemaStack()
public String getString(String stringCode,
Object[] args)
throws ControllerException
stringCode - the String code to retrieveargs - the formatting arguments
ControllerException - upon error
public String getString(String stringCode)
throws ControllerException
stringCode - the string code to retrieve
ControllerException - upon error
public String getString(String stringCode,
String string1)
throws ControllerException
stringCode - the string code to retrievestring1 - a single parameter for message format (the first argument to replace)
ControllerException - upon error
public String getString(String stringCode,
String string1,
String string2)
throws ControllerException
stringCode - the string code to retrievestring1 - formatting parameter onestring2 - formatting parameter two
ControllerException - upon error
public String getString(String stringCode,
String string1,
String string2,
String string3)
throws ControllerException
stringCode - the string code to retrievestring1 - formatting parameter onestring2 - formatting parameter twostring3 - formatting parameter number three
ControllerException - upon error
public String getString(String stringCode,
String string1,
String string2,
String string3,
String string4)
throws ControllerException
stringCode - the string code to retrievestring1 - formatting parameter onestring2 - formatting parameter twostring3 - formatting parameter number threestring4 - formatting parameter number four
ControllerException - upon errorpublic void setStyle(String newStyle)
newStyle - the new style string. Must be in one of the
struts-config.xml files.public String getStyle()
public void setTitle(String newTitle)
newTitle - the new title for the controller
public static ControllerResponse fromXML(org.w3c.dom.Node n)
throws ControllerException
n - a DOM node to assemble the response from.
ControllerException - upon errorpublic String getName()
public String getTitle()
public Transition getTransition(String transitionName)
throws ControllerException
transitionName - the name of the transition
ControllerException - upon errorpublic final Vector getTransitions()
public Map getNamedBlocks()
throws ControllerException
ControllerException - upon error
public Map getNamedOutputs()
throws ControllerException
ControllerException - upon error
public Map getNamedTransitions()
throws ControllerException
ControllerException - upon error
public void setUser(String newUser)
throws ControllerException
newUser - the new user.
ControllerException - upon error
public String getUser()
throws ControllerException
ControllerException - upon error
public void add(ControllerElement t)
throws ControllerException
t - the new ControllerElement
ControllerException - upon error [Such as if the ControllerElement
is an unrecognized type]
public void addAutoInput(String fieldName,
String friendlyName,
String defaultValue,
int displayLength,
int maxLength,
Vector validValues)
throws ControllerException
fieldName - java.lang.StringfriendlyName - the friendly namedefaultValue - java.lang.StringdisplayLength - the length of the displaymaxLength - the maximum length of the inputvalidValues - a Vector of valid value objects for dropdowns
ControllerException - upon error
public void addAutoInput(String fieldName,
DBObject dbobj,
String defaultValue)
throws ControllerException
fieldName - java.lang.Stringdbobj - com.jcorporate.expresso.core.dbobj.DBObjectdefaultValue - java.lang.String
ControllerException - upon error
public void addAutoInput(String fieldName,
String dbClassName,
String defaultValue)
throws ControllerException
fieldName - java.lang.StringdbClassName - java.lang.StringdefaultValue - java.lang.String
ControllerException - upon error
public void addAutoInput(DBObject myDBObj)
throws ControllerException
myDBObj - the dbobject to render to the controller response
ControllerException - upon error
public void addAutoInput(String fieldName,
String friendlyName,
String dbClassName,
String defaultValue)
throws ControllerException
fieldName - java.lang.StringfriendlyName - the description of the Input to set.dbClassName - java.lang.StringdefaultValue - java.lang.String
ControllerException - upon error
public void addAutoInput(String fieldName,
String friendlyName,
String defaultValue,
int displayLength,
int maxLength,
Vector validValues,
String fieldType)
throws ControllerException
fieldName - java.lang.StringfriendlyName - the description of the inputdefaultValue - java.lang.StringdisplayLength - display size of the InputmaxLength - the maximum input lengthvalidValues - valid value Vector if needed for dropdown boxesfieldType - the type of the field such as "datetime", "varchar",
etc
ControllerException - upon error
public void addAutoInputRenameField(String fieldName,
String renameFieldTo,
DBObject dbobj,
String defaultValue)
throws ControllerException
fieldName - java.lang.StringrenameFieldTo - the field to rename todbobj - com.jcorporate.expresso.core.dbobj.DBObjectdefaultValue - java.lang.String
ControllerException - upon error
public void addBlock(Block newBlock)
throws ControllerException
newBlock - the block instance to add
ControllerException - upon error
public void addError(String errorMessage)
throws ControllerException
errorMessage -
ControllerException
public void addError(String errorMessage,
Object arg)
throws ControllerException
errorMessage - key to error msg found in message bundlearg - a replacement value to use in ${} replacement template
ControllerExceptionMessageBundle.getString(java.lang.String, java.lang.Object[])
public void addError(String errorMessage,
Object[] args)
throws ControllerException
errorMessage - key to error msg found in message bundleargs - an array of replacement value to use in ${} replacement templates
ControllerExceptionMessageBundle.getString(java.lang.String, java.lang.Object[])
public void addError(String propName,
String errorMessage)
throws ControllerException
propName - errorMessage -
ControllerException
public void addInput(Input newInput)
throws ControllerException
newInput - the Input to add to the ControllerResponse
ControllerException - upon error
public void addOutput(Output newOutput)
throws ControllerException
newOutput - the new output to add
ControllerException - upon error
public void addTransition(Transition newTransition)
throws ControllerException
newTransition - the new Transition to add
ControllerException - upon error
public void autoValidate(String checkClassName,
ErrorCollection errorCollection)
throws ValidationException,
ControllerException
checkClassName - the class name to validateerrorCollection - where Errors are saved to
ValidationException - The exception description.
ControllerException - upon error
public void autoValidate(String checkClassName,
ErrorCollection errorCollection,
Vector requiredFields)
throws ValidationException,
ControllerException
checkClassName - the class name to cehckerrorCollection - the error collection to save errors torequiredFields - the field anmes that are required
ValidationException - The exception description.
ControllerException - upon errorpublic void clearAttributes()
public void clearBlockCache()
public void clearFormCache()
throws ControllerException
ControllerException - upon errorpublic void clearInputCache()
public void clearOutputCache()
public void clearTransitionCache()
public boolean hasErrors()
throws ControllerException
ControllerException - if there is a problem
public boolean hasErrors(String label)
throws ControllerException
ControllerException - if there is a problem
public void restoreForm()
throws ControllerException
ControllerException
public void saveErrors(ErrorCollection errorCollection)
throws ControllerException
errorCollection - java.jcorporate.expresso.core.controller.ErrorCollection
ControllerException - upon error
public String toXML()
throws ControllerException
ControllerException - upon error
public void validate(ValidationSet validSet,
ErrorCollection errorCollection)
throws ValidationException
validSet - com.jcorporate.expresso.core.controller.ValidationSeterrorCollection - com.jcorporate.expresso.core.controller.ErrorCollection
ValidationException - upon error
protected DefaultForm getDefaultForm()
throws ControllerException
ControllerException - upon errorprotected void setSchema(String schemaClass)
schemaClass - the schema class name to associate with this
controllerresposneprotected boolean validState()
public Map getNestedMap()
throws ControllerException
ControllerExceptionpublic String getTitleKey()
|
Expresso 5-6 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||