public abstract class ActionEvent extends Object implements Action
This is an alternative to the Action class that allows you to do event based actions. Essentially, you label all your submit buttons with the prefix of "eventSubmit_" and the suffix of "methodName". For example, "eventSubmit_doDelete". Then any class that subclasses this class will get its "doDelete(PipelineData data)" method executed. If for any reason, it was not able to execute the method, it will fall back to executing the doPerform() method which is required to be implemented.
Limitations:
Because ParameterParser makes all the key values lowercase, we have to do some work to format the string into a method name. For example, a button name eventSubmit_doDelete gets converted into eventsubmit_dodelete. Thus, we need to form some sort of naming convention so that dodelete can be turned into doDelete.
Thus, the convention is this:
Modifier and Type | Field and Description |
---|---|
protected boolean |
bubbleUpException
If true, then exceptions raised in eventSubmit_do<xxx> methods
as well as in doPerform methods are bubbled up to the Turbine
servlet's handleException method.
|
protected static String |
BUTTON
The name of the button to look for.
|
protected static int |
BUTTON_LENGTH
The length of the button to look for.
|
protected static String |
DEFAULT_METHOD
The default method.
|
protected static int |
LENGTH
The length of the button to look for.
|
protected org.apache.logging.log4j.Logger |
log
Logging
|
protected static int |
METHOD_NAME_LENGTH
The length of the method name.
|
protected static String |
METHOD_NAME_PREFIX
The prefix of the method name.
|
CACHE_SIZE_DEFAULT, CACHE_SIZE_KEY, NAME, PREFIX
Constructor and Description |
---|
ActionEvent() |
Modifier and Type | Method and Description |
---|---|
protected boolean |
considerKey(String key,
org.apache.fulcrum.parser.ParameterParser pp)
Checks whether the selected key really is a valid event.
|
void |
doPerform(PipelineData pipelineData)
This overrides the default Action.doPerform() to execute the
doEvent() method.
|
protected void |
executeEvents(org.apache.fulcrum.parser.ParameterParser pp,
Class<?>[] signature,
Object[] parameters)
This method should be called to execute the event based system.
|
protected String |
formatString(String input,
org.apache.fulcrum.parser.ParameterParser pp)
This method does the conversion of the lowercase method name
into the proper case.
|
protected Method |
getMethod(String name,
Class<?>[] signature,
org.apache.fulcrum.parser.ParameterParser pp)
Retrieve a method of the given name and signature.
|
protected org.apache.logging.log4j.Logger log
protected static final String BUTTON
protected static final int BUTTON_LENGTH
protected static final String DEFAULT_METHOD
protected static final String METHOD_NAME_PREFIX
protected static final int METHOD_NAME_LENGTH
protected static final int LENGTH
protected boolean bubbleUpException
public ActionEvent()
protected Method getMethod(String name, Class<?>[] signature, org.apache.fulcrum.parser.ParameterParser pp) throws NoSuchMethodException
name
- the name of the methodsignature
- an array of classes forming the signature of the methodpp
- ParameterParser for correct foldingNoSuchMethodException
- if the method does not existpublic void doPerform(PipelineData pipelineData) throws Exception
protected void executeEvents(org.apache.fulcrum.parser.ParameterParser pp, Class<?>[] signature, Object[] parameters) throws Exception
pp
- the parameter parsersignature
- the signature of the method to callparameters
- the parameters for the method to callException
- a generic exception.protected String formatString(String input, org.apache.fulcrum.parser.ParameterParser pp)
input
- The unconverted method name.pp
- The parameter parser (for correct folding)protected boolean considerKey(String key, org.apache.fulcrum.parser.ParameterParser pp)
key
- The selected keypp
- The parameter parser to look for the key valueCopyright © 2000–2019 The Apache Software Foundation. All rights reserved.