org.jbpm.pvm.impl
Class ExecutionImpl

java.lang.Object
  extended by org.jbpm.pvm.impl.ExecutionImpl
All Implemented Interfaces:
java.io.Serializable, Execution

public class ExecutionImpl
extends java.lang.Object
implements Execution, java.io.Serializable

Author:
Tom Baeyens
See Also:
Serialized Form

Field Summary
protected  java.util.Queue<AtomicOperation> atomicOperations
          the queue of atomic operations to be performed for this execution.
protected  java.util.Set<CommentImpl> comments
           
protected  long dbid
           
protected  int dbversion
           
protected  EventImpl event
           
protected  ObservableElementImpl eventSource
           
protected  java.lang.Exception exception
           
protected  java.util.Collection<ExecutionImpl> executions
          are concurrent executions that related to this execution.
protected  java.util.Map<java.lang.String,Execution> executionsMap
          caches the child executions by execution name.
protected  java.lang.String key
           
protected  java.lang.String name
           
protected  int nextLogIndex
          maintains the index of the next log record.
protected  NodeImpl node
           
protected  ExecutionImpl parent
          the parent child relation of executions is convenient for some forms of concurrency.
protected  Node previousNode
           
protected  Transition previousTransition
           
protected  int priority
           
protected  ProcessDefinitionImpl processDefinition
           
protected  ExecutionImpl processInstance
           
protected  ProcessModificationsImpl processModifications
           
protected  org.jbpm.pvm.impl.ExecutionImpl.Propagation propagation
           
protected  java.lang.String state
           
protected  TransitionImpl transition
          transition is not to be made persistable by default
protected  NodeImpl transitionOrigin
          the node from which the transition was taken.
protected  org.jbpm.pvm.impl.ExecutionImpl.UserCodeType userCodeType
           
protected  java.util.List<VariableScope> variableScopes
          stack of runtime variable scopes.
 
Fields inherited from interface org.jbpm.pvm.Execution
STATE_ACTIVE, STATE_CANCELLED, STATE_ENDED, STATE_INACTIVE, STATE_SUSPENDED
 
Constructor Summary
ExecutionImpl()
           
 
Method Summary
 void addComment(CommentImpl comment)
           
 void addExecution(Execution execution)
           
 void addLog(ProcessLog processLog)
          adds a log to this execution.
 void cancel()
          ends this execution and assigns the state Execution.STATE_CANCELLED.
protected  void checkLock()
           
 Comment createComment(java.lang.String message)
          adding a comment.
 ExecutionImpl createExecution()
          creates a child path of execution.
 ExecutionImpl createExecution(java.lang.String name)
          creates a child path of execution with the given name.
 VariableScope createVariableScope()
          creates a new variable scope.
 VariableScope createVariableScope(java.util.List<VariableDefinition> variableDefinitions)
          creates a new variable scope and initialize it according to the given variable definitions.
 void destroyVariableScope()
          removes the most inner variableScope.
 void end()
          ends this execution and all of its child executions.
 void end(java.lang.String state)
          ends this execution and all it's child executions with a user defined status.
 void end(java.lang.String state, boolean remove)
          ends this execution and all it's child executions with a user defined status.
 void execute(Node node)
          executes the given node.
 void execute(java.lang.String nodeName)
          executes the given nested node.
protected  TransitionImpl findDefaultTransition()
           
protected  TransitionImpl findTransition(java.lang.String transitionName)
          by default this will use NodeImpl.findOutgoingTransition(String) to search for the outgoing transition, which includes a search over the parent chain of the current node.
protected  VariableScope findVariableScope()
           
protected  VariableScope findVariableScope(java.lang.String key)
           
 void fire(java.lang.String eventName, ObservableElement eventSource)
          fires the event on the given eventSource and then propagates the event up to the eventSource's parent chain.
 java.util.List<Comment> getComments()
          the list of comments made on this execution.
 long getDbid()
          the meaningless database primary key
 Event getEvent()
          the event that is being fired, part of the current position in the process graph.
 ObservableElement getEventSource()
          the original object that fired the event, part of the current position in the process graph.
 java.lang.Exception getException()
          the exception in case an exception handler is handling an exception.
 ExecutionImpl getExecution(java.lang.String name)
          the child execution for the given name or null in case such execution doesn't exist.
 java.util.Collection<Execution> getExecutions()
          the child executions in the execution structure.
 java.util.Map<java.lang.String,Execution> getExecutionsMap()
          maps child execution names to execution objects.
