-
Notifications
You must be signed in to change notification settings - Fork 0
/
context.go
80 lines (55 loc) · 2.15 KB
/
context.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
package model
import (
"github.com/TIBCOSoftware/flogo-contrib/action/flow/definition"
"github.com/TIBCOSoftware/flogo-lib/core/data"
)
// FlowContext is the execution context of the Flow when executing
// a Flow Behavior function
type FlowContext interface {
// FlowDefinition returns the Flow definition associated with this context
FlowDefinition() *definition.Definition
// TaskInstances get the task instances
TaskInstances() []TaskInstance
// Status gets the state of the Flow instance
Status() FlowStatus
}
// TaskContext is the execution context of the Task when executing
// a Task Behavior function
type TaskContext interface {
// Status gets the state of the Task instance
Status() TaskStatus
// SetStatus sets the state of the Task instance
SetStatus(status TaskStatus)
// Task returns the Task associated with this context
Task() *definition.Task
// GetFromLinkInstances returns the instances of predecessor Links of the current task.
GetFromLinkInstances() []LinkInstance
// GetToLinkInstances returns the instances of successor Links of the current task.
GetToLinkInstances() []LinkInstance
// EvalLink evaluates the specified link
EvalLink(link *definition.Link) (bool, error)
// EvalActivity evaluates the Activity associated with the Task
EvalActivity() (done bool, err error)
// PostActivity does post evaluation of the Activity associated with the Task
PostEvalActivity() (done bool, err error)
Resolve(toResolve string) (value interface{}, err error)
//todo move to a mutable scope
AddWorkingData(attr *data.Attribute)
UpdateWorkingData(key string, value interface{}) error
GetWorkingData(key string) (*data.Attribute, bool)
}
// LinkInstance is the instance of a link
type LinkInstance interface {
// Link returns the Link associated with this Link Instance
Link() *definition.Link
// Status gets the state of the Link instance
Status() LinkStatus
// SetStatus sets the state of the Link instance
SetStatus(status LinkStatus)
}
type TaskInstance interface {
// Task returns the Task associated with this Task Instance
Task() *definition.Task
// Status gets the state of the Task instance
Status() TaskStatus
}