public abstract class AbstractStep extends java.lang.Object implements Step
execute(Context) and
getActor().TIME_NOT_SET| Modifier | Constructor and Description |
|---|---|
|
AbstractStep(int workflowId,
java.util.Map<java.lang.String,java.io.Serializable> workflowContext,
java.lang.String messageKey)
Constructs a new Step belonging to a specified Workflow and having a specified message key.
|
protected |
AbstractStep(java.lang.String messageKey)
Protected constructor that creates a new Step with a specified message key.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
addError(java.lang.String message)
Protected helper method that adds a String representing an error message to the Step's cached errors list.
|
void |
addSuccessor(Outcome outcome,
Step step)
Adds a successor Step to this one, which will be triggered by a supplied Outcome.
|
abstract Outcome |
execute(Context ctx)
Executes the processing for this Step and returns an Outcome indicating if it succeeded (
Outcome.STEP_COMPLETE or
Outcome.STEP_ABORT). |
abstract java.security.Principal |
getActor()
The Principal responsible for completing this Step, such as a system user or actor assigned to a Decision.
|
java.util.Collection<Outcome> |
getAvailableOutcomes()
Returns a Collection of available outcomes, such as "approve", "deny" or "reassign", in the order in which they were added via
Step.addSuccessor(Outcome, Step). |
java.util.Date |
getEndTime()
The end time for this Step.
|
java.util.List<java.lang.String> |
getErrors()
Returns a List of error strings generated by this Step.
|
java.lang.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. |
java.util.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. |
java.util.Map<java.lang.String,java.io.Serializable> |
getWorkflowContext() |
int |
getWorkflowId() |
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(int workflowId,
java.util.Map<java.lang.String,java.io.Serializable> workflowContext)
method that sets the parent Workflow id and context post-construction.
|
void |
start()
Starts the Step, and sets the start time to the moment when this method is first invoked.
|
protected AbstractStep(java.lang.String messageKey)
setWorkflow(int, Map) should be called.messageKey - the Step's message key, such as decision.editPageApproval. By convention, the message prefix should
be a lower-case version of the Step's type, plus a period (e.g., task. and decision.).public AbstractStep(int workflowId, java.util.Map<java.lang.String,java.io.Serializable> workflowContext, java.lang.String messageKey)
workflowId - the parent workflow id to setworkflowContext - the parent workflow context to setmessageKey - the Step's message key, such as decision.editPageApproval. By convention, the message prefix should
be a lower-case version of the Step's type, plus a period (e.g., task. and decision.).public final void addSuccessor(Outcome outcome, Step step)
Step.getAvailableOutcomes() should return them in the same order they were added.addSuccessor in interface Stepoutcome - the Outcome triggering a particular successor Stepstep - the Step to associated with this Outcomes (null denotes no Steps)public final java.util.Collection<Outcome> getAvailableOutcomes()
Step.addSuccessor(Outcome, Step). Concrete implementations should always return a defensive copy of the outcomes, not the
original backing collection.getAvailableOutcomes in interface Steppublic final java.util.List<java.lang.String> getErrors()
public abstract Outcome execute(Context ctx) 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 Step.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.
execute in interface Stepctx - executing wiki context.WikiException - if the step encounters errors while executingpublic abstract java.security.Principal getActor()
public final java.util.Date getEndTime()
Step.TIME_NOT_SET if not completed
yet.getEndTime in interface Steppublic final java.lang.String getMessageKey()
task. and decision.).getMessageKey in interface Steppublic final Outcome getOutcome()
Outcome.STEP_CONTINUE.getOutcome in interface Steppublic final java.util.Date getStartTime()
Step.TIME_NOT_SET if not started yet.getStartTime in interface Steppublic final boolean isCompleted()
null result for Step.getOutcome().isCompleted in interface Steptrue if the Step has completed; false if not.public final boolean isStarted()
public final void setOutcome(Outcome outcome)
Step.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.setOutcome in interface Stepoutcome - whether the step should be considered completedpublic final void start() throws WikiException
start in interface StepWikiException - if the step encounters errors while startingpublic final Step getSuccessor(Outcome outcome)
null.getSuccessor in interface Stepoutcome - the outcomepublic final void setWorkflow(int workflowId, java.util.Map<java.lang.String,java.io.Serializable> workflowContext)
setWorkflow in interface StepworkflowId - the parent workflow id to setworkflowContext - the parent workflow context to setpublic int getWorkflowId()
public java.util.Map<java.lang.String,java.io.Serializable> getWorkflowContext()
protected final void addError(java.lang.String message)
message - the error messageCopyright (c) 2001-2022 The Apache Software Foundation. All rights reserved.