<T> T
getExtension(java.lang.Class<T> extensionClass)
          way to access process language extensions in the execution without having to cast.
 java.lang.String getKey()
          the meaningful but optional business key that is unique within one process definition.
 java.lang.String getName()
          the name of this execution.
 NodeImpl getNode()
          the current node indicating the position in the process definition graph.
 Execution getParent()
          the parent execution in the execution structure.
 Node getPreviousNode()
          returns the previously executed node only if Node.isPreviousNeeded() is set to true.
 Transition getPreviousTransition()
          returns the previously taken transition only if Node.isPreviousNeeded() is set to true.
 int getPriority()
          indicates low priorities with negative values and high priorities with positive values.
 ProcessDefinitionImpl getProcessDefinition()
          the process definition for this execution.
 ExecutionImpl getProcessInstance()
          the main path of execution in the execution structure.
 ProcessModificationsImpl getProcessModifications()
           
 org.jbpm.pvm.impl.ExecutionImpl.Propagation getPropagation()
           
 java.lang.String getState()
          the state of this execution.
 TransitionImpl getTransition()
          the current transition indicating the position in the process definition graph.
 NodeImpl getTransitionOrigin()
           
 org.jbpm.pvm.impl.ExecutionImpl.UserCodeType getUserCodeType()
           
 java.lang.Object getVariable(java.lang.String key)
          retrieves the variable value for the given key.
 java.util.Set<java.lang.String> getVariableKeys()
          the variable keys for this execution in all visible scopes.
 java.util.Map<java.lang.String,java.lang.Object> getVariables()
          retrieves all variables, CAUTION : this might be a very costly operation in case you're using database persistence and many variables have to be fetched from the database.
protected  VariableScope getVariableScope()
           
 java.util.Iterator<VariableScope> getVariableScopeIterator()
          iterates over all variable scopes from inner to outer, including executionScopes on the parent execution chain.
 java.util.List<VariableScope> getVariableScopes()
           
 void handleException(ObservableElementImpl observableElement, EventImpl actionEvent, EventListenerReference eventListenerReference, java.lang.Exception exception, java.lang.String rethrowMessage)
           
 boolean hasExecution(java.lang.String name)
          indicates if this execution has a child execution with the given executionName
 boolean hasVariable(java.lang.String key)
          checks presence of the given variable key.
 boolean isActive()
          is this execution active ?
 boolean isEnded()
          is this execution ended normally ?
 boolean isFinished()
          is this execution ended or cancelled ?
 boolean isLocked()
          is this execution locked ?
 boolean isSuspended()
          is this execution suspended ?
 void lock(java.lang.String state)
          makes this execution read-only.
 void move(Node destination)
          reposition this execution in the destination node.
protected  void moveTo(NodeImpl destination)
           
protected  ExecutionImpl newChildExecution()
           
protected  VariableScope newVariableScope()
           
 int nextLogIndex()
           
 void performAtomicOperation(AtomicOperation operation)
           
 void performAtomicOperationSync(AtomicOperation operation)
           
 void popVariableScope()
           
 void proceed()
           
