forked from nitram509/lib-bpmn-engine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
engine_properties.go
50 lines (43 loc) · 1.7 KB
/
engine_properties.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
package bpmn_engine
import (
"github.com/bwmarrin/snowflake"
"github.com/ipsitasbgit/lib-bpmn-engine/pkg/bpmn_engine/exporter"
"github.com/ipsitasbgit/lib-bpmn-engine/pkg/spec/BPMN20"
)
type ProcessInfo struct {
BpmnProcessId string // The ID as defined in the BPMN file
Version int32 // A version of the process, default=1, incremented, when another process with the same ID is loaded
ProcessKey int64 // The engines key for this given process with version
definitions BPMN20.TDefinitions // parsed file content
checksumBytes [16]byte // internal checksum to identify different versions
}
type BpmnEngineState struct {
name string
processes []ProcessInfo
processInstances []*ProcessInstanceInfo
messageSubscriptions []*MessageSubscription
jobs []*job
timers []*Timer
scheduledFlows []string
taskHandlers []*taskHandler
exporters []exporter.EventExporter
snowflake *snowflake.Node
}
// GetProcessInstances returns a list of instance information.
func (state *BpmnEngineState) GetProcessInstances() []*ProcessInstanceInfo {
return state.processInstances
}
// FindProcessInstanceById searches for a give processInstanceKey
// and returns the corresponding ProcessInstanceInfo otherwise nil
func (state *BpmnEngineState) FindProcessInstanceById(processInstanceKey int64) *ProcessInstanceInfo {
for _, instance := range state.processInstances {
if instance.instanceKey == processInstanceKey {
return instance
}
}
return nil
}
// GetName returns the name of the engine, only useful in case you control multiple ones
func (state *BpmnEngineState) GetName() string {
return state.name
}