org.camunda.bpm.engine.impl.pvm.runtime
Class PvmExecutionImpl

java.lang.Object
  extended by org.camunda.bpm.engine.impl.core.variable.scope.AbstractVariableScope
      extended by org.camunda.bpm.engine.impl.core.instance.CoreExecution
          extended by org.camunda.bpm.engine.impl.pvm.runtime.PvmExecutionImpl
All Implemented Interfaces:
Serializable, BaseDelegateExecution, BpmnModelExecutionContext, DelegateExecution, ProcessEngineServicesAware, VariableScope, VariableEventDispatcher, ActivityExecution, PvmExecution, PvmProcessInstance
Direct Known Subclasses:
ExecutionEntity, ExecutionImpl

public abstract class PvmExecutionImpl
extends CoreExecution
implements ActivityExecution, PvmProcessInstance

Author:
Daniel Meyer, Roman Smirnov, Sebastian Menski
See Also:
Serialized Form

Field Summary
protected  ActivityImpl activity
          current activity
protected  String activityInstanceId
          the unique id of the current activity instance
protected  int activityInstanceState
          marks the current activity instance
protected  String caseInstanceId
          the id of a case associated with this execution
protected  List<DelayedVariableEvent> delayedEvents
          Contains the delayed variable events, which will be dispatched on a save point.
protected  String deleteReason
           
protected  boolean deleteRoot
           
protected  boolean externallyTerminated
           
protected  boolean isActive
          indicates if this execution represents an active path of execution.
protected  boolean isConcurrent
           
protected  boolean isEnded
           
protected  boolean isEventScope
           
protected  boolean isScope
           
protected  PvmActivity nextActivity
          the activity which is to be started next
protected  boolean preserveScope
          transient; used for process instance modification to preserve a scope from getting deleted
protected  ProcessDefinitionImpl processDefinition
           
protected  PvmExecutionImpl replacedBy
           
protected  long sequenceCounter
           
protected  ExecutionStartContext startContext
           
protected  TransitionImpl transition
          the transition that is currently being taken
protected  List<PvmTransition> transitionsToTake
          A list of outgoing transitions from the current activity that are going to be taken
 
Fields inherited from class org.camunda.bpm.engine.impl.core.instance.CoreExecution
businessKey, eventName, eventSource, id, listenerIndex, skipCustomListeners, skipIoMapping, skipSubprocesses, tenantId
 
Fields inherited from class org.camunda.bpm.engine.impl.core.variable.scope.AbstractVariableScope
cachedElContext
 
Constructor Summary
PvmExecutionImpl()
           
 
Method Summary
 void activityInstanceDone()
           
 void activityInstanceStarted()
           
 void activityInstanceStarting()
           
 void clearDelayedEvents()
          Cleares the current delayed variable events.
 void clearScope(String reason, boolean skipCustomListeners, boolean skipIoMappings)
           
protected  void collectActiveActivityIds(List<String> activeActivityIds)
           
protected  void collectExecutions(String activityId, List<PvmExecution> executions)
           
protected  void continueExecutionIfNotCanceled(Callback<PvmExecutionImpl,Void> continuation, PvmExecutionImpl execution)
           
 void continueIfExecutionDoesNotAffectNextOperation(Callback<PvmExecutionImpl,Void> dispatching, Callback<PvmExecutionImpl,Void> continuation, PvmExecutionImpl execution)
          Executes the given depending operations with the given execution.
 Map<ScopeImpl,PvmExecutionImpl> createActivityExecutionMapping()
          Returns a mapping from scope activities to scope executions for all scopes that are ancestors of the activity currently executed by this execution.
 Map<ScopeImpl,PvmExecutionImpl> createActivityExecutionMapping(ScopeImpl currentScope)
           
protected  Map<ScopeImpl,PvmExecutionImpl> createActivityExecutionMapping(ScopeImpl currentScope, Map<ScopeImpl,PvmExecutionImpl> mapping)
          Creates an extended mapping based on this execution and the given existing mapping.
 PvmExecutionImpl createConcurrentExecution()
           
 PvmExecutionImpl createExecution()
          creates a new execution.
abstract  PvmExecutionImpl createExecution(boolean initStartContext)
          creates a new execution.
 Incident createIncident(String incidentType, String configuration)
          Returns the newest incident in this execution
 Incident createIncident(String incidentType, String configuration, String message)
          Create an incident associated with this execution
abstract  CmmnExecution createSubCaseInstance(CmmnCaseDefinition caseDefinition)
          Creates a new sub case instance.
abstract  CmmnExecution createSubCaseInstance(CmmnCaseDefinition caseDefinition, String businessKey)
          Creates a new sub case instance.
 PvmExecutionImpl createSubProcessInstance(PvmProcessDefinition processDefinition)
          creates a new sub process instance.
 PvmExecutionImpl createSubProcessInstance(PvmProcessDefinition processDefinition, String businessKey)
           
 PvmExecutionImpl createSubProcessInstance(PvmProcessDefinition processDefinition, String businessKey, String caseInstanceId)
           
 void delayEvent(DelayedVariableEvent delayedVariableEvent)
          Delays and stores the given DelayedVariableEvent on the process instance.
 void delayEvent(PvmExecutionImpl targetScope, VariableEvent variableEvent)
          Delays a given variable event with the given target scope.
 void deleteCascade(String deleteReason)
           
 void deleteCascade(String deleteReason, boolean skipCustomListeners)
           
 void deleteCascade(String deleteReason, boolean skipCustomListeners, boolean skipIoMappings)
           
 void deleteCascade(String deleteReason, boolean skipCustomListeners, boolean skipIoMappings, boolean externallyTerminated, boolean skipSubprocesses)
           
 void deleteCascade2(String deleteReason)
           
 void destroy()
           
 void dispatchDelayedEventsAndPerformOperation(Callback<PvmExecutionImpl,Void> continuation)
          Dispatches the current delayed variable events and performs the given atomic operation if the current state was not changed.
 void dispatchDelayedEventsAndPerformOperation(PvmAtomicOperation atomicOperation)
          Dispatches the current delayed variable events and performs the given atomic operation if the current state was not changed.
