-
Notifications
You must be signed in to change notification settings - Fork 5
/
join_model.go
45 lines (40 loc) · 958 Bytes
/
join_model.go
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
package goflow
//XML合并节点
type JoinModel struct {
NodeModel
}
//合并分叉节点
func (p *JoinModel) MergeBranchHandle(execution *Execution) {
activeNodes := FindActiveNodes(p)
MergeHandle(execution, activeNodes)
}
//执行
func (p *JoinModel) Exec(execution *Execution) {
p.MergeBranchHandle(execution)
if execution.IsMerged {
p.RunOutTransition(execution)
}
}
//递归查找分叉节点
func FindForkTaskNames(node INodeModel) []string {
ret := make([]string, 0)
switch node.(type) {
case *ForkModel:
default:
for _, tm := range node.GetInputs() {
switch tm.Source.(type) {
case *SubProcessModel:
ret = append(ret, tm.Source.(*SubProcessModel).Name)
case *TaskModel:
ret = append(ret, tm.Source.(*TaskModel).Name)
default:
ret = append(ret, FindForkTaskNames(tm.Source)...)
}
}
}
return ret
}
//查找分叉节点
func FindActiveNodes(node INodeModel) []string {
return FindForkTaskNames(node)
}