org.jbpm.graph.def
Class ProcessDefinition

java.lang.Object
  extended by org.jbpm.graph.def.GraphElement
      extended by org.jbpm.graph.def.ProcessDefinition
All Implemented Interfaces:
Serializable, Identifiable, NodeCollection

public class ProcessDefinition
extends GraphElement
implements NodeCollection

See Also:
Serialized Form

Field Summary
protected  Map actions
           
protected  Map definitions
           
protected  boolean isTerminationImplicit
           
protected  List nodes
           
protected  Node startState
           
static String[] supportedEventTypes
          Deprecated. arrays are mutable and thus vulnerable to external manipulation. use getSupportedEventTypes() instead
protected  int version
           
 
Fields inherited from class org.jbpm.graph.def.GraphElement
description, events, exceptionHandlers, name, processDefinition
 
Constructor Summary
ProcessDefinition()
           
ProcessDefinition(String name)
           
ProcessDefinition(String[] nodes, String[] transitions)
           
 
Method Summary
 Action addAction(Action action)
          creates a bidirectional relation between this process definition and the given action.
 ModuleDefinition addDefinition(ModuleDefinition moduleDefinition)
           
 Node addNode(Node node)
          adds the given node to this node-collection.
 Object createInstance()
           
static ProcessDefinition createNewProcessDefinition()
           
 ProcessInstance createProcessInstance()
           
 ProcessInstance createProcessInstance(Map variables)
           
 ProcessInstance createProcessInstance(Map variables, String businessKey)
           
 boolean equals(Object o)
          Tells whether this process definition is equal to the given object.
static Node findNode(NodeCollection nodeCollection, String hierarchicalName)
           
 Node findNode(String hierarchicalName)
          finds the node by the given hierarchical name.
 String generateNodeName()
          generates a new name for a node to be added to this collection.
static String generateNodeName(List nodes)
           
 Action getAction(String name)
           
 Map getActions()
           
 ContextDefinition getContextDefinition()
           
 ModuleDefinition getDefinition(Class clazz)
           
 Map getDefinitions()
           
 FileDefinition getFileDefinition()
           
 Node getNode(String name)
          retrieves a node by name.
 List getNodes()
          is the ordered list of nodes.
 Map getNodesMap()
          maps node-names to nodes.
 GraphElement getParent()
           
 Node getStartState()
           
 String[] getSupportedEventTypes()
          indicative set of event types supported by this graph element.
 TaskMgmtDefinition getTaskMgmtDefinition()
           
 int getVersion()
           
 boolean hasActions()
           
 int hashCode()
          Computes the hash code for this process definition.
 boolean hasNode(String name)
          is true if this node-collection contains a node with the given name, false otherwise.
 boolean isTerminationImplicit()
           
static ProcessDefinition parseParResource(String parResource)
          parse a process definition from a process archive resource.
static ProcessDefinition parseParZipInputStream(ZipInputStream zipInputStream)
          parse a process definition from a process archive zip-stream.
static ProcessDefinition parseXmlInputStream(InputStream inputStream)
          parse a process definition from an xml input stream.
static ProcessDefinition parseXmlReader(Reader reader)
          parse a process definition from an xml reader.
static ProcessDefinition parseXmlResource(String xmlResource)
          parse a process definition from an xml resource file.
static ProcessDefinition parseXmlString(String xml)
          parse a process definition from an xml string.
 void removeAction(Action action)
          removes the bidirectional relation between this process definition and the given action.
 ModuleDefinition removeDefinition(ModuleDefinition moduleDefinition)
           
 Node removeNode(Node node)
          removes the given node from this node-collection.
 void reorderNode(int oldIndex, int newIndex)
          changes the order of the nodes : the node on oldIndex is removed and inserted in the newIndex.
 void setDefinitions(Map definitions)
           
 void setProcessDefinition(ProcessDefinition processDefinition)
           
 void setStartState(Node startState)
           
 void setStartState(StartState startState)
           
 void setTerminationImplicit(boolean isTerminationImplicit)
           
 void setVersion(int version)
          Sets the version of this process.
 
Methods inherited from class org.jbpm.graph.def.GraphElement
addEvent, addExceptionHandler, createAsyncActionExecutionJob, executeAction, findExceptionHandler, fireAndPropagateEvent, fireEvent, getDescription, getEvent, getEvents, getExceptionHandlers, getId, getName, getParentChain, getParents, getProcessDefinition, hasEvent, hasEvents, raiseException, removeEvent, removeExceptionHandler, reorderExceptionHandler, setDescription, setName, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

version

protected int version

isTerminationImplicit

protected boolean isTerminationImplicit

startState

protected Node startState

nodes

protected List nodes

actions

protected Map actions

definitions

protected Map definitions

supportedEventTypes

public static final String[] supportedEventTypes
Deprecated. arrays are mutable and thus vulnerable to external manipulation. use getSupportedEventTypes() instead
Constructor Detail

ProcessDefinition

public ProcessDefinition()

ProcessDefinition

public ProcessDefinition(String name)

ProcessDefinition

public ProcessDefinition(String[] nodes,
                         String[] transitions)
Method Detail

getSupportedEventTypes

public String[] getSupportedEventTypes()
Description copied from class: GraphElement
indicative set of event types supported by this graph element. this is currently only used by the process designer to know which event types to show on a given graph element. in process definitions and at runtime, there are no constraints on the event-types.

Specified by:
getSupportedEventTypes in class GraphElement

createNewProcessDefinition

public static ProcessDefinition createNewProcessDefinition()

createProcessInstance

public ProcessInstance createProcessInstance()

createProcessInstance