protected  void propagateEvent(java.lang.String eventName, ObservableElement eventSource, ObservableElement observableElement)
          this method enables specific process languages to overwrite the event propagation behaviour
 void pushVariableScope(VariableScope executionScope)
           
 void removeExecution(Execution execution)
          removes the child execution.
 void removeExecutions()
           
 void removeVariable(java.lang.String key)
          removes the variable with the given key.
 void resume()
          resumes an execution.
 void sendContinuationMessage(AtomicOperation operation)
           
 void setComments(java.util.Set<CommentImpl> comments)
           
 void setEvent(EventImpl event)
           
 void setEventSource(ObservableElementImpl eventSource)
           
 void setException(java.lang.Exception exception)
           
 void setExecutions(java.util.Collection<ExecutionImpl> executions)
           
 void setKey(java.lang.String key)
           
 void setName(java.lang.String name)
           
 void setNode(NodeImpl node)
           
 void setParent(ExecutionImpl parent)
           
 void setPreviousNode(Node previousNode)
           
 void setPreviousTransition(Transition previousTransition)
           
 void setPriority(int priority)
          setter for the priority.
 void setProcess(ProcessDefinitionImpl processDefinition)
           
 void setProcessDefinition(ProcessDefinitionImpl processDefinition)
           
 void setProcessInstance(ExecutionImpl processInstance)
           
 void setProcessModifications(ProcessModificationsImpl processModifications)
           
 void setPropagation(org.jbpm.pvm.impl.ExecutionImpl.Propagation propagation)
           
 void setState(java.lang.String state)
           
 void setTransition(TransitionImpl transition)
           
 void setTransitionOrigin(NodeImpl transitionOrigin)
           
 void setUserCodeType(org.jbpm.pvm.impl.ExecutionImpl.UserCodeType userCodeType)
           
 void setVariable(java.lang.String key, java.lang.Object value)
          sets the variable into the most inner matching variable scope.
 void setVariables(java.util.Map<java.lang.String,java.lang.Object> variables)
          sets all the variable into the most inner matching variable scope.
 void setVariableScopes(java.util.List<VariableScope> variableScopes)
           
 void signal()
          feeds a external trigger into this execution.
 void signal(java.util.Map<java.lang.String,java.lang.Object> parameters)
          feeds an external trigger into the execution with parameters.
 void signal(java.lang.String signal)
          feeds a named external trigger into the execution.
 void signal(java.lang.String signal, java.util.Map<java.lang.String,java.lang.Object> parameters)
          feeds a named external trigger into the execution with parameters.
 void start()
          invoked as part of ProcessDefinitionImpl.startExecution().
 void suspend()
          suspends this execution and all it's child executions.
 void take(java.lang.String transitionName)
          takes the outgoing transition with the given name.
 void take(Transition transition)
          takes the given outgoing transition.
 void takeDefaultTransition()
          takes the default transition.
 java.lang.String toString()
           
 void unlock()
          unlocks a locked execution.
 void waitForSignal()
          makes this execution wait in the current node until an external trigger is given with one of the Execution.signal() methods.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

dbid

protected long dbid

dbversion

protected int dbversion

key

protected java.lang.String key

name

protected java.lang.String name

state

protected java.lang.String state
See Also:
Execution

processDefinition

protected ProcessDefinitionImpl processDefinition

node

protected NodeImpl node

transition

protected TransitionImpl transition
transition is not to be made persistable by default


transitionOrigin

protected NodeImpl transitionOrigin
the node from which the transition was taken. This can be different from the transition source in case a transition of an eclosing node was taken. transitionOrigin is not to be made persistable by default


event

protected EventImpl event

eventSource

protected ObservableElementImpl eventSource

executions

protected java.util.Collection<ExecutionImpl> executions
are concurrent executions that related to this execution.


parent

protected ExecutionImpl parent
the parent child relation of executions is convenient for some forms of concurrency.


processInstance

protected ExecutionImpl processInstance

comments

protected java.util.Set<CommentImpl> comments

priority

protected int priority

nextLogIndex

protected int nextLogIndex
maintains the index of the next log record. That way, the logs don't have to be loaded to add one. Instead, for each log that is added to this execution, the nextLogIndex is used and incremented.


executionsMap

protected transient java.util.Map<java.lang.String,Execution> executionsMap
caches the child executions by execution name. This member might be null and is only created from the executions in case its needed. Note that not all executions are forced to have a name and duplicates are allowed. In case the executions change, the executionsMap can be nulled or also updated (but a check needs to be added wether it exists).


variableScopes

protected java.util.List<VariableScope> variableScopes
stack of runtime variable scopes. An execution scope can maintain runtime information related to a local processDefinition scope. Scopes of parent executions should be considered as appended to this stack. Execution scopes are ordered from inner to outer. So when searching for a scope, it should be done in the normal iteration order. New execution scopes should always be added as the first element.


atomicOperations

protected java.util.Queue<AtomicOperation> atomicOperations
the queue of atomic operations to be performed for this execution.


propagation

protected org.jbpm.pvm.impl.ExecutionImpl.Propagation propagation

previousNode

protected Node previousNode

previousTransition

protected Transition previousTransition

userCodeType

protected org.jbpm.pvm.impl.ExecutionImpl.UserCodeType userCodeType

exception

protected java.lang.Exception exception

processModifications

protected ProcessModificationsImpl processModifications
Constructor Detail

ExecutionImpl

public ExecutionImpl()
Method Detail

start

public void start()
invoked as part of ProcessDefinitionImpl.startExecution(). Specific processDefinition languages can customize the start behaviour by subclassing and overriding this method.


toString

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

signal

public void signal()
Description copied from interface: Execution
feeds a external trigger into this execution.

