|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object nl.openedge.baritus.FormBeanCtrlBase
FormBeanBase is the class that does the real work within Baritus. Usually, you should extend the singleton implementation FormBeanCtrl. However, if you want to have behaviour like Maverick's ThrowawayFormBeanUser (a new instance of the controller is created on each request), you can extend from this class directly. Note that as method init(Node) is specific for the ControllerSingleton that is implemented in FormBeanCtrl, you do not have this method at your disposal here, hence you should do initialisation in your constructor instead.
Field Summary | |
static java.lang.String |
ERROR
Common name for the typical "error" view. |
static java.lang.String |
LOGON
Common name for the typical "logon" view. |
static java.lang.String |
REDIRECT
Common name for the "redirect" view. |
static java.lang.String |
REQUEST_ATTRIBUTE_EXECUTION_PARAMS
Key for request attribute that is used to store the execution parameters for the current request. |
static java.lang.String |
REQUEST_ATTRIBUTE_FORMBEANCONTEXT
Key for request attribute that is used to store the formbean context. |
static java.lang.String |
SESSION_KEY_CURRENT_LOCALE
session key for the current locale. |
static java.lang.String |
SUCCESS
Common name for the typical "success" view. |
Constructor Summary | |
FormBeanCtrlBase()
|
Method Summary | |
protected void |
addInterceptor(Interceptor interceptor)
Add an interceptor to the current list of interceptors. |
protected void |
addInterceptor(int index,
Interceptor interceptor)
Add an interceptor to the current list of interceptors at the specified position. |
protected void |
addPopulator(java.util.regex.Pattern pattern,
FieldPopulator populator)
Register a custom populator that overrides the default population process for all request parameters that match the regular expression stored in the provided pattern. |
protected void |
addPopulator(java.lang.String fieldName,
FieldPopulator populator)
Register a field populator for the given fieldName. |
protected void |
addValidationActivationRule(ValidationActivationRule rule)
Register the rule for the whole form. |
protected void |
addValidator(FormValidator validator)
Register a form validator. |
protected void |
addValidator(java.lang.String fieldName,
FieldValidator validator)
Register a field validator for the given fieldName. |
protected void |
addValidatorDelegate(nl.openedge.baritus.ValidatorDelegate validatorDelegate)
Add a validator delegate. |
protected void |
doSetNoCache(org.infohazard.maverick.flow.ControllerContext cctx)
Set http response headers that indicate that this page should not be cached. |
void |
fixExecutionParams(ExecutionParams params)
Save the execution params that are used to influence the execution of the formBeanCtrl (like population, validation, etc). |
protected java.lang.String |
getConversionErrorLabelKey(java.lang.Class type,
java.lang.String name,
java.lang.Object triedValue)
Get the message bundle key for a conversion error for the given type and field with the given name. |
protected FieldPopulator |
getDefaultPopulator()
get the default field populator |
protected java.lang.String |
getErrorView(org.infohazard.maverick.flow.ControllerContext cctx,
FormBeanContext formBeanContext)
Get error view. |
ExecutionParams |
getExecutionParams(org.infohazard.maverick.flow.ControllerContext cctx)
Get a deep copy of the execution params that are used to influence the execution of the formBeanCtrl (like population, validation, etc). |
protected java.util.Locale |
getLocaleForRequest(org.infohazard.maverick.flow.ControllerContext cctx,
FormBeanContext formBeanContext)
Get the prefered locale for the current request. |
static java.lang.String |
getLocalizedMessage(java.lang.String key)
Get localized message for given key. |
protected static java.lang.String |
getLocalizedMessage(java.lang.String key,
java.util.Locale locale)
Get localized message for given key and locale. |
protected static java.lang.String |
getLocalizedMessage(java.lang.String key,
java.util.Locale locale,
java.lang.Object[] parameters)
Get localized message for given key and locale and format it with the given parameters. |
protected static java.lang.String |
getLocalizedMessage(java.lang.String key,
java.lang.Object[] parameters)
Get localized message for given key and locale and format it with the given parameters. |
java.lang.String |
getPropertyNameKey(java.lang.String name)
Get the message bundle key for the given property name. |
protected java.util.List |
getValidatorDelegates()
Get the list of registered validator delegates. |
protected MultiHashMap |
getValidators(java.lang.String fieldName)
Get the fieldValidators that were registered with the given fieldName. |
java.lang.String |
go(org.infohazard.maverick.flow.ControllerContext cctx)
Executes this controller. |
protected boolean |
isNullOrEmpty(java.lang.Object value)
Check if the value is null or empty. |
protected abstract java.lang.Object |
makeFormBean(FormBeanContext formBeanContext,
org.infohazard.maverick.flow.ControllerContext cctx)
This method will be called to produce a bean whose properties will be populated with the http currentRequest parameters, the resulting object will be placed in the formBeanContext after this call. |
protected abstract java.lang.String |
perform(FormBeanContext formBeanContext,
org.infohazard.maverick.flow.ControllerContext cctx)
This method must be overriden to perform application logic. |
protected void |
removeInterceptor(Interceptor interceptor)
Remove an interceptor from the current list of interceptors. |
protected void |
removePopulator(java.util.regex.Pattern pattern)
Register a custom populator that overrides the default population process for all request parameters that match the regular expression stored in the provided pattern. |
protected void |
removePopulator(java.lang.String fieldName)
De-register the field populator that was registered with the given fieldName. |
protected void |
removeValidationActivationRule(ValidationActivationRule rule)
De-register the given rule for the whole form. |
protected void |
removeValidator(FormValidator validator)
De-register the given form level validator. |
protected void |
removeValidator(java.lang.String fieldName,
FieldValidator validator)
De-register the given validator that was registered with the given fieldName. |
protected void |
removeValidatorDelegate(nl.openedge.baritus.ValidatorDelegate validatorDelegate)
Remove a validator delegate. |
protected void |
removeValidators(java.lang.String fieldName)
De-register the fieldValidators that were registered with the given fieldName. |
void |
setConversionErrorForField(org.infohazard.maverick.flow.ControllerContext cctx,
FormBeanContext formBeanContext,
java.lang.Class targetType,
java.lang.String name,
java.lang.Object triedValue,
java.lang.Throwable t)
Set error for field with name 'name' in case of a conversion error. |
protected void |
setDefaultPopulator(FieldPopulator populator)
set the default field populator |
void |
setOverrideField(org.infohazard.maverick.flow.ControllerContext cctx,
FormBeanContext formBeanContext,
java.lang.String name,
java.lang.Object triedValue,
java.lang.Throwable t,
FieldValidator validator)
Set the override value for the provdied field name. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String SUCCESS
public static final java.lang.String LOGON
public static final java.lang.String ERROR
public static final java.lang.String REDIRECT
public static final java.lang.String SESSION_KEY_CURRENT_LOCALE
public static final java.lang.String REQUEST_ATTRIBUTE_FORMBEANCONTEXT
public static final java.lang.String REQUEST_ATTRIBUTE_EXECUTION_PARAMS
Constructor Detail |
public FormBeanCtrlBase()
Method Detail |
public final java.lang.String go(org.infohazard.maverick.flow.ControllerContext cctx) throws javax.servlet.ServletException
go
in interface org.infohazard.maverick.flow.Controller
cctx
- maverick controller context
javax.servlet.ServletException
Controller.go(org.infohazard.maverick.flow.ControllerContext)
public void setConversionErrorForField(org.infohazard.maverick.flow.ControllerContext cctx, FormBeanContext formBeanContext, java.lang.Class targetType, java.lang.String name, java.lang.Object triedValue, java.lang.Throwable t)
cctx
- controller contextformBeanContext
- context with form beantargetType
- type of target propertyname
- name of fieldtriedValue
- value that was tried for populationt
- exceptionpublic java.lang.String getPropertyNameKey(java.lang.String name)
name
- property name
protected java.lang.String getConversionErrorLabelKey(java.lang.Class type, java.lang.String name, java.lang.Object triedValue)
type
- type of the target property that threw the conversion errorname
- name of the target propertytriedValue
- the value that could not be converted to the type of the
target property
public void setOverrideField(org.infohazard.maverick.flow.ControllerContext cctx, FormBeanContext formBeanContext, java.lang.String name, java.lang.Object triedValue, java.lang.Throwable t, FieldValidator validator)
cctx
- controller contextformBeanContext
- context with form beanname
- name of the fieldtriedValue
- the user input value/ currentRequest parametert
- exception if known (may be null)validator
- the validator that was the cause of the validation failure, if one
(is null if this was a conversion error)protected abstract java.lang.String perform(FormBeanContext formBeanContext, org.infohazard.maverick.flow.ControllerContext cctx) throws java.lang.Exception
formBeanContext
- context with the populated bean returned by makeFormBean().cctx
- maverick controller context.
java.lang.Exception
- As a last fallthrough, exceptions are handled by the framework.
It is advisable however, to keep control of the error reporting, and let this
method do the exception handlingprotected abstract java.lang.Object makeFormBean(FormBeanContext formBeanContext, org.infohazard.maverick.flow.ControllerContext cctx)
formBeanContext
- the form bean context. If this is the first control within
a request, the formBeanContext will be empty. If this is a not the first
control that is called within a request (i.e. more controls are linked together),
and execution parameters property reuseFormBeanContext is true (which is the
default), the formBeanContext may allready contain error registrations, and
contains the formBean that was used in the control before this one.cctx
- controller context with references to request, response etc.
protected void addValidatorDelegate(nl.openedge.baritus.ValidatorDelegate validatorDelegate)
validatorDelegate
- protected void removeValidatorDelegate(nl.openedge.baritus.ValidatorDelegate validatorDelegate)
validatorDelegate
- protected java.util.List getValidatorDelegates()
protected void addValidator(java.lang.String fieldName, FieldValidator validator)
fieldName
- name of fieldvalidator
- validator instanceprotected void addValidator(FormValidator validator)
validator
- the form level validatorprotected void removeValidators(java.lang.String fieldName)
fieldName
- name of fieldprotected void removeValidator(java.lang.String fieldName, FieldValidator validator)
fieldName
- name of fieldvalidator
- the validator to remove for the given fieldprotected void removeValidator(FormValidator validator)
validator
- form validatorprotected void addValidationActivationRule(ValidationActivationRule rule)
rule
- activation ruleprotected void removeValidationActivationRule(ValidationActivationRule rule)
rule
- global rule to removeprotected MultiHashMap getValidators(java.lang.String fieldName)
fieldName
- name of the field
protected void addPopulator(java.lang.String fieldName, FieldPopulator populator)
fieldName
- name of fieldpopulator
- populator instanceprotected void removePopulator(java.lang.String fieldName)
fieldName
- name of fieldprotected void addPopulator(java.util.regex.Pattern pattern, FieldPopulator populator)
pattern
- regex patternpopulator
- populator instanceprotected void removePopulator(java.util.regex.Pattern pattern)
pattern
- regex patternprotected void setDefaultPopulator(FieldPopulator populator)
populator
- the default field populatorprotected FieldPopulator getDefaultPopulator()
protected void addInterceptor(Interceptor interceptor)
interceptor
- the interceptor to add to the current list of interceptorsprotected void addInterceptor(int index, Interceptor interceptor)
index
- index position where to insert the interceptorinterceptor
- the interceptor to add to the current list of interceptorsprotected void removeInterceptor(Interceptor interceptor)
interceptor
- the interceptor to remove from the current list of interceptorsprotected boolean isNullOrEmpty(java.lang.Object value)
value
- object to check on
public static java.lang.String getLocalizedMessage(java.lang.String key)
key
- key of message
protected static java.lang.String getLocalizedMessage(java.lang.String key, java.util.Locale locale)
key
- key of messagelocale
- locale for message
protected static java.lang.String getLocalizedMessage(java.lang.String key, java.lang.Object[] parameters)
key
- key of messageparameters
- parameters for the message
protected static java.lang.String getLocalizedMessage(java.lang.String key, java.util.Locale locale, java.lang.Object[] parameters)
key
- key of messagelocale
- locale for messageparameters
- parameters for the message
protected java.util.Locale getLocaleForRequest(org.infohazard.maverick.flow.ControllerContext cctx, FormBeanContext formBeanContext)
cctx
- controller contextformBeanContext
- context
protected java.lang.String getErrorView(org.infohazard.maverick.flow.ControllerContext cctx, FormBeanContext formBeanContext)
cctx
- controller contextformBeanContext
- context
protected void doSetNoCache(org.infohazard.maverick.flow.ControllerContext cctx)
cctx
- controller contextpublic ExecutionParams getExecutionParams(org.infohazard.maverick.flow.ControllerContext cctx)
cctx
- Maverick context with the current request, null if it should be ignored.
public void fixExecutionParams(ExecutionParams params)
params
- the execution params that are used to influence the execution
of the formBeanCtrl (like population, validation, etc).
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |