Package org.apache.wiki.workflow

## Interface WorkflowManager

All Superinterfaces:
  `java.util.EventListener`, `Initializable`, `WikiEventListener`

All Known Implementing Classes:
  `DefaultWorkflowManager`

    public interface WorkflowManager
    extends WikiEventListener, Initializable

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

Fields
`static java.lang.String` `PROPERTY_APPROVER_PREFIX` The prefix to use for looking up `jspwiki.properties` approval roles.
`static java.lang.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 java.lang.String` `WF_UP_CREATE_SAVE_ATTR_SAVED_PROFILE` The workflow attribute which stores the user profile.
`static java.lang.String` `WF_UP_CREATE_SAVE_DECISION_MESSAGE_KEY` The message key for storing the Decision text for saving a user profile.
`static java.lang.String` `WF_UP_CREATE_SAVE_FACT_PREFS_EMAIL` Fact name for storing the preferences' email.
`static java.lang.String` `WF_UP_CREATE_SAVE_FACT_PREFS_FULL_NAME` Fact name for storing the preferences' full name.
`static java.lang.String` `WF_UP_CREATE_SAVE_FACT_PREFS_LOGIN_NAME` Fact name for storing the preferences' login name.
`static java.lang.String` `WF_UP_CREATE_SAVE_FACT_SUBMITTER` Fact name for storing a the submitter name.
`static java.lang.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 java.lang.String` `WF_WP_SAVE_DECISION_MESSAGE_KEY` The message key for storing the Decision text for saving a page.
`static java.lang.String` `WF_WP_SAVE_FACT_CURRENT_TEXT` Fact name for storing the current text.
`static java.lang.String` `WF_WP_SAVE_FACT_DIFF_TEXT` Fact name for storing a diff text.
`static java.lang.String` `WF_WP_SAVE_FACT_IS_AUTHENTICATED` Fact name for storing whether the user is authenticated or not.
`static java.lang.String` `WF_WP_SAVE_FACT_PAGE_NAME` Fact name for storing the page name.
`static java.lang.String` `WF_WP_SAVE_FACT_PROPOSED_TEXT` Fact name for storing the proposed (edited) text.
`static java.lang.String` `WF_WP_SAVE_REJECT_MESSAGE_KEY` The message key for rejecting the decision to save the page.

### Method Summary

All Methods Instance Methods Abstract Methods
`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
`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.
`java.util.Map<java.lang.Integer,​Workflow>` `getWorkflowsAsMap()` Returns a map of the currently active workflows.
`boolean` `requiresApproval​(java.lang.String messageKey)` Returns `true` if a workflow matching a particular key contains an approval step.

### Methods inherited from interface org.apache.wiki.api.engine.Initializable

`initialize`

### Methods inherited from interface org.apache.wiki.event.WikiEventListener

`actionPerformed`

### Field Detail

#### WF_WP_SAVE_APPROVER

    static final java.lang.String WF_WP_SAVE_APPROVER

The name of the key from jspwiki.properties which defines who shall approve the workflow of storing a wikipage. Value is `"workflow.saveWikiPage"`

See Also:
  Constant Field Values

#### WF_WP_SAVE_DECISION_MESSAGE_KEY

    static final java.lang.String WF_WP_SAVE_DECISION_MESSAGE_KEY

The message key for storing the Decision text for saving a page. Value is "decision.saveWikiPage".

See Also:
  Constant Field Values

#### WF_WP_SAVE_REJECT_MESSAGE_KEY

    static final java.lang.String WF_WP_SAVE_REJECT_MESSAGE_KEY

The message key for rejecting the decision to save the page. Value is "notification.saveWikiPage.reject".

See Also:
  Constant Field Values

#### WF_WP_SAVE_FACT_PAGE_NAME

    static final java.lang.String WF_WP_SAVE_FACT_PAGE_NAME

Fact name for storing the page name. Value is "fact.pageName".

See Also:
  Constant Field Values

#### WF_WP_SAVE_FACT_DIFF_TEXT

    static final java.lang.String WF_WP_SAVE_FACT_DIFF_TEXT

Fact name for storing a diff text. Value is "fact.diffText".

See Also:
  Constant Field Values

#### WF_WP_SAVE_FACT_CURRENT_TEXT

    static final java.lang.String WF_WP_SAVE_FACT_CURRENT_TEXT

Fact name for storing the current text. Value is "fact.currentText".

See Also:
  Constant Field Values

