提交 | 用户 | 时间
|
bb2880
|
1 |
package com.iailab.module.bpm.framework.flowable.core.candidate.strategy.form; |
H |
2 |
|
|
3 |
import cn.hutool.core.convert.Convert; |
|
4 |
import cn.hutool.core.lang.Assert; |
|
5 |
import com.iailab.module.bpm.framework.flowable.core.candidate.BpmTaskCandidateStrategy; |
|
6 |
import com.iailab.module.bpm.framework.flowable.core.candidate.strategy.user.BpmTaskCandidateUserStrategy; |
|
7 |
import com.iailab.module.bpm.framework.flowable.core.enums.BpmTaskCandidateStrategyEnum; |
|
8 |
import org.flowable.bpmn.model.BpmnModel; |
|
9 |
import org.flowable.engine.delegate.DelegateExecution; |
|
10 |
import org.springframework.stereotype.Component; |
|
11 |
|
|
12 |
import java.util.Map; |
|
13 |
import java.util.Set; |
|
14 |
|
|
15 |
/** |
|
16 |
* 表单内用户字段 {@link BpmTaskCandidateUserStrategy} 实现类 |
|
17 |
* |
|
18 |
* @author hou |
|
19 |
*/ |
|
20 |
@Component |
|
21 |
public class BpmTaskCandidateFormUserStrategy implements BpmTaskCandidateStrategy { |
|
22 |
|
|
23 |
@Override |
|
24 |
public BpmTaskCandidateStrategyEnum getStrategy() { |
|
25 |
return BpmTaskCandidateStrategyEnum.FORM_USER; |
|
26 |
} |
|
27 |
|
|
28 |
@Override |
|
29 |
public void validateParam(String param) { |
|
30 |
Assert.notEmpty(param, "表单内用户字段不能为空"); |
|
31 |
} |
|
32 |
|
|
33 |
@Override |
|
34 |
public Set<Long> calculateUsersByTask(DelegateExecution execution, String param) { |
|
35 |
Object result = execution.getVariable(param); |
|
36 |
return Convert.toSet(Long.class, result); |
|
37 |
} |
|
38 |
|
|
39 |
@Override |
|
40 |
public Set<Long> calculateUsersByActivity(BpmnModel bpmnModel, String activityId, |
|
41 |
String param, Long startUserId, String processDefinitionId, |
|
42 |
Map<String, Object> processVariables) { |
|
43 |
Object result = processVariables == null ? null : processVariables.get(param); |
|
44 |
return Convert.toSet(Long.class, result); |
|
45 |
} |
|
46 |
|
|
47 |
} |