forked from zileyuan/goflow
-
Notifications
You must be signed in to change notification settings - Fork 0
/
end_model.go
39 lines (33 loc) · 924 Bytes
/
end_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
package goflow
//XML的结束节点
type EndModel struct {
NodeModel
}
//执行
func (p *EndModel) Exec(execution *Execution) {
engine := execution.Engine
order := execution.Order
tasks := GetActiveTasksByOrderId(order.Id)
for _, task := range tasks {
CompleteTask(task.Id, string(ER_AUTO), nil)
}
CompleteOrder(order.Id)
if order.ParentId != "" {
parentOrder := &Order{}
if parentOrder.GetOrderById(order.ParentId) {
process := engine.GetProcessById(parentOrder.ProcessId)
processModel := process.Model
spm := processModel.GetNode(order.ParentNodeName).(*SubProcessModel)
newExecution := &Execution{
Engine: engine,
Process: process,
Order: parentOrder,
Args: execution.Args,
ChildOrderId: order.Id,
Task: execution.Task,
}
spm.Execute(newExecution)
execution.Tasks = append(execution.Tasks, newExecution.Tasks...)
}
}
}