Activiti7 获取当前任务节点出口连线(动态生成处理节点)

Activiti7 获取当前任务节点出口连线(动态生成处理节点)

Activiti7 中 PVM,ActivitiImpl,PvmTransition ,ExecutionImpl, TransitionImpl 替代方法

通过阅读官方文档:

PVM classes
All classes from the org.activiti.engine.impl.pvm package (and subpackages) have been removed. This is because the PVM (Process Virtual Machine) model has been removed and replaced by a simpler and more lightweight model.

This means that usages of ActivitiImpl, ProcessDefinitionImpl, ExecutionImpl, TransitionImpl are invalid.

Generally, most of the usage of these classes in version 5 came down to getting information that was contained in the process definition. In version 6, all the process definition information can be found through the BpmnModel, which is a Java representation of the BPMN 2.0 XML for the process definition (enhanced to make certain operations and searches easier).

The quickest way to get the BpmnModel for a process definition is to use the org.activiti.engine.impl.util.ProcessDefinitionUtil class:

// The whole model
ProcessDefinitionUtil.getBpmnModel(String processDefinitionId);

// Only the specific process definition
ProcessDefinitionUtil.getProcess(String processDefinitionId);

大致是说:官方为了轻量化,所以就把原来的PVM 流程引擎给优化了、
删了后推荐我们获取bpmnModel或者process来获取模型的参数。

BpmnModel获取方式可以使用官方推荐的,我这边交互刚好只有taskId,就用这个做个demo;

// 获取当前任务
Task task = taskService.createTaskQuery().taskId(taskId).singleResult();
//获取当前模型
BpmnModel bpmnModel = repositoryService.getBpmnModel(task.getProcessDefinitionId());
// 获取当前节点
FlowElement flowElement = bpmnModel.getFlowElement(task.getTaskDefinitionKey());
// 这里不转也有方法拿到,我这是为了后人阅读方便
UserTask userTask = (UserTask)flowElement;
//获取节点出口线段
List<SequenceFlow> outgoingFlows = userTask.getOutgoingFlows();
// 我这边暂时是解析expression 获取条件和约定的值返回到前端构造button
评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值