use of org.camunda.bpm.engine.variable.impl.VariableMapImpl in project camunda-bpm-platform by camunda.
the class GetCaseExecutionVariablesCmd method execute.
public VariableMap execute(CommandContext commandContext) {
ensureNotNull("caseExecutionId", caseExecutionId);
CaseExecutionEntity caseExecution = commandContext.getCaseExecutionManager().findCaseExecutionById(caseExecutionId);
ensureNotNull(CaseExecutionNotFoundException.class, "case execution " + caseExecutionId + " doesn't exist", "caseExecution", caseExecution);
for (CommandChecker checker : commandContext.getProcessEngineConfiguration().getCommandCheckers()) {
checker.checkReadCaseInstance(caseExecution);
}
VariableMapImpl result = new VariableMapImpl();
// collect variables
caseExecution.collectVariables(result, variableNames, isLocal, deserializeValues);
return result;
}
use of org.camunda.bpm.engine.variable.impl.VariableMapImpl in project camunda-bpm-platform by camunda.
the class GetTaskVariablesCmd method execute.
public VariableMap execute(CommandContext commandContext) {
ensureNotNull("taskId", taskId);
TaskEntity task = Context.getCommandContext().getTaskManager().findTaskById(taskId);
ensureNotNull("task " + taskId + " doesn't exist", "task", task);
checkGetTaskVariables(task, commandContext);
VariableMapImpl variables = new VariableMapImpl();
// collect variables from task
task.collectVariables(variables, variableNames, isLocal, deserializeValues);
return variables;
}
use of org.camunda.bpm.engine.variable.impl.VariableMapImpl in project camunda-bpm-platform by camunda.
the class CaseTaskTest method testInputSourceDifferentTarget.
/**
* default manual activation behaviour changed - remove manual activation statement
*/
@Deployment(resources = { "org/camunda/bpm/engine/test/cmmn/casetask/CaseTaskTest.testInputSourceDifferentTarget.cmmn", "org/camunda/bpm/engine/test/api/cmmn/oneTaskCase.cmmn" })
public void testInputSourceDifferentTarget() {
// given
VariableMap vars = new VariableMapImpl();
vars.putValue("aVariable", "abc");
vars.putValue("anotherVariable", 999);
String superCaseInstanceId = createCaseInstanceByKey(ONE_CASE_TASK_CASE, vars).getId();
String caseTaskId = queryCaseExecutionByActivityId(CASE_TASK).getId();
// then
CaseExecutionEntity subCaseInstance = (CaseExecutionEntity) queryOneTaskCaseInstance();
assertNotNull(subCaseInstance);
List<VariableInstance> variables = runtimeService.createVariableInstanceQuery().caseInstanceIdIn(subCaseInstance.getId()).list();
assertFalse(variables.isEmpty());
assertEquals(2, variables.size());
for (VariableInstance variable : variables) {
String name = variable.getName();
if ("myVariable".equals(name)) {
assertEquals("myVariable", name);
assertEquals("abc", variable.getValue());
} else if ("myAnotherVariable".equals(name)) {
assertEquals("myAnotherVariable", name);
assertEquals(999, variable.getValue());
} else {
fail("Found an unexpected variable: '" + name + "'");
}
}
// complete ////////////////////////////////////////////////////////
terminate(subCaseInstance.getId());
close(subCaseInstance.getId());
assertCaseEnded(subCaseInstance.getId());
terminate(caseTaskId);
close(superCaseInstanceId);
assertCaseEnded(superCaseInstanceId);
}
use of org.camunda.bpm.engine.variable.impl.VariableMapImpl in project camunda-bpm-platform by camunda.
the class CaseTaskTest method testInputAll.
@Deployment(resources = { "org/camunda/bpm/engine/test/cmmn/casetask/CaseTaskTest.testInputAll.cmmn", "org/camunda/bpm/engine/test/api/cmmn/oneTaskCase.cmmn" })
public void testInputAll() {
// given
VariableMap vars = new VariableMapImpl();
vars.putValue("aVariable", "abc");
vars.putValue("anotherVariable", 999);
String superCaseInstanceId = createCaseInstanceByKey(ONE_CASE_TASK_CASE, vars).getId();
String caseTaskId = queryCaseExecutionByActivityId(CASE_TASK).getId();
// then
CaseExecutionEntity subCaseInstance = (CaseExecutionEntity) queryOneTaskCaseInstance();
assertNotNull(subCaseInstance);
List<VariableInstance> variables = runtimeService.createVariableInstanceQuery().caseInstanceIdIn(subCaseInstance.getId()).list();
assertFalse(variables.isEmpty());
assertEquals(2, variables.size());
for (VariableInstance variable : variables) {
String name = variable.getName();
if ("aVariable".equals(name)) {
assertEquals("aVariable", name);
assertEquals("abc", variable.getValue());
} else if ("anotherVariable".equals(name)) {
assertEquals("anotherVariable", name);
assertEquals(999, variable.getValue());
} else {
fail("Found an unexpected variable: '" + name + "'");
}
}
// complete ////////////////////////////////////////////////////////
terminate(subCaseInstance.getId());
close(subCaseInstance.getId());
assertCaseEnded(subCaseInstance.getId());
terminate(caseTaskId);
close(superCaseInstanceId);
assertCaseEnded(superCaseInstanceId);
}
use of org.camunda.bpm.engine.variable.impl.VariableMapImpl in project camunda-bpm-platform by camunda.
the class RestartProcessInstancesCmd method collectInitialVariables.
protected VariableMap collectInitialVariables(CommandContext commandContext, HistoricProcessInstance processInstance) {
HistoryService historyService = commandContext.getProcessEngineConfiguration().getHistoryService();
HistoricActivityInstance startActivityInstance = resolveStartActivityInstance(processInstance);
HistoricDetailQueryImpl query = (HistoricDetailQueryImpl) historyService.createHistoricDetailQuery().variableUpdates().executionId(processInstance.getId()).activityInstanceId(startActivityInstance.getId());
List<HistoricDetail> historicDetails = query.sequenceCounter(1).list();
VariableMap variables = new VariableMapImpl();
for (HistoricDetail detail : historicDetails) {
HistoricVariableUpdate variableUpdate = (HistoricVariableUpdate) detail;
variables.putValueTyped(variableUpdate.getVariableName(), variableUpdate.getTypedValue());
}
return variables;
}
Aggregations