org.jbpm.pvm.internal.model
Class CompositeElementImpl

java.lang.Object
  extended by org.jbpm.pvm.internal.model.ProcessElementImpl
      extended by org.jbpm.pvm.internal.model.ObservableElementImpl
          extended by org.jbpm.pvm.internal.model.ScopeElementImpl
              extended by org.jbpm.pvm.internal.model.CompositeElementImpl
All Implemented Interfaces:
java.io.Serializable, CompositeElement, ObservableElement
Direct Known Subclasses:
ActivityImpl, ProcessDefinitionImpl

public abstract class CompositeElementImpl
extends ScopeElementImpl
implements CompositeElement

Author:
Tom Baeyens
See Also:
Serialized Form

Field Summary
protected  java.util.List<ActivityImpl> activities
           
protected  java.util.Map<java.lang.String,ActivityImpl> activitiesMap
           
 
Fields inherited from class org.jbpm.pvm.internal.model.ScopeElementImpl
timerDefinitions, variableDefinitions
 
Fields inherited from class org.jbpm.pvm.internal.model.ObservableElementImpl
description, events, name
 
Fields inherited from class org.jbpm.pvm.internal.model.ProcessElementImpl
dbid, dbversion, exceptionHandlers, processDefinition, properties
 
Constructor Summary
CompositeElementImpl()
           
 
Method Summary
 Activity addActivity(ActivityImpl activity)
           
 ActivityImpl createActivity()
          creates a nested activity.
 ActivityImpl createActivity(java.lang.String activityName)
          creates a nested activity with the given name.
 ActivityImpl findActivity(java.lang.String activityName)
          searches for the given activity in this element recursively, including this activity and all child activities.
 java.util.List<? extends Activity> getActivities()
          the list of nested activities.
 java.util.Map<java.lang.String,? extends Activity> getActivitiesMap()
          the nested activities, keyed by activity name.
 ActivityImpl getActivity(java.lang.String activityName)
          the first nested activity with the given name or null of no such activity exists.
 boolean hasActivities()
          indicates if this processDefinition has activities.
 boolean hasActivity(java.lang.String activityName)
          is this activity present ?
 boolean removeActivity(ActivityImpl activity)
          removes the given activity from the nested activities.
 
Methods inherited from class org.jbpm.pvm.internal.model.ScopeElementImpl
addTimerDefinition, createTimerDefinition, createVariableDefinition, getTimerDefinitions, getVariableDefinitions, hasTimerDefinitions, hasVariableDefinitions, isLocalScope
 
Methods inherited from class org.jbpm.pvm.internal.model.ObservableElementImpl
addEvent, createEvent, getDescription, getEvent, getEvents, getName, getParent, hasEvent, setDescription, setName
 
Methods inherited from class org.jbpm.pvm.internal.model.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.internal.model.ObservableElement
getDbid, getName, getParent, getProcessDefinition, getProperty, getPropertyKeys, hasEvent
 

Field Detail

activities

protected java.util.List<ActivityImpl> activities

activitiesMap

protected transient java.util.Map<java.lang.String,ActivityImpl> activitiesMap
Constructor Detail

CompositeElementImpl

public CompositeElementImpl()
Method Detail

createActivity

public ActivityImpl createActivity()
creates a nested activity. Also the nested activity's parent pointer will be set appropriatly.


createActivity

public ActivityImpl createActivity(java.lang.String activityName)
creates a nested activity with the given name. Also the nested activity's parent pointer will be set appropriatly.

Parameters:
activityName - may be null.

addActivity

public Activity addActivity(ActivityImpl activity)

removeActivity

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


getActivity

public ActivityImpl getActivity(java.lang.String activityName)
the first nested activity with the given name or null of no such activity exists.

Specified by:
getActivity in interface CompositeElement

hasActivity

public boolean hasActivity(java.lang.String activityName)
is this activity present ?

Specified by:
hasActivity in interface CompositeElement

findActivity

public ActivityImpl findActivity(java.lang.String activityName)
Description copied from interface: CompositeElement
searches for the given activity in this element recursively, including this activity and all child activities. The search is done depth-first. A null value for activityName matches a activity without a name.

Specified by:
findActivity in interface CompositeElement

getActivities

public java.util.List<? extends Activity> getActivities()
the list of nested activities. Beware: the actual member is returned. No copy is made.

Specified by:
getActivities in interface CompositeElement

getActivitiesMap

public java.util.Map<java.lang.String,? extends Activity> getActivitiesMap()
the nested activities, keyed by activity name. If a activity 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:
getActivitiesMap in interface CompositeElement

hasActivities

public boolean hasActivities()
indicates if this processDefinition has activities.

Specified by:
hasActivities in interface CompositeElement


Copyright © 2010 JBoss Community. All Rights Reserved.