Typically a signal causes the execution to proceed, but that doesn't necessarily has to be the case . The ExternalActivity is responsible for interpreting the signal and acting upon it.

A signal can optionally be given a signal name, a map of parameters or both.

Since it's an external trigger, this method requires that this execution is waiting for an external trigger. So this method must be called as an external client and can not be called while this execution is executing. In an Activity for example you're not allowed to call the signal on the execution cause it is executing. But you are allowed to invoke this method on any other execution (at least, if that one is waiting for an external trigger).

Typically a signal will cause the execution to start executing, but that is not a must. What happens with this signal is defined in the ExternalActivity.signal(Execution, String, Map) of the current node.

Specified by:
signal in interface Execution
See Also:
Execution.signal()

signal

public void signal(java.lang.String signal)
Description copied from interface: Execution
feeds a named external trigger into the execution.

In each state, a number of things can happen. The signal parameter specifies which of these things is happening. It's somewhat similar to a method name in the invocation of an object.

Specified by:
signal in interface Execution
See Also:
Execution.signal(String)

signal

public void signal(java.util.Map<java.lang.String,java.lang.Object> parameters)
Description copied from interface: Execution
feeds an external trigger into the execution with parameters.

Specified by:
signal in interface Execution
See Also:
Execution.signal(Map)

signal

public void signal(java.lang.String signal,
                   java.util.Map<java.lang.String,java.lang.Object> parameters)
Description copied from interface: Execution
feeds a named external trigger into the execution with parameters.

In each state, a number of things can happen. The signal parameter specifies which of these things is happening. It's somewhat similar to a method name in the invocation of an object.

The parameters parameter provide extra information to the signal. Typically, the parameters are set as variables but the process language can overwrite that behaviour in the current node. See ExternalActivity.signal(Execution, String, Map) for more information.

Specified by:
signal in interface Execution
See Also:
Execution.signal(String, Map)

takeDefaultTransition

public void takeDefaultTransition()
Description copied from interface: Execution
takes the default transition.

This method can only be called from inside ExternalActivity implementations and in rare occasions also from outside of the execution (from an external client while the process is in a wait state). For external clients, it is more normal to use the Execution.signal() method as in that case, it's the current node (hence the process language)that will decide how to interpret the signal.

Specified by:
takeDefaultTransition in interface Execution
See Also:
Execution.takeDefaultTransition()

take

public void take(java.lang.String transitionName)
Description copied from interface: Execution
takes the outgoing transition with the given name.

This method can only be called from inside ExternalActivity implementations and in rare occasions also from outside of the execution (from an external client while the process is in a wait state). For external clients, it is more normal to use the Execution.signal(String) method as in that case, it's the current node (hence the process language)that will decide how to interpret the signal.

Transitions will be looked up recursively starting from the current node and then up the node-parent-hierarchy

Specified by:
take in interface Execution
Parameters:
transitionName - is the name of the transition to take. A null value will match the first unnamed transition.
See Also:
Execution.take(String)

take

public void take(Transition transition)
Description copied from interface: Execution
takes the given outgoing transition.

This method can only be called from inside ExternalActivity implementations and in rare occasions also from outside of the execution (from an external client while the process is in a wait state). For external clients, it is more normal to use the Execution.signal(String) method as in that case, it's the current node (hence the process language)that will decide how to interpret the signal.

CAUTION: It's up to the client to make sure that this transition makes sense as there is no check whether the given transition is an outgoing transition of the current node. The motivation for that is that in case of superstates, that check can become too 'expensive'.

Specified by:
take in interface Execution
See Also:
Execution.takeDefaultTransition()

execute

public void execute(java.lang.String nodeName)
Description copied from interface: Execution
executes the given nested node.

The nodeName is looked up in the current node's nested nodes.

This method can only be called from inside ExternalActivity implementations and in rare occasions also from outside of the execution (from an external client while the process is in a wait state). For external clients, it is more normal to use the Execution.signal(String) method as in that case, it's the current node (hence the process language)that will decide how to interpret the signal.

Specified by:
execute in interface Execution
See Also:
Execution.execute(String)

execute

public void execute(Node node)
Description copied from interface: Execution
executes the given node.

This method can only be called from inside ExternalActivity implementations and in rare occasions also from outside of the execution (from an external client while the process is in a wait state). For external clients, it is more normal to use the Execution.signal(String) method as in that case, it's the current node (hence the process language)that will decide how to interpret the signal.

Specified by:
execute in interface Execution
See Also:
Execution.execute(Node)

