use of org.activiti.engine.impl.pvm.runtime.InterpretableExecution in project Activiti by Activiti.
the class ExecutionEntity method destroyScope.
public void destroyScope(String reason) {
if (log.isDebugEnabled()) {
log.debug("performing destroy scope behavior for execution {}", this);
}
// remove all child executions and sub process instances:
HistoryManager historyManager = Context.getCommandContext().getHistoryManager();
List<InterpretableExecution> executions = new ArrayList<InterpretableExecution>(getExecutions());
for (InterpretableExecution childExecution : executions) {
if (childExecution.getSubProcessInstance() != null) {
childExecution.getSubProcessInstance().deleteCascade(reason);
}
historyManager.recordActivityEnd((ExecutionEntity) childExecution);
childExecution.deleteCascade(reason);
}
if (activityId != null) {
historyManager.recordActivityEnd(this);
}
removeTasks(reason);
removeJobs();
}
use of org.activiti.engine.impl.pvm.runtime.InterpretableExecution in project Activiti by Activiti.
the class ProcessDefinitionImpl method createProcessInstanceForInitial.
/** creates a process instance using the provided activity as initial */
public PvmProcessInstance createProcessInstanceForInitial(ActivityImpl initial) {
if (initial == null) {
throw new ActivitiException("Cannot start process instance, initial activity where the process instance should start is null.");
}
InterpretableExecution processInstance = newProcessInstance(initial);
processInstance.setProcessDefinition(this);
processInstance.setProcessInstance(processInstance);
processInstance.initialize();
InterpretableExecution scopeInstance = processInstance;
List<ActivityImpl> initialActivityStack = getInitialActivityStack(initial);
for (ActivityImpl initialActivity : initialActivityStack) {
if (initialActivity.isScope()) {
scopeInstance = (InterpretableExecution) scopeInstance.createExecution();
scopeInstance.setActivity(initialActivity);
if (initialActivity.isScope()) {
scopeInstance.initialize();
}
}
}
scopeInstance.setActivity(initial);
return processInstance;
}
use of org.activiti.engine.impl.pvm.runtime.InterpretableExecution in project Activiti by Activiti.
the class EventSubProcessStartEventActivityBehavior method execute.
@Override
public void execute(ActivityExecution execution) throws Exception {
InterpretableExecution interpretableExecution = (InterpretableExecution) execution;
ActivityImpl activity = interpretableExecution.getProcessDefinition().findActivity(activityId);
ActivityExecution outgoingExecution = execution;
if (isInterrupting) {
execution.destroyScope("Event subprocess triggered using activity " + activityId);
} else {
outgoingExecution = execution.createExecution();
outgoingExecution.setActive(true);
outgoingExecution.setScope(false);
outgoingExecution.setConcurrent(true);
}
// set the outgoing execution to this activity
((InterpretableExecution) outgoingExecution).setActivity(activity);
// continue execution
outgoingExecution.takeAll(activity.getOutgoingTransitions(), Collections.EMPTY_LIST);
}
use of org.activiti.engine.impl.pvm.runtime.InterpretableExecution in project Activiti by Activiti.
the class AbstractBpmnActivityBehavior method signalCompensationDone.
protected void signalCompensationDone(ActivityExecution execution, Object signalData) {
// join compensating executions
if (execution.getExecutions().isEmpty()) {
if (execution.getParent() != null) {
ActivityExecution parent = execution.getParent();
((InterpretableExecution) execution).remove();
((InterpretableExecution) parent).signal("compensationDone", signalData);
}
} else {
((ExecutionEntity) execution).forceUpdate();
}
}
use of org.activiti.engine.impl.pvm.runtime.InterpretableExecution in project Activiti by Activiti.
the class CancelEndEventActivityBehavior method execute.
@Override
public void execute(ActivityExecution execution) throws Exception {
// find cancel boundary event:
ActivityImpl cancelBoundaryEvent = ScopeUtil.findInParentScopesByBehaviorType((ActivityImpl) execution.getActivity(), CancelBoundaryEventActivityBehavior.class);
if (cancelBoundaryEvent == null) {
throw new ActivitiException("Could not find cancel boundary event for cancel end event " + execution.getActivity());
}
ActivityExecution scopeExecution = ScopeUtil.findScopeExecutionForScope((ExecutionEntity) execution, cancelBoundaryEvent.getParentActivity());
// end all executions and process instances in the scope of the transaction
scopeExecution.destroyScope("cancel end event fired");
// the scope execution executes the boundary event
InterpretableExecution outgoingExecution = (InterpretableExecution) scopeExecution;
outgoingExecution.setActivity(cancelBoundaryEvent);
outgoingExecution.setActive(true);
// execute the boundary
cancelBoundaryEvent.getActivityBehavior().execute(outgoingExecution);
}
Aggregations