org.ow2.orchestra.pvm.internal.model
Class ExecutionImpl

java.lang.Object
  extended by org.ow2.orchestra.pvm.internal.model.ExecutionImpl
All Implemented Interfaces:
Serializable, ActivityExecution, ClientExecution, ClientProcessInstance, Execution, EventListenerExecution, Discussable, OpenExecution

public class ExecutionImpl
extends Object
implements ClientProcessInstance, ActivityExecution, EventListenerExecution

Author:
Tom Baeyens
See Also:
Serialized Form

Nested Class Summary
static class ExecutionImpl.Propagation
           
 
Field Summary
protected  Queue<AtomicOperation> atomicOperations
          the queue of atomic operations to be performed for this execution.
protected  Set<CommentImpl> comments
          the free text comments users make on this execution
protected  long dbid
           
protected  int dbversion
           
protected  EventImpl event
           
protected  ObservableElementImpl eventSource
           
protected  Exception exception
           
static AtomicOperation EXECUTE_NODE
           
protected  Collection<ExecutionImpl> executions
          are concurrent executions that related to this execution.
protected  Map<String,OpenExecution> executionsMap
          caches the child executions by execution name.
protected  boolean hasVariables
           
protected  String id
          a unique id for this execution.
protected  List<JobImpl<?>> jobs
           
protected  String key
          a key for this execution. typically this is an externally provided reference that is unique within the scope of the process definition.
protected  String name
          an optional name for this execution. can be used to differentiate concurrent paths of execution like e.g. the 'shipping' and 'billing' paths.
protected  int nextLogIndex
          maintains the index of the next log record.
protected  NodeImpl node
          current node
protected  ExecutionImpl parent
          the parent child relation of executions is convenient for some forms of concurrency.
protected  Date parentInstanceStartTime
           
protected  Node previousNode
           
protected  Transition previousTransition
           
protected  int priority
           
static AtomicOperation PROCEED_TO_DESTINATION
           
protected  ProcessDefinitionImpl processDefinition
           
protected  ExecutionImpl processInstance
           
protected  ProcessModificationsImpl processModifications
           
static AtomicOperation PROPAGATE_TO_PARENT
           
protected  ExecutionImpl.Propagation propagation
           
protected  String state
           
protected  ExecutionImpl subProcessInstance
          the sub process link in case of sub process execution
protected  ExecutionImpl superProcessExecution
          the super process link in case this is a sub process execution
static AtomicOperation TAKE_TRANSITION
           
protected  TransitionImpl transition
          transition is not to be made persistable by default
protected  NodeImpl transitionOrigin
          the node from which the transition was taken.
protected  Map<String,Variable> variables
           
 
Fields inherited from interface org.ow2.orchestra.pvm.Execution
STATE_ACTIVE, STATE_ASYNC, STATE_CANCELLED, STATE_CREATED, 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 begin()
          starts this process instance
 ExecutionImpl beginNode(NodeImpl nodeToBegin)
           
 ClientProcessInstance beginSubProcessInstance(ClientProcessDefinition subProcessDefinition)
          creates and begins a sub process related to this path of execution.
 ClientProcessInstance beginSubProcessInstance(ClientProcessDefinition subProcessDefinition, String subProcessInstanceKey)
          creates and begins a sub process related to this path of execution.
 void cancel()
          ends this execution and assigns the state Execution.STATE_CANCELLED.
