Search in sources :

Example 91 with ExecutionEntity

use of org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity in project camunda-bpm-platform by camunda.

the class ThrowEscalationEventActivityBehavior method leaveExecution.

protected void leaveExecution(ActivityExecution execution, final PvmActivity currentActivity, EscalationEventDefinition escalationEventDefinition) {
    // execution tree could have been expanded by triggering a non-interrupting event
    ExecutionEntity replacingExecution = ((ExecutionEntity) execution).getReplacedBy();
    ExecutionEntity leavingExecution = (ExecutionEntity) (replacingExecution != null ? replacingExecution : execution);
    leave(leavingExecution);
}
Also used : ExecutionEntity(org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity)

Example 92 with ExecutionEntity

use of org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity in project camunda-bpm-platform by camunda.

the class UserTaskActivityBehavior method onParseMigratingInstance.

@Override
public void onParseMigratingInstance(MigratingInstanceParseContext parseContext, MigratingActivityInstance migratingInstance) {
    ExecutionEntity execution = migratingInstance.resolveRepresentativeExecution();
    for (TaskEntity task : execution.getTasks()) {
        migratingInstance.addMigratingDependentInstance(new MigratingUserTaskInstance(task, migratingInstance));
        parseContext.consume(task);
        Collection<VariableInstanceEntity> variables = task.getVariablesInternal();
        if (variables != null) {
            for (VariableInstanceEntity variable : variables) {
                // we don't need to represent task variables in the migrating instance structure because
                // they are migrated by the MigratingTaskInstance as well
                parseContext.consume(variable);
            }
        }
    }
}
Also used : TaskEntity(org.camunda.bpm.engine.impl.persistence.entity.TaskEntity) ExecutionEntity(org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity) MigratingUserTaskInstance(org.camunda.bpm.engine.impl.migration.instance.MigratingUserTaskInstance) VariableInstanceEntity(org.camunda.bpm.engine.impl.persistence.entity.VariableInstanceEntity)

Example 93 with ExecutionEntity

use of org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity in project camunda-bpm-platform by camunda.

the class AbstractCorrelateMessageCmd method checkAuthorization.

protected void checkAuthorization(CorrelationHandlerResult correlation) {
    CommandContext commandContext = Context.getCommandContext();
    for (CommandChecker checker : commandContext.getProcessEngineConfiguration().getCommandCheckers()) {
        if (MessageCorrelationResultType.Execution.equals(correlation.getResultType())) {
            ExecutionEntity execution = correlation.getExecutionEntity();
            checker.checkUpdateProcessInstanceById(execution.getProcessInstanceId());
        } else {
            ProcessDefinitionEntity definition = correlation.getProcessDefinitionEntity();
            checker.checkCreateProcessInstance(definition);
        }
    }
}
Also used : CommandContext(org.camunda.bpm.engine.impl.interceptor.CommandContext) ExecutionEntity(org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity) ProcessDefinitionEntity(org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity) CommandChecker(org.camunda.bpm.engine.impl.cfg.CommandChecker)

Example 94 with ExecutionEntity

use of org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity in project camunda-bpm-platform by camunda.

the class AbstractDeleteProcessInstanceCmd method deleteProcessInstance.

