Class WorkflowBuilder
- java.lang.Object
-
- org.apache.wiki.workflow.WorkflowBuilder
-
public final class WorkflowBuilder extends java.lang.Object
Factory class that creates common Workflow instances such as a standard approval workflow.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Workflow
buildApprovalWorkflow(java.security.Principal submitter, java.lang.String workflowApproverKey, Step prepTask, java.lang.String decisionKey, Fact[] facts, Step completionTask, java.lang.String rejectedMessageKey)
static WorkflowBuilder
getBuilder(Engine engine)
Returns the WorkflowBuilder instance for a Engine.
-
-
-
Method Detail
-
getBuilder
public static WorkflowBuilder getBuilder(Engine engine)
Returns the WorkflowBuilder instance for a Engine. Only one WorkflowBuilder exists for a given engine.- Parameters:
engine
- the wiki engine- Returns:
- the workflow builder
-
buildApprovalWorkflow
public Workflow buildApprovalWorkflow(java.security.Principal submitter, java.lang.String workflowApproverKey, Step prepTask, java.lang.String decisionKey, Fact[] facts, Step completionTask, java.lang.String rejectedMessageKey) throws WikiException
Builds an approval workflow that requests approval from a named user,
Group
orRole
before running a Task.The Principal who approves the activity is determined by looking up the property
jspwiki.approver.workflowApproverKey
injspwiki.properties
. If that Principal resolves to a known user, Group Role, a Decision will be placed in the respective workflow queue (or multiple queues, if necessary). Only one approver needs to make the Decision, and if the request is approved, the completion task will be executed. If the request is denied, aSimpleNotification
with a message corresponding to therejectedMessage
message key will be placed in the submitter's workflow queue.To help approvers determine how to make the Decision, callers can supply an array of Fact objects to this method, which will be added to the Decision in the order they appear in the array. These items will be displayed in the web UI. In addition, the value of the first Fact will also be added as the third message argument for the workflow (the first two are always the submitter and the approver). For example, the PageManager code that creates the "save page approval" workflow adds the name of the page as its first Fact; this results in the page name being substituted correctly into the resulting message: "Save wiki page <strong>{2}</strong>".
- Parameters:
submitter
- the user submitting the requestworkflowApproverKey
- the key that names the user, Group or Role who must approve the request. The key is looked up injspwiki.properties
, and is derived by prependingjspwiki.approver
to the value ofworkflowApproverKey
prepTask
- the initial task that should run before the Decision step is processed. If this parameter isnull
, the Decision will run as the first Step insteaddecisionKey
- the message key indefault.properties
that contains the text that will appear in approvers' workflow queues indicating they need to make a Decision; for example,decision.saveWikiPage
. In the i18n message bundle file, this key might return text that reads "Approve page <strong>{2}</strong>"facts
- an array ofFact
objects that will be shown to the approver to aid decision-making. The facts will be displayed in the order supplied in the arraycompletionTask
- the Task that will run if the Decision is approvedrejectedMessageKey
- the message key indefault.properties
that contains the text that will appear in the submitter's workflow queue if request was not approved; for example,notification.saveWikiPage.reject
. In the i18n message bundle file, this key might might return text that reads "Your request to save page <strong>{2}</strong> was rejected." If this parameter isnull
, no message will be sent- Returns:
- the created workflow
- Throws:
WikiException
- if the name of the approving user, Role or Group cannot be determined
-
-