com.opensymphony.workflow.loader
Class WorkflowDescriptor

java.lang.Object
  extended by com.opensymphony.workflow.loader.AbstractDescriptor
      extended by com.opensymphony.workflow.loader.WorkflowDescriptor
All Implemented Interfaces:
Validatable, XMLizable, Serializable

public class WorkflowDescriptor
extends AbstractDescriptor
implements Validatable

Describes a single workflow

Author:
Pat Lightbody
See Also:
Serialized Form

Field Summary
protected  Map commonActions
           
protected  List commonActionsList
           
static String DOCTYPE_DECL
           
protected  List globalActions
           
protected  ConditionsDescriptor globalConditions
           
protected  List initialActions
           
protected  List joins
           
protected  Map metaAttributes
           
protected  List registers
           
protected  List splits
           
protected  List steps
           
protected  Map timerFunctions
           
protected  String workflowName
           
static String XML_HEADER
           
 
Fields inherited from interface com.opensymphony.workflow.util.XMLizable
INDENT
 
Constructor Summary
WorkflowDescriptor()
          Deprecated. use DescriptorFactory instead
WorkflowDescriptor(org.w3c.dom.Element root)
          Deprecated. use DescriptorFactory instead
 
Method Summary
 void addCommonAction(ActionDescriptor descriptor)
          Add a common action
 void addGlobalAction(ActionDescriptor descriptor)
          Add a global action
 void addInitialAction(ActionDescriptor descriptor)
          Add an initial action
 void addJoin(JoinDescriptor descriptor)
          Add a join
 void addSplit(SplitDescriptor descriptor)
          Add a split
 void addStep(StepDescriptor descriptor)
          Add a step
 ActionDescriptor getAction(int id)
           
 Map getCommonActions()
          Get a Map of the common actions specified, keyed on actionId (an Integer)
 List getGlobalActions()
          Get a List of the global actions specified
 ConditionsDescriptor getGlobalConditions()
           
 ActionDescriptor getInitialAction(int id)
           
 List getInitialActions()
          Get a List of initial steps for this workflow
 JoinDescriptor getJoin(int id)
           
 List getJoins()
          Get a List of initial steps for this workflow
 Map getMetaAttributes()
           
 String getName()
           
 List getRegisters()
           
 SplitDescriptor getSplit(int id)
           
 List getSplits()
          Get a List of initial steps for this workflow
 StepDescriptor getStep(int id)
           
 List getSteps()
          Get a List of steps in this workflow
 FunctionDescriptor getTriggerFunction(int id)
           
 Map getTriggerFunctions()
          Get a Map of all trigger functions in this workflow
protected  void init(org.w3c.dom.Element root)
           
 boolean removeAction(ActionDescriptor actionToRemove)
          Remove an action from this workflow completely.
 void setName(String name)
           
 FunctionDescriptor setTriggerFunction(int id, FunctionDescriptor descriptor)
          Update a trigger function
 void validate()
          Validate this element, and propagate validation to all contained sub-elements.
 void writeXML(PrintWriter out, int indent)
           
 
Methods inherited from class com.opensymphony.workflow.loader.AbstractDescriptor
asXML, getEntityId, getId, getParent, hasId, setEntityId, setId, setParent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

XML_HEADER

public static final String XML_HEADER
See Also:
Constant Field Values

DOCTYPE_DECL

public static final String DOCTYPE_DECL
See Also:
Constant Field Values

globalConditions

protected ConditionsDescriptor globalConditions

commonActionsList

protected List commonActionsList

globalActions

protected List globalActions

initialActions

protected List initialActions

joins

protected List joins

registers

protected List registers

splits

protected List splits

steps

protected List steps

commonActions

protected Map commonActions

metaAttributes

protected Map metaAttributes

timerFunctions

protected Map timerFunctions

workflowName

protected String workflowName
Constructor Detail

WorkflowDescriptor

public WorkflowDescriptor()
Deprecated. use DescriptorFactory instead


WorkflowDescriptor

public WorkflowDescriptor(org.w3c.dom.Element root)
Deprecated. use DescriptorFactory instead

Method Detail

getAction

public ActionDescriptor getAction(int id)

getCommonActions

