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 validator in your workflow definition.
13: *
14: * @author <a href="mailto:plightbo@hotmail.com">Patrick Lightbody</a>
15: */
16: public interface Validator {
17: //~ Methods ////////////////////////////////////////////////////////////////
18:
19: /**
20: * Validates the user input.
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: * Also, any variable set as a {@link com.opensymphony.workflow.Register}), will also be
36: * available in the transient map. These transient variables only last through
37: * the method call that they were invoked in, such as {@link Workflow#initialize}
38: * and {@link Workflow#doAction}.
39: * @param args The properties for this function invocation. Properties are created
40: * from arg nested elements within the xml, an arg element takes in a name attribute
41: * which is the properties key, and the CDATA text contents of the element map to
42: * the property value.
43: * @param ps The persistent variables that are associated with the current
44: * instance of the workflow. Any change made to the propertyset are persisted to
45: * the propertyset implementation's persistent store.
46: * @throws InvalidInputException if the input is deemed to be invalid
47: */
48: public void validate(Map transientVars, Map args, PropertySet ps)
49: throws InvalidInputException, WorkflowException;
50: }
|