protected  void checkLock()
           
 Comment createComment(String message)
          create a comment
 ExecutionImpl createExecution()
          creates a child execution.
 Execution createExecution(Execution parentExecution)
          creates a new child execution under the given parent.
 ExecutionImpl createExecution(String executionName)
          creates a child execution with the given name.
 Execution createExecution(String executionName, Execution parentExecution)
          creates a new child execution under the given parent with the given name.
 ExecutionImpl createScope(CompositeElementImpl scope)
           
 ClientProcessInstance createSubProcessInstance(ClientProcessDefinition subProcessDefinition)
          creates a sub process related to this path of execution.
 ClientProcessInstance createSubProcessInstance(ClientProcessDefinition subProcessDefinition, String subProcessInstanceKey)
          creates a sub process related to this path of execution.
 void createTimer(String eventName, String signalName, String dueDateDescription)
           
 void createTimer(String eventName, String signalName, String dueDateDescription, Date dueDate, String repeat, Boolean isExclusive, Integer retries)
           
 void createTimer(String eventName, String signalName, String dueDateDescription, String repeat)
           
 void createVariable(String variableKey, Object variableValue)
          create a new variable in this execution scope and determine the type automagically.
 void createVariable(String variableKey, Object variableValue, String typeName)
          create a new variable in this execution scope with the given type name.
 void createVariable(String variableKey, Object variableValue, String typeName, Type type)
           
 void createVariable(String variableKey, Object variableValue, Type type)
           
 ExecutionImpl destroyScope(CompositeElementImpl scope)
           
protected  void destroyTimers(CompositeElementImpl scope)
           
protected  void destroyVariables(CompositeElementImpl scope, ExecutionImpl outerExecution)
           
 void end()
          ends this execution and all of its child executions.
 void end(String endState)
          ends this execution and all it's child executions with a user defined status.
 ExecutionImpl endNode(NodeImpl nodeToEnd)
           
 boolean equals(Object o)
           
 void execute(Node nodeToExecute)
          executes the given node.
 void execute(String nodeName)
          executes the given nested node.
protected  TransitionImpl findDefaultTransition()
           
