KickJava   Java API By Example, From Geeks To Geeks.

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


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 validator in your workflow definition.
14  *
15  * @author <a HREF="mailto:plightbo@hotmail.com">Patrick Lightbody</a>
16  * @version $Revision: 1.6 $
17  */

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

21     /**
22      * Validates the user input.
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      * Also, any variable set as a {@link com.opensymphony.workflow.Register}), will also be
38      * available in the transient map. These transient variables only last through
39      * the method call that they were invoked in, such as {@link Workflow#initialize}
40      * and {@link Workflow#doAction}.
41      * @param args The properties for this function invocation. Properties are created
42      * from arg nested elements within the xml, an arg element takes in a name attribute
43      * which is the properties key, and the CDATA text contents of the element map to
44      * the property value.
45      * @param ps The persistent variables that are associated with the current
46      * instance of the workflow. Any change made to the propertyset are persisted to
47      * the propertyset implementation's persistent store.
48      * @throws InvalidInputException if the input is deemed to be invalid
49      */

50     public void validate(Map JavaDoc transientVars, Map JavaDoc args, PropertySet ps) throws InvalidInputException, WorkflowException;
51 }
52
Popular Tags