waitForSignal

public void waitForSignal()
Description copied from interface: Execution
makes this execution wait in the current node until an external trigger is given with one of the Execution.signal() methods.

Specified by:
waitForSignal in interface Execution

proceed

public void proceed()

move

public void move(Node destination)
Description copied from interface: Execution
reposition this execution in the destination node.

Specified by:
move in interface Execution

moveTo

protected void moveTo(NodeImpl destination)

performAtomicOperation

public void performAtomicOperation(AtomicOperation operation)

getState

public java.lang.String getState()
Description copied from interface: Execution
the state of this execution.

Specified by:
getState in interface Execution
See Also:
Execution.getState()

lock

public void lock(java.lang.String state)
Description copied from interface: Execution
makes this execution read-only. All methods that change the state of this execution (incl the fire methods) will throw a PvmException. The only mutable method allowed is Execution.unlock().

Specified by:
lock in interface Execution
See Also:
Execution.lock(String)

unlock

public void unlock()
Description copied from interface: Execution
unlocks a locked execution.

Specified by:
unlock in interface Execution
See Also:
Execution.unlock()

isActive

public boolean isActive()
Description copied from interface: Execution
is this execution active ? This is the inverse of Execution.isLocked().

Specified by:
isActive in interface Execution
See Also:
Execution.isActive()

isLocked

public boolean isLocked()
Description copied from interface: Execution
is this execution locked ? This is the inverse of Execution.isActive().

Specified by:
isLocked in interface Execution
See Also:
Execution.isLocked()

isSuspended

public boolean isSuspended()
Description copied from interface: Execution
is this execution suspended ?

Specified by:
isSuspended in interface Execution
See Also:
Execution.isSuspended()

isEnded

public boolean isEnded()
Description copied from interface: Execution
is this execution ended normally ?

Specified by:
isEnded in interface Execution
See Also:
Execution.isEnded()

isFinished

public boolean isFinished()
Description copied from interface: Execution
is this execution ended or cancelled ?

Specified by:
isFinished in interface Execution
See Also:
Execution.isFinished()

end

public void end()
Description copied from interface: Execution
ends this execution and all of its child executions.

The execution will be removed from it's parent. Potentially this can cause a parent execution to start executing in case this is the last concurrent execution for which the parent is waiting.

This method should not be called in Activitys. It can be called from outside the process execution and in ExternalActivitys.

Specified by:
end in interface Execution
See Also:
Execution.end()

end

public void end(java.lang.String state)
Description copied from interface: Execution
ends this execution and all it's child executions with a user defined status.

It is not recommended to use any of the defined statuses as that may case unpredictable side effects.

The execution will be removed from it's parent.

Specified by:
end in interface Execution
See Also:
Execution.end(String)

end

public void end(java.lang.String state,
                boolean remove)
Description copied from interface: Execution
ends this execution and all it's child executions with a user defined status.

It is not recommended to use any of the defined statuses as that may case unpredictable side effects.

Specified by:
end in interface Execution
remove - indicates whether the execution must be removed from its parent.
See Also:
Execution.end(String, boolean)

cancel

public void cancel()
Description copied from interface: Execution
ends this execution and assigns the state Execution.STATE_CANCELLED.

Specified by:
cancel in interface Execution
See Also:
Execution.cancel()

suspend

public void suspend()
Description copied from interface: Execution
suspends this execution and all it's child executions. Human tasks of a suspended execution shouldn't show up in people's task list and timers of suspended executions shouldn't fire.

Specified by:
suspend in interface Execution
See Also:
Execution.suspend()

resume

public void resume()
Description copied from interface: Execution
resumes an execution. Inverse of Execution.suspend().

Specified by:
resume in interface Execution
See Also:
Execution.resume()

checkLock

protected void checkLock()

sendContinuationMessage

public void sendContinuationMessage(AtomicOperation operation)

performAtomicOperationSync

public void performAtomicOperationSync(AtomicOperation operation)

pushVariableScope

public void pushVariableScope(VariableScope executionScope)

popVariableScope

public void popVariableScope()

getVariableScopes

public java.util.List<VariableScope> getVariableScopes()

setVariable

public void setVariable(java.lang.String key,
                        java.lang.Object value)
Description copied from interface: Execution
sets the variable into the most inner matching variable scope. If no variable scope is present, a new one is created on the process instance. So by default, variables are created in the most outer scope and hence they will be visible for the full process instance. For more about variables and variable scopes, see section variables in the package description.

