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);
}
}
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);
}
}
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;
}
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;
}
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;
}
Aggregations