protected  TransitionImpl findTransition(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.
 void fire(String eventName, ObservableElement firedEventSource)
          fires the event on the given eventSource and then propagates the event up to the eventSource's parent chain.
 List<Comment> getComments()
          all comments.
 long getDbid()
           
 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.
 Exception getException()
          the exception in case an exception handler is handling an exception.
 ExecutionImpl getExecution(String executionName)
          the child execution for the given name or null in case such execution doesn't exist.
 Collection<OpenExecution> getExecutions()
          the child executions in the execution structure.
 Map<String,OpenExecution> getExecutionsMap()
          maps child execution names to execution objects.
<T> T
getExtension(Class<T> extensionClass)
          way to access process language extensions in the execution without having to cast.
 String getId()
          a globally unique identifier for this execution.
 List<JobImpl<?>> getJobs()
          timers for this execution scope
 String getKey()
          the optional user provided business key that is unique within one process definition.
 String getName()
          the externally given name or id of this execution.
 NodeImpl getNode()
          the current node
 String getNodeName()
          represents the current position in the process by indicating the name of the current node.
 ExecutionImpl getParent()
          the parent execution in the execution structure.
 Date getParentInstanceStartTime()
           
 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()
           
 ExecutionImpl.Propagation getPropagation()
           
 String getState()
          the state of this execution.
 ExecutionImpl getSubProcessInstance()
          the related sub process execution.
 ExecutionImpl getSuperProcessExecution()
           
 TransitionImpl getTransition()
          the current transition indicating the position in the process definition graph.
 NodeImpl getTransitionOrigin()
           
 Object getVariable(String variableKey)
          retrieve the value for the given key.
 Set<String> getVariableKeys()
          a non-null set that contains all the keys present in this scope.
 Variable getVariableObject(String variableKey)
           
 Map<String,Object> getVariables()
          a non-null map containing all the key-value pairs in this scope.
 void handleException(ObservableElementImpl observableElement, EventImpl exceptionEvent, EventListenerReference eventListenerReference, Exception thrownException, String rethrowMessage)
           
 boolean hasExecution(String executionName)
          indicates if this execution has a child execution with the given executionName
 int hashCode()
           
 boolean hasVariable(String variableKey)
          indicates presenve of the given key.
 boolean hasVariables()
          indicates if there are keys in this scope.
 void initializeProcessInstance(ProcessDefinitionImpl executionProcessDefinition, String executionKey)
           
protected  ExecutionImpl initializeScopes()
           
protected  void initializeTimers(CompositeElementImpl scope)
           
protected  void initializeVariables(CompositeElementImpl scope, ExecutionImpl outerExecution)
           
protected  TimerImpl instantiateTimer()
           
 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(String lockState)
           
 void move(Node destination)
          position this execution in the destination node.
 void move(Node destination, Execution execution)
          position the given execution in the destination node
 void moveTo(NodeImpl destination)
           
protected  ExecutionImpl newChildExecution()
           
 int nextLogIndex()
           
 void performAtomicOperation(AtomicOperation operation)
           
 void performAtomicOperationSync(AtomicOperation operation)
           
 void proceed()
           
protected  void propagateEvent(String eventName, ObservableElement firedEventSource, ObservableElementImpl observableElement)
          this method enables specific process languages to overwrite the event propagation behaviour
 void removeComment(Comment comment)
          remove a comment
 void removeExecution(Execution child)
          removes the child execution from this execution.
 void removeExecution(Execution childExecution, Execution parentExecution)
          removes the child execution from the given parent.
 boolean removeVariable(String variableKey)
          remove the key-value pair for the given key from this scope.
 void removeVariables()
          removes all variables in this scope
 void resume()
          resumes an execution.
 void sendContinuationMessage(AtomicOperation operation)
           
 void setComments(Set<CommentImpl> comments)
           
 void setEvent(EventImpl event)
           
 void setEventSource(ObservableElementImpl eventSource)
           
 void setException(Exception exception)
           
 void setExecutions(Collection<ExecutionImpl> executions)
           
 void setId(String id)
           
 void setKey(String key)
           
 void setName(String name)
           
 void setNode(NodeImpl node)
           
 void setParent(ExecutionImpl parent)
           
 void setParentInstanceStartTime(Date startTime)
           
 void setPreviousNode(Node previousNode)
           
 void setPreviousTransition(Transition previousTransition)
           
 void setPriority(int priority)
          setter for the priority.
 void setProcessDefinition(ProcessDefinitionImpl processDefinition)
           
 void setProcessInstance(ExecutionImpl processInstance)
           
 void setProcessModifications(ProcessModificationsImpl processModifications)
           
 void setPropagation(ExecutionImpl.Propagation propagation)
           
 void setState(String state)
           
 void setSubProcessInstance(ExecutionImpl subProcessExecution)
           
 void setSuperProcessExecution(ExecutionImpl superProcessExecution)
           
 void setTransition(TransitionImpl transition)
           
 void setTransitionOrigin(NodeImpl transitionOrigin)
           
 void setVariable(String variableKey, Object variableValue)
          updates or creates a variable for the given value.
 void setVariables(Map<String,Object> variables)
          sets all given variables.
 void signal()
          feeds a external trigger into this execution.
 void signal(Execution execution)
          feeds a external trigger into the given execution.
 void signal(Map<String,Object> parameters)
          feeds an external trigger into the execution with parameters.
 void signal(Map<String,Object> parameters, Execution execution)
          feeds an external trigger into a given execution with parameters.
 void signal(String signal)
          feeds a named external trigger into the execution.
 void signal(String signalName, Execution execution)
          feeds a named external trigger into a given execution.
 void signal(String signal, Map<String,Object> parameters)
          feeds a named external trigger into the execution with parameters.
 void signal(String signalName, Map<String,Object> parameters, Execution execution)
          feeds a named external trigger into a given execution with parameters.
 void suspend()
          suspends this execution and all it's child executions.
 void take(String transitionName)
          takes the outgoing transition with the given name.
 void take(Transition transitionToTake)
          takes the given outgoing transition.
 void take(Transition transitionToTake, Execution execution)
          let's the given execution take the transition.
 void takeDefaultTransition()
          takes the default transition.
 String toString()
           
 void unlock()
           
 void waitForSignal()
          makes this execution wait in the current node until an external trigger is given with one of the #signal() methods.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

EXECUTE_NODE

public static final AtomicOperation EXECUTE_NODE

PROCEED_TO_DESTINATION

public static final AtomicOperation PROCEED_TO_DESTINATION

TAKE_TRANSITION

public static final AtomicOperation TAKE_TRANSITION

PROPAGATE_TO_PARENT

public static final AtomicOperation PROPAGATE_TO_PARENT

dbid

protected long dbid

dbversion

protected int dbversion

name

protected String name
an optional name for this execution. can be used to differentiate concurrent paths of execution like e.g. the 'shipping' and 'billing' paths.


key

protected String key
a key for this execution. typically this is an externally provided reference that is unique within the scope of the process definition.


id

protected String id
a unique id for this execution.


state

protected String state
See Also:
Execution

processDefinition

protected ProcessDefinitionImpl processDefinition

node

protected NodeImpl node
current 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 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

hasVariables

protected boolean hasVariables

variables

protected Map<String,Variable> variables

jobs

protected List<JobImpl<?>> jobs

superProcessExecution

protected ExecutionImpl superProcessExecution
the super process link in case this is a sub process execution


subProcessInstance

protected ExecutionImpl subProcessInstance
the sub process link in case of sub process execution


comments

protected Set<CommentImpl> comments
the free text comments users make on this execution


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 Map<String,OpenExecution> 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 whether it exists).