protected void deleteProcessInstance(final CommandContext commandContext, String processInstanceId, final String deleteReason, final boolean skipCustomListeners, boolean externallyTerminated, final boolean skipIoMappings, boolean skipSubprocesses) {
    ensureNotNull(BadUserRequestException.class, "processInstanceId is null", "processInstanceId", processInstanceId);
    // fetch process instance
    ExecutionManager executionManager = commandContext.getExecutionManager();
    final ExecutionEntity execution = executionManager.findExecutionById(processInstanceId);
    ensureNotNull(BadUserRequestException.class, "No process instance found for id '" + processInstanceId + "'", "processInstance", execution);
    checkDeleteProcessInstance(execution, commandContext);
    // delete process instance
    commandContext.getExecutionManager().deleteProcessInstance(processInstanceId, deleteReason, false, skipCustomListeners, externallyTerminated, skipIoMappings, skipSubprocesses);
    if (skipSubprocesses) {
        List<ProcessInstance> superProcesslist = commandContext.getProcessEngineConfiguration().getRuntimeService().createProcessInstanceQuery().superProcessInstanceId(processInstanceId).list();
        triggerHistoryEvent(superProcesslist);
    }
    final ExecutionEntity superExecution = execution.getSuperExecution();
    if (superExecution != null) {
        commandContext.runWithoutAuthorization(new Callable<Void>() {

            public Void call() {
                ProcessInstanceModificationBuilderImpl builder = (ProcessInstanceModificationBuilderImpl) new ProcessInstanceModificationBuilderImpl(commandContext, superExecution.getProcessInstanceId(), deleteReason).cancelActivityInstance(superExecution.getActivityInstanceId());
                builder.execute(false, skipCustomListeners, skipIoMappings);
                return null;
            }
        });
    }
    // create user operation log
    commandContext.getOperationLogManager().logProcessInstanceOperation(UserOperationLogEntry.OPERATION_TYPE_DELETE, processInstanceId, null, null, Collections.singletonList(PropertyChange.EMPTY_CHANGE));
}
Also used : ExecutionManager(org.camunda.bpm.engine.impl.persistence.entity.ExecutionManager) ExecutionEntity(org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity) ProcessInstance(org.camunda.bpm.engine.runtime.ProcessInstance) ProcessInstanceModificationBuilderImpl(org.camunda.bpm.engine.impl.ProcessInstanceModificationBuilderImpl)

Example 95 with ExecutionEntity

use of org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity in project camunda-bpm-platform by camunda.

the class AbstractVariableCmd method execute.

public Void execute(CommandContext commandContext) {
    this.commandContext = commandContext;
    AbstractVariableScope scope = getEntity();
    executeOperation(scope);
    ExecutionEntity contextExecution = getContextExecution();
    if (contextExecution != null) {
        contextExecution.dispatchDelayedEventsAndPerformOperation((Callback<PvmExecutionImpl, Void>) null);
    }
    if (!preventLogUserOperation) {
        logVariableOperation(scope);
    }
    return null;
}
Also used : ExecutionEntity(org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity) PvmExecutionImpl(org.camunda.bpm.engine.impl.pvm.runtime.PvmExecutionImpl) AbstractVariableScope(org.camunda.bpm.engine.impl.core.variable.scope.AbstractVariableScope)

Aggregations

ExecutionEntity (org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity)170 Deployment (org.camunda.bpm.engine.test.Deployment)42 ProcessInstance (org.camunda.bpm.engine.runtime.ProcessInstance)18 TaskEntity (org.camunda.bpm.engine.impl.persistence.entity.TaskEntity)17 CaseExecutionEntity (org.camunda.bpm.engine.impl.cmmn.entity.runtime.CaseExecutionEntity)16 Execution (org.camunda.bpm.engine.runtime.Execution)14 ProcessDefinitionEntity (org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity)13 ActivityImpl (org.camunda.bpm.engine.impl.pvm.process.ActivityImpl)12 Task (org.camunda.bpm.engine.task.Task)12 ScopeImpl (org.camunda.bpm.engine.impl.pvm.process.ScopeImpl)10 ArrayList (java.util.ArrayList)9 VariableInstanceEntity (org.camunda.bpm.engine.impl.persistence.entity.VariableInstanceEntity)9 Test (org.junit.Test)9 CommandChecker (org.camunda.bpm.engine.impl.cfg.CommandChecker)7 EventSubscriptionEntity (org.camunda.bpm.engine.impl.persistence.entity.EventSubscriptionEntity)7 PvmExecutionImpl (org.camunda.bpm.engine.impl.pvm.runtime.PvmExecutionImpl)7 ProcessDefinitionImpl (org.camunda.bpm.engine.impl.pvm.process.ProcessDefinitionImpl)6 ActivityInstance (org.camunda.bpm.engine.runtime.ActivityInstance)6 ProcessEngineException (org.camunda.bpm.engine.ProcessEngineException)5 CommandContext (org.camunda.bpm.engine.impl.interceptor.CommandContext)5