Class AbstractWorkflowAction
java.lang.Object
org.apache.avalon.framework.logger.AbstractLogEnabled
org.apache.cocoon.acting.AbstractAction
org.apache.cocoon.acting.ServiceableAction
org.ametys.plugins.workflow.cocoon.AbstractWorkflowAction
- All Implemented Interfaces:
Initializable
,Component
,LogEnabled
,Serviceable
,Action
- Direct Known Subclasses:
DoFormWorkflowAction
,InitializeWorkflowAction
,WorkflowAction
Abstract action for managing a workflow instance.
The following parameters are supported:
- actionId
- the id of the action to fire
-
Field Summary
Fields inherited from class org.apache.cocoon.acting.ServiceableAction
manager
Fields inherited from class org.apache.cocoon.acting.AbstractAction
EMPTY_MAP
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected abstract Map
_act
(Redirector redirector, Map objectModel, String source, Parameters parameters, int actionId, Map inputs) Initialize or act on a workflow instance.protected int
_getActionId
(Map objectModel, String source, Parameters parameters) Provide the action id to use.protected abstract String
_getExceptionContext
(Map objectModel, String source, Parameters parameters) Provides the exception context for a more friendly error message.protected String
_getFailConditions
(Map inputs) Get the fail conditions as a String_getInputs
(Redirector redirector, Map objectModel, String source, Parameters parameters) Provide the inputs to use.protected Errors
_getWorkflowErrors
(Map inputs) Get the workflow errorsprotected Errors
_getWorkflowWarns
(Map inputs) Get the workflow warningsprotected Map
_processInvalidActionException
(Redirector redirector, Map objectModel, String source, Parameters parameters, long actionId, Map inputs, com.opensymphony.workflow.InvalidActionException e) Called when the current action is invalid.protected Map
_processWorkflowException
(Redirector redirector, Map objectModel, String source, Parameters parameters, long actionId, com.opensymphony.workflow.WorkflowException e) Called when the current action has thrown aWorkflowException
.act
(Redirector redirector, SourceResolver resolver, Map objectModel, String source, Parameters parameters) void
Methods inherited from class org.apache.cocoon.acting.ServiceableAction
service
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
-
Field Details
-
_workflowProvider
Workflow provider
-
-
Constructor Details
-
AbstractWorkflowAction
public AbstractWorkflowAction()
-
-
Method Details
-
initialize
- Specified by:
initialize
in interfaceInitializable
- Throws:
Exception
-
act
public Map act(Redirector redirector, SourceResolver resolver, Map objectModel, String source, Parameters parameters) throws Exception -
_getActionId
Provide the action id to use. Default implementation uses parameteractionId
.- Parameters:
objectModel
- the current object model.source
- the current source.parameters
- the current parameters.- Returns:
- the action id.
- Throws:
Exception
- if an error occurs.
-
_getInputs
protected Map<String,Object> _getInputs(Redirector redirector, Map objectModel, String source, Parameters parameters) throws Exception Provide the inputs to use. Default implementation provide the redirector.- Parameters:
redirector
- the redirector.objectModel
- the current object model.source
- the current source.parameters
- the current parameters.- Returns:
- the inputs to use.
- Throws:
Exception
- if an error occurs.
-
_act
protected abstract Map _act(Redirector redirector, Map objectModel, String source, Parameters parameters, int actionId, Map inputs) throws com.opensymphony.workflow.InvalidInputException, com.opensymphony.workflow.WorkflowException Initialize or act on a workflow instance.- Parameters:
redirector
- the redirector.objectModel
- the current object model.source
- the current source.parameters
- the current parameters.actionId
- the action id to use.inputs
- the inputs to use- Returns:
- the action result.
- Throws:
com.opensymphony.workflow.InvalidInputException
- if the action id is not valid.com.opensymphony.workflow.WorkflowException
- if the action failed.
-
_processInvalidActionException
protected Map _processInvalidActionException(Redirector redirector, Map objectModel, String source, Parameters parameters, long actionId, Map inputs, com.opensymphony.workflow.InvalidActionException e) throws Exception Called when the current action is invalid. Default implementation throw an exception.- Parameters:
redirector
- the redirector.objectModel
- the current object model.source
- the current source.parameters
- the current parameters.actionId
- the invalid action id.inputs
- the inputse
- the invalid action exception.- Returns:
- the action result.
- Throws:
Exception
- in order to stop the current pipeline.
-
_getFailConditions
Get the fail conditions as a String- Parameters:
inputs
- the inputs- Returns:
- the fail conditions
-
_getWorkflowErrors
Get the workflow errors- Parameters:
inputs
- The inputs- Returns:
- The workflow errors or null if not found
-
_getWorkflowWarns
Get the workflow warnings- Parameters:
inputs
- The inputs- Returns:
- The workflow warnings or null if not found
-
_processWorkflowException
protected Map _processWorkflowException(Redirector redirector, Map objectModel, String source, Parameters parameters, long actionId, com.opensymphony.workflow.WorkflowException e) throws Exception Called when the current action has thrown aWorkflowException
. Default implementation throw an exception.- Parameters:
redirector
- the redirector.objectModel
- the current object model.source
- the current source.parameters
- the current parameters.actionId
- the invalid action id.e
- the workflow exception.- Returns:
- the action result.
- Throws:
Exception
- in order to stop the current pipeline.
-
_getExceptionContext
protected abstract String _getExceptionContext(Map objectModel, String source, Parameters parameters) Provides the exception context for a more friendly error message.- Parameters:
objectModel
- the current object model.source
- the current source.parameters
- the current parameters.- Returns:
- the message describing the exception context.
-