protected  void dispatchScopeEvents(PvmExecutionImpl execution)
          Dispatches the current delayed variable events on the scope of the given execution.
 void disposeExecutionStartContext()
           
 void disposeProcessInstanceStartContext()
           
 void end(boolean completeScope)
          Ends an execution.
 void endCompensation()
          Execution finished compensation.
 void enterActivityInstance()
          invoked to notify the execution that a new activity instance is started
 void executeActivities(List<PvmActivity> activityStack, PvmActivity targetActivity, PvmTransition targetTransition, Map<String,Object> variables, Map<String,Object> localVariables, boolean skipCustomListeners, boolean skipIoMappings)
          Instantiates the given activity stack.
 void executeActivitiesConcurrent(List<PvmActivity> activityStack, PvmActivity targetActivity, PvmTransition targetTransition, Map<String,Object> variables, Map<String,Object> localVariables, boolean skipCustomListeners, boolean skipIoMappings)
          Instantiates the given activity stack under this execution.
 void executeActivity(PvmActivity activity)
          Execute an activity which is not contained in normal flow (having no incoming sequence flows).
 void executeEventHandlerActivity(ActivityImpl eventHandlerActivity)
           
 void executeIoMapping()
           
 List<String> findActiveActivityIds()
           
 PvmExecutionImpl findExecution(String activityId)
           
 PvmExecutionImpl findExecutionForFlowScope(PvmScope targetFlowScope)
          For a given target flow scope, this method returns the corresponding scope execution.
protected  PvmExecutionImpl findExecutionForFlowScope(String targetScopeId)
           
 PvmExecutionImpl findExecutionForScope(ScopeImpl currentScope, ScopeImpl targetScope)
           
 List<PvmExecution> findExecutions(String activityId)
           
 List<ActivityExecution> findInactiveChildExecutions(PvmActivity activity)
           
 List<ActivityExecution> findInactiveConcurrentExecutions(PvmActivity activity)
          Retrieves all executions which are concurrent and inactive at the given activity.
 IncidentHandler findIncidentHandler(String incidentType)
           
abstract  void fireHistoricProcessStartEvent()
           
protected abstract  String generateActivityInstanceId(String activityId)
           
 ActivityImpl getActivity()
          ensures initialization and returns the activity
 String getActivityId()
           
 String getActivityInstanceId()
          return the Id of the activity instance currently executed by this execution
 int getActivityInstanceState()
           
protected  List<PvmExecutionImpl> getAllChildExecutions()
           
 String getCaseInstanceId()
           
 String getCurrentActivityId()
          Gets the id of the current activity.
 String getCurrentActivityName()
          Gets the name of the current activity.
 String getCurrentTransitionId()
          return the Id of the current transition
 List<DelayedVariableEvent> getDelayedEvents()
          The current delayed variable events.
 String getDeleteReason()
           
 List<? extends PvmExecutionImpl> getEventScopeExecutions()
           
abstract  List<? extends PvmExecutionImpl> getExecutions()
          returns the list of execution of which this execution the parent of.
abstract  List<? extends PvmExecutionImpl> getExecutionsAsCopy()
           
 ExecutionStartContext getExecutionStartContext()
           
protected  ScopeImpl getFlowScope()
           
protected  PvmExecutionImpl getFlowScopeExecution()
           
 PvmActivity getNextActivity()
          An activity which is to be started next.
 List<? extends PvmExecutionImpl> getNonEventScopeExecutions()
          returns child executions that are not event scope executions.
abstract  PvmExecutionImpl getParent()
          ensures initialization and returns the parent
 String getParentActivityInstanceId()
          return the Id of the parent activity instance currently executed by this execution
 String getParentId()
          Gets the id of the parent of this execution.
 PvmExecutionImpl getParentScopeExecution(boolean considerSuperExecution)
           
 AbstractVariableScope getParentVariableScope()
           
 String getProcessBusinessKey()
          The business key for the process instance this execution is associated with.
 ProcessDefinitionImpl getProcessDefinition()
           
abstract  PvmExecutionImpl getProcessInstance()
          ensures initialization and returns the process instance.
 ProcessInstanceStartContext getProcessInstanceStartContext()
           
abstract  PvmExecutionImpl getReplacedBy()
          Returns an execution that has replaced this execution for executing activities in their shared scope.
protected  ScopeImpl getScopeActivity()
           
 long getSequenceCounter()
           
abstract  CmmnExecution getSubCaseInstance()
           
abstract  PvmExecutionImpl getSubProcessInstance()
           
abstract  CmmnExecution getSuperCaseExecution()
           
abstract  PvmExecutionImpl getSuperExecution()
          In case this delegate execution is the process instance execution and this process instance was started by a call activity, this method returns the execution which executed the call activity in the super process instance.
protected  String getToStringIdentity()
           
 TransitionImpl getTransition()
           
 List<PvmTransition> getTransitionsToTake()
           
 String getVariableScopeKey()
           
 boolean hasChildren()
           
 boolean hasProcessInstanceStartContext()
           
 boolean hasReplacedParent()
           
 void inactivate()
          Inactivates this execution.
 void incrementSequenceCounter()
           
protected  void initActivityIds(List<DelayedVariableEvent> delayedEvents, Map<PvmExecutionImpl,String> activityInstanceIds, Map<PvmExecutionImpl,String> activityIds)
          Initializes the given maps with the target scopes and current activity id's and activity instance id's.
abstract  void initialize()
           