Specified by:
setVariable in interface Execution
See Also:
Execution.setVariable(String, Object)

setVariables

public void setVariables(java.util.Map<java.lang.String,java.lang.Object> variables)
Description copied from interface: Execution
sets all the variable into the most inner matching variable scope. This doesn't replace the variables map, so the current variables for which there is no key in the given variables map are left untouched. Existing variables for which there is a key are overwritten. This method just delegates to Execution.setVariable(String, Object) for each entry in the given map. For more about variables and their scopes, see section variables in the package description.

Specified by:
setVariables in interface Execution
See Also:
Execution.setVariables(Map)

getVariable

public java.lang.Object getVariable(java.lang.String key)
Description copied from interface: Execution
retrieves the variable value for the given key. If no such key is present null will be returned. Variables can exist and have null as value. Variable lookup will be done according to the variable scoping rules as explained in section variables in the package description.

Specified by:
getVariable in interface Execution

hasVariable

public boolean hasVariable(java.lang.String key)
Description copied from interface: Execution
checks presence of the given variable key. All variable scopes are searched.

Specified by:
hasVariable in interface Execution

getVariableKeys

public java.util.Set<java.lang.String> getVariableKeys()
Description copied from interface: Execution
the variable keys for this execution in all visible scopes. This method never returns null. If no variables are present, an empty set will be returned.

Specified by:
getVariableKeys in interface Execution
See Also:
Execution.setVariable(String, Object), Execution.removeVariable(String)

getVariables

public java.util.Map<java.lang.String,java.lang.Object> getVariables()
Description copied from interface: Execution
retrieves all variables, CAUTION : this might be a very costly operation in case you're using database persistence and many variables have to be fetched from the database. This method never returns null. If no variables are present, an empty map will be returned. Changes to the returned map will not lead to updates of the variables in this execution.

Specified by:
getVariables in interface Execution

createVariableScope

public VariableScope createVariableScope()
Description copied from interface: Execution
creates a new variable scope. Variable scopes are typically managed by the process languages and users should not have to use this method.

Specified by:
createVariableScope in interface Execution

createVariableScope

public VariableScope createVariableScope(java.util.List<VariableDefinition> variableDefinitions)
Description copied from interface: Execution
creates a new variable scope and initialize it according to the given variable definitions. Variable scopes are typically managed by the process languages and users should not have to use this method.

Specified by:
createVariableScope in interface Execution

newVariableScope

protected VariableScope newVariableScope()

destroyVariableScope

public void destroyVariableScope()
Description copied from interface: Execution
removes the most inner variableScope. Variable scopes are typically managed by the process languages and users should not have to use this method.

Specified by:
destroyVariableScope in interface Execution

getVariableScopeIterator

public java.util.Iterator<VariableScope> getVariableScopeIterator()
Description copied from interface: Execution
iterates over all variable scopes from inner to outer, including executionScopes on the parent execution chain. Variable scopes are typically managed by the process languages and users should not have to use this method.

Specified by:
getVariableScopeIterator in interface Execution

removeVariable

public void removeVariable(java.lang.String key)
Description copied from interface: Execution
removes the variable with the given key. Lookup of the variable will be done just like in the Execution.getVariable(String) method. More can be found in section variables in the package description.

Specified by:
removeVariable in interface Execution
See Also:
Execution.setVariable(String, Object)

getVariableScope

protected VariableScope getVariableScope()

findVariableScope

protected VariableScope findVariableScope()

findVariableScope

protected VariableScope findVariableScope(java.lang.String key)

fire

public void fire(java.lang.String eventName,
                 ObservableElement eventSource)
Description copied from interface: Execution
fires the event on the given eventSource and then propagates the event up to the eventSource's parent chain. All the actions will see the given eventSource in Execution.getEventSource(), event if the events are registered to parent's of the given eventSource.

Specified by:
fire in interface Execution
See Also:
Execution.fire(String, ObservableElement)

propagateEvent

protected void propagateEvent(java.lang.String eventName,
                              ObservableElement eventSource,
                              ObservableElement observableElement)
this method enables specific process languages to overwrite the event propagation behaviour


handleException

public void handleException(ObservableElementImpl observableElement,
                            EventImpl actionEvent,
                            EventListenerReference eventListenerReference,
                            java.lang.Exception exception,
                            java.lang.String rethrowMessage)

createComment

