org.jbpm.pvm.internal.model
Class ActivityImpl

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
                  extended by org.jbpm.pvm.internal.model.ActivityImpl
All Implemented Interfaces:
java.io.Serializable, Activity, CompositeElement, ObservableElement
Direct Known Subclasses:
ProcessModificationsImpl.AddedActivity

public class ActivityImpl
extends CompositeElementImpl
implements Activity

Author:
Tom Baeyens
See Also:
Serialized Form

Field Summary
protected  ActivityBehaviour activityBehaviour
           
protected  Descriptor activityBehaviourDescriptor
           
protected  Continuation continuation
           
protected  ActivityCoordinatesImpl coordinates
           
protected  TransitionImpl defaultOutgoingTransition
           
protected  java.util.List<TransitionImpl> incomingTransitions
           
protected  boolean isActivityBehaviourStateful
           
protected  java.util.List<TransitionImpl> outgoingTransitions
           
protected  java.util.Map<java.lang.String,TransitionImpl> outgoingTransitionsMap
           
protected  ActivityImpl parentActivity
           
protected  java.lang.String type
           
 
Fields inherited from class org.jbpm.pvm.internal.model.CompositeElementImpl
activities, 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
ActivityImpl()
          Use CompositeElementImpl.createActivity() or CompositeElementImpl.createActivity() instead.
 
Method Summary
 ActivityImpl addActivity(ActivityImpl activity)
           
 Transition addIncomingTransition(TransitionImpl transition)
          adds the given transition as an arriving transition to this activity.
 Transition addOutgoingTransition(TransitionImpl transition)
          adds the given transition as a leaving transition to this activity.
 boolean contains(ActivityImpl activity)
           
 TransitionImpl createOutgoingTransition()
          creates an outgoing transition from this activity.
 ActivityImpl findActivity(java.lang.String activityName)
          searches for the given activity in this element recursively, including this activity and all child activities.
 TransitionImpl findDefaultTransition()
          searches for the default transition in this activity and then up the parent chain.
 TransitionImpl findOutgoingTransition(java.lang.String transitionName)
          searches for the given transitionName in this activity and then up the parent chain.
 ActivityBehaviour getActivityBehaviour()
           
 Descriptor getActivityBehaviourDescriptor()
           
 Continuation getContinuation()
           
 ActivityCoordinatesImpl getCoordinates()
           
 TransitionImpl getDefaultOutgoingTransition()
           
 java.util.List<? extends Transition> getIncomingTransitions()
          the list of arriving transitions.
 java.lang.String getName()
          the short display name given to this element.
 TransitionImpl getOutgoingTransition(java.lang.String transitionName)
          the first leaving transition with the given name or null of no such leaving transition exists.
 java.util.List<? extends Transition> getOutgoingTransitions()
          the list of leaving transitions.
 java.util.Map<java.lang.String,? extends Transition> getOutgoingTransitionsMap()
          the leaving transitions, keyed by transition name.
 ObservableElementImpl getParent()
          the enclosing activity or the process definition
 ActivityImpl getParentActivity()
           
 java.util.List<ObservableElementImpl> getParentChain()
          collects the full stack of parent in a list.
 java.lang.String getType()
           
 boolean hasIncomingTransitions()
          indicates if this activity has arriving transitions
 boolean hasOutgoingTransition(java.lang.String transitionName)
          indicates if a leaving transition with the given transitionName exists.
 boolean hasOutgoingTransitions()
          indicates if this activity has leaving transitions
 boolean isActivityBehaviourStateful()
           
 boolean isAsync()
           
 boolean removeIncomingTransition(TransitionImpl transition)
          removes the given transition if it is contained in the arriving transitions of this activity.
 boolean removeOutgoingTransition(TransitionImpl transition)
          removes the given transition from the leaving transitions.
 void setActivityBehaviour(ActivityBehaviour activityBehaviour)
           
 void setActivityBehaviourDescriptor(Descriptor activityBehaviourDescriptor)
           
 void setActivityBehaviourStateful(boolean isActivityBehaviourStateful)
           
 void setContinuation(Continuation continuation)
           
 void setCoordinates(ActivityCoordinatesImpl coordinates)
           
 void setDefaultOutgoingTransition(TransitionImpl defaultOutgoingTransition)
           
 void setIncomingTransitions(java.util.List<TransitionImpl> incomingTransitions)
          sets the incomingTransitions to the given list of incomingTransitions.
 void setName(java.lang.String name)
           
 void setOutgoingTransitions(java.util.List<TransitionImpl> outgoingTransitions)
          sets the outgoingTransitions to the given list of outgoingTransitions.
 void setParentActivity(ActivityImpl parentActivity)
           
 void setType(java.lang.String type)
           
 java.lang.String toString()
           
 
