bpmn

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 22, 2026 License: Apache-2.0 Imports: 12 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
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

func CheckTimerMinimum(e *Element, minimum time.Duration) []model.Issue

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 Validate

func Validate(p *Process, rules Rules) (issues []model.Issue)

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 (this *Element) HasMappings() bool

func (*Element) IsDeviceCommand

func (this *Element) IsDeviceCommand() bool

IsDeviceCommand reports a service task that sends device commands (TASK-01).

func (*Element) IsDeviceEvent

func (this *Element) IsDeviceEvent() bool

IsDeviceEvent reports a message event that waits for device or import data (EVT-03).

func (*Element) Key

func (this *Element) Key() string

Key identifies the element for namespace rules, e.g. "startEvent:timer" (NS-06).

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 EventKind

type EventKind string
const (
	EventNone    EventKind = ""
	EventMessage EventKind = "message"
	EventTimer   EventKind = "timer"
)

type Flow

type Flow struct {
	Id     string
	Name   string
	Source *Element
	Target *Element
	// JavaScript condition, empty if the flow is unconditional
	Condition string
	// contains filtered or unexported fields
}

func Cycles

func Cycles(p *Process) (result []*Flow)

Cycles returns one flow per loop of the sequence flow: the flow that leads back to an element on the current path of a depth-first search in document order.

type FormField

type FormField struct {
	Id           string
	Label        string
	Type         string
	DefaultValue string
	// the field declares a default; tells defaultValue="" from no default at all
	HasDefault bool
	Properties map[string]string
}

type MapEntry

type MapEntry struct {
	Key   string
	Value Value
}

type Mapping

type Mapping struct {
	Name  string
	Value Value
}

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

func Parse(xml string) (process *Process, issues []model.Issue, err error)

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

func ParseAndValidate(xml string, rules Rules) (*Process, []model.Issue, error)

ParseAndValidate combines Parse and Validate; issues block a deploy and are hints on a model save.

func (*Process) Element

func (this *Process) Element(id string) *Element

func (*Process) NoneStartEvent

func (this *Process) NoneStartEvent() *Element

NoneStartEvent returns the start event used for starts through the API, or nil.

func (*Process) Ordered

func (this *Process) Ordered() []*Element

func (*Process) StartEvents

func (this *Process) StartEvents() (result []*Element)

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).

type TimerDefinition

type TimerDefinition struct {
	Kind  timer.Kind
	Value string
	// Value is JavaScript and evaluates to the timer value (BPMN-06, EXPR-01)
	Expression bool
	// contains filtered or unexported fields
}

type Value

type Value struct {
	Kind   ValueKind
	Text   string
	Script string
	Map    []MapEntry
	List   []Value
	// contains filtered or unexported fields
}

Value of an input or output mapping; text and script are explicitly different (EXPR-02).

type ValueKind

type ValueKind string
const (
	ValueText   ValueKind = "text"
	ValueScript ValueKind = "script"
	ValueMap    ValueKind = "map"
	ValueList   ValueKind = "list"
)

Directories

Path Synopsis
Package bpmntest builds BPMN documents for tests.
Package bpmntest builds BPMN documents for tests.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL