public interface Step extends Serializable
Discrete unit of work in a Workflow, such as a Decision
or a
Task
. Decisions require user input, while Tasks do not. All Steps,
however, possess these properties:
getActor()
.Outcome.DECISION_APPROVE
),
"reassign decision" (Outcome.DECISION_REASSIGN
), "abort step" (Outcome.STEP_ABORT
)
and others. The range of possible Outcomes for the Step is returned by
getAvailableOutcomes()
; see the Outcome class for more details.getErrors()
.isStarted()
and isCompleted()
.getStartTime()
and getEndTime()
, respectively.
Steps contain a getMessageKey()
method that returns a key that can
be used with the InternationalizationManager
.
See also Workflow.getMessageArguments()
, which is a convenience
method that returns message arguments.
Modifier and Type | Method and Description |
---|---|
void |
addSuccessor(Outcome outcome,
Step step)
Adds a successor Step to this one, which will be triggered by a supplied
Outcome.
|
Outcome |
execute()
Executes the processing for this Step and returns an Outcome indicating
if it succeeded (
Outcome.STEP_COMPLETE or
Outcome.STEP_ABORT ). |
Principal |
getActor()
The Principal responsible for completing this Step, such as a system user
or actor assigned to a Decision.
|
Collection<Outcome> |
getAvailableOutcomes()
Returns a Collection of available outcomes, such as "approve", "deny" or
"reassign", in the order in which they were added via
addSuccessor(Outcome, Step) . |
Date |
getEndTime()
The end time for this Step.
|
List<String> |
getErrors()
Returns a List of error strings generated by this Step.
|
Serializable[] |
getMessageArguments()
Returns the message arguments for this Step, typically by delegating to the
parent Workflow's
Workflow.getMessageArguments() method. |
String |
getMessageKey()
Message key for human-friendly name of this Step, including any parameter
substitutions.
|
Outcome |
getOutcome()
Returns the Outcome of this Step's processing; by default,
Outcome.STEP_CONTINUE . |
Principal |
getOwner()
Convenience method that returns the owner of the Workflow by delegating
to
Workflow.getOwner() . |
Date |
getStartTime()
The start time for this Step.
|
Step |
getSuccessor(Outcome outcome)
Identifies the next Step for a particular Outcome; if there is no next
Step for this Outcome, this method returns
null . |
Workflow |
getWorkflow()
Gets the Workflow that is the parent of this Step.
|
boolean |
isCompleted()
Determines whether the Step is completed; if not, it is by definition
awaiting action by the owner or in process.
|
boolean |
isStarted()
Determines whether the Step has started.
|
void |
setOutcome(Outcome outcome)
Sets the current Outcome for the step.
|
void |
setWorkflow(Workflow workflow)
Sets the parent Workflow post-construction.
|
void |
start()
Starts the Step, and sets the start time to the moment when this method
is first invoked.
|
void addSuccessor(Outcome outcome, Step step)
getAvailableOutcomes()
should return them in the same
order they were added.outcome
- the Outcome triggering a particular successor Stepstep
- the Step to associated with this Outcomes (null
denotes no Steps)Collection<Outcome> getAvailableOutcomes()
addSuccessor(Outcome, Step)
. Concrete implementations should
always return a defensive copy of the outcomes, not the original backing
collection.List<String> getErrors()
Outcome execute() throws WikiException
Executes the processing for this Step and returns an Outcome indicating
if it succeeded (Outcome.STEP_COMPLETE
or
Outcome.STEP_ABORT
). Processing instructions can do just about
anything, such as executing custom business logic or changing the Step's
final outcome via setOutcome(Outcome)
. A return value of
STEP_COMPLETE
indicates that the instructions executed completely,
without errors; STEP_ABORT
indicates that the Step and its
parent Workflow should be aborted (that is, fail silently without error).
If the execution step encounters any errors, it should throw a
WikiException or a subclass.
Note that successful execution of this methods does not necessarily mean
that the Step is considered "complete"; rather, it just means that it has
executed. Therefore, it is possible that execute
could run
multiple times.
WikiException
- if the step encounters errors while executingPrincipal getActor()
Date getEndTime()
Workflow.TIME_NOT_SET
if not completed yet.String getMessageKey()
task.
and decision.
).Serializable[] getMessageArguments()
Workflow.getMessageArguments()
method.Outcome getOutcome()
Outcome.STEP_CONTINUE
.Date getStartTime()
Workflow.TIME_NOT_SET
if
not started yet.Workflow getWorkflow()
boolean isCompleted()
null
result for
getOutcome()
.true
if the Step has completed; false
if not.boolean isStarted()
true
if the Step has started; false
if not.void start() throws WikiException
WikiException
- if the step encounters errors while startingvoid setOutcome(Outcome outcome)
getAvailableOutcomes()
, or is not Outcome.STEP_CONTINUE
or Outcome.STEP_ABORT
, this method returns an
IllegalArgumentException. If the caller attempts to set an Outcome
and the Step has already completed, this method throws an
IllegalStateException.outcome
- whether the step should be considered completedPrincipal getOwner()
Workflow.getOwner()
.Step getSuccessor(Outcome outcome)
null
.outcome
- the outcomevoid setWorkflow(Workflow workflow)
Step
.workflow
- the parent workflow to setCopyright © 2001-2019 The Apache Software Foundation. All rights reserved.