atomicOperations

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


propagation

protected ExecutionImpl.Propagation propagation

previousNode

protected Node previousNode

previousTransition

protected Transition previousTransition

exception

protected Exception exception

processModifications

protected ProcessModificationsImpl processModifications

parentInstanceStartTime

protected Date parentInstanceStartTime
Constructor Detail

ExecutionImpl

public ExecutionImpl()
Method Detail

initializeProcessInstance

public void initializeProcessInstance(ProcessDefinitionImpl executionProcessDefinition,
                                      String executionKey)

begin

public void begin()
Description copied from interface: ClientProcessInstance
starts this process instance

Specified by:
begin in interface ClientProcessInstance

initializeScopes

protected ExecutionImpl initializeScopes()

createScope

public ExecutionImpl createScope(CompositeElementImpl scope)

destroyScope

public ExecutionImpl destroyScope(CompositeElementImpl scope)

toString

public String toString()
Overrides:
toString in class Object

end

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

All child executions will be stopped and removed. This execution will not be removed from its parent.

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 ActivityExecution
Specified by:
end in interface ClientExecution

end

public void end(String endState)
Description copied from interface: ClientExecution
ends this execution and all it's child executions with a user defined status. Giving states {@link

Specified by:
end in interface ActivityExecution
Specified by:
end in interface ClientExecution

cancel

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

Specified by:
cancel in interface ActivityExecution
Specified by:
cancel in interface ClientExecution
See Also:
ClientExecution.end(String)

suspend

public void suspend()
Description copied from interface: ClientExecution
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 ClientExecution
See Also:
Execution#suspend()

resume

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

Specified by:
resume in interface ClientExecution
See Also:
Execution#resume()

signal

public void signal()
Description copied from interface: ClientExecution
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 org.ow2.orchestra.pvm.activity.ExternalActivity#signal(Execution, String, Map) of the current node.

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

signal

public void signal(String signal)
Description copied from interface: ClientExecution
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 ClientExecution
See Also:
See the unnamed signal for more information

signal

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

Specified by:
signal in interface ClientExecution
See Also:
See the unnamed signal for more information

signal

public void signal(String signal,
                   Map<String,Object> parameters)
Description copied from interface: ClientExecution
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 org.ow2.orchestra.pvm.activity.ExternalActivity#signal(Execution, String, Map) for more information.

Specified by:
signal in interface ClientExecution
See Also:
See the unnamed signal for more information

signal

public void signal(Execution execution)
Description copied from interface: ClientExecution
feeds a external trigger into the given 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 org.ow2.orchestra.pvm.activity.ExternalActivity#signal(Execution, String, Map) of the current node.

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

signal

public void signal(String signalName,
                   Execution execution)
