Repository navigation
Expand file tree
/
Copy pathScriptDefaultConstants.java
More file actions
139 lines (125 loc) · 4.07 KB
/
Copy pathScriptDefaultConstants.java
File metadata and controls
139 lines (125 loc) · 4.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
package com.codingapi.flow.script;
/**
* 默认脚本定义
*/
public class ScriptDefaultConstants {
/**
* 默认自定义动作脚本
*/
public static final String SCRIPT_DEFAULT_ACTION_CUSTOM = """
// @SCRIPT_TITLE 默认条件 触发通过
// @SCRIPT_META {"trigger":"PASS"}
def run(request){
return 'PASS';
}
""";
/**
* 默认动作显示脚本
*/
public static final String SCRIPT_DEFAULT_ACTION_DISPLAY = """
// @SCRIPT_TITLE 默认显示
def run(request){
return true;
}
""";
/**
* 默认拒绝动作脚本
*/
public static final String SCRIPT_DEFAULT_ACTION_REJECT = """
// @SCRIPT_TITLE 返回开始节点
// @SCRIPT_META {"type":"START"}
def run(request){
return request.getStartNode().getId();
}
""";
/**
* 默认条件脚本
*/
public static final String SCRIPT_DEFAULT_CONDITION = """
// @SCRIPT_TITLE 默认条件(允许执行)
def run(request){
return true;
}
""";
/**
* 默认异常触发脚本(issue #296)
* <p>
* 默认行为为「异常提示」:不跳转、不兜底,阻断本次操作并提示用户,避免历史默认的
* 「回退至开始节点」让发起人误以为流程已正常流转。业务方可通过
* {@code ScriptRegistryContext#setRegistry} 覆盖文案或改为指定节点/指定人员。
*/
public static final String SCRIPT_DEFAULT_ERROR_TRIGGER = """
// @SCRIPT_TITLE 异常提示
// @SCRIPT_META {"type":"prompt"}
def run(request){
return [type:'prompt', message:'流程未匹配到审批人,无法继续处理,请联系流程管理员']
}
""";
/**
* 默认节点标题脚本
*/
public static final String SCRIPT_DEFAULT_NODE_TITLE = """
// @SCRIPT_TITLE 你有一条待办
def run(request){
return '你有一条待办'
}
""";
/**
* 默认人员加载脚本
*/
public static final String SCRIPT_DEFAULT_OPERATOR_LOAD = """
// @SCRIPT_TITLE 流程创建者
// @SCRIPT_META {"type":"creator"}
def run(request){
return [request.getCreatedOperatorId()]
}
""";
/**
* 默认人员匹配脚本
*/
public static final String SCRIPT_DEFAULT_OPERATOR_MATCH = """
// @SCRIPT_TITLE 任意用户
// @SCRIPT_META {"type":"any"}
def run(request){
return true
}
""";
/**
* 默认路由脚本
*/
public static final String SCRIPT_DEFAULT_ROUTER = """
// @SCRIPT_TITLE 发起节点
// @SCRIPT_META {"node":"START"}
def run(request){
return request.getStartNode().getId();
}
""";
/**
* 默认子流程脚本
*/
public static final String SCRIPT_DEFAULT_SUB_PROCESS = """
// @SCRIPT_TITLE 创建当前流程
def run(request){
return request.toCreateRequest()
}
""";
/**
* 默认子流程结果确认脚本:等待本次创建的全部子流程结束。
*/
public static final String SCRIPT_DEFAULT_SUB_PROCESS_RESULT = """
// @SCRIPT_TITLE 全部子流程结束后继续
def run(request){
return request.findSubProcessRecords(request.getCurrentNode().getId()).size()
== request.getSubProcessTotal();
}
""";
/**
* 默认触发脚本
*/
public static final String SCRIPT_DEFAULT_TRIGGER = """
// @SCRIPT_TITLE 示例触发节点(打印触发日志)
def run(request){
print('hello trigger node.\\n');
}
""";
}