提交 | 用户 | 时间
|
bb2880
|
1 |
package com.iailab.module.bpm.enums.definition; |
H |
2 |
|
|
3 |
import cn.hutool.core.util.ArrayUtil; |
|
4 |
import com.iailab.framework.common.core.IntArrayValuable; |
|
5 |
import lombok.AllArgsConstructor; |
|
6 |
import lombok.Getter; |
|
7 |
|
|
8 |
import java.util.Arrays; |
|
9 |
import java.util.Objects; |
|
10 |
|
|
11 |
/** |
|
12 |
* 仿钉钉的流程器设计器的模型节点类型 |
|
13 |
* |
|
14 |
* @author hou |
|
15 |
*/ |
|
16 |
@Getter |
|
17 |
@AllArgsConstructor |
|
18 |
public enum BpmSimpleModelNodeType implements IntArrayValuable { |
|
19 |
|
|
20 |
// 0 ~ 1 开始和结束 |
|
21 |
START_NODE(0, "开始", "startEvent"), |
|
22 |
END_NODE(1, "结束", "endEvent"), |
|
23 |
|
|
24 |
// 10 ~ 49 各种节点 |
|
25 |
START_USER_NODE(10, "发起人", "userTask"), // 发起人节点。前端的开始节点,Id 固定 |
|
26 |
APPROVE_NODE(11, "审批人", "userTask"), |
|
27 |
COPY_NODE(12, "抄送人", "serviceTask"), |
|
28 |
|
|
29 |
// 50 ~ 条件分支 |
|
30 |
CONDITION_NODE(50, "条件", "sequenceFlow"), // 用于构建流转条件的表达式 |
|
31 |
CONDITION_BRANCH_NODE(51, "条件分支", "exclusiveGateway"), |
|
32 |
PARALLEL_BRANCH_NODE(52, "并行分支", "parallelGateway"), |
|
33 |
INCLUSIVE_BRANCH_NODE(53, "包容分支", "inclusiveGateway"), |
|
34 |
; |
|
35 |
|
|
36 |
public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(BpmSimpleModelNodeType::getType).toArray(); |
|
37 |
|
|
38 |
private final Integer type; |
|
39 |
private final String name; |
|
40 |
private final String bpmnType; |
|
41 |
|
|
42 |
/** |
|
43 |
* 判断是否为分支节点 |
|
44 |
* |
|
45 |
* @param type 节点类型 |
|
46 |
*/ |
|
47 |
public static boolean isBranchNode(Integer type) { |
|
48 |
return Objects.equals(CONDITION_BRANCH_NODE.getType(), type) |
|
49 |
|| Objects.equals(PARALLEL_BRANCH_NODE.getType(), type) |
|
50 |
|| Objects.equals(INCLUSIVE_BRANCH_NODE.getType(), type); |
|
51 |
} |
|
52 |
|
|
53 |
public static BpmSimpleModelNodeType valueOf(Integer type) { |
|
54 |
return ArrayUtil.firstMatch(nodeType -> nodeType.getType().equals(type), values()); |
|
55 |
} |
|
56 |
|
|
57 |
@Override |
|
58 |
public int[] array() { |
|
59 |
return ARRAYS; |
|
60 |
} |
|
61 |
|
|
62 |
} |