org.jbpm.pvm.impl
Class CompositeElementImpl

java.lang.Object
  extended by org.jbpm.pvm.impl.ProcessElementImpl
      extended by org.jbpm.pvm.impl.ObservableElementImpl
          extended by org.jbpm.pvm.impl.CompositeElementImpl
All Implemented Interfaces:
java.io.Serializable, CompositeElement, ObservableElement, ProcessElement
Direct Known Subclasses:
NodeImpl, ProcessDefinitionImpl

public class CompositeElementImpl
extends ObservableElementImpl
implements CompositeElement

Author:
Tom Baeyens
See Also:
Serialized Form

Field Summary
protected  boolean hasVariableDefinitions
           
protected  java.util.List<NodeImpl> nodes
           
protected  java.util.Map<java.lang.String,NodeImpl> nodesMap
           
protected  java.util.List<VariableDefinitionImpl> variableDefinitions
           
 
Fields inherited from class org.jbpm.pvm.impl.ObservableElementImpl
description, events, name
 
Fields inherited from class org.jbpm.pvm.impl.ProcessElementImpl
dbid, dbversion, exceptionHandlers, processDefinition, properties
 
Constructor Summary
CompositeElementImpl()
           
 
Method Summary
 Node addNode(NodeImpl node)
           
 Node createNode()
          creates a nested node.
 NodeImpl createNode(java.lang.String nodeName)
          creates a nested node with the given name.
 Node findNode(java.lang.String nodeName)
          searches for the given node in this node, including this node and all child nodes recursively.
 NodeImpl getNode(java.lang.String nodeName)
          the first nested node with the given name or null of no such node exists.
 java.util.List<Node> getNodes()
          the list of nested activities.
 java.util.Map<java.lang.String,Node> getNodesMap()
          the nested activities, keyed by node name.
 java.util.List<VariableDefinition> getVariableDefinitions()
           
 boolean hasNode(java.lang.String nodeName)
          is this node present ?
 boolean hasNodes()
          indicates if this processDefinition has nodes.
 boolean removeNode(NodeImpl node)
          removes the given node from the nested activities.
 void setVariableDefinitions(java.util.List<VariableDefinitionImpl> variableDefinitions)
           
 
Methods inherited from class org.jbpm.pvm.impl.ObservableElementImpl
addEvent, createEvent, getDescription, getEvent, getEvents, getName, getParent, hasEvent, setDescription, setEvents, setName
 
Methods inherited from class org.jbpm.pvm.impl.ProcessElementImpl
addExceptionHandler, addProperty, createExceptionHandler, getDbid, getExceptionHandlers, getProcessDefinition, getProperties, getProperty, getPropertyKeys, setExceptionHandlers, setProcessDefinition, setProperties
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jbpm.pvm.ObservableElement
getDescription, getEvent, getEvents, getName, getParent, hasEvent
 
Methods inherited from interface org.jbpm.pvm.ProcessElement
getDbid, getExceptionHandlers, getProcessDefinition, getProperty, getPropertyKeys
 

Field Detail

nodes

protected java.util.List<NodeImpl> nodes

hasVariableDefinitions

protected boolean hasVariableDefinitions

variableDefinitions

protected java.util.List<VariableDefinitionImpl> variableDefinitions

nodesMap

protected transient java.util.Map<java.lang.String,NodeImpl> nodesMap
Constructor Detail

CompositeElementImpl

public CompositeElementImpl()
Method Detail

createNode

public Node createNode()
creates a nested node. Also the nested node's parent pointer will be set appropriatly.


createNode

public NodeImpl createNode(java.lang.String nodeName)
creates a nested node with the given name. Also the nested node's parent pointer will be set appropriatly.

Parameters:
nodeName - may be null.

addNode

public Node addNode(NodeImpl node)

removeNode

public boolean removeNode(NodeImpl node)
removes the given node from the nested activities. Also the node's parent will be nulled. This method will do nothing if the node is null or if the node is not in the list of nested activities. If the node is actually removed from the list of activities, the node's source will be nulled. In case this is the node that was in the activitiesMap and another node exists with the same name, that node (the first) will be put in the activitiesMap as a replacement for the removed node.


getNode

public NodeImpl getNode(java.lang.String nodeName)
the first nested node with the given name or null of no such node exists.

Specified by:
getNode in interface CompositeElement

hasNode

public boolean hasNode(java.lang.String nodeName)
is this node present ?

Specified by:
hasNode in interface CompositeElement

findNode

public Node findNode(java.lang.String nodeName)
Description copied from interface: CompositeElement
searches for the given node in this node, including this node and all child nodes recursively. The search is done depth-first. A null value for nodeName matches a node without a name.

Specified by:
findNode in interface CompositeElement

getNodes

public java.util.List<Node> getNodes()
the list of nested activities. Beware: the actual member is returned. No copy is made.

Specified by:
getNodes in interface CompositeElement

getNodesMap

public java.util.Map<java.lang.String,Node> getNodesMap()
the nested activities, keyed by node name. If a node with the same name occurs mutltiple times, the first in the list is included in the map. Activities with a null value for their name are not included in the map. Beware: the actual member is returned. No copy is made.

Specified by:
getNodesMap in interface CompositeElement

hasNodes

public boolean hasNodes()
indicates if this processDefinition has nodes.

Specified by:
hasNodes in interface CompositeElement

getVariableDefinitions

public java.util.List<VariableDefinition> getVariableDefinitions()

setVariableDefinitions

public void setVariableDefinitions(java.util.List<VariableDefinitionImpl> variableDefinitions)