KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > opensymphony > workflow > Condition


1 /*
2  * Copyright (c) 2002-2003 by OpenSymphony
3  * All rights reserved.
4  */

5 package com.opensymphony.workflow;
6
7 import com.opensymphony.module.propertyset.PropertySet;
8
9 import java.util.Map JavaDoc;
10
11
12 /**
13  * Interface that must be implemented to define a java-based condition in your workflow definition.
14  *
15  * @author <a HREF="mailto:plightbo@hotmail.com">Patrick Lightbody</a>
16  * @version $Revision: 1.7 $
17  */

18 public interface Condition {
19     //~ Methods ////////////////////////////////////////////////////////////////
20

21     /**
22      * Determines if a condition should signal pass or fail.
23      *
24      * @param transientVars Variables that will not be persisted. These include inputs
25      * given in the {@link Workflow#initialize} and {@link Workflow#doAction} method calls.
26      * There are a number of special variable names:
27      * <ul>
28      * <li><code>entry</code>: (object type: {@link com.opensymphony.workflow.spi.WorkflowEntry})
29      * The workflow instance
30      * <li><code>context</code>:
31      * (object type: {@link com.opensymphony.workflow.WorkflowContext}). The workflow context.
32      * <li><code>actionId</code>: The Integer ID of the current action that was take (if applicable).
33      * <li><code>currentSteps</code>: A Collection of the current steps in the workflow instance.
34      * <li><code>store</code>: The {@link com.opensymphony.workflow.spi.WorkflowStore}.
35      * <li><code>descriptor</code>: The {@link com.opensymphony.workflow.loader.WorkflowDescriptor}.
36      * </ul>
37      * <p>
38      * Also, any variable set as a {@link com.opensymphony.workflow.Register}), will also be
39      * available in the transient map, no matter what. These transient variables only last through
40      * the method call that they were invoked in, such as {@link Workflow#initialize}
41      * and {@link Workflow#doAction}.
42      * @param args The properties for this function invocation. Properties are created
43      * from arg nested elements within the xml, an arg element takes in a name attribute
44      * which is the properties key, and the CDATA text contents of the element map to
45      * the property value. There is a magic property of '<code>stepId</code>';
46      * if specified with a value of -1, then the value is replaced with the
47      * current step's ID before the condition is called.
48      * @param ps The persistent variables that are associated with the current
49      * instance of the workflow. Any change made to this will be seen on the next
50      * function call in the workflow lifetime.
51      */

52     public boolean passesCondition(Map JavaDoc transientVars, Map JavaDoc args, PropertySet ps) throws WorkflowException;
53 }
54
Popular Tags