public ProcessInstance createProcessInstance(Map variables)

createProcessInstance

public ProcessInstance createProcessInstance(Map variables,
                                             String businessKey)

setProcessDefinition

public void setProcessDefinition(ProcessDefinition processDefinition)
Overrides:
setProcessDefinition in class GraphElement

equals

public boolean equals(Object o)
Tells whether this process definition is equal to the given object. This method considers two process definitions equal if they are equal in name and version, the name is not null and the version is not negative.

Overrides:
equals in class GraphElement

hashCode

public int hashCode()
Computes the hash code for this process definition. Process definitions with a null name or a negative version will return their identity hash code.

Overrides:
hashCode in class GraphElement

parseXmlString

public static ProcessDefinition parseXmlString(String xml)
parse a process definition from an xml string.

Throws:
JpdlException - if parsing reported an error.

parseXmlResource

public static ProcessDefinition parseXmlResource(String xmlResource)
parse a process definition from an xml resource file.

Throws:
JpdlException - if parsing reported an error.

parseXmlInputStream

public static ProcessDefinition parseXmlInputStream(InputStream inputStream)
parse a process definition from an xml input stream.

Throws:
JpdlException - if parsing reported an error.

parseXmlReader

public static ProcessDefinition parseXmlReader(Reader reader)
parse a process definition from an xml reader.

Throws:
JpdlException - if parsing reported an error.

parseParZipInputStream

public static ProcessDefinition parseParZipInputStream(ZipInputStream zipInputStream)
                                                throws IOException
parse a process definition from a process archive zip-stream.

Throws:
JpdlException - if parsing reported an error.
IOException

parseParResource

public static ProcessDefinition parseParResource(String parResource)
                                          throws IOException
parse a process definition from a process archive resource.

Throws:
JpdlException - if parsing reported an error.
IOException

getNodes

public List getNodes()
Description copied from interface: NodeCollection
is the ordered list of nodes.

Specified by:
getNodes in interface NodeCollection

getNodesMap

public Map getNodesMap()
Description copied from interface: NodeCollection
maps node-names to nodes. returns an empty map if no nodes are contained.

Specified by:
getNodesMap in interface NodeCollection

getNode

public Node getNode(String name)
Description copied from interface: NodeCollection
retrieves a node by name.

Specified by:
getNode in interface NodeCollection
Returns:
the node or null if no such node is present.

hasNode

public boolean hasNode(String name)
Description copied from interface: NodeCollection
is true if this node-collection contains a node with the given name, false otherwise.

Specified by:
hasNode in interface NodeCollection

addNode

public Node addNode(Node node)
Description copied from interface: NodeCollection
adds the given node to this node-collection.

Specified by:
addNode in interface NodeCollection
Returns:
the added node.

removeNode

public Node removeNode(Node node)
Description copied from interface: NodeCollection
removes the given node from this node-collection.

Specified by:
removeNode in interface NodeCollection
Returns:
the removed node or null if the node was not present in this collection.

reorderNode

public void reorderNode(int oldIndex,
                        int newIndex)
Description copied from interface: NodeCollection
changes the order of the nodes : the node on oldIndex is removed and inserted in the newIndex. All nodes inbetween the old and the new index shift one index position.

Specified by:
reorderNode in interface NodeCollection

generateNodeName

public String generateNodeName()
Description copied from interface: NodeCollection
generates a new name for a node to be added to this collection.

Specified by:
generateNodeName in interface NodeCollection

findNode

public Node findNode(String hierarchicalName)
Description copied from interface: NodeCollection
finds the node by the given hierarchical name. use .. for the parent, use slashes '/' to separate the node names.

Specified by:
findNode in interface NodeCollection

generateNodeName

public static String generateNodeName(List nodes)

findNode

public static Node findNode(NodeCollection nodeCollection,
                            String hierarchicalName)

setStartState

public void setStartState(StartState startState)

getParent

public GraphElement getParent()
Overrides:
getParent in class GraphElement

addAction

public Action addAction(Action action)
creates a bidirectional relation between this process definition and the given action.

Throws:
IllegalArgumentException - if action is null or if action.getName() is null.

removeAction

public void removeAction(Action action)
removes the bidirectional relation between this process definition and the given action.

Throws:
IllegalArgumentException - if action is null or if the action was not present in the actions of this process definition.

getAction

public Action getAction(String name)

getActions

public Map getActions()

hasActions

public boolean hasActions()

createInstance

public Object createInstance()

addDefinition

public ModuleDefinition addDefinition(ModuleDefinition moduleDefinition)

removeDefinition

public ModuleDefinition removeDefinition(ModuleDefinition moduleDefinition)

getDefinition

public ModuleDefinition getDefinition(Class clazz)

getContextDefinition

public ContextDefinition getContextDefinition()

getFileDefinition

public FileDefinition getFileDefinition()

getTaskMgmtDefinition

public TaskMgmtDefinition getTaskMgmtDefinition()

getDefinitions

public Map getDefinitions()

setDefinitions

public void setDefinitions(Map definitions)

getVersion

public int getVersion()

setVersion

public void setVersion(int version)
Sets the version of this process. Generally the version is assigned automatically upon deployment.

Parameters:
version - the version to assign. Automatic versioning starts from 1. Any negative value is regarded as an unknown or null version. The meaning of version 0 is undefined.

getStartState

public Node getStartState()

setStartState

public void setStartState(Node startState)

isTerminationImplicit

public boolean isTerminationImplicit()

setTerminationImplicit

public void setTerminationImplicit(boolean isTerminationImplicit)


Copyright © 2011 JBoss, a division of Red Hat, Inc.. All Rights Reserved.