|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface RequestData
File: RequestData.java Created: 2012-04-29 RequestData is the façade API for applications using the framework. It's also the store of the MTP, session and request information during the request life cycle.
Applications using the framework must use this API to interact with the framework. The life of an requestData object is the same as the request.
Field Summary | |
---|---|
static java.lang.String |
MTP_LOGGER
Logger name of the framework. |
static java.lang.String |
REQUEST_EXCEPTION
The request attribute name of the exception thrown in the request life-cycle. |
static java.lang.String |
REQUEST_REQUESTDATA_ATTRIBUTE
The request attribute name of the RequestData object. |
static int |
VALIDATION_ERROR_LOADING_PARAMETER_VALUES_INTO_MODEL
Request has not been validated, because some fields cannot be loaded into application model object. |
static int |
VALIDATION_ERROR_STAGE_1_DATATYPE_CONVERSION
Request has not been validated, because datatype conversion has failed. |
static int |
VALIDATION_ERROR_STAGE_2_REQUIRED_FIELDS
Request has not been validated, because some required fields are empty. |
static int |
VALIDATION_ERROR_STAGE_3_FIELD_VALIDATION_FUNCTIONS
Request has not been validated, because some field validation functions has returned with error. |
static int |
VALIDATION_ERROR_STAGE_4_MODEL_VALIDATION_FUNCTION
Request has not been validated, because the validation function of the model has returned with error. |
static int |
VALIDATION_NO_VALIDATED
Request has not been validated, because no validation is done. |
static int |
VALIDATION_OK
Request has been validated, all stages are passed right. |
Method Summary | |
---|---|
void |
createSession()
Creates a new session for the user (framework creates a new session for the request if it does not has one). |
void |
deleteSessionAttribute(java.lang.String attributeName)
Removes an attribute from the session. |
Configurator |
getConfigurator()
Returns the main configuration object. |
FormInstance |
getFormInstance()
Returns the formInstance object with the parameters of the request associated
with the model . |
java.util.Hashtable<java.lang.String,Language> |
getLanguages()
Returns the application supported languages. |
java.lang.String |
getMessage(java.lang.String key)
Obtains a message text from a languageEntry in the request user's language with
the supplied key. |
Model |
getModel()
Gets the model configuration object selected for the request, or
null if the request has no model. |
java.lang.Object |
getModelInstance()
Returns the application model instance object. |
java.lang.String |
getModelResponse()
Returns the response string returned by the run method of the application model
object. |
java.lang.Object |
getRequestAttribute(java.lang.String attributeName)
Returns an attribute stored previously in the request. |
java.lang.String |
getRequestParameter(java.lang.String parameterName)
Obtains a parameter from the request. |
Result |
getResult()
Returns the result object of the request. |
java.util.Hashtable<java.lang.String,Role> |
getRoles()
Gets the roles granted to the session. |
java.lang.Object |
getSessionAttribute(java.lang.String attributeName)
Returns an attribute stored previously in the session. |
Language |
getUserLanguage()
Gets the language inferred for the request, based on previous
setUserLanguage call, request agent supported languages or default application
language. |
int |
getValidationStatus()
Returns the request validation status. |
java.lang.String |
getView()
Returns the view name to which the response will be redirected. |
boolean |
hasValidSession()
Checks if the request has a valid session. |
boolean |
isAuthorized()
Returns the request session authorization status to run the model. |
boolean |
isValidated()
Returns if the request has passed all validations. |
void |
logoutSession()
Invalidates the session of the request. |
void |
setRequestAttribute(java.lang.String attributeName,
java.lang.Object attributeObject)
Stores an attribute in the request. |
void |
setRoles(java.util.Hashtable<java.lang.String,Role> sessionRoles)
Sets the roles granted to the session. |
void |
setSessionAttribute(java.lang.String attributeName,
java.lang.Object attributeObject)
Stores an attribute into the session. |
void |
setUserLanguage(Language userLanguage)
Sets the language for the session. |
Field Detail |
---|
static final java.lang.String MTP_LOGGER
static final java.lang.String REQUEST_REQUESTDATA_ATTRIBUTE
static final java.lang.String REQUEST_EXCEPTION
static final int VALIDATION_NO_VALIDATED
getValidationStatus()
,
Constant Field Valuesstatic final int VALIDATION_ERROR_STAGE_1_DATATYPE_CONVERSION
getValidationStatus()
,
Constant Field Valuesstatic final int VALIDATION_ERROR_STAGE_2_REQUIRED_FIELDS
getValidationStatus()
,
Constant Field Valuesstatic final int VALIDATION_ERROR_STAGE_3_FIELD_VALIDATION_FUNCTIONS
getValidationStatus()
,
Constant Field Valuesstatic final int VALIDATION_ERROR_LOADING_PARAMETER_VALUES_INTO_MODEL
getValidationStatus()
,
Constant Field Valuesstatic final int VALIDATION_ERROR_STAGE_4_MODEL_VALIDATION_FUNCTION
getValidationStatus()
,
Constant Field Valuesstatic final int VALIDATION_OK
getValidationStatus()
,
Constant Field ValuesMethod Detail |
---|
Configurator getConfigurator()
Configurator
java.util.Hashtable<java.lang.String,Language> getLanguages()
Language
void createSession()
This is done automatically by the framework, but application can create a new session for the request.
hasValidSession()
,
logoutSession()
boolean hasValidSession()
true
if request has a valid session, false
otherwise.createSession()
,
logoutSession()
void logoutSession()
createSession()
,
hasValidSession()
java.lang.Object getSessionAttribute(java.lang.String attributeName)
attributeName
- the name of the attribute to obtain.
null
if it's empty or
doesn't exists.void setSessionAttribute(java.lang.String attributeName, java.lang.Object attributeObject)
attributeName
- the name of the attribute to store.attributeObject
- the object to store in the session.void deleteSessionAttribute(java.lang.String attributeName)
attributeName
- the name of the attribute to remove.java.util.Hashtable<java.lang.String,Role> getRoles()
Role
void setRoles(java.util.Hashtable<java.lang.String,Role> sessionRoles)
sessionRoles
- the list of roles to grant to the session. The previous granted roles
are replaced with these.Role
Language getUserLanguage()
language
inferred for the request, based on previous
setUserLanguage
call, request agent supported languages or default application
language.
language
inferred for the request.Language
void setUserLanguage(Language userLanguage)
userLanguage
- the language
to assign to the session.Language
java.lang.String getMessage(java.lang.String key)
languageEntry
in the request user's language with
the supplied key.
key
- the key string to match with a languageEntry
key.
string
message in request inferred language or null
if
not found.Language
,
LanguageEntry
java.lang.Object getRequestAttribute(java.lang.String attributeName)
attributeName
- the name of the attribute to obtain.
null
if it's empty or doesn't exists.void setRequestAttribute(java.lang.String attributeName, java.lang.Object attributeObject)
attributeName
- the name of the attribute to store.attributeObject
- the object to store in the request.java.lang.String getRequestParameter(java.lang.String parameterName)
parameterName
- the name of the parameter to obtain.
string
with the parameter value or null
if
the parameter doesn't exists.Model getModel()
model
configuration object selected for the request, or
null
if the request has no model.
Model
java.lang.Object getModelInstance()
FormInstance getFormInstance()
formInstance
object with the parameters of the request associated
with the model
.
formInstance
configuration object.FormInstance
java.lang.String getModelResponse()
string
returned by the run method of the application model
object.
string
returned by the run method of the application model
object.Result getResult()
result
object of the request.
result
object of the request or null
if it doesn't exists.Model
,
Result
java.lang.String getView()
boolean isAuthorized()
true
if request session has been authorized, or false
otherwise.int getValidationStatus()
RequestData.VALIDATION_*
values.boolean isValidated()
true
if the request has passed all validations, false
otherwise.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |