-
Notifications
You must be signed in to change notification settings - Fork 0
/
act_gateway.go
63 lines (52 loc) · 1.01 KB
/
act_gateway.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
package loong
import (
"context"
"github.com/it512/loong/bpmn"
)
// forkMode
const (
forkFork = 1
newFork = 10
fullJoin = 66
halfJoin = 88
)
// gw type
const (
nogw = 0
exclusive = 1
complexgw = 3
eventbase = 5
parallel = 7
inclusive = 9
)
type gateway struct{}
func (c gateway) EmitExec(ctx context.Context, xs []Exec, emt Emitter) error {
/*
for _, ex := range xs {
sf := fromExec(ex, ex.OutTag)
emt.Emit(sf) //nolint:errcheck
}
*/
return nil
}
type exclusivGatewayOp struct {
Variable
bpmn.TExclusiveGateway
UnimplementedActivity
}
func (e exclusivGatewayOp) Do(ctx context.Context) error {
switch e.Exec.GwType {
case eventbase:
e.Exec.GwType = nogw
case nogw, exclusive:
// skip
case parallel, inclusive:
panic("排他网关的前置网关不能为包容网关或并行网关")
case complexgw:
panic("目前不支持复杂网关")
}
return nil
}
func (e *exclusivGatewayOp) Emit(ctx context.Context, emt Emitter) error {
return emt.Emit(fromOuter(ctx, e.Variable, e))
}