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; 10 11 12 /** 13 * Interface to be implemented by any class that are to be called from within a workflow as a function, 14 * either as a pre-function or a post-function. The args nested elements within the function xml call 15 * will be mapped to the properties parameter. 16 * 17 * @author <a HREF="mailto:plightbo@hotmail.com">Pat Lightbody</a> 18 * @version $Revision: 1.5 $ 19 */ 20 public interface FunctionProvider { 21 //~ Methods //////////////////////////////////////////////////////////////// 22 23 /** 24 * Execute this function 25 * @param transientVars Variables that will not be persisted. These include inputs 26 * given in the {@link Workflow#initialize} and {@link Workflow#doAction} method calls. 27 * There are a number of special variable names: 28 * <ul> 29 * <li><code>entry</code>: (object type: {@link com.opensymphony.workflow.spi.WorkflowEntry}) 30 * The workflow instance 31 * <li><code>context</code>: 32 * (object type: {@link com.opensymphony.workflow.WorkflowContext}). The workflow context. 33 * <li><code>actionId</code>: The Integer ID of the current action that was take (if applicable). 34 * <li><code>currentSteps</code>: A Collection of the current steps in the workflow instance. 35 * <li><code>store</code>: The {@link com.opensymphony.workflow.spi.WorkflowStore}. 36 * <li><code>descriptor</code>: The {@link com.opensymphony.workflow.loader.WorkflowDescriptor}. 37 * </ul> 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. 46 * @param ps The persistent variables that are associated with the current 47 * instance of the workflow. Any change made to the propertyset are persisted to 48 * the propertyset implementation's persistent store. 49 */ 50 public void execute(Map transientVars, Map args, PropertySet ps) throws WorkflowException; 51 } 52