public Comment createComment(java.lang.String message)
Description copied from interface: Execution
adding a comment. The actor making this comment is taken from the environment if it is available with Environment.getUserId().

Specified by:
createComment in interface Execution

addComment

public void addComment(CommentImpl comment)

createExecution

public ExecutionImpl createExecution()
Description copied from interface: Execution
creates a child path of execution. This execution will serve as the parent of the newly created execution. When the child execution ends, it will be automatically removed from the list of executions. Creating a child execution implies that this execution will no longer be a leaf in the execution tree. So the state of this execution will automatically set to Execution.STATE_INACTIVE when this method is invoked.

Specified by:
createExecution in interface Execution
See Also:
Execution.createExecution()

createExecution

public ExecutionImpl createExecution(java.lang.String name)
Description copied from interface: Execution
creates a child path of execution with the given name. This execution will serve as the parent of the newly created execution. When the created execution is ended with Execution.end() or Execution.end(String), then it will be automatically removed from this parent execution. Creating a child execution implies that this execution will no longer be a leaf in the execution tree. So the state of this execution will automatically set to Execution.STATE_INACTIVE when this method is invoked.

Specified by:
createExecution in interface Execution
See Also:
Execution.createExecution(String)

newChildExecution

protected ExecutionImpl newChildExecution()

addExecution

public void addExecution(Execution execution)

getExecution

public ExecutionImpl getExecution(java.lang.String name)
Description copied from interface: Execution
the child execution for the given name or null in case such execution doesn't exist.

Specified by:
getExecution in interface Execution
See Also:
Execution.getExecution(String)

removeExecution

public void removeExecution(Execution execution)
Description copied from interface: Execution
removes the child execution. Even in case the removed execution was the last child execution, the state of this execution will not be changed. It is up to the node implementations to set the state appropriately.

Specified by:
removeExecution in interface Execution

removeExecutions

public void removeExecutions()

getExecutionsMap

public java.util.Map<java.lang.String,Execution> getExecutionsMap()
Description copied from interface: Execution
maps child execution names to execution objects. In case multiple executions have the same name, the first one is taken. Can be null or can be an empty map. The first execution without a name is also included with null as the key.

Specified by:
getExecutionsMap in interface Execution
See Also:
Execution.getExecutionsMap()

hasExecution

public boolean hasExecution(java.lang.String name)
Description copied from interface: Execution
indicates if this execution has a child execution with the given executionName

Specified by:
hasExecution in interface Execution

addLog

public void addLog(ProcessLog processLog)
Description copied from interface: Execution
adds a log to this execution.

Specified by:
addLog in interface Execution

nextLogIndex

public int nextLogIndex()

findTransition

protected TransitionImpl findTransition(java.lang.String transitionName)
by default this will use NodeImpl.findOutgoingTransition(String) to search for the outgoing transition, which includes a search over the parent chain of the current node. This method allows process languages to overwrite this default implementation of the transition lookup by transitionName.


findDefaultTransition

protected TransitionImpl findDefaultTransition()

getExtension

public <T> T getExtension(java.lang.Class<T> extensionClass)
Description copied from interface: Execution
way to access process language extensions in the execution without having to cast. Casting can be problematic for persistence.

Specified by:
getExtension in interface Execution

getNode

public NodeImpl getNode()
Description copied from interface: Execution
the current node indicating the position in the process definition graph. Can be null in case a transition is being taken.

Specified by:
getNode in interface Execution

getDbid

public long getDbid()
Description copied from interface: Execution
the meaningless database primary key

Specified by:
getDbid in interface Execution

getEvent

public Event getEvent()
Description copied from interface: Execution
the event that is being fired, part of the current position in the process graph. Can be null in case no event is being fired.

Specified by:
getEvent in interface Execution

getEventSource

public ObservableElement getEventSource()
Description copied from interface: Execution
the original object that fired the event, part of the current position in the process graph. Can be null in case no event is being fired. This is mostly the object that is listened to with an Activity, but the eventSource can also be a child of the object to which is listened in case of event propagation.

Specified by:
getEventSource in interface Execution

getExecutions

public java.util.Collection<Execution> getExecutions()
Description copied from interface: Execution
the child executions in the execution structure. Can be null and can be an empty collection.

Specified by:
getExecutions in interface Execution

getName

public java.lang.String getName()
Description copied from interface: Execution
the name of this execution. The name of a main path of execution is null.

Specified by:
getName in interface Execution

getParent