Description copied from interface: ClientExecution
feeds a named external trigger into a given 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 ClientExecution
See Also:
See the unnamed signal for more information

signal

public void signal(Map<String,Object> parameters,
                   Execution execution)
Description copied from interface: ClientExecution
feeds an external trigger into a given execution with parameters.

Specified by:
signal in interface ClientExecution
See Also:
See the unnamed signal for more information

signal

public void signal(String signalName,
                   Map<String,Object> parameters,
                   Execution execution)
Description copied from interface: ClientExecution
feeds a named external trigger into a given 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 org.ow2.orchestra.pvm.activity.ExternalActivity#signal(Execution, String, Map) for more information.

Specified by:
signal in interface ClientExecution
See Also:
See the unnamed signal for more information

takeDefaultTransition

public void takeDefaultTransition()
Description copied from interface: ActivityExecution
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 #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 ActivityExecution
See Also:
Execution#takeDefaultTransition()

take

public void take(String transitionName)
Description copied from interface: ActivityExecution
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 #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 ActivityExecution
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 transitionToTake)
Description copied from interface: ActivityExecution
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 #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 ActivityExecution
See Also:
Execution#takeDefaultTransition()

take

public void take(Transition transitionToTake,
                 Execution execution)
Description copied from interface: ActivityExecution
let's the given execution take the transition.

Specified by:
take in interface ActivityExecution

execute

public void execute(String nodeName)
Description copied from interface: ActivityExecution
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 #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 ActivityExecution
See Also:
Execution#execute(String)

execute

public void execute(Node nodeToExecute)
Description copied from interface: ActivityExecution
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 #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 ActivityExecution
See Also:
Execution#execute(Node)

waitForSignal

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

Specified by:
waitForSignal in interface ActivityExecution

proceed

public void proceed()

move

public void move(Node destination,
                 Execution execution)
Description copied from interface: ActivityExecution
position the given execution in the destination node

Specified by:
move in interface ActivityExecution

move

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

Specified by:
move in interface ActivityExecution

moveTo

public void moveTo(NodeImpl destination)

beginNode

public ExecutionImpl beginNode(NodeImpl nodeToBegin)

endNode

public ExecutionImpl endNode(NodeImpl nodeToEnd)

performAtomicOperation

public void performAtomicOperation(AtomicOperation operation)

initializeVariables

protected void initializeVariables(CompositeElementImpl scope,
                                   ExecutionImpl outerExecution)

destroyVariables

protected void destroyVariables(CompositeElementImpl scope,
                                ExecutionImpl outerExecution)

createVariable

public void createVariable(String variableKey,
                           Object variableValue)
Description copied from interface: OpenExecution
create a new variable in this execution scope and determine the type automagically.

Specified by:
createVariable in interface OpenExecution

createVariable

public void createVariable(String variableKey,
                           Object variableValue,
                           String typeName)
Description copied from interface: OpenExecution
create a new variable in this execution scope with the given type name.

Specified by:
createVariable in interface OpenExecution

createVariable

public void createVariable(String variableKey,
                           Object variableValue,
                           Type type)

createVariable

public void createVariable(String variableKey,
                           Object variableValue,
                           String typeName,
                           Type type)

setVariable

public void setVariable(String variableKey,
                        Object variableValue)
Description copied from interface: OpenExecution
updates or creates a variable for the given value. Values are allowed to be null.

Specified by:
setVariable in interface OpenExecution

setVariables

public void setVariables(Map<String,Object> variables)
Description copied from interface: OpenExecution
sets all given variables. Existing key-value pairs for which there is no key in the provided variables will not be removed.

Specified by:
setVariables in interface OpenExecution

getVariable

public Object getVariable(String variableKey)
Description copied from interface: OpenExecution
retrieve the value for the given key. The value can be null. If there is no value for the given key, the returned value will also be null. The value for key null will always be null as null keys are not allowed.

Specified by:
getVariable in interface OpenExecution

getVariableObject

