|
|
@@ -14,6 +14,7 @@ import org.flowable.bpmn.model.UserTask;
|
|
|
import org.flowable.engine.delegate.DelegateExecution;
|
|
|
import org.flowable.engine.impl.bpmn.behavior.AbstractBpmnActivityBehavior;
|
|
|
import org.flowable.engine.impl.bpmn.behavior.ParallelMultiInstanceBehavior;
|
|
|
+import org.flowable.common.engine.api.delegate.Expression;
|
|
|
|
|
|
import java.util.List;
|
|
|
import java.util.Set;
|
|
|
@@ -56,14 +57,7 @@ public class BpmParallelMultiInstanceBehavior extends ParallelMultiInstanceBehav
|
|
|
protected int resolveNrOfInstances(DelegateExecution execution) {
|
|
|
// 情况一:UserTask 节点
|
|
|
if (execution.getCurrentFlowElement() instanceof UserTask) {
|
|
|
- // 第一步,设置 collectionVariable 和 CollectionVariable
|
|
|
- // 从 execution.getVariable() 读取所有任务处理人的 key
|
|
|
- super.collectionExpression = null; // collectionExpression 和 collectionVariable 是互斥的
|
|
|
- super.collectionVariable = FlowableUtils.formatExecutionCollectionVariable(execution.getCurrentActivityId());
|
|
|
- // 从 execution.getVariable() 读取当前所有任务处理的人的 key
|
|
|
- super.collectionElementVariable = FlowableUtils.formatExecutionCollectionElementVariable(execution.getCurrentActivityId());
|
|
|
-
|
|
|
- // 第二步,获取任务的所有处理人
|
|
|
+ // 获取任务的所有处理人
|
|
|
@SuppressWarnings("unchecked")
|
|
|
Set<Long> assigneeUserIds = (Set<Long>) execution.getVariable(super.collectionVariable, Set.class);
|
|
|
if (assigneeUserIds == null) {
|
|
|
@@ -94,4 +88,21 @@ public class BpmParallelMultiInstanceBehavior extends ParallelMultiInstanceBehav
|
|
|
return super.resolveNrOfInstances(execution);
|
|
|
}
|
|
|
|
|
|
+ // ========== 屏蔽解析器覆写 ==========
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void setCollectionExpression(Expression collectionExpression) {
|
|
|
+ // 保持自定义变量名,忽略解析器写入的 collection 表达式
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void setCollectionVariable(String collectionVariable) {
|
|
|
+ // 保持自定义变量名,忽略解析器写入的 collection 变量名
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void setCollectionElementVariable(String collectionElementVariable) {
|
|
|
+ // 保持自定义变量名,忽略解析器写入的单元素变量名
|
|
|
+ }
|
|
|
+
|
|
|
}
|