Package org.apache.wiki.workflow

# Class DecisionQueue

java.lang.Object
org.apache.wiki.workflow.DecisionQueue

All Implemented Interfaces:
  `Serializable`

public class DecisionQueue extends Object implements Serializable
Keeps a queue of pending Decisions that need to be acted on by named Principals.

Since:
  2.5
See Also:
  - Serialized Form

## Constructor Summary

Constructors
Constructor
Description
`DecisionQueue()`
Constructs a new DecisionQueue.

## Method Summary

Modifier and Type
Method
Description
`protected void`
`add(Decision decision)`
Adds a Decision to the DecisionQueue; also sets the Decision's unique identifier.
`void`
`decide(Decision decision, Outcome outcome, org.apache.wiki.api.core.Context context)`
Attempts to complete a Decision by calling `Decision.decide(Outcome, Context)`.
`protected Decision[]`
`decisions()`
Protected method that returns all pending Decisions in the queue, in order of submission.
`Collection<Decision>`
`getActorDecisions(org.apache.wiki.api.core.Session session)`
Returns a Collection representing the current Decisions that pertain to a users's Session.
`void`
`reassign(Decision decision, Principal owner)`
Reassigns the owner of the Decision to a new owner.
`protected void`
`remove(Decision decision)`
Protected method that removes a Decision from the queue.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### DecisionQueue

public DecisionQueue()
Constructs a new DecisionQueue.

## Method Details

### add

protected void add(Decision decision)
Adds a Decision to the DecisionQueue; also sets the Decision's unique identifier.

Parameters:
  `decision` - the Decision to add

### decisions

protected Decision[] decisions()
Protected method that returns all pending Decisions in the queue, in order of submission. If no Decisions are pending, this method returns a zero-length array.

Returns:
  the pending decisions

### remove

protected void remove(Decision decision)
Protected method that removes a Decision from the queue.

Parameters:
  `decision` - the decision to remove

### getActorDecisions

public Collection<Decision> getActorDecisions(org.apache.wiki.api.core.Session session)
Returns a Collection representing the current Decisions that pertain to a users's Session. The Decisions are obtained by iterating through the Session's Principals and selecting those Decisions whose `Decision.getActor()` value match. If the session is not authenticated, this method returns an empty Collection.

Parameters:
  `session` - the wiki session
Returns:
  the collection of Decisions, which may be empty

### decide

public void decide(Decision decision, Outcome outcome, org.apache.wiki.api.core.Context context) throws org.apache.wiki.api.exceptions.WikiException
Attempts to complete a Decision by calling `Decision.decide(Outcome, Context)`. This will cause the Step immediately following the Decision (if any) to start. If the decision completes successfully, this method also removes the completed decision from the queue.

Parameters:
  `decision` - the Decision for which the Outcome will be supplied
  `outcome` - the Outcome of the Decision
Throws:
  `org.apache.wiki.api.exceptions.WikiException` - if the succeeding Step cannot start for any reason

### reassign

public void reassign(Decision decision, Principal owner) throws org.apache.wiki.api.exceptions.WikiException
Reassigns the owner of the Decision to a new owner. Under the covers, this method calls `Decision.reassign(Principal)`.

Parameters:
  `decision` - the Decision to reassign
  `owner` - the new owner
Throws:
  `org.apache.wiki.api.exceptions.WikiException` - never