public class DefaultWorkflowManager extends java.lang.Object implements WorkflowManager
Monitor class that tracks running Workflows. The WorkflowManager also keeps track of the names of users or groups expected to approve particular Workflows.
PROPERTY_APPROVER_PREFIX, WF_UP_CREATE_SAVE_APPROVER, WF_UP_CREATE_SAVE_ATTR_SAVED_PROFILE, WF_UP_CREATE_SAVE_DECISION_MESSAGE_KEY, WF_UP_CREATE_SAVE_FACT_PREFS_EMAIL, WF_UP_CREATE_SAVE_FACT_PREFS_FULL_NAME, WF_UP_CREATE_SAVE_FACT_PREFS_LOGIN_NAME, WF_UP_CREATE_SAVE_FACT_SUBMITTER, WF_WP_SAVE_APPROVER, WF_WP_SAVE_DECISION_MESSAGE_KEY, WF_WP_SAVE_FACT_CURRENT_TEXT, WF_WP_SAVE_FACT_DIFF_TEXT, WF_WP_SAVE_FACT_IS_AUTHENTICATED, WF_WP_SAVE_FACT_PAGE_NAME, WF_WP_SAVE_FACT_PROPOSED_TEXT, WF_WP_SAVE_REJECT_MESSAGE_KEY| Constructor and Description |
|---|
DefaultWorkflowManager()
Constructs a new WorkflowManager, with an empty workflow cache.
|
| Modifier and Type | Method and Description |
|---|---|
void |
actionPerformed(WikiEvent event)
Listens for
WorkflowEvent objects emitted by Workflows. |
protected void |
add(Workflow workflow)
Protected helper method that adds a newly created Workflow to the cache, and sets its
workflowManager and
Id properties if not set. |
protected void |
addToDecisionQueue(Decision decision) |
java.security.Principal |
getApprover(java.lang.String messageKey)
Looks up and resolves the actor who approves a Decision for a particular Workflow, based on the Workflow's message key.
|
java.util.List<Workflow> |
getCompletedWorkflows()
Returns a collection of finished workflows; that is, those that have aborted or completed.
|
DecisionQueue |
getDecisionQueue()
Returns the DecisionQueue associated with this WorkflowManager
|
protected Engine |
getEngine()
Protected helper method that returns the associated Engine
|
java.util.List<Workflow> |
getOwnerWorkflows(Session session)
Returns the current workflows a wiki session owns.
|
java.util.Set<Workflow> |
getWorkflows()
Returns a collection of the currently active workflows.
|
void |
initialize(Engine engine,
java.util.Properties props)
Any properties that begin with
WorkflowManager.PROPERTY_APPROVER_PREFIX will be assumed to be Decisions that require approval. |
protected void |
remove(Workflow workflow)
Protected helper method that removes a specified Workflow from the cache, and moves it to the workflow history list.
|
protected void |
removeFromDecisionQueue(Decision decision,
Context context) |
boolean |
requiresApproval(java.lang.String messageKey)
Returns
true if a workflow matching a particular key contains an approval step. |
public DefaultWorkflowManager()
public java.util.Set<Workflow> getWorkflows()
getWorkflows in interface WorkflowManagerpublic java.util.List<Workflow> getCompletedWorkflows()
getCompletedWorkflows in interface WorkflowManagerpublic void initialize(Engine engine, java.util.Properties props)
WorkflowManager.PROPERTY_APPROVER_PREFIX will be assumed to be Decisions that require approval. For a given
property key, everything after the prefix denotes the Decision's message key. The property value indicates the Principal (Role,
GroupPrincipal, WikiPrincipal) that must approve the Decision. For example, if the property key/value pair is
jspwiki.approver.workflow.saveWikiPage=Admin, the Decision's message key is workflow.saveWikiPage. The Principal
Admin will be resolved via AuthorizationManager.resolvePrincipal(String).initialize in interface Initializablepublic boolean requiresApproval(java.lang.String messageKey)
true if a workflow matching a particular key contains an approval step.requiresApproval in interface WorkflowManagermessageKey - the name of the workflow; corresponds to the value returned by Workflow.getMessageKey().public java.security.Principal getApprover(java.lang.String messageKey) throws WikiException
AdmingetApprover in interface WorkflowManagermessageKey - the Decision's message keyWikiException - if the message key was not found, or the
Principal value corresponding to the key could not be resolvedprotected Engine getEngine()
public DecisionQueue getDecisionQueue()
getDecisionQueue in interface WorkflowManagerpublic java.util.List<Workflow> getOwnerWorkflows(Session session)
Workflow.getOwner() method returns a Principal
also possessed by the wiki session (see Session.getPrincipals()). If the wiki session is not
authenticated, this method returns an empty Collection.getOwnerWorkflows in interface WorkflowManagersession - the wiki sessionpublic void actionPerformed(WikiEvent event)
WorkflowEvent objects emitted by Workflows. In particular, this method listens for WorkflowEvent.CREATED,
WorkflowEvent.ABORTED, WorkflowEvent.COMPLETED and WorkflowEvent.DQ_REMOVAL events. If a workflow is created,
it is automatically added to the cache. If one is aborted or completed, it is automatically removed. If a removal from decision queue
is issued, the current step from workflow, which is assumed to be a Decision, is removed from the DecisionQueue.actionPerformed in interface WikiEventListenerevent - the event passed to this listenerprotected void add(Workflow workflow)
workflowManager and
Id properties if not set.workflow - the workflow to addprotected void remove(Workflow workflow)
workflow - the workflow to removeprotected void removeFromDecisionQueue(Decision decision, Context context)
protected void addToDecisionQueue(Decision decision)
Copyright (c) 2001-2022 The Apache Software Foundation. All rights reserved.