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


Java ProcessEngine.getDynamicBpmnService方法代码示例

本文整理汇总了Java中org.activiti.engine.ProcessEngine.getDynamicBpmnService方法的典型用法代码示例。如果您正苦于以下问题:Java ProcessEngine.getDynamicBpmnService方法的具体用法?Java ProcessEngine.getDynamicBpmnService怎么用?Java ProcessEngine.getDynamicBpmnService使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.activiti.engine.ProcessEngine的用法示例。


在下文中一共展示了ProcessEngine.getDynamicBpmnService方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: main

import org.activiti.engine.ProcessEngine; //导入方法依赖的package包/类
public static void main(String[] args) throws InterruptedException {
// Build process enigne
ProcessEngine processEngine = new StandaloneInMemProcessEngineConfiguration()
								// enable process definition info cache
								 .setEnableProcessDefinitionInfoCache(true)
								 .buildProcessEngine();
   
   RepositoryService repositoryService = processEngine.getRepositoryService();
   RuntimeService runtimeService = processEngine.getRuntimeService();
   
   // deploy process definition
   repositoryService.createDeployment()
     .addClasspathResource("dynamic-service-task.bpmn20.xml")
     .deploy();
   
   // this will invoke OldServiceTask
   ProcessInstance processInstance = 
   		runtimeService.startProcessInstanceByKey("dynamic-service-task");

   String processDefinitionId = processInstance.getProcessDefinitionId();
   
   // change service task class name
   System.out.println("==== changing service task class name ====");
   
   DynamicBpmnService dynamicBpmnService = processEngine.getDynamicBpmnService();
   ObjectNode infoNode = dynamicBpmnService
   					.changeServiceTaskClassName("dynamicServiceTask", 
   							"org.activiti.examples.NewServiceTask");
   
   dynamicBpmnService.saveProcessDefinitionInfo(processDefinitionId, infoNode);
   
   // this will invoke NewServiceTask
   processInstance = runtimeService.startProcessInstanceByKey("dynamic-service-task");
 }
 
开发者ID:balsarori,项目名称:activiti-examples,代码行数:35,代码来源:ChangeServiceClass.java

示例2: main

import org.activiti.engine.ProcessEngine; //导入方法依赖的package包/类
public static void main(String[] args) throws InterruptedException {
// Build process enigne
ProcessEngine processEngine = new StandaloneInMemProcessEngineConfiguration()
								// enable process definition info cache
								 .setEnableProcessDefinitionInfoCache(true)
								 .buildProcessEngine();
   
   RepositoryService repositoryService = processEngine.getRepositoryService();
   RuntimeService runtimeService = processEngine.getRuntimeService();
   
   // deploy process definition
   repositoryService.createDeployment()
     .addClasspathResource("dynamic-script-task.bpmn20.xml")
     .deploy();
   
   String processDefinitionId = repositoryService.createProcessDefinitionQuery()
								.singleResult().getId();
   
   DynamicBpmnService dynamicBpmnService = processEngine.getDynamicBpmnService();
   ObjectNode infoNode = dynamicBpmnService
   					.changeScriptTaskScript("scriptTask", 
   							"java.lang.System.out.println(\"New output\");");
   
   dynamicBpmnService.saveProcessDefinitionInfo(processDefinitionId, infoNode);
   
   // start a process instance
   runtimeService.startProcessInstanceByKey("dynamic-script-task");
   
 }
 
开发者ID:balsarori,项目名称:activiti-examples,代码行数:30,代码来源:ChangeScriptTask.java

示例3: main

import org.activiti.engine.ProcessEngine; //导入方法依赖的package包/类
public static void main(String[] args) throws InterruptedException {
// Build process enigne
ProcessEngine processEngine = new StandaloneInMemProcessEngineConfiguration()
								// enable process definition info cache
								 .setEnableProcessDefinitionInfoCache(true)
								 .buildProcessEngine();
   
   RepositoryService repositoryService = processEngine.getRepositoryService();
   RuntimeService runtimeService = processEngine.getRuntimeService();
   
   // deploy process definition
   repositoryService.createDeployment()
     .addClasspathResource("dynamic-user-task.bpmn20.xml")
     .deploy();
   
   String processDefinitionId = repositoryService.createProcessDefinitionQuery()
								.singleResult().getId();
   
   // change user task candidate groups
   DynamicBpmnService dynamicBpmnService = processEngine.getDynamicBpmnService();
   ObjectNode infoNode = dynamicBpmnService
   					.changeUserTaskCandidateGroup("userTask", 
   							"management", true);
   
   dynamicBpmnService.saveProcessDefinitionInfo(processDefinitionId, infoNode);
   
   // start a process instance
   runtimeService.startProcessInstanceByKey("dynamic-user-task");

   TaskService taskService = processEngine.getTaskService();
   
   // tasks claimable by users group
   long count = taskService.createTaskQuery()
		.taskCandidateGroup("users").count();
   
   System.out.println("tasks claimable by users group " + count);
   
   // fetch the task (tasks claimable by management group)
   Task task = taskService.createTaskQuery()
   				.taskCandidateGroup("management")
   				.singleResult();
   
   // claim task and complete
   taskService.claim(task.getId(), "manager");
   taskService.complete(task.getId());
   
 }
 
开发者ID:balsarori,项目名称:activiti-examples,代码行数:48,代码来源:ChangeUserTask.java


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