Documentation
¶
Index ¶
- Constants
- func ApplyParameters(p *Process, parameters map[string]model.ElementParameters) (issues []model.Issue)
- func CheckTimerMinimum(e *Element, minimum time.Duration) []model.Issue
- func StartParameters(e *Element) []model.StartParameter
- func Validate(p *Process, rules Rules) (issues []model.Issue)
- func WithDiagram(xml string) (result string, added bool, err error)
- type Element
- type ElementType
- type EventKind
- type Flow
- type FormField
- type MapEntry
- type Mapping
- type MessageRef
- type Process
- type Rules
- type TimerDefinition
- type Value
- type ValueKind
Constants ¶
const ( NsBpmnDi = "http://www.omg.org/spec/BPMN/20100524/DI" NsDc = "http://www.omg.org/spec/DD/20100524/DC" NsDi = "http://www.omg.org/spec/DD/20100524/DI" )
const ( NsBpmn = "http://www.omg.org/spec/BPMN/20100524/MODEL" NsCamunda = "http://camunda.org/schema/1.0/bpmn" NsSenergy = "https://senergy.infai.org" NsXsi = "http://www.w3.org/2001/XMLSchema-instance" )
Variables ¶
This section is empty.
Functions ¶
func ApplyParameters ¶
func ApplyParameters(p *Process, parameters map[string]model.ElementParameters) (issues []model.Issue)
ApplyParameters sets the values a deployment overrides per element: input mappings by name as text, senergy:variables of device events, timer definitions and defaults of start form fields (DEP-01). Overrides of elements, inputs or fields the process does not have are issues.
func CheckTimerMinimum ¶
CheckTimerMinimum reports a literal timer duration shorter than minimum; deploy parameters can set a timer after validation, so the deploy checks it again (DEP-01).
func StartParameters ¶
func StartParameters(e *Element) []model.StartParameter
StartParameters lists the form fields of a start event without those marked ignore_on_start (RUN-02).
func WithDiagram ¶ added in v0.9.0
WithDiagram adds a bpmndi:BPMNDiagram to a model that has none, so that a designer can show a model a client sent without one. The layout puts the flow nodes in layers along the sequence flows, lanes as bands and the participants of a collaboration as pools; a subprocess with content is shown collapsed with a diagram of its own. Annotations, data objects and message flows get no position. A model with a diagram, or one that is no BPMN, comes back unchanged with added false.
Types ¶
type Element ¶
type Element struct {
Id string
Name string
Type ElementType
Kind EventKind
Incoming []*Flow
Outgoing []*Flow
DefaultFlow *Flow
Message *MessageRef
Timer *TimerDefinition
Inputs []Mapping
Outputs []Mapping
// script task
Script string
ResultVariable string
// service task (TASK-00, TASK-07)
TaskType string
Retries *int
Timeout string
// start event form fields (BPMN-02)
FormFields []FormField
// senergy:* attributes by local name, e.g. device event descriptions
Attributes map[string]string
// camunda:properties of the element
Properties map[string]string
// id of the lane the element is in; the deploy dialog groups by lane (BPMN-01)
Lane string
// contains filtered or unexported fields
}
func (*Element) HasMappings ¶
func (*Element) IsDeviceCommand ¶
IsDeviceCommand reports a service task that sends device commands (TASK-01).
func (*Element) IsDeviceEvent ¶
IsDeviceEvent reports a message event that waits for device or import data (EVT-03).
type ElementType ¶
type ElementType string
ElementType is the local name of a supported BPMN flow node (BPMN-01 to BPMN-16).
const ( StartEvent ElementType = "startEvent" EndEvent ElementType = "endEvent" IntermediateCatchEvent ElementType = "intermediateCatchEvent" IntermediateThrowEvent ElementType = "intermediateThrowEvent" Task ElementType = "task" ScriptTask ElementType = "scriptTask" ServiceTask ElementType = "serviceTask" ExclusiveGateway ElementType = "exclusiveGateway" ParallelGateway ElementType = "parallelGateway" InclusiveGateway ElementType = "inclusiveGateway" EventBasedGateway ElementType = "eventBasedGateway" )
func (ElementType) IsEvent ¶
func (this ElementType) IsEvent() bool
func (ElementType) IsGateway ¶
func (this ElementType) IsGateway() bool
type Flow ¶
type MessageRef ¶
type MessageRef struct {
// id of the bpmn:message the event refers to, if any
Id string
// literal message name; empty for device events, whose name the engine assigns per deployment
Name string
DeviceEvent bool
// senergy:messageName, a JavaScript expression for the name, evaluated when the event waits;
// e.g. the done event of a deployment a module created (SMS-04)
Expression string
}
type Process ¶
type Process struct {
Id string
Name string
// senergy:description of the process, which the designer of smart services writes
Description string
Elements map[string]*Element
Flows map[string]*Flow
// element ids in document order, for deterministic iteration
Order []string
}
func Parse ¶
Parse reads BPMN XML into a process graph. It returns an error only if no process can be read at all. Everything outside the supported subset is reported as an issue that names the element (BPMN-18); Validate adds the semantic checks.
func ParseAndValidate ¶
ParseAndValidate combines Parse and Validate; issues block a deploy and are hints on a model save.
func (*Process) NoneStartEvent ¶
NoneStartEvent returns the start event used for starts through the API, or nil.
func (*Process) StartEvents ¶
type Rules ¶
type Rules struct {
// element keys like "startEvent" or "startEvent:timer"; a rule on the type covers all kinds
Elements model.ListRule
TaskTypes model.ListRule
// reports whether the engine implements a task type; nil accepts every type
TaskTypeAvailable func(taskType string) bool
// reject cycles in the sequence flow, so that every run ends (SMS-03)
ForbidCycles bool
// shortest timer duration; 0 allows every duration. process-deployment rejected durations
// below 5 s, which keeps loops with a timer from flooding instances and history.
MinTimerDuration time.Duration
}
Rules restrict the supported subset per namespace (NS-03, NS-06).