|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.wiki.workflow.WorkflowManager
public class WorkflowManager
Monitor class that tracks running Workflows. The WorkflowManager also keeps track of the names of users or groups expected to approve particular Workflows.
Field Summary | |
---|---|
protected static String |
PROPERTY_APPROVER_PREFIX
The prefix to use for looking up jspwiki.properties approval roles. |
Constructor Summary | |
---|---|
WorkflowManager()
Constructs a new WorkflowManager, with an empty workflow cache. |
Method Summary | |
---|---|
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 |
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 |
getOwnerWorkflows(WikiSession session)
Returns the current workflows a wiki session owns. |
Collection |
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final String PROPERTY_APPROVER_PREFIX
jspwiki.properties
approval roles.
Constructor Detail |
---|
public WorkflowManager()
Method Detail |
---|
public void start(Workflow workflow) throws WikiException
workflow
- the workflow to start
WikiException
- if a workflow the automatically assigned
ID already exist; this should not happen normallypublic Collection getWorkflows()
public List 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 key
WikiException
- 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 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 session
public 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 addprotected void remove(Workflow workflow)
workflow
- the workflow to remove
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |