Package org.apache.wiki.workflow
Class Task
- java.lang.Object
-
- org.apache.wiki.workflow.AbstractStep
-
- org.apache.wiki.workflow.Task
-
- All Implemented Interfaces:
java.io.Serializable
,Step
- Direct Known Subclasses:
PreSaveWikiPageTask
,SaveUserProfileTask
,SaveWikiPageTask
public abstract class Task extends AbstractStep
AbstractStep subclass that executes instructions, uninterrupted, and results in an Outcome. Concrete classes only need to implementAbstractStep.execute(org.apache.wiki.api.core.Context)
. When the execution step completes,execute
must returnOutcome.STEP_COMPLETE
,Outcome.STEP_CONTINUE
orOutcome.STEP_ABORT
. Subclasses can add any errors by calling the helper methodAbstractStep.addError(String)
. The execute method should generally capture and add errors to the error list instead of throwing a WikiException.- Since:
- 2.5
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from interface org.apache.wiki.workflow.Step
TIME_NOT_SET
-
-
Constructor Summary
Constructors Constructor Description Task(int workflowId, java.util.Map<java.lang.String,java.io.Serializable> workflowContext, java.lang.String messageKey)
Constructs a new instance of a Task, with an associated Workflow and message key.Task(java.lang.String messageKey)
Public constructor that creates a new Task with a specified message key.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.security.Principal
getActor()
ReturnsSystemPrincipal.SYSTEM_USER
.Step
getSuccessor()
Identifies the next Step after this Task finishes successfully.void
setSuccessor(Step step)
Sets the successor Step to this one, which will be triggered if the Task completes successfully (that is,Step.getOutcome()
returnsOutcome.STEP_COMPLETE
.-
Methods inherited from class org.apache.wiki.workflow.AbstractStep
addError, addSuccessor, execute, getAvailableOutcomes, getEndTime, getErrors, getMessageKey, getOutcome, getStartTime, getSuccessor, getWorkflowContext, getWorkflowId, isCompleted, isStarted, setOutcome, setWorkflow, start
-
-
-
-
Constructor Detail
-
Task
public Task(java.lang.String messageKey)
Public constructor that creates a new Task with a specified message key. After construction, the protected methodAbstractStep.setWorkflow(int, Map)
should be called.- Parameters:
messageKey
- the Step's message key, such asdecision.editPageApproval
. By convention, the message prefix should be a lower-case version of the Step's type, plus a period (e.g.,task.
anddecision.
).
-
Task
public Task(int workflowId, java.util.Map<java.lang.String,java.io.Serializable> workflowContext, java.lang.String messageKey)
Constructs a new instance of a Task, with an associated Workflow and message key.- Parameters:
workflowId
- the parent workflow id to setworkflowContext
- the parent workflow context to setmessageKey
- the i18n message key
-
-
Method Detail
-
getActor
public final java.security.Principal getActor()
ReturnsSystemPrincipal.SYSTEM_USER
.- Specified by:
getActor
in interfaceStep
- Specified by:
getActor
in classAbstractStep
- Returns:
- the system principal
-
setSuccessor
public final void setSuccessor(Step step)
Sets the successor Step to this one, which will be triggered if the Task completes successfully (that is,Step.getOutcome()
returnsOutcome.STEP_COMPLETE
. This method is really a convenient shortcut forStep.addSuccessor(Outcome, Step)
, where the first parameter isOutcome.STEP_COMPLETE
.- Parameters:
step
- the successor
-
getSuccessor
public final Step getSuccessor()
Identifies the next Step after this Task finishes successfully. This method will always return the value set in methodsetSuccessor(Step)
, regardless of the current completion state.- Returns:
- the next step
-
-