码迷,mamicode.com
首页 > 其他好文 > 详细

flowable 多实例动态添加人

时间:2019-01-24 18:53:39      阅读:1019      评论:0      收藏:0      [点我收藏+]

标签:org   order   class   col   exec   completed   key   iss   equals   

背景:

由于在日常情况下,我们的多实例要动态添加人员的场景,有没有这样的api呢?新的flowable有这样的功能。

具体实现

xml 

<userTask id="miTasks" name="My Task ${loopCounter}" activiti:assignee="${assignee}">
      <multiInstanceLoopCharacteristics isSequential="false">
        <loopDataInputRef>assigneeList</loopDataInputRef>
        <inputDataItem name="assignee" />
        <completionCondition>${nrOfCompletedInstances/nrOfInstances >= 0.6 }</completionCondition>
      </multiInstanceLoopCharacteristics>
    </userTask>

具体实现

List<String> assigneeList = Arrays.asList("kermit", "gonzo", "mispiggy", "fozzie", "bubba");
String procId = runtimeService.startProcessInstanceByKey("miParallelUserTasksBasedOnCollection", CollectionUtil.singletonMap("assigneeList", assigneeList)).getId();
        
List<org.flowable.task.api.Task> tasks = taskService.createTaskQuery().orderByTaskAssignee().asc().list();
assertEquals(5, tasks.size());
assertEquals("bubba", tasks.get(0).getAssignee());
assertEquals("fozzie", tasks.get(1).getAssignee());
assertEquals("gonzo", tasks.get(2).getAssignee());
assertEquals("kermit", tasks.get(3).getAssignee());
assertEquals("mispiggy", tasks.get(4).getAssignee());
            
runtimeService.addMultiInstanceExecution("miTasks", procId, Collections.singletonMap("assignee", (Object) "johndoe"));
tasks = taskService.createTaskQuery().orderByTaskAssignee().asc().list();
assertEquals(6, tasks.size());

说明:

runtimeService.addMultiInstanceExecution(要加签的节点id,流程实例id, Collections.singletonMap("单个对象的别名", (Object) "对象值"));

 

flowable 多实例动态添加人

标签:org   order   class   col   exec   completed   key   iss   equals   

原文地址:https://www.cnblogs.com/liuwenjun/p/10315993.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!