org.apache.wiki.workflow
Class DecisionQueue

java.lang.Object
  extended by 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
DecisionQueue()
          Constructs a new DecisionQueue.
 
Method Summary
protected  void add(Decision decision)
          Adds a Decision to the DecisionQueue; also sets the Decision's unique identifier.
 void decide(Decision decision, Outcome outcome)
          Attempts to complete a Decision by calling Decision.decide(Outcome).
protected  Decision[] decisions()
          Protected method that returns all pending Decisions in the queue, in order of submission.
 Collection getActorDecisions(WikiSession session)
          Returns a Collection representing the current Decisions that pertain to a users's WikiSession.
 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 Detail

DecisionQueue

public DecisionQueue()
Constructs a new DecisionQueue.

Method Detail

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 TODO: explore whether this method could be made protected

remove

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

Parameters:
decision - the decision to remove

getActorDecisions

public Collection getActorDecisions(WikiSession session)
Returns a Collection representing the current Decisions that pertain to a users's WikiSession. The Decisions are obtained by iterating through the WikiSession's Principals and selecting those Decisions whose Decision.getActor() value match. If the wiki 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)
            throws WikiException
Attempts to complete a Decision by calling Decision.decide(Outcome). 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:
WikiException - if the succeeding Step cannot start for any reason

reassign

public void reassign(Decision decision,
                     Principal owner)
              throws 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:
WikiException - never


Copyright © {inceptionYear}-2014 The Apache Software Foundation. All rights reserved.