本文整理汇总了Java中org.camunda.bpm.engine.variable.VariableMap.putValue方法的典型用法代码示例。如果您正苦于以下问题:Java VariableMap.putValue方法的具体用法?Java VariableMap.putValue怎么用?Java VariableMap.putValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.camunda.bpm.engine.variable.VariableMap
的用法示例。
在下文中一共展示了VariableMap.putValue方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getNewVariables
import org.camunda.bpm.engine.variable.VariableMap; //导入方法依赖的package包/类
private VariableMap getNewVariables(JsonObject event) {
VariableMap variables = Variables.createVariables();
if (event.get("pickId") != null) {
variables.putValue("pickId", event.getString("pickId"));
}
if (event.get("shipmentId") != null) {
variables.putValue("shipmentId", event.getString("shipmentId"));
}
return variables;
}
示例2: testCallCaseAsExpressionStartsWithDollar
import org.camunda.bpm.engine.variable.VariableMap; //导入方法依赖的package包/类
@Deployment(resources = {
"org/camunda/bpm/engine/test/cmmn/casetask/CaseTaskTest.testCallCaseAsExpressionStartsWithDollar.cmmn",
"org/camunda/bpm/engine/test/api/cmmn/oneTaskCase.cmmn"
})
public void testCallCaseAsExpressionStartsWithDollar() {
// given
// a deployed case definition
VariableMap vars = new VariableMapImpl();
vars.putValue("oneTaskCase", ONE_TASK_CASE);
String superCaseInstanceId = createCaseInstanceByKey(ONE_CASE_TASK_CASE, vars).getId();
String caseTaskId = queryCaseExecutionByActivityId(CASE_TASK).getId();
// then
CaseExecutionEntity subCaseInstance = (CaseExecutionEntity) queryOneTaskCaseInstance();
assertNotNull(subCaseInstance);
String superCaseExecutionId = subCaseInstance.getSuperCaseExecutionId();
CaseExecution superCaseExecution = queryCaseExecutionById(superCaseExecutionId);
assertEquals(caseTaskId, superCaseExecutionId);
assertEquals(superCaseInstanceId, superCaseExecution.getCaseInstanceId());
// complete ////////////////////////////////////////////////////////
terminate(subCaseInstance.getId());
close(subCaseInstance.getId());
assertCaseEnded(subCaseInstance.getId());
terminate(caseTaskId);
close(superCaseInstanceId);
assertCaseEnded(superCaseInstanceId);
}
示例3: testCallCaseAsExpressionStartsWithHash
import org.camunda.bpm.engine.variable.VariableMap; //导入方法依赖的package包/类
@Deployment(resources = {
"org/camunda/bpm/engine/test/cmmn/casetask/CaseTaskTest.testCallCaseAsExpressionStartsWithHash.cmmn",
"org/camunda/bpm/engine/test/api/cmmn/oneTaskCase.cmmn"
})
public void testCallCaseAsExpressionStartsWithHash() {
// given
// a deployed case definition
VariableMap vars = new VariableMapImpl();
vars.putValue("oneTaskCase", ONE_TASK_CASE);
String superCaseInstanceId = createCaseInstanceByKey(ONE_CASE_TASK_CASE, vars).getId();
String caseTaskId = queryCaseExecutionByActivityId(CASE_TASK).getId();
// then
CaseExecutionEntity subCaseInstance = (CaseExecutionEntity) queryOneTaskCaseInstance();
assertNotNull(subCaseInstance);
String superCaseExecutionId = subCaseInstance.getSuperCaseExecutionId();
CaseExecution superCaseExecution = queryCaseExecutionById(superCaseExecutionId);
assertEquals(caseTaskId, superCaseExecutionId);
assertEquals(superCaseInstanceId, superCaseExecution.getCaseInstanceId());
// complete ////////////////////////////////////////////////////////
terminate(subCaseInstance.getId());
close(subCaseInstance.getId());
assertCaseEnded(subCaseInstance.getId());
terminate(caseTaskId);
close(superCaseInstanceId);
assertCaseEnded(superCaseInstanceId);
}
示例4: mapInputVariables
import org.camunda.bpm.engine.variable.VariableMap; //导入方法依赖的package包/类
@Override
public void mapInputVariables(DelegateExecution superExecution, VariableMap subVariables) {
subVariables.putValue("orderId",superExecution.getVariable("orderId"));
}
示例5: testCallCaseByVersionAsExpressionStartsWithDollar
import org.camunda.bpm.engine.variable.VariableMap; //导入方法依赖的package包/类
@Deployment(resources = {
"org/camunda/bpm/engine/test/cmmn/casetask/CaseTaskTest.testCallCaseByVersionAsExpressionStartsWithDollar.cmmn",
"org/camunda/bpm/engine/test/api/cmmn/oneTaskCase.cmmn"
})
public void testCallCaseByVersionAsExpressionStartsWithDollar() {
// given
String bpmnResourceName = "org/camunda/bpm/engine/test/api/cmmn/oneTaskCase.cmmn";
String secondDeploymentId = repositoryService.createDeployment()
.addClasspathResource(bpmnResourceName)
.deploy()
.getId();
String thirdDeploymentId = repositoryService.createDeployment()
.addClasspathResource(bpmnResourceName)
.deploy()
.getId();
assertEquals(4, repositoryService.createCaseDefinitionQuery().count());
VariableMap vars = new VariableMapImpl();
vars.putValue("myVersion", 2);
String superCaseInstanceId = createCaseInstanceByKey(ONE_CASE_TASK_CASE,vars).getId();
String caseTaskId = queryCaseExecutionByActivityId(CASE_TASK).getId();
String caseDefinitionIdInSecondDeployment = repositoryService
.createCaseDefinitionQuery()
.caseDefinitionKey(ONE_TASK_CASE)
.deploymentId(secondDeploymentId)
.singleResult()
.getId();
// then
CaseExecutionEntity subCaseInstance = (CaseExecutionEntity) queryOneTaskCaseInstance();
assertNotNull(subCaseInstance);
String superCaseExecutionId = subCaseInstance.getSuperCaseExecutionId();
CaseExecution superCaseExecution = queryCaseExecutionById(superCaseExecutionId);
assertEquals(caseTaskId, superCaseExecutionId);
assertEquals(superCaseInstanceId, superCaseExecution.getCaseInstanceId());
assertEquals(caseDefinitionIdInSecondDeployment, subCaseInstance.getCaseDefinitionId());
// complete ////////////////////////////////////////////////////////
terminate(subCaseInstance.getId());
close(subCaseInstance.getId());
assertCaseEnded(subCaseInstance.getId());
terminate(caseTaskId);
close(superCaseInstanceId);
assertCaseEnded(superCaseInstanceId);
repositoryService.deleteDeployment(secondDeploymentId, true);
repositoryService.deleteDeployment(thirdDeploymentId, true);
}
示例6: testInputSourceDifferentTarget
import org.camunda.bpm.engine.variable.VariableMap; //导入方法依赖的package包/类
/**
* 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);
}
示例7: testInputSourceExpression
import org.camunda.bpm.engine.variable.VariableMap; //导入方法依赖的package包/类
/**
* Default manual activation changed - add variables to case instantiation, remove manual activation
*/
@Deployment(resources = {
"org/camunda/bpm/engine/test/cmmn/casetask/CaseTaskTest.testInputSourceExpression.cmmn",
"org/camunda/bpm/engine/test/api/cmmn/oneTaskCase.cmmn"
})
public void testInputSourceExpression() {
// 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((long)1000, 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);
}
示例8: testInputAll
import org.camunda.bpm.engine.variable.VariableMap; //导入方法依赖的package包/类
@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);
}
示例9: testVariablesRoundtrip
import org.camunda.bpm.engine.variable.VariableMap; //导入方法依赖的package包/类
/**
* assertion on variables - change subprocess definition
*/
@Deployment(resources = {
"org/camunda/bpm/engine/test/cmmn/casetask/CaseTaskTest.testVariablesRoundtrip.cmmn",
"org/camunda/bpm/engine/test/api/cmmn/oneTaskCaseWithManualActivation.cmmn"
})
public void testVariablesRoundtrip() {
// given
VariableMap vars = new VariableMapImpl();
vars.putValue("aVariable", "xyz");
vars.putValue("anotherVariable", 123);
String superCaseInstanceId = createCaseInstanceByKey(ONE_CASE_TASK_CASE, vars).getId();
String subCaseInstanceId = queryOneTaskCaseInstance().getId();
caseService
.withCaseExecution(subCaseInstanceId)
.setVariable("aVariable", "abc")
.setVariable("anotherVariable", 999)
.execute();
String humanTaskId = queryCaseExecutionByActivityId("PI_HumanTask_1").getId();
caseService
.withCaseExecution(humanTaskId)
.manualStart();
caseService
.withCaseExecution(humanTaskId)
.complete();
// when
caseService
.withCaseExecution(subCaseInstanceId)
.close();
// then
List<VariableInstance> variables = runtimeService
.createVariableInstanceQuery()
.caseInstanceIdIn(superCaseInstanceId)
.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 ////////////////////////////////////////////////////////
close(superCaseInstanceId);
assertCaseEnded(superCaseInstanceId);
}
示例10: testlocalConfigurationWithNestedChangingExpression
import org.camunda.bpm.engine.variable.VariableMap; //导入方法依赖的package包/类
@Test
public void testlocalConfigurationWithNestedChangingExpression() throws ParseException {
BpmnModelInstance bpmnModelInstance = Bpmn.createExecutableProcess("process")
.startEvent()
.serviceTask()
.camundaClass("foo")
.camundaAsyncBefore()
.camundaFailedJobRetryTimeCycle("${var}")
.endEvent()
.done();
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
Date startDate = simpleDateFormat.parse("2017-01-01T09:55:00");
ClockUtil.setCurrentTime(startDate);
testRule.deploy(bpmnModelInstance);
VariableMap params = Variables.createVariables();
params.putValue("var", "${nestedVar1},PT15M,${nestedVar3}");
params.putValue("nestedVar", "PT13M");
params.putValue("nestedVar1", "PT5M");
params.putValue("nestedVar3", "PT25M");
ProcessInstance pi = runtimeService.startProcessInstanceByKey("process", params);
ClockUtil.setCurrentTime(SIMPLE_DATE_FORMAT.parse("2017-01-01T09:55:00"));
assertNotNull(pi);
Date currentTime = SIMPLE_DATE_FORMAT.parse("2017-01-01T10:00:00");
ClockUtil.setCurrentTime(currentTime);
String processInstanceId = pi.getProcessInstanceId();
int jobRetries = executeJob(processInstanceId);
assertEquals(3, jobRetries);
currentTime = DateUtils.addMinutes(currentTime, 5);
assertLockExpirationTime(currentTime);
ClockUtil.setCurrentTime(currentTime);
jobRetries = executeJob(processInstanceId);
assertEquals(2, jobRetries);
currentTime = DateUtils.addMinutes(currentTime, 15);
assertLockExpirationTime(currentTime);
ClockUtil.setCurrentTime(currentTime);
runtimeService.setVariable(pi.getProcessInstanceId(), "var", "${nestedVar}");
jobRetries = executeJob(processInstanceId);
assertEquals(1, jobRetries);
currentTime = DateUtils.addMinutes(currentTime, 13);
assertLockExpirationTime(currentTime);
ClockUtil.setCurrentTime(currentTime);
jobRetries = executeJob(processInstanceId);
assertEquals(0, jobRetries);
}
示例11: mapInputVariables
import org.camunda.bpm.engine.variable.VariableMap; //导入方法依赖的package包/类
@Override
public void mapInputVariables(DelegateExecution execution, VariableMap variables) {
variables.putValue("TestInputVar", "inValue");
}