use of org.camunda.bpm.engine.impl.pvm.runtime.PvmExecutionImpl in project camunda-bpm-platform by camunda.
the class ProcessDefinitionImpl method createProcessInstanceForInitial.
/**
* creates a process instance using the provided activity as initial
*/
public PvmProcessInstance createProcessInstanceForInitial(ActivityImpl initial) {
ensureNotNull("Cannot start process instance, initial activity where the process instance should start is null", "initial", initial);
PvmExecutionImpl processInstance = newProcessInstance();
processInstance.setProcessDefinition(this);
processInstance.setProcessInstance(processInstance);
// always set the process instance to the initial activity, no matter how deeply it is nested;
// this is required for firing history events (cf start activity) and persisting the initial activity
// on async start
processInstance.setActivity(initial);
return processInstance;
}
use of org.camunda.bpm.engine.impl.pvm.runtime.PvmExecutionImpl in project camunda-bpm-platform by camunda.
the class FoxDeleteProcessInstanceCmd method execute.
public Void execute(CommandContext commandContext) {
ensureNotNull("processInstanceId", processInstanceId);
ExecutionEntity execution = commandContext.getExecutionManager().findExecutionById(processInstanceId);
ensureNotNull("No process instance found for id '" + processInstanceId + "'", "execution", execution);
commandContext.getTaskManager().deleteTasksByProcessInstanceId(processInstanceId, deleteReason, false, false);
for (PvmExecutionImpl currentExecution : this.collectExecutionToDelete(execution)) {
currentExecution.deleteCascade2(deleteReason);
}
return null;
}
use of org.camunda.bpm.engine.impl.pvm.runtime.PvmExecutionImpl in project camunda-bpm-platform by camunda.
the class FoxDeleteProcessInstanceCmd method collectExecutionToDelete.
public List<PvmExecutionImpl> collectExecutionToDelete(PvmExecutionImpl execution) {
List<PvmExecutionImpl> result = new ArrayList<PvmExecutionImpl>();
for (PvmExecutionImpl currentExecution : execution.getExecutions()) {
result.addAll(this.collectExecutionToDelete(currentExecution));
}
if (execution.getSubProcessInstance() != null) {
result.addAll(this.collectExecutionToDelete(execution.getSubProcessInstance()));
}
result.add(execution);
return result;
}
use of org.camunda.bpm.engine.impl.pvm.runtime.PvmExecutionImpl in project camunda-bpm-platform by camunda.
the class EventHandlerImpl method handleIntermediateEvent.
public void handleIntermediateEvent(EventSubscriptionEntity eventSubscription, Object payload, CommandContext commandContext) {
PvmExecutionImpl execution = eventSubscription.getExecution();
ActivityImpl activity = eventSubscription.getActivity();
ensureNotNull("Error while sending signal for event subscription '" + eventSubscription.getId() + "': " + "no activity associated with event subscription", "activity", activity);
if (payload instanceof Map) {
execution.setVariables((Map<String, Object>) payload);
}
if (activity.equals(execution.getActivity())) {
execution.signal("signal", null);
} else {
// and not the subprocess itself
if (activity.getActivityBehavior() instanceof EventSubProcessStartEventActivityBehavior) {
activity = (ActivityImpl) activity.getFlowScope();
}
execution.executeEventHandlerActivity(activity);
}
}
use of org.camunda.bpm.engine.impl.pvm.runtime.PvmExecutionImpl in project camunda-bpm-platform by camunda.
the class EventSubProcessStartConditionalEventActivityBehavior method leaveOnSatisfiedCondition.
@Override
public void leaveOnSatisfiedCondition(final EventSubscriptionEntity eventSubscription, final VariableEvent variableEvent) {
PvmExecutionImpl execution = eventSubscription.getExecution();
if (execution != null && !execution.isEnded() && execution.isScope() && conditionalEvent.tryEvaluate(variableEvent, execution)) {
ActivityImpl activity = eventSubscription.getActivity();
activity = (ActivityImpl) activity.getFlowScope();
execution.executeEventHandlerActivity(activity);
}
}
Aggregations