public Variable getVariableObject(String variableKey)

hasVariable

public boolean hasVariable(String variableKey)
Description copied from interface: OpenExecution
indicates presenve of the given key. No exception will be thrown if key is null.

Specified by:
hasVariable in interface OpenExecution
Returns:
true if the key is present and false if the key doesn't exist or if key is null.

getVariableKeys

public Set<String> getVariableKeys()
Description copied from interface: OpenExecution
a non-null set that contains all the keys present in this scope. Even if there are no variable keys, an empty, non-null set will be returned.

Specified by:
getVariableKeys in interface OpenExecution

getVariables

public Map<String,Object> getVariables()
Description copied from interface: OpenExecution
a non-null map containing all the key-value pairs in this scope. Even if there are no variable keys, an empty, non-null map will be returned.

Specified by:
getVariables in interface OpenExecution

hasVariables

public boolean hasVariables()
Description copied from interface: OpenExecution
indicates if there are keys in this scope.

Specified by:
hasVariables in interface OpenExecution

removeVariable

public boolean removeVariable(String variableKey)
Description copied from interface: OpenExecution
remove the key-value pair for the given key from this scope. No exception will be thrown when the variable is not present.

Specified by:
removeVariable in interface OpenExecution

removeVariables

public void removeVariables()
Description copied from interface: OpenExecution
removes all variables in this scope

Specified by:
removeVariables in interface OpenExecution

initializeTimers

protected void initializeTimers(CompositeElementImpl scope)

destroyTimers

protected void destroyTimers(CompositeElementImpl scope)

createTimer

public void createTimer(String eventName,
                        String signalName,
                        String dueDateDescription)

createTimer

public void createTimer(String eventName,
                        String signalName,
                        String dueDateDescription,
                        String repeat)

createTimer

public void createTimer(String eventName,
                        String signalName,
                        String dueDateDescription,
                        Date dueDate,
                        String repeat,
                        Boolean isExclusive,
                        Integer retries)

getJobs

public List<JobImpl<?>> getJobs()
Description copied from interface: OpenExecution
timers for this execution scope

Specified by:
getJobs in interface OpenExecution

instantiateTimer

protected TimerImpl instantiateTimer()

getState

public 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(String lockState)
See Also:
Execution#lock(String)

unlock

public void unlock()
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()

checkLock

protected void checkLock()

sendContinuationMessage

public void sendContinuationMessage(AtomicOperation operation)

performAtomicOperationSync

public void performAtomicOperationSync(AtomicOperation operation)

fire

public void fire(String eventName,
                 ObservableElement firedEventSource)
Description copied from interface: ActivityExecution
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 #getEventSource(), event if the events are registered to parent's of the given eventSource.

Specified by:
fire in interface ActivityExecution
Specified by:
fire in interface EventListenerExecution
See Also:
Execution#fire(String, ObservableElement)

propagateEvent

protected void propagateEvent(String eventName,
                              ObservableElement firedEventSource,
                              ObservableElementImpl observableElement)
this method enables specific process languages to overwrite the event propagation behaviour


handleException

public void handleException(ObservableElementImpl observableElement,
                            EventImpl exceptionEvent,
                            EventListenerReference eventListenerReference,
                            Exception thrownException,
                            String rethrowMessage)

createComment

public Comment createComment(String message)
Description copied from interface: Discussable
create a comment

Specified by:
createComment in interface Discussable

removeComment

public void removeComment(Comment comment)
Description copied from interface: Discussable
remove a comment

Specified by:
removeComment in interface Discussable

addComment

public void addComment(CommentImpl comment)

createExecution

public ExecutionImpl createExecution()
Description copied from interface: ActivityExecution
creates a child execution. See #createExecution(Execution, String) for more information.

Specified by:
createExecution in interface ActivityExecution
See Also:
Execution#createProcessInstance()

createExecution

public Execution createExecution(Execution parentExecution)
Description copied from interface: ActivityExecution
creates a new child execution under the given parent. See #createExecution(Execution, String) for more information.