abstract  void initializeTimerDeclarations()
           
 Map<PvmActivity,PvmExecutionImpl> instantiateScopes(List<PvmActivity> activityStack, boolean skipCustomListeners, boolean skipIoMappings)
          Instantiates the given set of activities and returns the execution for the bottom-most activity
 void interrupt(String reason)
          Interrupts an execution
 void interrupt(String reason, boolean skipCustomListeners, boolean skipIoMappings)
           
 boolean isActive()
          returns whether this execution is currently active.
 boolean isActive(String activityId)
           
 boolean isCanceled()
          Returns whether this execution has been canceled.
 boolean isCompleteScope()
          Returns whether this execution completed the parent scope.
 boolean isConcurrent()
          returns whether this execution is concurrent or not.
 boolean isDeleteRoot()
           
 boolean isEnded()
          returns whether this execution has ended or not.
 boolean isEventScope()
           
 boolean isExternallyTerminated()
           
 boolean isInState(ActivityInstanceState state)
           
 boolean isPreserveScope()
           
 boolean isProcessInstanceExecution()
          returns whether this execution is a process instance or not.
 boolean isReplacedByParent()
           
 boolean isScope()
          Returns whether this execution is a scope.
 void leaveActivityInstance()
          invoked to notify the execution that an activity instance is ended.
 void leaveActivityViaTransition(PvmTransition outgoingTransition)
           
 void leaveActivityViaTransitions(List<PvmTransition> _transitions, List<? extends ActivityExecution> _recyclableExecutions)
          Takes the given outgoing transitions, and potentially reusing the given list of executions that were previously joined.
protected abstract  PvmExecutionImpl newExecution()
           
 void onConcurrentExpand(PvmExecutionImpl scopeExecution)
          Callback on tree expansion when this execution is used as the concurrent execution where the argument's children become a subordinate to.
 void propagateEnd()
          Precondition: execution is already ended but this has not been propagated yet.
 void remove()
           
 void removeAllTasks()
           
protected  void removeEventScopes()
           
