当前位置: 首页>>代码示例>>Java>>正文


Java PvmProcessInstance.setVariable方法代码示例

本文整理汇总了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();
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:23,代码来源:CallActivityBehavior.java

示例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"));
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:40,代码来源:PvmTest.java

示例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());
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:28,代码来源:PvmVariablesTest.java

示例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"));
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:40,代码来源:PvmTest.java

示例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());
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:29,代码来源:PvmVariablesTest.java

示例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();
}
 
开发者ID:iotsap,项目名称:FiWare-Template-Handler,代码行数:28,代码来源:CallActivityBehavior.java

示例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();
 }
 
开发者ID:springvelocity,项目名称:xbpm5,代码行数:29,代码来源:CallActivityBehavior.java


注:本文中的org.activiti.engine.impl.pvm.PvmProcessInstance.setVariable方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。