Specified by:
createExecution in interface ActivityExecution

createExecution

public Execution createExecution(String executionName,
                                 Execution parentExecution)
Description copied from interface: ActivityExecution
creates a new child execution under the given parent with the given name. Only leaf executions can be active. So creating the first child execution will inactivate the parent execution automatically.

Specified by:
createExecution in interface ActivityExecution

createExecution

public ExecutionImpl createExecution(String executionName)
Description copied from interface: ActivityExecution
creates a child execution with the given name. See #createExecution(Execution, String) for more information.

Specified by:
createExecution in interface ActivityExecution
See Also:
Execution#createProcessInstance(String)

newChildExecution

protected ExecutionImpl newChildExecution()

addExecution

public void addExecution(Execution execution)

getExecution

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

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

removeExecution

public void removeExecution(Execution child)
Description copied from interface: ActivityExecution
removes the child execution from this execution. Removing the last child execution of a parent will cause the parent's state to become active.

Specified by:
removeExecution in interface ActivityExecution

removeExecution

public void removeExecution(Execution childExecution,
                            Execution parentExecution)
Description copied from interface: ActivityExecution
removes the child execution from the given parent. Removing the last child execution of a parent will cause the parent's state to become active.

Specified by:
removeExecution in interface ActivityExecution

getExecutionsMap

public Map<String,OpenExecution> getExecutionsMap()
Description copied from interface: OpenExecution
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 OpenExecution

hasExecution

public boolean hasExecution(String executionName)
Description copied from interface: OpenExecution
indicates if this execution has a child execution with the given executionName

Specified by:
hasExecution in interface OpenExecution

createSubProcessInstance

public ClientProcessInstance createSubProcessInstance(ClientProcessDefinition subProcessDefinition)
Description copied from interface: ActivityExecution
creates a sub process related to this path of execution. ProcessDefinitions can be obtained from the PvmDbSession in the Environment.

Specified by:
createSubProcessInstance in interface ActivityExecution

createSubProcessInstance

public ClientProcessInstance createSubProcessInstance(ClientProcessDefinition subProcessDefinition,
                                                      String subProcessInstanceKey)
Description copied from interface: ActivityExecution
creates a sub process related to this path of execution. ProcessDefinitions can be obtained from the PvmDbSession in the Environment.

Specified by:
createSubProcessInstance in interface ActivityExecution

beginSubProcessInstance

public ClientProcessInstance beginSubProcessInstance(ClientProcessDefinition subProcessDefinition)
Description copied from interface: ActivityExecution
creates and begins a sub process related to this path of execution. ProcessDefinitions can be obtained from the PvmDbSession in the Environment.

Specified by:
beginSubProcessInstance in interface ActivityExecution

beginSubProcessInstance

public ClientProcessInstance beginSubProcessInstance(ClientProcessDefinition subProcessDefinition,
                                                     String subProcessInstanceKey)
Description copied from interface: ActivityExecution
creates and begins a sub process related to this path of execution. ProcessDefinitions can be obtained from the PvmDbSession in the Environment.

Specified by:
beginSubProcessInstance in interface ActivityExecution

getNodeName

public String getNodeName()
Description copied from interface: Execution
represents the current position in the process by indicating the name of the current node.

Specified by:
getNodeName in interface Execution

addLog

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

Specified by:
addLog in interface ActivityExecution
Specified by:
addLog in interface EventListenerExecution

nextLogIndex

public int nextLogIndex()

findTransition

