01: /*
02: * Copyright (c) 2002-2003 by OpenSymphony
03: * All rights reserved.
04: */
05: package com.opensymphony.workflow;
06:
07: import com.opensymphony.module.propertyset.PropertySet;
08:
09: import java.util.Map;
10:
11: /**
12: * Interface that must be implemented to define a java-based condition in your workflow definition.
13: *
14: * @author <a href="mailto:plightbo@hotmail.com">Patrick Lightbody</a>
15: */
16: public interface Condition {
17: //~ Methods ////////////////////////////////////////////////////////////////
18:
19: /**
20: * Determines if a condition should signal pass or fail.
21: *
22: * @param transientVars Variables that will not be persisted. These include inputs
23: * given in the {@link Workflow#initialize} and {@link Workflow#doAction} method calls.
24: * There are a number of special variable names:
25: * <ul>
26: * <li><code>entry</code>: (object type: {@link com.opensymphony.workflow.spi.WorkflowEntry})
27: * The workflow instance
28: * <li><code>context</code>:
29: * (object type: {@link com.opensymphony.workflow.WorkflowContext}). The workflow context.
30: * <li><code>actionId</code>: The Integer ID of the current action that was take (if applicable).
31: * <li><code>currentSteps</code>: A Collection of the current steps in the workflow instance.
32: * <li><code>store</code>: The {@link com.opensymphony.workflow.spi.WorkflowStore}.
33: * <li><code>descriptor</code>: The {@link com.opensymphony.workflow.loader.WorkflowDescriptor}.
34: * </ul>
35: * <p>
36: * Also, any variable set as a {@link com.opensymphony.workflow.Register}), will also be
37: * available in the transient map, no matter what. These transient variables only last through
38: * the method call that they were invoked in, such as {@link Workflow#initialize}
39: * and {@link Workflow#doAction}.
40: * @param args The properties for this function invocation. Properties are created
41: * from arg nested elements within the xml, an arg element takes in a name attribute
42: * which is the properties key, and the CDATA text contents of the element map to
43: * the property value. There is a magic property of '<code>stepId</code>';
44: * if specified with a value of -1, then the value is replaced with the
45: * current step's ID before the condition is called.
46: * @param ps The persistent variables that are associated with the current
47: * instance of the workflow. Any change made to this will be seen on the next
48: * function call in the workflow lifetime.
49: */
50: public boolean passesCondition(Map transientVars, Map args,
51: PropertySet ps) throws WorkflowException;
52: }
|