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:
InitializeWorkflowAction
,WorkflowAction
public abstract class AbstractWorkflowAction extends ServiceableAction implements Initializable
Abstract action for managing a workflow instance.The following parameters are supported:
- actionId
- the id of the action to fire
-
-
Field Summary
Fields Modifier and Type Field Description protected WorkflowProvider
_workflowProvider
Workflow provider-
Fields inherited from class org.apache.cocoon.acting.ServiceableAction
manager
-
Fields inherited from class org.apache.cocoon.acting.AbstractAction
EMPTY_MAP
-
-
Constructor Summary
Constructors Constructor Description AbstractWorkflowAction()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected 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 Stringprotected Map<String,Object>
_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
.Map
act(Redirector redirector, SourceResolver resolver, Map objectModel, String source, Parameters parameters)
void
initialize()
-
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 Detail
-
_workflowProvider
protected WorkflowProvider _workflowProvider
Workflow provider
-
-
Constructor Detail
-
AbstractWorkflowAction
public AbstractWorkflowAction()
-
-
Method Detail
-
initialize
public void initialize() throws Exception
- Specified by:
initialize
in interfaceInitializable
- Throws:
Exception
-
act
public Map act(Redirector redirector, SourceResolver resolver, Map objectModel, String source, Parameters parameters) throws Exception
-
_getActionId
protected int _getActionId(Map objectModel, String source, Parameters parameters) throws Exception
Provide the action id to use.Default implementation uses parameter
actionId
.- 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
protected String _getFailConditions(Map inputs)
Get the fail conditions as a String- Parameters:
inputs
- the inputs- Returns:
- the fail conditions
-
_getWorkflowErrors
protected Errors _getWorkflowErrors(Map inputs)
Get the workflow errors- Parameters:
inputs
- The inputs- Returns:
- The workflow errors or null if not found
-
_getWorkflowWarns
protected Errors _getWorkflowWarns(Map inputs)
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.
-
-