Package org.apache.wiki.workflow
Class DecisionQueue
- java.lang.Object
-
- org.apache.wiki.workflow.DecisionQueue
-
- All Implemented Interfaces:
java.io.Serializable
public class DecisionQueue extends java.lang.Object implements java.io.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
All Methods Instance Methods Concrete Methods 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, Context context)
Attempts to complete a Decision by callingDecision.decide(Outcome, Context)
.protected Decision[]
decisions()
Protected method that returns all pending Decisions in the queue, in order of submission.java.util.Collection<Decision>
getActorDecisions(Session session)
Returns a Collection representing the current Decisions that pertain to a users's Session.void
reassign(Decision decision, java.security.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.
-
-
-
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
-
remove
protected void remove(Decision decision)
Protected method that removes a Decision from the queue.- Parameters:
decision
- the decision to remove
-
getActorDecisions
public java.util.Collection<Decision> getActorDecisions(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 whoseDecision.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, Context context) throws WikiException
Attempts to complete a Decision by callingDecision.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 suppliedoutcome
- the Outcome of the Decision- Throws:
WikiException
- if the succeeding Step cannot start for any reason
-
reassign
public void reassign(Decision decision, java.security.Principal owner) throws WikiException
Reassigns the owner of the Decision to a new owner. Under the covers, this method callsDecision.reassign(Principal)
.- Parameters:
decision
- the Decision to reassignowner
- the new owner- Throws:
WikiException
- never
-
-