use of org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity in project camunda-bpm-platform by camunda.
the class ModifyProcessInstanceCmd method execute.
@Override
public Void execute(CommandContext commandContext) {
String processInstanceId = builder.getProcessInstanceId();
ExecutionManager executionManager = commandContext.getExecutionManager();
ExecutionEntity processInstance = executionManager.findExecutionById(processInstanceId);
ensureProcessInstanceExist(processInstanceId, processInstance);
checkUpdateProcessInstance(processInstance, commandContext);
processInstance.setPreserveScope(true);
List<AbstractProcessInstanceModificationCommand> instructions = builder.getModificationOperations();
checkCancellation(commandContext);
for (int i = 0; i < instructions.size(); i++) {
AbstractProcessInstanceModificationCommand instruction = instructions.get(i);
LOG.debugModificationInstruction(processInstanceId, i + 1, instruction.describe());
instruction.setSkipCustomListeners(builder.isSkipCustomListeners());
instruction.setSkipIoMappings(builder.isSkipIoMappings());
instruction.execute(commandContext);
}
processInstance = executionManager.findExecutionById(processInstanceId);
if (!processInstance.hasChildren()) {
if (processInstance.getActivity() == null) {
// process instance was cancelled
checkDeleteProcessInstance(processInstance, commandContext);
deletePropagate(processInstance, builder.getModificationReason(), builder.isSkipCustomListeners(), builder.isSkipIoMappings());
} else if (processInstance.isEnded()) {
// process instance has ended regularly
processInstance.propagateEnd();
}
}
if (writeOperationLog) {
commandContext.getOperationLogManager().logProcessInstanceOperation(getLogEntryOperation(), processInstanceId, null, null, Collections.singletonList(PropertyChange.EMPTY_CHANGE));
}
return null;
}
use of org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity in project camunda-bpm-platform by camunda.
the class ModifyProcessInstanceCmd method deletePropagate.
protected void deletePropagate(ExecutionEntity processInstance, String deleteReason, boolean skipCustomListeners, boolean skipIoMappings) {
ExecutionEntity topmostDeletableExecution = processInstance;
ExecutionEntity parentScopeExecution = (ExecutionEntity) topmostDeletableExecution.getParentScopeExecution(true);
while (parentScopeExecution != null && (parentScopeExecution.getNonEventScopeExecutions().size() <= 1)) {
topmostDeletableExecution = parentScopeExecution;
parentScopeExecution = (ExecutionEntity) topmostDeletableExecution.getParentScopeExecution(true);
}
topmostDeletableExecution.deleteCascade(deleteReason, skipCustomListeners, skipIoMappings);
}
use of org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity in project camunda-bpm-platform by camunda.
the class RemoveExecutionVariablesCmd method logVariableOperation.
protected void logVariableOperation(AbstractVariableScope scope) {
ExecutionEntity execution = (ExecutionEntity) scope;
commandContext.getOperationLogManager().logVariableOperation(getLogEntryOperation(), execution.getId(), null, PropertyChange.EMPTY_CHANGE);
}
use of org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity in project camunda-bpm-platform by camunda.
the class TransitionInstanceCancellationCmd method determineSourceInstanceExecution.
protected ExecutionEntity determineSourceInstanceExecution(final CommandContext commandContext) {
ActivityInstance instance = commandContext.runWithoutAuthorization(new Callable<ActivityInstance>() {
public ActivityInstance call() throws Exception {
return new GetActivityInstanceCmd(processInstanceId).execute(commandContext);
}
});
TransitionInstance instanceToCancel = findTransitionInstance(instance, transitionInstanceId);
EnsureUtil.ensureNotNull(NotValidException.class, describeFailure("Transition instance '" + transitionInstanceId + "' does not exist"), "transitionInstance", instanceToCancel);
ExecutionEntity transitionExecution = commandContext.getExecutionManager().findExecutionById(instanceToCancel.getExecutionId());
return transitionExecution;
}
use of org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity in project camunda-bpm-platform by camunda.
the class SetExecutionVariablesCmd method logVariableOperation.
protected void logVariableOperation(AbstractVariableScope scope) {
ExecutionEntity execution = (ExecutionEntity) scope;
commandContext.getOperationLogManager().logVariableOperation(getLogEntryOperation(), execution.getId(), null, PropertyChange.EMPTY_CHANGE);
}
Aggregations