protected abstract  void removeVariablesLocalInternal()
           
 void replace(PvmExecutionImpl execution)
          Replace an execution by this execution.
 void resolveIncident(String incidentId)
          Resolves an incident with given id.
 PvmExecutionImpl resolveReplacedBy()
          Instead of getReplacedBy(), which returns the execution that this execution was directly replaced with, this resolves the chain of replacements (i.e.
 void setActive(boolean isActive)
          makes this execution active or inactive.
 void setActivity(PvmActivity activity)
           
 void setActivityInstanceId(String activityInstanceId)
           
 void setCanceled(boolean canceled)
           
 void setCaseInstanceId(String caseInstanceId)
           
 void setCompleteScope(boolean completeScope)
           
 void setConcurrent(boolean isConcurrent)
          changes the concurrent indicator on this execution.
 void setDeleteReason(String deleteReason)
           
 void setDeleteRoot(boolean deleteRoot)
           
 void setEnded(boolean isEnded)
           
 void setEventScope(boolean isEventScope)
           
 void setExternallyTerminated(boolean externallyTerminated)
           
 void setNextActivity(PvmActivity nextActivity)
           
 void setParent(PvmExecutionImpl parent)
          Sets the execution's parent and updates the old and new parents' set of child executions
abstract  void setParentExecution(PvmExecutionImpl parent)
          Use #setParent to also update the child execution sets
 void setPreserveScope(boolean preserveScope)
           
 void setProcessDefinition(ProcessDefinitionImpl processDefinition)
           
abstract  void setProcessInstance(PvmExecutionImpl pvmExecutionImpl)
           
 void setScope(boolean isScope)
          Changes whether this execution is a scope or not
 void setSequenceCounter(long sequenceCounter)
           
 void setStartContext(ExecutionStartContext startContext)
           
abstract  void setSubCaseInstance(CmmnExecution subCaseInstance)
           
abstract  void setSubProcessInstance(PvmExecutionImpl subProcessInstance)
           
abstract  void setSuperCaseExecution(CmmnExecution superCaseExecution)
           
abstract  void setSuperExecution(PvmExecutionImpl superExecution)
           
 void setTransition(PvmTransition transition)
           
 void setTransitionsToTake(List<PvmTransition> transitionsToTake)
           
 void setVariable(String variableName, Object value, String targetActivityId)
          Method to store variable in a specific scope identified by activity ID.
 void signal(String signalName, Object signalData)
           
 void start()
           
 void start(Map<String,Object> variables)
           
 void startWithoutExecuting(Map<String,Object> variables)
          perform starting behavior but don't execute the initial activity
 void take()
           
 String toString()
           
 boolean tryPruneLastConcurrentChild()
           
 
Methods inherited from class org.camunda.bpm.engine.impl.core.instance.CoreExecution
getBusinessKey, getEventName, getEventSource, getId, getListenerIndex, getTenantId, invokeListener, isSkipCustomListeners, isSkipIoMappings, isSkipSubprocesses, performOperation, performOperationSync, setBusinessKey, setEventName, setEventSource, setId, setListenerIndex, setSkipCustomListeners, setSkipIoMappings, setSkipSubprocesseses, setTenantId
 
Methods inherited from class org.camunda.bpm.engine.impl.core.variable.scope.AbstractVariableScope
collectVariableNames, collectVariables, dispatchEvent, getCachedElContext, getSourceActivityVariableScope, getValueFromVariableInstance, getVariable, getVariable, getVariableInstance, getVariableInstanceFactory, getVariableInstanceLifecycleListeners, getVariableInstanceLocal, getVariableInstancesLocal, getVariableLocal, getVariableLocal, getVariableLocalTyped, getVariableLocalTyped, getVariableNames, getVariableNamesLocal, getVariables, getVariablesLocal, getVariablesLocalTyped, getVariablesLocalTyped, getVariableStore, getVariablesTyped, getVariablesTyped, getVariableTyped, getVariableTyped, hasVariable, hasVariableLocal, hasVariables, hasVariablesLocal, invokeVariableLifecycleListenersCreate, invokeVariableLifecycleListenersCreate, invokeVariableLifecycleListenersDelete, invokeVariableLifecycleListenersDelete, invokeVariableLifecycleListenersUpdate, invokeVariableLifecycleListenersUpdate, removeVariable, removeVariable, removeVariableLocal, removeVariableLocal, removeVariables, removeVariables, removeVariablesLocal, removeVariablesLocal, setCachedElContext, setVariable, setVariable, setVariableLocal, setVariableLocal, setVariableLocalTransient, setVariables, setVariablesLocal
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.camunda.bpm.engine.impl.pvm.delegate.ActivityExecution
forceUpdate
 
Methods inherited from interface org.camunda.bpm.engine.delegate.DelegateExecution
getProcessDefinitionId, getProcessInstanceId, getTenantId
 
Methods inherited from interface org.camunda.bpm.engine.delegate.BaseDelegateExecution
getBusinessKey, getEventName, getId
 
Methods inherited from interface org.camunda.bpm.engine.delegate.VariableScope
getVariable, getVariableLocal, getVariableLocalTyped, getVariableLocalTyped, getVariableNames, getVariableNamesLocal, getVariables, getVariablesLocal, getVariablesLocalTyped, getVariablesLocalTyped, getVariablesTyped, getVariablesTyped, getVariableTyped, getVariableTyped, hasVariable, hasVariableLocal, hasVariables, hasVariablesLocal, removeVariable, removeVariableLocal, removeVariables, removeVariables, removeVariablesLocal, removeVariablesLocal, setVariable, setVariableLocal, setVariables, setVariablesLocal
 
Methods inherited from interface org.camunda.bpm.engine.delegate.BpmnModelExecutionContext
getBpmnModelElementInstance, getBpmnModelInstance
 
Methods inherited from interface org.camunda.bpm.engine.delegate.ProcessEngineServicesAware
getProcessEngineServices
 
Methods inherited from interface org.camunda.bpm.engine.impl.pvm.PvmExecution
getVariable, getVariables, hasVariable, setVariable
 

Field Detail

processDefinition

protected transient ProcessDefinitionImpl processDefinition

startContext

protected transient ExecutionStartContext startContext

activity

protected transient ActivityImpl activity
current activity


nextActivity

protected transient PvmActivity nextActivity
the activity which is to be started next


transition

protected transient TransitionImpl transition
the transition that is currently being taken


transitionsToTake

protected transient List<PvmTransition> transitionsToTake
A list of outgoing transitions from the current activity that are going to be taken


activityInstanceId

protected String activityInstanceId
the unique id of the current activity instance


caseInstanceId

protected String caseInstanceId
the id of a case associated with this execution


replacedBy

protected PvmExecutionImpl replacedBy

deleteRoot

protected boolean deleteRoot

deleteReason

protected String deleteReason

externallyTerminated

protected boolean externallyTerminated

isActive

protected boolean isActive
indicates if this execution represents an active path of execution. Executions are made inactive in the following situations:


isScope

protected boolean isScope

isConcurrent

protected boolean isConcurrent

isEnded

protected boolean isEnded

isEventScope

protected boolean isEventScope

preserveScope

protected boolean preserveScope
transient; used for process instance modification to preserve a scope from getting deleted


activityInstanceState

protected int activityInstanceState
marks the current activity instance


sequenceCounter

protected long sequenceCounter

delayedEvents

protected transient List<DelayedVariableEvent> delayedEvents
Contains the delayed variable events, which will be dispatched on a save point.

Constructor Detail

PvmExecutionImpl

public PvmExecutionImpl()
Method Detail

createExecution

public PvmExecutionImpl createExecution()
creates a new execution. properties processDefinition, processInstance and activity will be initialized.

Specified by:
createExecution in interface ActivityExecution

createExecution

public abstract PvmExecutionImpl createExecution(boolean initStartContext)
Description copied from interface: ActivityExecution
creates a new execution. This execution will be the parent of the newly created execution. properties processDefinition, processInstance and activity will be initialized.

Specified by:
createExecution in interface ActivityExecution

createSubProcessInstance

public PvmExecutionImpl createSubProcessInstance(PvmProcessDefinition processDefinition)
Description copied from interface: ActivityExecution
creates a new sub process instance. The current execution will be the super execution of the created execution.

Specified by:
createSubProcessInstance in interface ActivityExecution
Parameters:
processDefinition - The PvmProcessDefinition of the subprocess.

createSubProcessInstance

public PvmExecutionImpl createSubProcessInstance(PvmProcessDefinition processDefinition,
                                                 String businessKey)
Specified by:
createSubProcessInstance in interface ActivityExecution
Parameters:
processDefinition - The PvmProcessDefinition of the subprocess.
businessKey - the business key of the process instance
See Also:
ActivityExecution.createSubProcessInstance(PvmProcessDefinition)

createSubProcessInstance

public PvmExecutionImpl createSubProcessInstance(PvmProcessDefinition processDefinition,
                                                 String businessKey,
                                                 String caseInstanceId)
Specified by:
createSubProcessInstance in interface ActivityExecution
Parameters:
processDefinition - The PvmProcessDefinition of the subprocess.
businessKey - the business key of the process instance
caseInstanceId - the case instance id of the process instance
See Also:
ActivityExecution.createSubProcessInstance(PvmProcessDefinition)

newExecution

protected abstract PvmExecutionImpl newExecution()

createSubCaseInstance

public abstract CmmnExecution createSubCaseInstance(CmmnCaseDefinition caseDefinition)
Description copied from interface: ActivityExecution

Creates a new sub case instance.

This execution will be the super execution of the created sub case instance.

Specified by:
createSubCaseInstance in interface ActivityExecution
Parameters:
caseDefinition - The CmmnCaseDefinition of the sub case instance.

createSubCaseInstance

public abstract CmmnExecution createSubCaseInstance(CmmnCaseDefinition caseDefinition,
                                                    String businessKey)
Description copied from interface: ActivityExecution

Creates a new sub case instance.

This execution will be the super execution of the created sub case instance.

Specified by:
createSubCaseInstance in interface ActivityExecution
Parameters:
caseDefinition - The CmmnCaseDefinition of the sub case instance.
businessKey - The businessKey to be set on sub case instance.

initialize

public abstract void initialize()

initializeTimerDeclarations

public abstract void initializeTimerDeclarations()

executeIoMapping

public void executeIoMapping()

start

public void start()
Specified by:
start in interface PvmProcessInstance

start

public void start(Map<String,Object> variables)
Specified by:
start in interface PvmProcessInstance

startWithoutExecuting

public void startWithoutExecuting(Map<String,Object> variables)
perform starting behavior but don't execute the initial activity

Parameters:
variables - the variables which are used for the start

fireHistoricProcessStartEvent

public abstract void fireHistoricProcessStartEvent()

destroy

public void destroy()
Specified by:
destroy in interface ActivityExecution

removeAllTasks

public void removeAllTasks()

removeEventScopes

protected void removeEventScopes()

clearScope

public void clearScope(String reason,
                       boolean skipCustomListeners,
                       boolean skipIoMappings)

interrupt

public void interrupt(String reason)
Interrupts an execution

Specified by:
interrupt in interface ActivityExecution

interrupt

public void interrupt(String reason,
                      boolean skipCustomListeners,
                      boolean skipIoMappings)

end

public void end(boolean completeScope)
Ends an execution. Invokes end listeners for the current activity and notifies the flow scope execution of this happening which may result in the flow scope ending.

Specified by:
end in interface ActivityExecution
Parameters:
completeScope - true if ending the execution contributes to completing the BPMN 2.0 scope

endCompensation

public void endCompensation()
Description copied from interface: ActivityExecution
Execution finished compensation. Removes this execution and notifies listeners.

Specified by:
endCompensation in interface ActivityExecution

propagateEnd

public void propagateEnd()

Precondition: execution is already ended but this has not been propagated yet.

Propagates the ending of this execution to the flowscope execution; currently only supports the process instance execution


remove

public void remove()
Specified by:
remove in interface ActivityExecution

createConcurrentExecution

public PvmExecutionImpl createConcurrentExecution()

tryPruneLastConcurrentChild

public boolean tryPruneLastConcurrentChild()
Specified by:
tryPruneLastConcurrentChild in interface ActivityExecution

deleteCascade

public void deleteCascade(String deleteReason)
Specified by:
deleteCascade in interface PvmProcessInstance

deleteCascade

public void deleteCascade(String deleteReason,
                          boolean skipCustomListeners)

deleteCascade

public void deleteCascade(String deleteReason,
                          boolean skipCustomListeners,
                          boolean skipIoMappings)

deleteCascade

public void deleteCascade(String deleteReason,
                          boolean skipCustomListeners,
                          boolean skipIoMappings,
                          boolean externallyTerminated,
                          boolean skipSubprocesses)

deleteCascade2

public void deleteCascade2(String deleteReason)

executeEventHandlerActivity

public void executeEventHandlerActivity(ActivityImpl eventHandlerActivity)

getReplacedBy

public abstract PvmExecutionImpl getReplacedBy()

Returns an execution that has replaced this execution for executing activities in their shared scope.

Invariant: this execution and getReplacedBy() execute in the same scope.


resolveReplacedBy

public PvmExecutionImpl resolveReplacedBy()
Instead of getReplacedBy(), which returns the execution that this execution was directly replaced with, this resolves the chain of replacements (i.e. in the case the replacedBy execution itself was replaced again)


hasReplacedParent

public boolean hasReplacedParent()

isReplacedByParent

public boolean isReplacedByParent()

replace

public void replace(PvmExecutionImpl execution)

Replace an execution by this execution. The replaced execution has a pointer (getReplacedBy()) to this execution. This pointer is maintained until the replaced execution is removed or this execution is removed/ended.

This is used for two cases: Execution tree expansion and execution tree compaction

See Also:
createConcurrentExecution(), tryPruneLastConcurrentChild()

onConcurrentExpand

public void onConcurrentExpand(PvmExecutionImpl scopeExecution)
Callback on tree expansion when this execution is used as the concurrent execution where the argument's children become a subordinate to. Note that this case is not the inverse of replace because replace has the semantics that the replacing execution can be used to continue execution of this execution's activity instance.


signal

public void signal(String signalName,
                   Object signalData)
Specified by:
signal in interface ActivityExecution
Specified by:
signal in interface PvmExecution

take

public void take()

executeActivity

public void executeActivity(PvmActivity activity)
Execute an activity which is not contained in normal flow (having no incoming sequence flows). Cannot be called for activities contained in normal flow.

First, the ActivityStartBehavior is evaluated. In case the start behavior is not ActivityStartBehavior.DEFAULT, the corresponding start behavior is executed before executing the activity.

For a given activity, the execution on which this method must be called depends on the type of the start behavior:

Specified by:
executeActivity in interface ActivityExecution
Parameters:
the - activity to start

executeActivitiesConcurrent

public void executeActivitiesConcurrent(List<PvmActivity> activityStack,
                                        PvmActivity targetActivity,
                                        PvmTransition targetTransition,
                                        Map<String,Object> variables,
                                        Map<String,Object> localVariables,
                                        boolean skipCustomListeners,
                                        boolean skipIoMappings)
Instantiates the given activity stack under this execution. Sets the variables for the execution responsible to execute the most deeply nested activity.

Parameters:
activityStack - The most deeply nested activity is the last element in the list

instantiateScopes

public Map<PvmActivity,PvmExecutionImpl> instantiateScopes(List<PvmActivity> activityStack,
                                                           boolean skipCustomListeners,
                                                           boolean skipIoMappings)
Instantiates the given set of activities and returns the execution for the bottom-most activity


executeActivities

public void executeActivities(List<PvmActivity> activityStack,
                              PvmActivity targetActivity,
                              PvmTransition targetTransition,
                              Map<String,Object> variables,
                              Map<String,Object> localVariables,
                              boolean skipCustomListeners,
                              boolean skipIoMappings)
Instantiates the given activity stack. Uses this execution to execute the highest activity in the stack. Sets the variables for the execution responsible to execute the most deeply nested activity.

Parameters:
activityStack - The most deeply nested activity is the last element in the list

findInactiveConcurrentExecutions

public List<ActivityExecution> findInactiveConcurrentExecutions(PvmActivity activity)
Description copied from interface: ActivityExecution
Retrieves all executions which are concurrent and inactive at the given activity.

Specified by:
findInactiveConcurrentExecutions in interface ActivityExecution

findInactiveChildExecutions

public List<ActivityExecution> findInactiveChildExecutions(PvmActivity activity)
Specified by:
findInactiveChildExecutions in interface ActivityExecution

getAllChildExecutions

protected List<PvmExecutionImpl> getAllChildExecutions()

leaveActivityViaTransition

public void leaveActivityViaTransition(PvmTransition outgoingTransition)
Specified by:
leaveActivityViaTransition in interface ActivityExecution

leaveActivityViaTransitions

public void leaveActivityViaTransitions(List<PvmTransition> _transitions,
                                        List<? extends ActivityExecution> _recyclableExecutions)
Description copied from interface: ActivityExecution
Takes the given outgoing transitions, and potentially reusing the given list of executions that were previously joined.

Specified by:
leaveActivityViaTransitions in interface ActivityExecution

removeVariablesLocalInternal

protected abstract void removeVariablesLocalInternal()

isActive

public boolean isActive(String activityId)

inactivate

public void inactivate()
Description copied from interface: ActivityExecution
Inactivates this execution. This is useful for example in a join: the execution still exists, but it is not longer active.

Specified by:
inactivate in interface ActivityExecution

getExecutions

public abstract List<? extends PvmExecutionImpl> getExecutions()
Description copied from interface: ActivityExecution
returns the list of execution of which this execution the parent of. This is a copy of the actual list, so a modification has no direct effect.

Specified by:
getExecutions in interface ActivityExecution

getExecutionsAsCopy

public abstract List<? extends PvmExecutionImpl> getExecutionsAsCopy()

getNonEventScopeExecutions

public List<? extends PvmExecutionImpl> getNonEventScopeExecutions()
Description copied from interface: ActivityExecution
returns child executions that are not event scope executions.

Specified by:
getNonEventScopeExecutions in interface ActivityExecution

getEventScopeExecutions

public List<? extends PvmExecutionImpl> getEventScopeExecutions()

findExecution

public PvmExecutionImpl findExecution(String activityId)
Specified by:
findExecution in interface PvmProcessInstance

findExecutions

public List<PvmExecution> findExecutions(String activityId)
Specified by:
findExecutions in interface PvmProcessInstance

collectExecutions

protected void collectExecutions(String activityId,
                                 List<PvmExecution> executions)

findActiveActivityIds

public List<String> findActiveActivityIds()
Specified by:
findActiveActivityIds in interface PvmProcessInstance

collectActiveActivityIds

protected void collectActiveActivityIds(List<String> activeActivityIds)

getProcessBusinessKey

public String getProcessBusinessKey()
Description copied from interface: DelegateExecution
The business key for the process instance this execution is associated with.

Specified by:
getProcessBusinessKey in interface DelegateExecution

setProcessDefinition

public void setProcessDefinition(ProcessDefinitionImpl processDefinition)

getProcessDefinition

public ProcessDefinitionImpl getProcessDefinition()

getProcessInstance

public abstract PvmExecutionImpl getProcessInstance()
ensures initialization and returns the process instance.

Specified by:
getProcessInstance in interface DelegateExecution

setProcessInstance

public abstract void setProcessInstance(PvmExecutionImpl pvmExecutionImpl)

getCaseInstanceId

public String getCaseInstanceId()

setCaseInstanceId

public void setCaseInstanceId(String caseInstanceId)

getActivity

public ActivityImpl getActivity()
ensures initialization and returns the activity

Specified by:
getActivity in interface ActivityExecution
Specified by:
getActivity in interface PvmExecution

getActivityId

public String getActivityId()

getCurrentActivityName

public String getCurrentActivityName()
Description copied from interface: DelegateExecution
Gets the name of the current activity.

Specified by:
getCurrentActivityName in interface DelegateExecution

getCurrentActivityId

public String getCurrentActivityId()
Description copied from interface: DelegateExecution
Gets the id of the current activity.

Specified by:
getCurrentActivityId in interface DelegateExecution

setActivity

public void setActivity(PvmActivity activity)
Specified by:
setActivity in interface ActivityExecution

enterActivityInstance

public void enterActivityInstance()
Description copied from interface: ActivityExecution
invoked to notify the execution that a new activity instance is started

Specified by:
enterActivityInstance in interface ActivityExecution

activityInstanceStarting

public void activityInstanceStarting()

activityInstanceStarted

public void activityInstanceStarted()

activityInstanceDone

public void activityInstanceDone()

generateActivityInstanceId

protected abstract String generateActivityInstanceId(String activityId)

leaveActivityInstance

public void leaveActivityInstance()
Description copied from interface: ActivityExecution
invoked to notify the execution that an activity instance is ended.

Specified by:
leaveActivityInstance in interface ActivityExecution

getParentActivityInstanceId

public String getParentActivityInstanceId()
Description copied from interface: ActivityExecution
return the Id of the parent activity instance currently executed by this execution

Specified by:
getParentActivityInstanceId in interface DelegateExecution
Specified by:
getParentActivityInstanceId in interface ActivityExecution

setActivityInstanceId

public void setActivityInstanceId(String activityInstanceId)
Specified by:
setActivityInstanceId in interface ActivityExecution

getActivityInstanceId

public String getActivityInstanceId()
Description copied from interface: ActivityExecution
return the Id of the activity instance currently executed by this execution

Specified by:
getActivityInstanceId in interface DelegateExecution
Specified by:
getActivityInstanceId in interface ActivityExecution

getParent

public abstract PvmExecutionImpl getParent()
ensures initialization and returns the parent

Specified by:
getParent in interface ActivityExecution

getParentId

public String getParentId()
Description copied from interface: DelegateExecution
Gets the id of the parent of this execution. If null, the execution represents a process-instance.

Specified by:
getParentId in interface DelegateExecution

hasChildren

public boolean hasChildren()
Specified by:
hasChildren in interface ActivityExecution
Returns:
true if this execution has child executions (event scope executions or not)

setParent

public void setParent(PvmExecutionImpl parent)
Sets the execution's parent and updates the old and new parents' set of child executions


setParentExecution

public abstract void setParentExecution(PvmExecutionImpl parent)
Use #setParent to also update the child execution sets


getSuperExecution

public abstract PvmExecutionImpl getSuperExecution()
Description copied from interface: DelegateExecution
In case this delegate execution is the process instance execution and this process instance was started by a call activity, this method returns the execution which executed the call activity in the super process instance.

Specified by:
getSuperExecution in interface DelegateExecution
Returns:
the super execution or null.

setSuperExecution

public abstract void setSuperExecution(PvmExecutionImpl superExecution)

getSubProcessInstance

public abstract PvmExecutionImpl getSubProcessInstance()

setSubProcessInstance

public abstract void setSubProcessInstance(PvmExecutionImpl subProcessInstance)

getSuperCaseExecution

public abstract CmmnExecution getSuperCaseExecution()

setSuperCaseExecution

public abstract void setSuperCaseExecution(CmmnExecution superCaseExecution)

getSubCaseInstance

public abstract CmmnExecution getSubCaseInstance()

setSubCaseInstance

public abstract void setSubCaseInstance(CmmnExecution subCaseInstance)

getScopeActivity

protected ScopeImpl getScopeActivity()

isScope

public boolean isScope()
Description copied from interface: ActivityExecution
Returns whether this execution is a scope.

Specified by:
isScope in interface ActivityExecution

setScope

public void setScope(boolean isScope)
Description copied from interface: ActivityExecution
Changes whether this execution is a scope or not

Specified by:
setScope in interface ActivityExecution

findExecutionForFlowScope

public PvmExecutionImpl findExecutionForFlowScope(PvmScope targetFlowScope)
For a given target flow scope, this method returns the corresponding scope execution.

Precondition: the execution is active and executing an activity. Can be invoked for scope and non scope executions.

Specified by:
findExecutionForFlowScope in interface ActivityExecution
Parameters:
targetFlowScope - scope activity or process definition for which the scope execution should be found
Returns:
the scope execution for the provided targetFlowScope

findExecutionForScope

public PvmExecutionImpl findExecutionForScope(ScopeImpl currentScope,
                                              ScopeImpl targetScope)

createActivityExecutionMapping

public Map<ScopeImpl,PvmExecutionImpl> createActivityExecutionMapping(ScopeImpl currentScope)

createActivityExecutionMapping

public Map<ScopeImpl,PvmExecutionImpl> createActivityExecutionMapping()
Description copied from interface: ActivityExecution
Returns a mapping from scope activities to scope executions for all scopes that are ancestors of the activity currently executed by this execution. Assumption: the current execution is active and executing an activity (ActivityExecution.getActivity() is not null).

Specified by:
createActivityExecutionMapping in interface ActivityExecution

getFlowScopeExecution

protected PvmExecutionImpl getFlowScopeExecution()

getFlowScope

protected ScopeImpl getFlowScope()

createActivityExecutionMapping

protected Map<ScopeImpl,PvmExecutionImpl> createActivityExecutionMapping(ScopeImpl currentScope,
                                                                         Map<ScopeImpl,PvmExecutionImpl> mapping)
Creates an extended mapping based on this execution and the given existing mapping. Any entry mapping in mapping that corresponds to an ancestor scope of currentScope is reused.


toString

public String toString()
Overrides:
toString in class Object

getToStringIdentity

protected String getToStringIdentity()

getVariableScopeKey

public String getVariableScopeKey()
Specified by:
getVariableScopeKey in interface VariableScope
Overrides:
getVariableScopeKey in class AbstractVariableScope

getParentVariableScope

public AbstractVariableScope getParentVariableScope()
Specified by:
getParentVariableScope in class AbstractVariableScope

setVariable

public void setVariable(String variableName,
                        Object value,
                        String targetActivityId)
Method to store variable in a specific scope identified by activity ID.

Specified by:
setVariable in interface DelegateExecution
Parameters:
variableName - - name of the variable
value - - value of the variable
targetActivityId - - activity ID which is associated with destination execution, if not existing - exception will be thrown

findExecutionForFlowScope

protected PvmExecutionImpl findExecutionForFlowScope(String targetScopeId)
Parameters:
targetScopeId - - destination scope to be found in current execution tree
Returns:
execution with activity id corresponding to targetScopeId

getSequenceCounter

public long getSequenceCounter()

setSequenceCounter

public void setSequenceCounter(long sequenceCounter)

incrementSequenceCounter

public void incrementSequenceCounter()

isExternallyTerminated

public boolean isExternallyTerminated()

setExternallyTerminated

public void setExternallyTerminated(boolean externallyTerminated)

getDeleteReason

public String getDeleteReason()

setDeleteReason

public void setDeleteReason(String deleteReason)

isDeleteRoot

public boolean isDeleteRoot()

setDeleteRoot

public void setDeleteRoot(boolean deleteRoot)

getTransition

public TransitionImpl getTransition()
Specified by:
getTransition in interface ActivityExecution

getTransitionsToTake

public List<PvmTransition> getTransitionsToTake()

setTransitionsToTake

public void setTransitionsToTake(List<PvmTransition> transitionsToTake)

getCurrentTransitionId

public String getCurrentTransitionId()
Description copied from interface: DelegateExecution
return the Id of the current transition

Specified by:
getCurrentTransitionId in interface DelegateExecution

setTransition

public void setTransition(PvmTransition transition)

isConcurrent

public boolean isConcurrent()
Description copied from interface: ActivityExecution
returns whether this execution is concurrent or not.

Specified by:
isConcurrent in interface ActivityExecution

setConcurrent

public void setConcurrent(boolean isConcurrent)
Description copied from interface: ActivityExecution
changes the concurrent indicator on this execution.

Specified by:
setConcurrent in interface ActivityExecution

isActive

public boolean isActive()
Description copied from interface: ActivityExecution
returns whether this execution is currently active.

Specified by:
isActive in interface ActivityExecution

setActive

public void setActive(boolean isActive)
Description copied from interface: ActivityExecution
makes this execution active or inactive.

Specified by:
setActive in interface ActivityExecution

setEnded

public void setEnded(boolean isEnded)
Specified by:
setEnded in interface ActivityExecution

isEnded

public boolean isEnded()
Description copied from interface: ActivityExecution
returns whether this execution has ended or not.

Specified by:
isEnded in interface ActivityExecution
Specified by:
isEnded in interface PvmProcessInstance

isCanceled

public boolean isCanceled()
Description copied from interface: DelegateExecution
Returns whether this execution has been canceled.

Specified by:
isCanceled in interface DelegateExecution

setCanceled

public void setCanceled(boolean canceled)

isCompleteScope

public boolean isCompleteScope()
Description copied from interface: ActivityExecution
Returns whether this execution completed the parent scope.

Specified by:
isCompleteScope in interface ActivityExecution

setCompleteScope

public void setCompleteScope(boolean completeScope)

setPreserveScope

public void setPreserveScope(boolean preserveScope)

isPreserveScope

public boolean isPreserveScope()

getActivityInstanceState

public int getActivityInstanceState()

isInState

public boolean isInState(ActivityInstanceState state)

isEventScope

public boolean isEventScope()

setEventScope

public void setEventScope(boolean isEventScope)

getExecutionStartContext

public ExecutionStartContext getExecutionStartContext()

disposeProcessInstanceStartContext

public void disposeProcessInstanceStartContext()

disposeExecutionStartContext

public void disposeExecutionStartContext()

getNextActivity

public PvmActivity getNextActivity()
Description copied from interface: ActivityExecution
An activity which is to be started next.

Specified by:
getNextActivity in interface ActivityExecution

isProcessInstanceExecution

public boolean isProcessInstanceExecution()
Description copied from interface: ActivityExecution
returns whether this execution is a process instance or not.

Specified by:
isProcessInstanceExecution in interface ActivityExecution

getProcessInstanceStartContext

public ProcessInstanceStartContext getProcessInstanceStartContext()

hasProcessInstanceStartContext

public boolean hasProcessInstanceStartContext()

setStartContext

public void setStartContext(ExecutionStartContext startContext)

setNextActivity

public void setNextActivity(PvmActivity nextActivity)

getParentScopeExecution

public PvmExecutionImpl getParentScopeExecution(boolean considerSuperExecution)

delayEvent

public void delayEvent(PvmExecutionImpl targetScope,
                       VariableEvent variableEvent)
Delays a given variable event with the given target scope.

Parameters:
targetScope - the target scope of the variable event
variableEvent - the variable event which should be delayed

delayEvent

public void delayEvent(DelayedVariableEvent delayedVariableEvent)
Delays and stores the given DelayedVariableEvent on the process instance.

Parameters:
delayedVariableEvent - the DelayedVariableEvent which should be store on the process instance

getDelayedEvents

public List<DelayedVariableEvent> getDelayedEvents()
The current delayed variable events.

Returns:
a list of DelayedVariableEvent objects

clearDelayedEvents

public void clearDelayedEvents()
Cleares the current delayed variable events.


dispatchDelayedEventsAndPerformOperation

public void dispatchDelayedEventsAndPerformOperation(PvmAtomicOperation atomicOperation)
Dispatches the current delayed variable events and performs the given atomic operation if the current state was not changed.

Parameters:
atomicOperation - the atomic operation which should be executed

dispatchDelayedEventsAndPerformOperation

public void dispatchDelayedEventsAndPerformOperation(Callback<PvmExecutionImpl,Void> continuation)
Dispatches the current delayed variable events and performs the given atomic operation if the current state was not changed.

Parameters:
continuation - the atomic operation continuation which should be executed

continueIfExecutionDoesNotAffectNextOperation

public void continueIfExecutionDoesNotAffectNextOperation(Callback<PvmExecutionImpl,Void> dispatching,
                                                          Callback<PvmExecutionImpl,Void> continuation,
                                                          PvmExecutionImpl execution)
Executes the given depending operations with the given execution. The execution state will be checked with the help of the activity instance id and activity id of the execution before and after the dispatching callback call. If the id's are not changed the continuation callback is called.

Parameters:
dispatching - the callback to dispatch the variable events
continuation - the callback to continue with the next atomic operation
execution - the execution which is used for the execution

continueExecutionIfNotCanceled

protected void continueExecutionIfNotCanceled(Callback<PvmExecutionImpl,Void> continuation,
                                              PvmExecutionImpl execution)

dispatchScopeEvents

protected void dispatchScopeEvents(PvmExecutionImpl execution)
Dispatches the current delayed variable events on the scope of the given execution.

Parameters:
execution - the execution on which scope the delayed variable should be dispatched

initActivityIds

protected void initActivityIds(List<DelayedVariableEvent> delayedEvents,
                               Map<PvmExecutionImpl,String> activityInstanceIds,
                               Map<PvmExecutionImpl,String> activityIds)
Initializes the given maps with the target scopes and current activity id's and activity instance id's.

Parameters:
delayedEvents - the delayed events which contains the information about the target scope
activityInstanceIds - the map which maps target scope to activity instance id
activityIds - the map which maps target scope to activity id

createIncident

public Incident createIncident(String incidentType,
                               String configuration)
Returns the newest incident in this execution

Specified by:
createIncident in interface DelegateExecution
Parameters:
incidentType - the type of new incident
configuration - configuration of the incident
Returns:
new incident

createIncident

public Incident createIncident(String incidentType,
                               String configuration,
                               String message)
Description copied from interface: DelegateExecution
Create an incident associated with this execution

Specified by:
createIncident in interface DelegateExecution
Parameters:
incidentType - the type of incident
Returns:
a new incident

resolveIncident

public void resolveIncident(String incidentId)
Resolves an incident with given id.

Specified by:
resolveIncident in interface DelegateExecution
Parameters:
incidentId -

findIncidentHandler

public IncidentHandler findIncidentHandler(String incidentType)


Copyright © 2017 camunda services GmbH. All rights reserved.