-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathast_workflow.go
More file actions
308 lines (243 loc) · 8.96 KB
/
ast_workflow.go
File metadata and controls
308 lines (243 loc) · 8.96 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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
// SPDX-License-Identifier: Apache-2.0
package ast
// CreateWorkflowStmt represents: CREATE WORKFLOW Module.Name ...
type CreateWorkflowStmt struct {
Name QualifiedName
CreateOrModify bool
Documentation string
// Context parameter entity
ParameterVar string // e.g. "$WorkflowContext"
ParameterEntity QualifiedName // e.g. Module.Entity
// Display metadata
DisplayName string // from DISPLAY 'text'
Description string // from DESCRIPTION 'text'
ExportLevel string // "Hidden" or "API", from EXPORT LEVEL identifier
// Optional metadata
OverviewPage QualifiedName // qualified name of overview page
DueDate string // due date expression
// Activities
Activities []WorkflowActivityNode
}
func (s *CreateWorkflowStmt) isStatement() {}
// DropWorkflowStmt represents: DROP WORKFLOW Module.Name
type DropWorkflowStmt struct {
Name QualifiedName
}
func (s *DropWorkflowStmt) isStatement() {}
// WorkflowActivityNode is the interface for workflow activity AST nodes.
type WorkflowActivityNode interface {
workflowActivityNode()
}
// WorkflowUserTaskNode represents a USER TASK activity.
type WorkflowUserTaskNode struct {
Name string // identifier name
Caption string // display caption
Page QualifiedName
Targeting WorkflowTargetingNode
Entity QualifiedName // user task entity
DueDate string // DUE DATE expression
Outcomes []WorkflowUserTaskOutcomeNode
IsMultiUser bool // Issue #8: true if MULTI USER TASK
BoundaryEvents []WorkflowBoundaryEventNode // Issue #7
TaskDescription string // from DESCRIPTION 'text'
}
func (n *WorkflowUserTaskNode) workflowActivityNode() {}
// WorkflowTargetingNode represents user targeting strategy.
// Kind: "microflow", "xpath", "group_microflow", "group_xpath", or ""
type WorkflowTargetingNode struct {
Kind string // "microflow", "xpath", "group_microflow", "group_xpath", or ""
Microflow QualifiedName // for microflow targeting (user or group)
XPath string // for xpath targeting (user or group)
}
// WorkflowUserTaskOutcomeNode represents an outcome of a user task.
type WorkflowUserTaskOutcomeNode struct {
Caption string
Activities []WorkflowActivityNode
}
// WorkflowCallMicroflowNode represents a CALL MICROFLOW activity.
type WorkflowCallMicroflowNode struct {
Microflow QualifiedName
Caption string
Outcomes []WorkflowConditionOutcomeNode
ParameterMappings []WorkflowParameterMappingNode // Issue #10
BoundaryEvents []WorkflowBoundaryEventNode // Issue #7
}
func (n *WorkflowCallMicroflowNode) workflowActivityNode() {}
// WorkflowCallWorkflowNode represents a CALL WORKFLOW activity.
type WorkflowCallWorkflowNode struct {
Workflow QualifiedName
Caption string
ParameterMappings []WorkflowParameterMappingNode
}
func (n *WorkflowCallWorkflowNode) workflowActivityNode() {}
// WorkflowDecisionNode represents a DECISION activity.
type WorkflowDecisionNode struct {
Expression string // decision expression
Caption string
Outcomes []WorkflowConditionOutcomeNode
}
func (n *WorkflowDecisionNode) workflowActivityNode() {}
// WorkflowConditionOutcomeNode represents an outcome of a decision or call microflow.
type WorkflowConditionOutcomeNode struct {
Value string // "True", "False", "Default", or enumeration value
Activities []WorkflowActivityNode
}
// WorkflowParallelSplitNode represents a PARALLEL SPLIT activity.
type WorkflowParallelSplitNode struct {
Caption string
Paths []WorkflowParallelPathNode
}
func (n *WorkflowParallelSplitNode) workflowActivityNode() {}
// WorkflowParallelPathNode represents a path in a parallel split.
type WorkflowParallelPathNode struct {
PathNumber int
Activities []WorkflowActivityNode
}
// WorkflowJumpToNode represents a JUMP TO activity.
type WorkflowJumpToNode struct {
Target string // name of target activity
Caption string
}
func (n *WorkflowJumpToNode) workflowActivityNode() {}
// WorkflowWaitForTimerNode represents a WAIT FOR TIMER activity.
type WorkflowWaitForTimerNode struct {
DelayExpression string
Caption string
}
func (n *WorkflowWaitForTimerNode) workflowActivityNode() {}
// WorkflowWaitForNotificationNode represents a WAIT FOR NOTIFICATION activity.
type WorkflowWaitForNotificationNode struct {
Caption string
BoundaryEvents []WorkflowBoundaryEventNode // Issue #7
}
func (n *WorkflowWaitForNotificationNode) workflowActivityNode() {}
// WorkflowEndNode represents an END activity.
type WorkflowEndNode struct {
Caption string
}
func (n *WorkflowEndNode) workflowActivityNode() {}
// WorkflowBoundaryEventNode represents a BOUNDARY EVENT clause on a user task.
// Issue #7
type WorkflowBoundaryEventNode struct {
EventType string // "InterruptingTimer", "NonInterruptingTimer", "Timer"
Delay string // ISO duration expression e.g. "${PT1H}"
Activities []WorkflowActivityNode // Sub-flow activities inside the boundary event
}
// WorkflowAnnotationActivityNode represents an ANNOTATION activity in a workflow.
// Issue #9
type WorkflowAnnotationActivityNode struct {
Text string
}
func (n *WorkflowAnnotationActivityNode) workflowActivityNode() {}
// WorkflowParameterMappingNode represents a parameter mapping in a CALL MICROFLOW WITH clause.
// Issue #10
type WorkflowParameterMappingNode struct {
Parameter string // parameter name (by-name reference)
Expression string // Mendix expression string
}
// AlterWorkflowStmt represents: ALTER WORKFLOW Module.Name operations...
type AlterWorkflowStmt struct {
Name QualifiedName
Operations []AlterWorkflowOp
}
func (s *AlterWorkflowStmt) isStatement() {}
// AlterWorkflowOp is the interface for ALTER WORKFLOW operations.
type AlterWorkflowOp interface {
alterWorkflowOp()
}
// SetWorkflowPropertyOp sets a workflow-level property.
type SetWorkflowPropertyOp struct {
Property string // "DISPLAY", "DESCRIPTION", "EXPORT_LEVEL", "DUE_DATE", "OVERVIEW_PAGE", "PARAMETER"
Value string // string value
Entity QualifiedName // for OVERVIEW_PAGE / PARAMETER: the qualified name
}
func (o *SetWorkflowPropertyOp) alterWorkflowOp() {}
// SetActivityPropertyOp sets a property on a named activity.
type SetActivityPropertyOp struct {
ActivityRef string // activity caption
AtPosition int // positional disambiguation (0 = no disambiguation)
Property string // "PAGE", "DESCRIPTION", "TARGETING_MICROFLOW", "TARGETING_XPATH", "DUE_DATE"
Value string // string value
PageName QualifiedName // for PAGE property
Microflow QualifiedName // for TARGETING MICROFLOW
}
func (o *SetActivityPropertyOp) alterWorkflowOp() {}
// InsertAfterOp inserts an activity after a named activity (linear position).
type InsertAfterOp struct {
ActivityRef string
AtPosition int
NewActivity WorkflowActivityNode
}
func (o *InsertAfterOp) alterWorkflowOp() {}
// DropActivityOp removes a linear activity from the flow graph.
type DropActivityOp struct {
ActivityRef string
AtPosition int
}
func (o *DropActivityOp) alterWorkflowOp() {}
// ReplaceActivityOp swaps an activity in place, preserving edges.
type ReplaceActivityOp struct {
ActivityRef string
AtPosition int
NewActivity WorkflowActivityNode
}
func (o *ReplaceActivityOp) alterWorkflowOp() {}
// InsertOutcomeOp adds a new outcome to a UserTask.
type InsertOutcomeOp struct {
OutcomeName string
ActivityRef string
AtPosition int
Activities []WorkflowActivityNode
}
func (o *InsertOutcomeOp) alterWorkflowOp() {}
// DropOutcomeOp removes an outcome from a UserTask.
type DropOutcomeOp struct {
OutcomeName string
ActivityRef string
AtPosition int
}
func (o *DropOutcomeOp) alterWorkflowOp() {}
// InsertPathOp adds a new path to a ParallelSplit.
type InsertPathOp struct {
ActivityRef string
AtPosition int
Activities []WorkflowActivityNode
}
func (o *InsertPathOp) alterWorkflowOp() {}
// DropPathOp removes a path from a ParallelSplit.
type DropPathOp struct {
PathCaption string
ActivityRef string
AtPosition int
}
func (o *DropPathOp) alterWorkflowOp() {}
// InsertBranchOp adds a new branch to a Decision.
type InsertBranchOp struct {
Condition string
ActivityRef string
AtPosition int
Activities []WorkflowActivityNode
}
func (o *InsertBranchOp) alterWorkflowOp() {}
// DropBranchOp removes a branch from a Decision.
type DropBranchOp struct {
BranchName string
ActivityRef string
AtPosition int
}
func (o *DropBranchOp) alterWorkflowOp() {}
// InsertBoundaryEventOp adds a boundary event to an activity.
type InsertBoundaryEventOp struct {
ActivityRef string
AtPosition int
EventType string // "InterruptingTimer", "NonInterruptingTimer"
Delay string
Activities []WorkflowActivityNode
}
func (o *InsertBoundaryEventOp) alterWorkflowOp() {}
// DropBoundaryEventOp removes a boundary event from an activity.
type DropBoundaryEventOp struct {
ActivityRef string
AtPosition int
}
func (o *DropBoundaryEventOp) alterWorkflowOp() {}