| java.lang.Object com.jcorporate.expresso.core.controller.ControllerRequest
All known Subclasses: com.jcorporate.expresso.core.controller.ServletControllerRequest,
ControllerRequest | public class ControllerRequest implements Serializable,com.jcorporate.expresso.core.dbobj.RequestContext,Cloneable(Code) | | ControllerRequest is a simple "wrapper" object that holds the parameters and data required
for a controller to be able to transition to a new state.
Developer Notes Because this class can be cloned, please make sure that
you add any fields to this class to the clone function.
|
Method Summary | |
public Object | clone() Returns a clone of this object. | public Object | getAttrib(String attrib) | public String | getAttribute(String attrib) | public Map | getAttributes() | public String | getDBName() | public String | getDataContext() | public ErrorCollection | getErrorCollection() Returns the Error collection that exists in the current session. | public 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. | public String | getFormAttribute() | public String | getInitParameter(String paramName) | public Locale | getLocale() Returns the locale of this request. | public Object | getObjectParameter(String paramName) | public String | getParameter(String paramCode) Fetch the value for the given parameter. | public Hashtable | getParameters() | public PersistentSession | getSession() Returns the Persistant Session Wrapper object to store requests between
environments. | public int | getUid() | public String | getUser() | public User | getUserInfo() | public boolean | isFileParameter(String paramName) | public boolean | isParameter(String paramName) Checks if the described parameter is a defined parameter
for this request
Parameters: paramName - the parameter to check against. | public void | populate(DBObject myDBObj) | public void | removeAttrib(String key) | public void | removeParameter(String paramName) Remove a parameter from this controller request. | public void | setAttrib(String attrib, Object val) | public void | setAttribute(String attrib, String val) | public void | setAttributes(Map attributes) | public synchronized void | setDBName(String newDBName) | public synchronized void | setDataContext(String newDBName) | public void | setFileParameter(String paramName, String paramValue, String fileName) | public synchronized void | setFormAttribute(String newAttribute) | public void | setInitParameter(String paramName, String paramValue) Our caller can pass us initialization parameters. | public synchronized void | setLocale(Locale newLocale) | public void | setObjectParameter(String paramName, Object paramValue) | public void | setParameter(String paramName, String paramValue) | public void | setParameters(Hashtable h) Set the parameters for this request. | public void | setSession(PersistentSession newSession) Provide the controller with a PersitentSession object, which it can use
to hold values between invokations. | public void | setUid(int newUid) Sets the current integer user id. | public void | setUser(String newUser) The client of the controller must tell us who is accessing us,
and we decide if they're allowed to access the given state. | public void | validateDBField(String dbFieldName, DBObject oneObject, ErrorCollection ec) Convenience method that retrieves the validates
against that one database object field. | public void | validateDBObject(DBObject oneObject, ErrorCollection ec) Convenience method that retrieves parameters/field values and populates a specified
db object. | public void | validateField(String dbFieldName, String reqFieldName, DBObject oneObject, ErrorCollection ec) Convenience method that retrieves the validates
against that one database object field. |
ControllerRequest | public ControllerRequest()(Code) | | Default Constructor. Initializes Logging
|
clone | public Object clone()(Code) | | Returns a clone of this object.
a newly cloned ControllerRequest object. |
getAttrib | public Object getAttrib(String attrib)(Code) | | get the named attribute of this Controller
Parameters: attrib - The name of an "attribute" for this ControllerElement item java.lang.String |
getAttribute | public String getAttribute(String attrib)(Code) | | get the named attribute of this Controller
Parameters: attrib - The name of an "attribute" for this ControllerElement item java.lang.String |
getAttributes | public Map getAttributes()(Code) | | Get the attributes Map
java.util.Map of objects keyed by String.todo return new HashMap(attributes) to encapsulate the data member properly? // 4/04 LAH |
getDBName | public String getDBName()(Code) | | Return the name of the database connection we use - or null
for the default connection
The current DBContext |
getDataContext | public String getDataContext()(Code) | | Return the name of the database connection we use - or null
for the default connection
The current DBContext |
getErrorCollection | public ErrorCollection getErrorCollection() throws ControllerException(Code) | | Returns the Error collection that exists in the current session.
an ErrorCollection object or NULL if an error collection doesn'texist. throws: ControllerException - if there is an error getting the Session object |
getFileName | public String getFileName(String paramName)(Code) | | 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 name of the paramter to get the filename for. java.lang.String |
getInitParameter | public String getInitParameter(String paramName)(Code) | | Retrieve the initialization parameter
Parameters: paramName - the name of the parameter to retrieve java.lang.String |
getLocale | public Locale getLocale()(Code) | | Returns the locale of this request.
a Locale Object based upon current locale settings. |
getObjectParameter | public Object getObjectParameter(String paramName) throws ControllerException(Code) | | Parameters: paramName - The name of the parameter to retrieve the Object retrieved from the object parameters list. throws: ControllerException - if unable to get the object parameters |
getParameter | public String getParameter(String paramCode)(Code) | | Fetch the value for the given parameter. Return null
if there is no such parameter
Parameters: paramCode - Code of the parameter desired java.lang.String |
getParameters | public Hashtable getParameters()(Code) | | Return the complete hashtable of parameters all keyed by parameter names
a Hashtable containing all the parameter values, keyed by name; this is a CLONE of the source hashtable, not the original |
getUid | public int getUid()(Code) | | Get the user id as an integer
an integer representing the internal UID |
getUser | public String getUser()(Code) | | Get the user name
the currently logged in user or NONE if there's no user logged in |
getUserInfo | public User getUserInfo() throws DBException(Code) | | get requesting user
user object for requesting user; will throw if UID is not found |
isFileParameter | public boolean isFileParameter(String paramName)(Code) | | Does a specified parameter refer to an uploaded file?
Parameters: paramName - the name of the parameter to check if it is a file boolean |
isParameter | public boolean isParameter(String paramName)(Code) | | Checks if the described parameter is a defined parameter
for this request
Parameters: paramName - the parameter to check against. true if the name given IS a valid defined parameter |
populate | public void populate(DBObject myDBObj) throws ControllerException(Code) | | Convenience method to populate a dbobject from the parameters supplied,
by looking for parameters with the same name as the field name in the db object
Parameters: myDBObj - the dbobject to populate throws: ControllerException - upon error |
removeAttrib | public void removeAttrib(String key)(Code) | | remove the attribute
Parameters: key - the name of the attribute to remove |
removeParameter | public void removeParameter(String paramName)(Code) | | Remove a parameter from this controller request.
Parameters: paramName - the name of the parameter to remove |
setAttrib | public void setAttrib(String attrib, Object val)(Code) | | Set the named attribute to the given value
Parameters: attrib - The name of an "attribtue" for this ControllerElement item Parameters: val - The value for this attribute |
setAttribute | public void setAttribute(String attrib, String val)(Code) | | Set the named attribute of this Controller to the given value
Parameters: attrib - The name of an "attribtue" for this ControllerElement item Parameters: val - The value for this attribute |
setAttributes | public void setAttributes(Map attributes)(Code) | | Set the attributes Map to the supplied Map
Parameters: attributes - a Map of attribute values |
setDBName | public synchronized void setDBName(String newDBName)(Code) | | Set this DB Controller to operate on a database other than the default
Parameters: newDBName - The dbcontext to set this request to. |
setDataContext | public synchronized void setDataContext(String newDBName)(Code) | | Set this DB Controller to operate on a database other than the default
Parameters: newDBName - The dbcontext to set this request to. |
setFormAttribute | public synchronized void setFormAttribute(String newAttribute)(Code) | | |
setInitParameter | public void setInitParameter(String paramName, String paramValue)(Code) | | Our caller can pass us initialization parameters. For example,
if we're being called by a client that has information on connecting
to a database, the connection parameters can be passed to us.
Parameters: paramName - the name of the parameter Parameters: paramValue - the value of the parameter |
setLocale | public synchronized void setLocale(Locale newLocale)(Code) | | Sets the Locale of this request
Parameters: newLocale - the new Locale to set this request to. |
setParameters | public void setParameters(Hashtable h)(Code) | | Set the parameters for this request.
Parameters: h - The hashtable for the bulk copies. |
setSession | public void setSession(PersistentSession newSession) throws ControllerException(Code) | | Provide the controller with a PersitentSession object, which it can use
to hold values between invokations. It is essential to use the PersistentSession
rather than handing the controller the HTTPSession or HTTPServletRequest, for
example, to preserve it's portability across all UI environments.
Parameters: newSession - A PersistentSession object |
setUid | public void setUid(int newUid)(Code) | | Sets the current integer user id.
Parameters: newUid - - the user ID integer to set this request to. |
setUser | public void setUser(String newUser)(Code) | | The client of the controller must tell us who is accessing us,
and we decide if they're allowed to access the given state.
Parameters: newUser - The user's string id to set this user to. |
validateDBField | public void validateDBField(String dbFieldName, DBObject oneObject, ErrorCollection ec) throws ControllerException, DBException(Code) | | Convenience method that retrieves the validates
against that one database object field. Assumes
that the parameter name in the request is the same as the
DB field name.
Parameters: dbFieldName - the name of the field to validate Parameters: oneObject - the DBOBject to validate Parameters: ec - The ErrorCollection to fill out if there is an error throws: DBException - upon data error throws: ControllerException - upon internal error |
validateDBObject | public void validateDBObject(DBObject oneObject, ErrorCollection ec) throws ControllerException, ValidationException(Code) | | Convenience method that retrieves parameters/field values and populates a specified
db object. Once the object is populated, the fields are validated
and the error collection populated if necessary.
Parameters: oneObject - the object to validate Parameters: ec - The error collection that gets filled out. throws: ControllerException - upon internal or data error throws: ValidationException - if there is an error validating the object |
validateField | public void validateField(String dbFieldName, String reqFieldName, DBObject oneObject, ErrorCollection ec) throws ControllerException, DBException(Code) | | Convenience method that retrieves the validates
against that one database object field.
Parameters: dbFieldName - the name of the field to validate Parameters: reqFieldName - ??? Parameters: oneObject - the DBOBject to validate Parameters: ec - The ErrorCollection to fill out if there is an error throws: DBException - upon data error throws: ControllerException - upon internal error |
|
|