Methods inherited from class org.jbpm.pvm.internal.model.CompositeElementImpl
createActivity, createActivity, getActivities, getActivitiesMap, getActivity, hasActivities, hasActivity, removeActivity
 
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, hasEvent, setDescription
 
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, wait, wait, wait
 
Methods inherited from interface org.jbpm.api.model.Activity
getActivities, getActivitiesMap, getActivity, hasActivities, hasActivity
 
Methods inherited from interface org.jbpm.pvm.internal.model.ObservableElement
getDbid, getProcessDefinition, getProperty, getPropertyKeys, hasEvent
 

Field Detail

activityBehaviour

protected ActivityBehaviour activityBehaviour

isActivityBehaviourStateful

protected boolean isActivityBehaviourStateful

activityBehaviourDescriptor

protected Descriptor activityBehaviourDescriptor

outgoingTransitions

protected java.util.List<TransitionImpl> outgoingTransitions

incomingTransitions

protected java.util.List<TransitionImpl> incomingTransitions

defaultOutgoingTransition

protected TransitionImpl defaultOutgoingTransition

parentActivity

protected ActivityImpl parentActivity

type

protected java.lang.String type

continuation

protected Continuation continuation

coordinates

protected ActivityCoordinatesImpl coordinates

outgoingTransitionsMap

protected transient java.util.Map<java.lang.String,TransitionImpl> outgoingTransitionsMap
Constructor Detail

ActivityImpl

public ActivityImpl()
Use CompositeElementImpl.createActivity() or CompositeElementImpl.createActivity() instead.

Method Detail

addActivity

public ActivityImpl addActivity(ActivityImpl activity)
Overrides:
addActivity in class CompositeElementImpl

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 Activity
Specified by:
findActivity in interface CompositeElement
Overrides:
findActivity in class CompositeElementImpl

createOutgoingTransition

public TransitionImpl createOutgoingTransition()
creates an outgoing transition from this activity.


addOutgoingTransition

public Transition addOutgoingTransition(TransitionImpl transition)
adds the given transition as a leaving transition to this activity. Also the source of the transition is set to this activity. Adding a transition that is already contained in the leaving transitions has no effect.

Returns:
the added transition.
Throws:
java.lang.NullPointerException - if transition is null.

removeOutgoingTransition

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


getOutgoingTransition

public TransitionImpl getOutgoingTransition(java.lang.String transitionName)
the first leaving transition with the given name or null of no such leaving transition exists.

Specified by:
getOutgoingTransition in interface Activity

findOutgoingTransition

public TransitionImpl findOutgoingTransition(java.lang.String transitionName)
searches for the given transitionName in this activity and then up the parent chain. Returns null if no such transition is found.

Specified by:
findOutgoingTransition in interface Activity

findDefaultTransition

public TransitionImpl findDefaultTransition()
searches for the default transition in this activity and then up the parent chain. Returns null if no such transition is found.


getOutgoingTransitions

public java.util.List<? extends Transition> getOutgoingTransitions()
the list of leaving transitions. Beware: the actual member is returned. No copy is made.

Specified by:
getOutgoingTransitions in interface Activity

hasOutgoingTransition

public boolean hasOutgoingTransition(java.lang.String transitionName)
indicates if a leaving transition with the given transitionName exists.

Specified by:
hasOutgoingTransition in interface Activity

hasOutgoingTransitions

public boolean hasOutgoingTransitions()
indicates if this activity has leaving transitions

Specified by:
hasOutgoingTransitions in interface Activity

setOutgoingTransitions

