public final class WorkflowBuilder extends Object
Modifier and Type | Method and Description |
---|---|
Workflow |
buildApprovalWorkflow(Principal submitter,
String workflowApproverKey,
Step prepTask,
String decisionKey,
Fact[] facts,
Step completionTask,
String rejectedMessageKey)
|
static WorkflowBuilder |
getBuilder(WikiEngine engine)
Returns the WorkflowBuilder instance for a WikiEngine.
|
public static WorkflowBuilder getBuilder(WikiEngine engine)
engine
- the wiki enginepublic Workflow buildApprovalWorkflow(Principal submitter, String workflowApproverKey, Step prepTask, String decisionKey, Fact[] facts, Step completionTask, String rejectedMessageKey) throws WikiException
Builds an approval workflow that requests approval from a named
user, Group
or
Role
before running a Task.
The Principal who approves the activity is determined by looking up
the property jspwiki.approver.workflowApproverKey
in jspwiki.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, a
SimpleNotification
with a message corresponding to the rejectedMessage
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>".
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 in jspwiki.properties
, and is derived
by prepending jspwiki.approver
to the value of workflowApproverKey
prepTask
- the initial task that should run before the Decision step is processed.
If this parameter is null
, the Decision will run as the first Step insteaddecisionKey
- the message key in default.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 of Fact
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 in default.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 is null
, no message will be sentWikiException
- if the name of the approving user, Role or Group cannot be determinedCopyright © 2001-2019 The Apache Software Foundation. All rights reserved.