#### WF_WP_SAVE_FACT_PROPOSED_TEXT

    static final java.lang.String WF_WP_SAVE_FACT_PROPOSED_TEXT

Fact name for storing the proposed (edited) text. Value is "fact.proposedText".

See Also:
  Constant Field Values

#### WF_WP_SAVE_FACT_IS_AUTHENTICATED

    static final java.lang.String WF_WP_SAVE_FACT_IS_AUTHENTICATED

Fact name for storing whether the user is authenticated or not. Value is "fact.isAuthenticated".

See Also:
  Constant Field Values

#### WF_UP_CREATE_SAVE_ATTR_SAVED_PROFILE

    static final java.lang.String WF_UP_CREATE_SAVE_ATTR_SAVED_PROFILE

The workflow attribute which stores the user profile.

See Also:
  Constant Field Values

#### WF_UP_CREATE_SAVE_APPROVER

    static final java.lang.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. Value is `"workflow.createUserProfile"`

See Also:
  Constant Field Values

#### WF_UP_CREATE_SAVE_DECISION_MESSAGE_KEY

    static final java.lang.String WF_UP_CREATE_SAVE_DECISION_MESSAGE_KEY

The message key for storing the Decision text for saving a user profile. Value is "decision.createUserProfile".

See Also:
  Constant Field Values

#### WF_UP_CREATE_SAVE_FACT_SUBMITTER

    static final java.lang.String WF_UP_CREATE_SAVE_FACT_SUBMITTER

Fact name for storing a the submitter name. Value is "fact.submitter".

See Also:
  Constant Field Values

#### WF_UP_CREATE_SAVE_FACT_PREFS_LOGIN_NAME

    static final java.lang.String WF_UP_CREATE_SAVE_FACT_PREFS_LOGIN_NAME

Fact name for storing the preferences' login name. Value is "prefs.loginname".

See Also:
  Constant Field Values

#### WF_UP_CREATE_SAVE_FACT_PREFS_FULL_NAME

    static final java.lang.String WF_UP_CREATE_SAVE_FACT_PREFS_FULL_NAME

Fact name for storing the preferences' full name. Value is "prefs.fullname".

See Also:
  Constant Field Values

#### WF_UP_CREATE_SAVE_FACT_PREFS_EMAIL

    static final java.lang.String WF_UP_CREATE_SAVE_FACT_PREFS_EMAIL

Fact name for storing the preferences' email. Value is "prefs.email".

See Also:
  Constant Field Values

#### PROPERTY_APPROVER_PREFIX

    static final java.lang.String PROPERTY_APPROVER_PREFIX

The prefix to use for looking up `jspwiki.properties` approval roles.

See Also:
  Constant Field Values

### Method Detail

#### getWorkflows

    java.util.Set<Workflow> getWorkflows()

Returns a collection of the currently active workflows.

Returns:
  the current workflows

#### getWorkflowsAsMap

    java.util.Map<java.lang.Integer,​Workflow> getWorkflowsAsMap()

Returns a map of the currently active workflows.

Returns:
  the current workflows as workflowId -> workflow tuples

#### getCompletedWorkflows

    java.util.List<Workflow> getCompletedWorkflows()

Returns a collection of finished workflows; that is, those that have aborted or completed.

Returns:
  the finished workflows

#### requiresApproval

    boolean requiresApproval​(java.lang.String messageKey)

Returns `true` if a workflow matching a particular key contains an approval step.

Parameters:
  `messageKey` - the name of the workflow; corresponds to the value returned by `Workflow.getMessageKey()`.
Returns:
  the result

#### getApprover

    java.security.Principal getApprover​(java.lang.String messageKey)
                                 throws WikiException

Looks up and resolves the actor who approves a Decision for a particular Workflow, based on the Workflow's message key. If not found, or if Principal is Unresolved, throws WikiException. This particular implementation always returns the GroupPrincipal `Admin`

Parameters:
  `messageKey` - the Decision's message key
Returns:
  the actor who approves Decisions
Throws:
  `WikiException` - if the message key was not found, or the Principal value corresponding to the key could not be resolved

#### getDecisionQueue

    DecisionQueue getDecisionQueue()

Returns the DecisionQueue associated with this WorkflowManager

Returns:
  the decision queue

#### getOwnerWorkflows

    java.util.List<Workflow> getOwnerWorkflows​(Session session)

Returns the current workflows a wiki session owns. These are workflows whose `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.

Parameters:
  `session` - the wiki session
Returns:
  the collection workflows the wiki session owns, which may be empty