public Execution getParent()
Description copied from interface: Execution
the parent execution in the execution structure. Null will be returned in case this execution itself is the main execution path.

Specified by:
getParent in interface Execution

getPriority

public int getPriority()
Description copied from interface: Execution
indicates low priorities with negative values and high priorities with positive values. The default priority is 0, which means NORMAL. Other recognized named priorities are HIGHEST (2), HIGH (1), LOW (-1) and LOWEST (-2). For the rest, the user can set any other priority integer value, but then, the UI will have to display it as an integer and not the named value.

Specified by:
getPriority in interface Execution

getProcessDefinition

public ProcessDefinitionImpl getProcessDefinition()
Description copied from interface: Execution
the process definition for this execution.

Specified by:
getProcessDefinition in interface Execution

getTransition

public TransitionImpl getTransition()
Description copied from interface: Execution
the current transition indicating the position in the process definition graph. Can be null in case this execution is not taking a transition.

Specified by:
getTransition in interface Execution

setEvent

public void setEvent(EventImpl event)

setEventSource

public void setEventSource(ObservableElementImpl eventSource)

setNode

public void setNode(NodeImpl node)

setPriority

public void setPriority(int priority)
Description copied from interface: Execution
setter for the priority. The default priority is 0, which means NORMAL. Other recognized named priorities are HIGHEST (2), HIGH (1), LOW (-1) and LOWEST (-2). For the rest, the user can set any other priority integer value, but then, the UI will have to display it as an integer and not the named value.

Specified by:
setPriority in interface Execution

setTransition

public void setTransition(TransitionImpl transition)

getPreviousNode

public Node getPreviousNode()
Description copied from interface: Execution
returns the previously executed node only if Node.isPreviousNeeded() is set to true.

Specified by:
getPreviousNode in interface Execution

getPreviousTransition

public Transition getPreviousTransition()
Description copied from interface: Execution
returns the previously taken transition only if Node.isPreviousNeeded() is set to true.

Specified by:
getPreviousTransition in interface Execution

getProcessInstance

public ExecutionImpl getProcessInstance()
Description copied from interface: Execution
the main path of execution in the execution structure. Null will be returned in case this execution itself is the main execution path.

Specified by:
getProcessInstance in interface Execution

setProcess

public void setProcess(ProcessDefinitionImpl processDefinition)

setProcessInstance

public void setProcessInstance(ExecutionImpl processInstance)

getComments

public java.util.List<Comment> getComments()
Description copied from interface: Execution
the list of comments made on this execution.

Specified by:
getComments in interface Execution

setComments

public void setComments(java.util.Set<CommentImpl> comments)

getTransitionOrigin

public NodeImpl getTransitionOrigin()

setTransitionOrigin

public void setTransitionOrigin(NodeImpl transitionOrigin)

getException

public java.lang.Exception getException()
Description copied from interface: Execution
the exception in case an exception handler is handling an exception.

Specified by:
getException in interface Execution

setException

public void setException(java.lang.Exception exception)

getProcessModifications

public ProcessModificationsImpl getProcessModifications()

setProcessModifications

public void setProcessModifications(ProcessModificationsImpl processModifications)

getKey

public java.lang.String getKey()
Description copied from interface: Execution
the meaningful but optional business key that is unique within one process definition. This could be for instance the order number. It's a user defined identifier for one execution within the scope of a single process definition.

Specified by:
getKey in interface Execution

setKey

public void setKey(java.lang.String key)

getPropagation

public org.jbpm.pvm.impl.ExecutionImpl.Propagation getPropagation()

setPropagation

public void setPropagation(org.jbpm.pvm.impl.ExecutionImpl.Propagation propagation)

getUserCodeType

public org.jbpm.pvm.impl.ExecutionImpl.UserCodeType getUserCodeType()

setUserCodeType

public void setUserCodeType(org.jbpm.pvm.impl.ExecutionImpl.UserCodeType userCodeType)

setName

public void setName(java.lang.String name)

setState

public void setState(java.lang.String state)

setProcessDefinition

public void setProcessDefinition(ProcessDefinitionImpl processDefinition)

setExecutions

public void setExecutions(java.util.Collection<ExecutionImpl> executions)

setParent

public void setParent(ExecutionImpl parent)

setVariableScopes

public void setVariableScopes(java.util.List<VariableScope> variableScopes)

setPreviousNode

public void setPreviousNode(Node previousNode)

setPreviousTransition

public void setPreviousTransition(Transition previousTransition)