本文整理汇总了Java中org.activiti.engine.impl.pvm.PvmProcessInstance.setVariable方法的典型用法代码示例。如果您正苦于以下问题:Java PvmProcessInstance.setVariable方法的具体用法?Java PvmProcessInstance.setVariable怎么用?Java PvmProcessInstance.setVariable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.activiti.engine.impl.pvm.PvmProcessInstance
的用法示例。
在下文中一共展示了PvmProcessInstance.setVariable方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: execute
import org.activiti.engine.impl.pvm.PvmProcessInstance; //导入方法依赖的package包/类
public void execute(ActivityExecution execution) throws Exception {
ProcessDefinitionImpl processDefinition = Context
.getProcessEngineConfiguration()
.getDeploymentCache()
.findDeployedLatestProcessDefinitionByKey(processDefinitonKey);
PvmProcessInstance subProcessInstance = execution.createSubProcessInstance(processDefinition);
// copy process variables
for (AbstractDataAssociation dataInputAssociation : dataInputAssociations) {
Object value = null;
if (dataInputAssociation.getSourceExpression()!=null) {
value = dataInputAssociation.getSourceExpression().getValue(execution);
}
else {
value = execution.getVariable(dataInputAssociation.getSource());
}
subProcessInstance.setVariable(dataInputAssociation.getTarget(), value);
}
subProcessInstance.start();
}
示例2: testPvmDecision
import org.activiti.engine.impl.pvm.PvmProcessInstance; //导入方法依赖的package包/类
public void testPvmDecision() {
PvmProcessDefinition processDefinition = new ProcessDefinitionBuilder()
.createActivity("start")
.initial()
.behavior(new Automatic())
.transition("checkCredit")
.endActivity()
.createActivity("checkCredit")
.behavior(new Decision())
.transition("askDaughterOut", "wow")
.transition("takeToGolf", "nice")
.transition("ignore", "default")
.endActivity()
.createActivity("takeToGolf")
.behavior(new WaitState())
.endActivity()
.createActivity("askDaughterOut")
.behavior(new WaitState())
.endActivity()
.createActivity("ignore")
.behavior(new WaitState())
.endActivity()
.buildProcessDefinition();
PvmProcessInstance processInstance = processDefinition.createProcessInstance();
processInstance.setVariable("creditRating", "Aaa-");
processInstance.start();
assertNotNull(processInstance.findExecution("takeToGolf"));
processInstance = processDefinition.createProcessInstance();
processInstance.setVariable("creditRating", "AAA+");
processInstance.start();
assertNotNull(processInstance.findExecution("askDaughterOut"));
processInstance = processDefinition.createProcessInstance();
processInstance.setVariable("creditRating", "bb-");
processInstance.start();
assertNotNull(processInstance.findExecution("ignore"));
}
示例3: testVariables
import org.activiti.engine.impl.pvm.PvmProcessInstance; //导入方法依赖的package包/类
public void testVariables() {
PvmProcessDefinition processDefinition = new ProcessDefinitionBuilder()
.createActivity("a")
.initial()
.behavior(new WaitState())
.endActivity()
.buildProcessDefinition();
PvmProcessInstance processInstance = processDefinition.createProcessInstance();
processInstance.setVariable("amount", 500L);
processInstance.setVariable("msg", "hello world");
processInstance.start();
assertEquals(500L, processInstance.getVariable("amount"));
assertEquals("hello world", processInstance.getVariable("msg"));
PvmExecution activityInstance = processInstance.findExecution("a");
assertEquals(500L, activityInstance.getVariable("amount"));
assertEquals("hello world", activityInstance.getVariable("msg"));
Map<String, Object> expectedVariables = new HashMap<String, Object>();
expectedVariables.put("amount", 500L);
expectedVariables.put("msg", "hello world");
assertEquals(expectedVariables, activityInstance.getVariables());
assertEquals(expectedVariables, processInstance.getVariables());
}
示例4: testPvmDecision
import org.activiti.engine.impl.pvm.PvmProcessInstance; //导入方法依赖的package包/类
public void testPvmDecision() {
PvmProcessDefinition processDefinition = new ProcessDefinitionBuilder()
.createActivity("start")
.initial()
.behavior(new Automatic())
.transition("checkCredit")
.endActivity()
.createActivity("checkCredit")
.behavior(new Decision())
.transition("askDaughterOut", "wow")
.transition("takeToGolf", "nice")
.transition("ignore", "default")
.endActivity()
.createActivity("takeToGolf")
.behavior(new WaitState())
.endActivity()
.createActivity("askDaughterOut")
.behavior(new WaitState())
.endActivity()
.createActivity("ignore")
.behavior(new WaitState())
.endActivity()
.buildProcessDefinition();
PvmProcessInstance processInstance = processDefinition.createProcessInstance();
processInstance.setVariable("creditRating", "Aaa-");
processInstance.start();
assertNotNull(processInstance.findExecution("takeToGolf"));
processInstance = processDefinition.createProcessInstance();
processInstance.setVariable("creditRating", "AAA+");
processInstance.start();
assertNotNull(processInstance.findExecution("askDaughterOut"));
processInstance = processDefinition.createProcessInstance();
processInstance.setVariable("creditRating", "bb-");
processInstance.start();
assertNotNull(processInstance.findExecution("ignore"));
}
示例5: testVariables
import org.activiti.engine.impl.pvm.PvmProcessInstance; //导入方法依赖的package包/类
@Test
public void testVariables() {
PvmProcessDefinition processDefinition = new ProcessDefinitionBuilder()
.createActivity("a")
.initial()
.behavior(new WaitState())
.endActivity()
.buildProcessDefinition();
PvmProcessInstance processInstance = processDefinition.createProcessInstance();
processInstance.setVariable("amount", 500L);
processInstance.setVariable("msg", "hello world");
processInstance.start();
assertEquals(500L, processInstance.getVariable("amount"));
assertEquals("hello world", processInstance.getVariable("msg"));
PvmExecution activityInstance = processInstance.findExecution("a");
assertEquals(500L, activityInstance.getVariable("amount"));
assertEquals("hello world", activityInstance.getVariable("msg"));
Map<String, Object> expectedVariables = new HashMap<String, Object>();
expectedVariables.put("amount", 500L);
expectedVariables.put("msg", "hello world");
assertEquals(expectedVariables, activityInstance.getVariables());
assertEquals(expectedVariables, processInstance.getVariables());
}
示例6: execute
import org.activiti.engine.impl.pvm.PvmProcessInstance; //导入方法依赖的package包/类
public void execute(ActivityExecution execution) throws Exception {
if ((processDefinitonKey == null) && (processDefinitionExpression != null)) {
processDefinitonKey = (String) processDefinitionExpression.getValue(execution);
}
ProcessDefinitionImpl processDefinition = Context
.getProcessEngineConfiguration()
.getDeploymentCache()
.findDeployedLatestProcessDefinitionByKey(processDefinitonKey);
PvmProcessInstance subProcessInstance = execution.createSubProcessInstance(processDefinition);
// copy process variables
for (AbstractDataAssociation dataInputAssociation : dataInputAssociations) {
Object value = null;
if (dataInputAssociation.getSourceExpression()!=null) {
value = dataInputAssociation.getSourceExpression().getValue(execution);
}
else {
value = execution.getVariable(dataInputAssociation.getSource());
}
subProcessInstance.setVariable(dataInputAssociation.getTarget(), value);
}
subProcessInstance.start();
}
示例7: execute
import org.activiti.engine.impl.pvm.PvmProcessInstance; //导入方法依赖的package包/类
public void execute(ActivityExecution execution) throws Exception {
String processDefinitonKey = this.processDefinitonKey;
if (processDefinitionExpression != null) {
processDefinitonKey = (String) processDefinitionExpression.getValue(execution);
}
ProcessDefinitionImpl processDefinition = Context
.getProcessEngineConfiguration()
.getDeploymentManager()
.findDeployedLatestProcessDefinitionByKey(processDefinitonKey);
PvmProcessInstance subProcessInstance = execution.createSubProcessInstance(processDefinition);
// copy process variables
for (AbstractDataAssociation dataInputAssociation : dataInputAssociations) {
Object value = null;
if (dataInputAssociation.getSourceExpression()!=null) {
value = dataInputAssociation.getSourceExpression().getValue(execution);
}
else {
value = execution.getVariable(dataInputAssociation.getSource());
}
subProcessInstance.setVariable(dataInputAssociation.getTarget(), value);
}
subProcessInstance.start();
}