public void setOutgoingTransitions(java.util.List<TransitionImpl> outgoingTransitions)
sets the outgoingTransitions to the given list of outgoingTransitions. A copy of the collection is made. Also the outgoingTransitionsMap will be updated and the source of all the transitions in the given list will be set to this activity. In case there was a leaving transitions list present, these transition's source will be nulled.


addIncomingTransition

public Transition addIncomingTransition(TransitionImpl transition)
adds the given transition as an arriving transition to this activity. Also the source of the transition is set to this activity.

Returns:
the added transition.
Throws:
java.lang.NullPointerException - if transition is null.

removeIncomingTransition

public boolean removeIncomingTransition(TransitionImpl transition)
removes the given transition if it is contained in the arriving transitions of this activity. If this transition was actually removed, its destination pointer is nulled.

Returns:
true if a transition was removed.

getIncomingTransitions

public java.util.List<? extends Transition> getIncomingTransitions()
the list of arriving transitions. Beware: the actual member is returned. No copy is made.

Specified by:
getIncomingTransitions in interface Activity

hasIncomingTransitions

public boolean hasIncomingTransitions()
indicates if this activity has arriving transitions

Specified by:
hasIncomingTransitions in interface Activity

setIncomingTransitions

public void setIncomingTransitions(java.util.List<TransitionImpl> incomingTransitions)
sets the incomingTransitions to the given list of incomingTransitions. A copy of the collection is made. Also the destination of all the transitions in the given list will be set to this activity. In case there was an arriving transitions list present, these transition's destination will be nulled.


getOutgoingTransitionsMap

public java.util.Map<java.lang.String,? extends Transition> getOutgoingTransitionsMap()
the leaving transitions, keyed by transition name. If a transition with the same name occurs mutltiple times, the first one is returned. Leaving transitions 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:
getOutgoingTransitionsMap in interface Activity

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getParentChain

public java.util.List<ObservableElementImpl> getParentChain()
collects the full stack of parent in a list. This activity is the first element in the chain. The process definition will be the last element. the chain will never be null.


isAsync

public boolean isAsync()

contains

public boolean contains(ActivityImpl activity)

getActivityBehaviour

public ActivityBehaviour getActivityBehaviour()

getParent

public ObservableElementImpl getParent()
Description copied from interface: ObservableElement
the enclosing activity or the process definition

Specified by:
getParent in interface ObservableElement
Overrides:
getParent in class ObservableElementImpl

getName

public java.lang.String getName()
Description copied from interface: ObservableElement
the short display name given to this element.

Specified by:
getName in interface Activity
Specified by:
getName in interface ObservableElement
Overrides:
getName in class ObservableElementImpl

setName

public void setName(java.lang.String name)
Overrides:
setName in class ObservableElementImpl

getDefaultOutgoingTransition

public TransitionImpl getDefaultOutgoingTransition()
Specified by:
getDefaultOutgoingTransition in interface Activity

setDefaultOutgoingTransition

public void setDefaultOutgoingTransition(TransitionImpl defaultOutgoingTransition)

getParentActivity

public ActivityImpl getParentActivity()
Specified by:
getParentActivity in interface Activity

setParentActivity

public void setParentActivity(ActivityImpl parentActivity)

getType

public java.lang.String getType()
Specified by:
getType in interface Activity

setType

public void setType(java.lang.String type)

getCoordinates

public ActivityCoordinatesImpl getCoordinates()

setCoordinates

public void setCoordinates(ActivityCoordinatesImpl coordinates)

getContinuation

public Continuation getContinuation()

setContinuation

public void setContinuation(Continuation continuation)

setActivityBehaviour

public void setActivityBehaviour(ActivityBehaviour activityBehaviour)

getActivityBehaviourDescriptor

public Descriptor getActivityBehaviourDescriptor()

setActivityBehaviourDescriptor

public void setActivityBehaviourDescriptor(Descriptor activityBehaviourDescriptor)

isActivityBehaviourStateful

public boolean isActivityBehaviourStateful()

setActivityBehaviourStateful

public void setActivityBehaviourStateful(boolean isActivityBehaviourStateful)


Copyright © 2010 JBoss Community. All Rights Reserved.