org.apache.wiki.workflow
Class Task

java.lang.Object
  extended by org.apache.wiki.workflow.AbstractStep
      extended by org.apache.wiki.workflow.Task
All Implemented Interfaces:
Serializable, Step
Direct Known Subclasses:
PageManager.PreSaveWikiPageTask, PageManager.SaveWikiPageTask, UserManager.SaveUserProfileTask

public abstract class Task
extends AbstractStep

AbstractStep subclass that executes instructions, uninterrupted, and results in an Outcome. Concrete classes only need to implement AbstractStep.execute(). When the execution step completes, execute must return Outcome.STEP_COMPLETE, Outcome.STEP_CONTINUE or Outcome.STEP_ABORT. Subclasses can add any errors by calling the helper method AbstractStep.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

Constructor Summary
Task(String messageKey)
          Protected constructor that creates a new Task with a specified message key.
Task(Workflow workflow, String messageKey)
          Constructs a new instance of a Task, with an associated Workflow and message key.
 
Method Summary
 Principal getActor()
          Returns SystemPrincipal.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() returns Outcome.STEP_COMPLETE.
 
Methods inherited from class org.apache.wiki.workflow.AbstractStep
addError, addSuccessor, execute, getAvailableOutcomes, getEndTime, getErrors, getMessageArguments, getMessageKey, getOutcome, getOwner, getStartTime, getSuccessor, getWorkflow, isCompleted, isStarted, setOutcome, setWorkflow, start
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Task

public Task(String messageKey)
Protected constructor that creates a new Task with a specified message key. After construction, the protected method AbstractStep.setWorkflow(Workflow) should be called.

Parameters:
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.).

Task

public Task(Workflow workflow,
            String messageKey)
Constructs a new instance of a Task, with an associated Workflow and message key.

Parameters:
workflow - the associated workflow
messageKey - the i18n message key
Method Detail

getActor

public final Principal getActor()
Returns SystemPrincipal.SYSTEM_USER.

Specified by:
getActor in interface Step
Specified by:
getActor in class AbstractStep
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() returns Outcome.STEP_COMPLETE. This method is really a convenient shortcut for Step.addSuccessor(Outcome, Step), where the first parameter is Outcome.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 method setSuccessor(Step), regardless of the current completion state.

Returns:
the next step


Copyright © {inceptionYear}-2014 The Apache Software Foundation. All rights reserved.