zoukankan      html  css  js  c++  java
  • flowable 多实例动态添加人

    背景:

    由于在日常情况下,我们的多实例要动态添加人员的场景,有没有这样的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) "对象值"));
  • 相关阅读:
    GUI常用监听事件
    GUI容器之布局管理器
    布局管理器的综合应用
    GUI容器之Panel
    mongodb
    redis持久化
    本地window启动redis
    redis主从模式
    hash 哈希
    set集合
  • 原文地址:https://www.cnblogs.com/liuwenjun/p/10315993.html
Copyright © 2011-2022 走看看