Flowable自由跳转

Java
475
0
0
2022-05-15

​Flowable6已经实现了流程节点间的跳转,本次就初探一下相关的API。

相关的示例代码在Flowable的开源代码中可以找到,具体的位置如下:

\modules\flowable-engine\src\test\java\org\flowable\engine\test\api\runtime\changestate

代码:

/**
 * 移动节点
 * www.fhadmin.cn
 */
@RequestMapping(value = "move/{proInstId}/{nodeId}/{toNodeId}")
public void move(@PathVariable("proInstId") String proInstId,
                 @PathVariable("nodeId") String nodeId,
                 @PathVariable("toNodeId") String toNodeId) {
    runtimeService.createChangeActivityStateBuilder()
            .processInstanceId(proInstId)
            .moveActivityIdTo(nodeId, toNodeId)
            .changeState();
}

runtimeService.createChangeActivityStateBuilder()
                .processInstanceId(proInstId)
                .moveActivityIdTo(nodeId, toNodeId)
                .changeState();