Search in sources :

Example 1 with ExecutionEntity

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

the class DefaultContextAssociationManager method setVariable.

@Override
public void setVariable(String variableName, Object value) {
    ExecutionEntity execution = getExecutionFromContext();
    if (execution != null) {
        execution.setVariable(variableName, value);
        execution.getVariable(variableName);
    } else {
        getScopedAssociation().setVariable(variableName, value);
    }
}
Also used : ExecutionEntity(org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity)

Example 2 with ExecutionEntity

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

the class DefaultContextAssociationManager method setVariableLocal.

@Override
public void setVariableLocal(String variableName, Object value) {
    ExecutionEntity execution = getExecutionFromContext();
    if (execution != null) {
        execution.setVariableLocal(variableName, value);
        execution.getVariableLocal(variableName);
    } else {
        getScopedAssociation().setVariableLocal(variableName, value);
    }
}
Also used : ExecutionEntity(org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity)

Example 3 with ExecutionEntity

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

the class ResolveIncidentCmd method execute.

@Override
public Void execute(CommandContext commandContext) {
    final Incident incident = commandContext.getIncidentManager().findIncidentById(incidentId);
    EnsureUtil.ensureNotNull(NotFoundException.class, "Cannot find an incident with id '" + incidentId + "'", "incident", incident);
    if (incident.getIncidentType().equals("failedJob") || incident.getIncidentType().equals("failedExternalTask")) {
        throw new BadUserRequestException("Cannot resolve an incident of type " + incident.getIncidentType());
    }
    EnsureUtil.ensureNotNull(BadUserRequestException.class, "", "executionId", incident.getExecutionId());
    ExecutionEntity execution = commandContext.getExecutionManager().findExecutionById(incident.getExecutionId());
    EnsureUtil.ensureNotNull(BadUserRequestException.class, "Cannot find an execution for an incident with id '" + incidentId + "'", "execution", execution);
    for (CommandChecker checker : commandContext.getProcessEngineConfiguration().getCommandCheckers()) {
        checker.checkUpdateProcessInstance(execution);
    }
    execution.resolveIncident(incidentId);
    return null;
}
Also used : ExecutionEntity(org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity) Incident(org.camunda.bpm.engine.runtime.Incident) BadUserRequestException(org.camunda.bpm.engine.BadUserRequestException) CommandChecker(org.camunda.bpm.engine.impl.cfg.CommandChecker)

Example 4 with ExecutionEntity

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

the class EvaluateStartConditionCmd method instantiateProcess.

protected ProcessInstance instantiateProcess(CommandContext commandContext, ConditionHandlerResult result) {
    ProcessDefinitionEntity processDefinitionEntity = result.getProcessDefinition();
    ActivityImpl startEvent = processDefinitionEntity.findActivity(result.getActivity().getActivityId());
    ExecutionEntity processInstance = processDefinitionEntity.createProcessInstance(builder.getBusinessKey(), startEvent);
    processInstance.start(builder.getVariables());
    return processInstance;
}
Also used : ActivityImpl(org.camunda.bpm.engine.impl.pvm.process.ActivityImpl) ExecutionEntity(org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity) ProcessDefinitionEntity(org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity)

Example 5 with ExecutionEntity

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

the class GetActivityInstanceCmd method loadProcessInstance.

protected List<ExecutionEntity> loadProcessInstance(String processInstanceId, CommandContext commandContext) {
    List<ExecutionEntity> result = null;
    // first try to load from cache
    // check whether the process instance is already (partially) loaded in command context
    List<ExecutionEntity> cachedExecutions = commandContext.getDbEntityManager().getCachedEntitiesByType(ExecutionEntity.class);
    for (ExecutionEntity executionEntity : cachedExecutions) {
        if (processInstanceId.equals(executionEntity.getProcessInstanceId())) {
            // found one execution from process instance
            result = new ArrayList<ExecutionEntity>();
            ExecutionEntity processInstance = executionEntity.getProcessInstance();
            // add process instance
            result.add(processInstance);
            loadChildExecutionsFromCache(processInstance, result);
            break;
        }
    }
    if (result == null) {
        // if the process instance could not be found in cache, load from database
        result = loadFromDb(processInstanceId, commandContext);
    }
    return result;
}
Also used : ExecutionEntity(org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity)

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