提交 | 用户 | 时间
bb2880 1 package com.iailab.module.bpm.framework.flowable.core.candidate.strategy.other;
e7c126 2
H 3 import cn.hutool.core.convert.Convert;
4 import com.iailab.module.bpm.framework.flowable.core.candidate.BpmTaskCandidateStrategy;
5 import com.iailab.module.bpm.framework.flowable.core.enums.BpmTaskCandidateStrategyEnum;
6 import com.iailab.module.bpm.framework.flowable.core.util.FlowableUtils;
bb2880 7 import org.flowable.bpmn.model.BpmnModel;
e7c126 8 import org.flowable.engine.delegate.DelegateExecution;
H 9 import org.springframework.stereotype.Component;
10
bb2880 11 import java.util.Map;
e7c126 12 import java.util.Set;
H 13
14 /**
15  * 流程表达式 {@link BpmTaskCandidateStrategy} 实现类
16  *
17  * @author iailab
18  */
19 @Component
20 public class BpmTaskCandidateExpressionStrategy implements BpmTaskCandidateStrategy {
21
22     @Override
23     public BpmTaskCandidateStrategyEnum getStrategy() {
24         return BpmTaskCandidateStrategyEnum.EXPRESSION;
25     }
26
27     @Override
28     public void validateParam(String param) {
29         // do nothing 因为它基本做不了校验
30     }
31
32     @Override
bb2880 33     public Set<Long> calculateUsersByTask(DelegateExecution execution, String param) {
e7c126 34         Object result = FlowableUtils.getExpressionValue(execution, param);
H 35         return Convert.toSet(Long.class, result);
36     }
37
bb2880 38     @Override
H 39     public Set<Long> calculateUsersByActivity(BpmnModel bpmnModel, String activityId, String param,
40                                               Long startUserId, String processDefinitionId, Map<String, Object> processVariables) {
41         Object result = FlowableUtils.getExpressionValue(processVariables, param);
42         return Convert.toSet(Long.class, result);
43     }
44
e7c126 45 }