本文整理汇总了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");
}
示例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");
}
示例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());
}