public Map getCommonActions()
Get a Map of the common actions specified, keyed on actionId (an Integer)

Returns:
A list of ActionDescriptor objects

getGlobalActions

public List getGlobalActions()
Get a List of the global actions specified

Returns:
A list of ActionDescriptor objects

getGlobalConditions

public ConditionsDescriptor getGlobalConditions()

getInitialAction

public ActionDescriptor getInitialAction(int id)

getInitialActions

public List getInitialActions()
Get a List of initial steps for this workflow

Returns:
A list of ActionDescriptor objects

getJoin

public JoinDescriptor getJoin(int id)

getJoins

public List getJoins()
Get a List of initial steps for this workflow

Returns:
A list of JoinDescriptor objects

getMetaAttributes

public Map getMetaAttributes()

setName

public void setName(String name)

getName

public String getName()

getRegisters

public List getRegisters()

getSplit

public SplitDescriptor getSplit(int id)

getSplits

public List getSplits()
Get a List of initial steps for this workflow

Returns:
A list of SplitDescriptor objects

getStep

public StepDescriptor getStep(int id)

getSteps

public List getSteps()
Get a List of steps in this workflow

Returns:
a List of StepDescriptor objects

setTriggerFunction

public FunctionDescriptor setTriggerFunction(int id,
                                             FunctionDescriptor descriptor)
Update a trigger function

Parameters:
id - The id for the trigger function
descriptor - The descriptor for the trigger function
Returns:
The old trigger function with the specified ID, if any existed

getTriggerFunction

public FunctionDescriptor getTriggerFunction(int id)

getTriggerFunctions

public Map getTriggerFunctions()
Get a Map of all trigger functions in this workflow

Returns:
a Map with Integer keys and FunctionDescriptor values

addCommonAction

public void addCommonAction(ActionDescriptor descriptor)
Add a common action

Parameters:
descriptor - The action descriptor to add
Throws:
IllegalArgumentException - if the descriptor's ID already exists in the workflow

addGlobalAction

public void addGlobalAction(ActionDescriptor descriptor)
Add a global action

Parameters:
descriptor - The action descriptor to add
Throws:
IllegalArgumentException - if the descriptor's ID already exists in the workflow

addInitialAction

public void addInitialAction(ActionDescriptor descriptor)
Add an initial action

Parameters:
descriptor - The action descriptor to add
Throws:
IllegalArgumentException - if the descriptor's ID already exists in the workflow

addJoin

public void addJoin(JoinDescriptor descriptor)
Add a join

Parameters:
descriptor - The join descriptor to add
Throws:
IllegalArgumentException - if the descriptor's ID already exists in the workflow

addSplit

public void addSplit(SplitDescriptor descriptor)
Add a split

Parameters:
descriptor - The split descriptor to add
Throws:
IllegalArgumentException - if the descriptor's ID already exists in the workflow

addStep

public void addStep(StepDescriptor descriptor)
Add a step

Parameters:
descriptor - The step descriptor to add
Throws:
IllegalArgumentException - if the descriptor's ID already exists in the workflow

removeAction

public boolean removeAction(ActionDescriptor actionToRemove)
Remove an action from this workflow completely.

This method will check global actions and all steps.

Returns:
true if the action was successfully removed, false if it was not found

validate

public void validate()
              throws InvalidWorkflowDescriptorException
Description copied from interface: Validatable
Validate this element, and propagate validation to all contained sub-elements. Should throw an InvalidWorkflowDescriptorException with details in message if the element is invalid. Validity checks should be checks that cannot be encapsulated in the DTD. Validation has to be called explicitly on writting, a writeXML() does not validate implicitly; it *IS* thus possible to write invalid descriptor files. This could be useful for e.g. a graphical workflow definition editor which would like to write incomplete definitions. Validation *IS* performed on loading a workflow definition.

Specified by:
validate in interface Validatable
Throws:
InvalidWorkflowDescriptorException
See Also:
WorkflowLoader.load(java.io.InputStream)

writeXML

public void writeXML(PrintWriter out,
                     int indent)
Specified by:
writeXML in interface XMLizable

init

protected void init(org.w3c.dom.Element root)

OpenSymphony Workflow Project Page