protected TransitionImpl findTransition(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(Class<T> extensionClass)
Description copied from interface: ActivityExecution
way to access process language extensions in the execution without having to cast. Casting can be problematic for persistence.

Specified by:
getExtension in interface ActivityExecution
Specified by:
getExtension in interface EventListenerExecution

equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

getComments

public List<Comment> getComments()
Description copied from interface: Discussable
all comments.

Specified by:
getComments in interface Discussable

getEvent

public Event getEvent()
Description copied from interface: EventListenerExecution
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 EventListenerExecution

getEventSource

public ObservableElement getEventSource()
Description copied from interface: EventListenerExecution
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 EventListenerExecution

getExecutions

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

Specified by:
getExecutions in interface OpenExecution

getName

public String getName()
Description copied from interface: Execution
the externally given name or id of this execution. The id of a main path of execution is null. Can be used to differentiate concurrent paths of execution e.g. the shipping and billing paths.

Specified by:
getName in interface Execution

getParent

public ExecutionImpl getParent()
Description copied from interface: OpenExecution
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 OpenExecution

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: OpenExecution
the process definition for this execution.

Specified by:
getProcessDefinition in interface OpenExecution

getTransition

public TransitionImpl getTransition()
Description copied from interface: ActivityExecution
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 ActivityExecution
Specified by:
getTransition in interface EventListenerExecution

setEvent

public void setEvent(EventImpl event)

setEventSource

public void setEventSource(ObservableElementImpl eventSource)

setPriority

public void setPriority(int priority)
Description copied from interface: OpenExecution
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 ActivityExecution
Specified by:
setPriority in interface EventListenerExecution
Specified by:
setPriority in interface OpenExecution

setTransition

public void setTransition(TransitionImpl transition)

getPreviousNode

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

Specified by:
getPreviousNode in interface ActivityExecution

getPreviousTransition

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

Specified by:
getPreviousTransition in interface ActivityExecution

getProcessInstance

public ExecutionImpl getProcessInstance()
Description copied from interface: OpenExecution
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 OpenExecution

setProcessInstance

public void setProcessInstance(ExecutionImpl processInstance)

setComments

public void setComments(Set<CommentImpl> comments)

getTransitionOrigin

public NodeImpl getTransitionOrigin()

setTransitionOrigin

public void setTransitionOrigin(NodeImpl transitionOrigin)

getException

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

Specified by:
getException in interface EventListenerExecution

setException

public void setException(Exception exception)

getProcessModifications

public ProcessModificationsImpl getProcessModifications()

setProcessModifications

public void setProcessModifications(ProcessModificationsImpl processModifications)

getKey

public String getKey()
Description copied from interface: Execution
the optional user provided 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

getPropagation

public ExecutionImpl.Propagation getPropagation()

setPropagation

public void setPropagation(ExecutionImpl.Propagation propagation)

setName

public void setName(String name)

setState

public void setState(String state)

setExecutions

public void setExecutions(Collection<ExecutionImpl> executions)

setParent

public void setParent(ExecutionImpl parent)

setPreviousNode

public void setPreviousNode(Node previousNode)

setPreviousTransition

public void setPreviousTransition(Transition previousTransition)

setProcessDefinition

public void setProcessDefinition(ProcessDefinitionImpl processDefinition)

getSuperProcessExecution

public ExecutionImpl getSuperProcessExecution()

setSuperProcessExecution

public void setSuperProcessExecution(ExecutionImpl superProcessExecution)

getSubProcessInstance

public ExecutionImpl getSubProcessInstance()
Description copied from interface: OpenExecution
the related sub process execution.

Specified by:
getSubProcessInstance in interface OpenExecution

setSubProcessInstance

public void setSubProcessInstance(ExecutionImpl subProcessExecution)

getNode

public NodeImpl getNode()
Description copied from interface: OpenExecution
the current node

Specified by:
getNode in interface OpenExecution

setNode

public void setNode(NodeImpl node)

getDbid

public long getDbid()
Specified by:
getDbid in interface Execution

setKey

public void setKey(String key)

getId

public String getId()
Description copied from interface: Execution
a globally unique identifier for this execution.

Specified by:
getId in interface Execution

setId

public void setId(String id)

setParentInstanceStartTime

public void setParentInstanceStartTime(Date startTime)
Parameters:
startTime - the startTime to set

getParentInstanceStartTime

public Date getParentInstanceStartTime()
Returns:
the startTime


Copyright © 2011 OW2 Consortium. All Rights Reserved.