public class WorkflowManager extends Object implements WikiEventListener
Monitor class that tracks running Workflows. The WorkflowManager also keeps track of the names of users or groups expected to approve particular Workflows.
Modifier and Type | Field and Description |
---|---|
protected static String |
PROPERTY_APPROVER_PREFIX
The prefix to use for looking up
jspwiki.properties approval roles. |
static String |
WF_UP_CREATE_SAVE_APPROVER
The name of the key from jspwiki.properties which defines who shall approve the workflow of creating a user profile.
|
static String |
WF_UP_CREATE_SAVE_ATTR_SAVED_PROFILE
The workflow attribute which stores the user profile.
|
static String |
WF_UP_CREATE_SAVE_DECISION_MESSAGE_KEY
The message key for storing the Decision text for saving a user profile.
|
static String |
WF_UP_CREATE_SAVE_FACT_PREFS_EMAIL
Fact name for storing the preferences' email.
|
static String |
WF_UP_CREATE_SAVE_FACT_PREFS_FULL_NAME
Fact name for storing the preferences' full name.
|
static String |
WF_UP_CREATE_SAVE_FACT_PREFS_LOGIN_NAME
Fact name for storing the preferences' login name.
|
static String |
WF_UP_CREATE_SAVE_FACT_SUBMITTER
Fact name for storing a the submitter name.
|
static String |
WF_WP_SAVE_APPROVER
The name of the key from jspwiki.properties which defines who shall approve the workflow of storing a wikipage.
|
static String |
WF_WP_SAVE_ATTR_PRESAVE_WIKI_CONTEXT
The workflow attribute which stores the wikiContext.
|
static String |
WF_WP_SAVE_DECISION_MESSAGE_KEY
The message key for storing the Decision text for saving a page.
|
static String |
WF_WP_SAVE_FACT_CURRENT_TEXT
Fact name for storing the current text.
|
static String |
WF_WP_SAVE_FACT_DIFF_TEXT
Fact name for storing a diff text.
|
static String |
WF_WP_SAVE_FACT_IS_AUTHENTICATED
Fact name for storing whether the user is authenticated or not.
|
static String |
WF_WP_SAVE_FACT_PAGE_NAME
Fact name for storing the page name.
|
static String |
WF_WP_SAVE_FACT_PROPOSED_TEXT
Fact name for storing the proposed (edited) text.
|
static String |
WF_WP_SAVE_REJECT_MESSAGE_KEY
The message key for rejecting the decision to save the page.
|
Constructor and Description |
---|
WorkflowManager()
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. |
Principal |
getApprover(String messageKey)
Looks up and resolves the actor who approves a Decision for a particular
Workflow, based on the Workflow's message key.
|
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 WikiEngine |
getEngine()
Protected helper method that returns the associated WikiEngine
|
Collection<Workflow> |
getOwnerWorkflows(WikiSession session)
Returns the current workflows a wiki session owns.
|
Collection<Workflow> |
getWorkflows()
Returns a collection of the currently active workflows.
|
void |
initialize(WikiEngine engine,
Properties props)
Initializes the WorkflowManager using a specfied WikiEngine and
properties.
|
protected void |
remove(Workflow workflow)
Protected helper method that removes a specified Workflow from the cache,
and moves it to the workflow history list.
|
boolean |
requiresApproval(String messageKey)
Returns
true if a workflow matching a particular key
contains an approval step. |
void |
start(Workflow workflow)
Adds a new workflow to the set of workflows and starts it.
|
public static final String WF_WP_SAVE_ATTR_PRESAVE_WIKI_CONTEXT
public static final String WF_WP_SAVE_APPROVER
public static final String WF_WP_SAVE_DECISION_MESSAGE_KEY
public static final String WF_WP_SAVE_REJECT_MESSAGE_KEY
public static final String WF_WP_SAVE_FACT_PAGE_NAME
public static final String WF_WP_SAVE_FACT_DIFF_TEXT
public static final String WF_WP_SAVE_FACT_CURRENT_TEXT
public static final String WF_WP_SAVE_FACT_PROPOSED_TEXT
public static final String WF_WP_SAVE_FACT_IS_AUTHENTICATED
public static final String WF_UP_CREATE_SAVE_ATTR_SAVED_PROFILE
public static final String WF_UP_CREATE_SAVE_APPROVER
public static final String WF_UP_CREATE_SAVE_DECISION_MESSAGE_KEY
public static final String WF_UP_CREATE_SAVE_FACT_SUBMITTER
public static final String WF_UP_CREATE_SAVE_FACT_PREFS_LOGIN_NAME
public static final String WF_UP_CREATE_SAVE_FACT_PREFS_FULL_NAME
public static final String WF_UP_CREATE_SAVE_FACT_PREFS_EMAIL
protected static final String PROPERTY_APPROVER_PREFIX
jspwiki.properties
approval roles.public WorkflowManager()
public void start(Workflow workflow) throws WikiException
workflow
- the workflow to startWikiException
- if a workflow the automatically assigned
ID already exist; this should not happen normallypublic Collection<Workflow> getWorkflows()
public List<Workflow> getCompletedWorkflows()
public void initialize(WikiEngine engine, Properties props)
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)
.engine
- the wiki engine to associate with this WorkflowManagerprops
- the wiki engine's propertiespublic boolean requiresApproval(String messageKey)
true
if a workflow matching a particular key
contains an approval step.messageKey
- the name of the workflow; corresponds to the value returned by
Workflow.getMessageKey()
.public Principal getApprover(String messageKey) throws WikiException
Admin
messageKey
- the Decision's message keyWikiException
- if the message key was not found, or the
Principal value corresponding to the key could not be resolvedprotected WikiEngine getEngine()
public DecisionQueue getDecisionQueue()
public Collection<Workflow> getOwnerWorkflows(WikiSession session)
Workflow.getOwner()
method returns a Principal also possessed by the
wiki session (see WikiSession.getPrincipals()
). If the
wiki session is not authenticated, this method returns an empty Collection.session
- the wiki sessionpublic void actionPerformed(WikiEvent event)
WorkflowEvent
objects emitted by Workflows. In particular, this
method listens for WorkflowEvent.CREATED
,
WorkflowEvent.ABORTED
and WorkflowEvent.COMPLETED
events. If a workflow is created, it is automatically added to the cache. If one is aborted or completed, it
is automatically removed.actionPerformed
in interface WikiEventListener
event
- the event passed to this listenerprotected void add(Workflow workflow)
workflowManager
and Id
properties if not set.workflow
- the workflow to addCopyright © 2001-2019 The Apache Software Foundation. All rights reserved.