bpmn

package
v0.0.0-...-738d89c Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2023 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrExpressionResultNotString = errors.New("expression result is not string")
	ErrExpressionResultNotInt    = errors.New("expression result is not int")
	ErrExpressionResultNotBool   = errors.New("condition expression result is not bool")
)
View Source
var ErrISO8601DurationFormat = errors.New("input string is of incorrect format")

Functions

func AsFloat

func AsFloat(in interface{}) float64

func AsInt

func AsInt(in interface{}) int64

func AsStr

func AsStr(val interface{}) interface{}

func EvaluateExpressionToDuration

func EvaluateExpressionToDuration(exp string) (du time.Duration, err error)

EvaluateExpressionToDuration evaluate iso8601 format to time.Duration

func EvaluateExpressionToString

func EvaluateExpressionToString(exp string, input vars.Mapping) (string, error)

func FormatDuration

func FormatDuration(dur time.Duration) string

FormatDuration returns an ISO 8601 duration string.

func IsFormal

func IsFormal(exp string) bool

IsFormal check expression is formal expression

func ParseDuration

func ParseDuration(isoDuration string) (time.Duration, error)

ParseDuration parses an ISO 8601 string representing a duration, and returns the resultant golang time.Duration instance.

Types

type Activity

type Activity struct {
	FlowNode
	Default           string `xml:"default,attr"`
	IsForCompensation bool   `xml:"isForCompensation,attr"`
}

type AssignmentDefinition

type AssignmentDefinition struct {
	Assignee        string `xml:"assignee,attr"`
	CandidateGroups string `xml:"candidateGroups,attr"`
	CandidateUsers  string `xml:"candidateUsers,attr"`
}

func (AssignmentDefinition) ConvertValue

func (a AssignmentDefinition) ConvertValue(val any) ([]string, error)

func (AssignmentDefinition) CountAssignees

func (a AssignmentDefinition) CountAssignees() (count int)

CountAssignees count assignees

func (AssignmentDefinition) GetAssignee

func (a AssignmentDefinition) GetAssignee(input vars.Mapping) (string, error)

func (AssignmentDefinition) GetCandidateGroups

func (a AssignmentDefinition) GetCandidateGroups(input vars.Mapping) ([]string, error)

func (AssignmentDefinition) GetCandidateUsers

func (a AssignmentDefinition) GetCandidateUsers(input vars.Mapping) ([]string, error)

type BaseElement

type BaseElement struct {
	Id                  string              `xml:"id,attr"`
	Documentation       []Documentation     `xml:"documentation,omitempty"`
	ExtensionProperties ExtensionProperties `xml:"extensionElements>properties>property,omitempty"`
}

func (*BaseElement) GetDocumentation

func (be *BaseElement) GetDocumentation() string

type BaseElementWithMixedContent

type BaseElementWithMixedContent struct {
	Id            string         `xml:"id,attr,omitempty"`
	Content       string         `xml:",innerxml"`
	Documentation *Documentation `xml:"documentation,omitempty"`
}

func (*BaseElementWithMixedContent) UnmarshalXML

func (b *BaseElementWithMixedContent) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

type BusinessRuleTask

type BusinessRuleTask struct {
	Task
	TaskDefinition *TaskDefinition `xml:"extensionElements>taskDefinition,omitempty"`
	Inputs         []Input         `xml:"extensionElements>ioMapping>input,omitempty"`
	Outputs        []Output        `xml:"extensionElements>ioMapping>output,omitempty"`
	Headers        []Header        `xml:"extensionElements>taskHeaders>header,omitempty"`
	Script         *Script         `xml:"extensionElements>script"`
	CalledDecision *CalledDecision `xml:"extensionElements>calledDecision"`
}

type CallActivity

type CallActivity struct {
	Activity
	CalledElement CalledElement `xml:"extensionElements>calledElement"`
	Inputs        []Input       `xml:"extensionElements>ioMapping>input,omitempty"`
	Outputs       []Output      `xml:"extensionElements>ioMapping>output,omitempty"`
}

type CalledDecision

type CalledDecision struct {
	DecisionId     string `xml:"decisionId,attr"`
	ResultVariable string `xml:"resultVariable,attr"`
}

type CalledElement

type CalledElement struct {
	ProcessId                  string `xml:"processId,attr"`
	PropagateAllChildVariables bool   `xml:"propagateAllChildVariables,attr"`
}

type CatchEvent

type CatchEvent struct {
	Event
}

type ComplexGateway

type ComplexGateway struct {
	Gateway
	ActivationCondition *Expression `xml:"activationCondition,attr,omitempty"`
	Default             string      `xml:"default,attr"`
}

type ConditionExpression

type ConditionExpression struct {
	FormalExpression
	Type     string `xml:"type,attr"`
	Resource string `xml:"resource,attr"`
}

ConditionExpression is camunda extension

func (ConditionExpression) Evaluate

func (c ConditionExpression) Evaluate(input map[string]any) (bool, error)

Evaluate condition expression. Camunda FEEL format is no like golang expression.

Supported operators:

`=`: FEEL equality, golang expression `==`.. note support in quote string like `="a=b"`

type Converter

type Converter interface {
	// ConvertDecisionTable convert decision table to other grammar
	ConvertDecisionTable(decisionID string, table *dmn.DecisionTable) ([]string, error)
	// Match bool evaluate
	Match(rule string, input vars.Mapping) (bool, error)
	Eval(rule string, input vars.Mapping) (any, error)
}

Converter convert dmn decision feel expression to other grammar

var Convert Converter

type Definitions

type Definitions struct {
	BaseElement
	TargetNamespace    string    `xml:"targetNamespace,attr"`
	ExpressionLanguage string    `xml:"expressionLanguage,attr"`
	TypeLanguage       string    `xml:"typeLanguage,attr"`
	Exporter           string    `xml:"exporter,attr"`
	ExporterVersion    string    `xml:"exporterVersion,attr"`
	Process            []Process `json:"process,omitempty" xml:"process"`
	Messages           []Message `json:"message,omitempty" xml:"message"`
	Signals            []Signal  `json:"signal,omitempty" xml:"signal"`
}

type Documentation

type Documentation struct {
	Content    string `xml:",innerxml"`
	Id         string `xml:"id,attr"`
	TextFormat string `xml:"textFormat,attr"`
}

type Elementor

type Elementor interface {
	GetId() string
	GetOutgoing() []string
}

type EndEvent

type EndEvent struct {
	ThrowEvent
}

type Event

type Event struct {
	FlowNode
}

type EventBasedGateway

type EventBasedGateway struct {
	Gateway
	Instantiate           bool                  `xml:"instantiate,attr"`
	EventBasedGatewayType EventBasedGatewayType `xml:"eventGatewayType,attr"`
}

type EventBasedGatewayType

type EventBasedGatewayType string
const (
	EventBasedGatewayTypeExclusive EventBasedGatewayType = "Exclusive"
	EventBasedGatewayTypeParallel  EventBasedGatewayType = "Parallel"
)

type EventDefinition

type EventDefinition struct {
	RootElement
}

type ExclusiveGateway

type ExclusiveGateway struct {
	Gateway
}

func (ExclusiveGateway) GetId

func (e ExclusiveGateway) GetId() string

func (ExclusiveGateway) GetOutgoing

func (e ExclusiveGateway) GetOutgoing() []string

type Expression

type Expression struct {
	BaseElementWithMixedContent
}

type ExtensionProperties

type ExtensionProperties []ExtensionProperty

func (ExtensionProperties) Decode

func (ep ExtensionProperties) Decode(valuePtr any) error

type ExtensionProperty

type ExtensionProperty struct {
	Name  string `xml:"name,attr"`
	Value string `xml:"value,attr"`
}

type FlowElement

type FlowElement struct {
	BaseElement
	Name string `xml:"name,attr"`
}

type FlowNode

type FlowNode struct {
	FlowElement
	Tag      string   `xml:"tag,attr"`
	Incoming []string `xml:"incoming"`
	Outgoing []string `xml:"outgoing"`
}

func (FlowNode) GetId

func (f FlowNode) GetId() string

func (FlowNode) GetOutgoing

func (f FlowNode) GetOutgoing() []string

type FormDefinition

type FormDefinition struct {
	FormKey string `xml:"formKey,attr"`
}

type FormalExpression

type FormalExpression struct {
	Expression
	Language           string `xml:"language,omitempty,attr"`
	EvaluatesToTypeRef string `xml:"evaluatesToTypeRef,attr"`
}

type Gateway

type Gateway struct {
	FlowNode
	GatewayDirection GatewayDirection `xml:"gatewayDirection,attr"`
}

type GatewayDirection

type GatewayDirection string
const (
	GatewayDirectionUnspecified GatewayDirection = "Unspecified"
	GatewayDirectionConverging  GatewayDirection = "Converging"
	GatewayDirectionDiverging   GatewayDirection = "Diverging"
	GatewayDirectionMixed       GatewayDirection = "Mixed"
)
type Header struct {
	Key   string `xml:"key,attr"`
	Value string `xml:"value,attr"`
}

type InclusiveGateway

type InclusiveGateway struct {
	Gateway
	Default string `xml:"default,attr,omitempty"`
}

type Input

type Input struct {
	Source string `xml:"source,attr"`
	Target string `xml:"target,attr"`
}

type IntermediateCatchEvent

type IntermediateCatchEvent struct {
	CatchEvent
	TimerEventDefinition   *TimerEventDefinition   `xml:"timerEventDefinition,omitempty"`
	MessageEventDefinition *MessageEventDefinition `xml:"messageEventDefinition,omitempty"`
	SignalEventDefinition  *SignalEventDefinition  `xml:"signalEventDefinition,omitempty"`
	Outputs                []Output                `xml:"extensionElements>ioMapping>output,omitempty"`
}

type LoopCharacteristics

type LoopCharacteristics struct {
	InputCollection  string `xml:"inputCollection,attr"`
	InputElement     string `xml:"inputElement,attr"`
	OutputCollection string `xml:"outputCollection,attr"`
	OutputElement    string `xml:"outputElement,attr"`
}

type ManualTask

type ManualTask struct {
	Task
}

type Message

type Message struct {
	RootElement
	Name         string        `xml:"name,attr"`
	Subscription *Subscription `xml:"extensionElements>subscription"`
}

func (Message) EvaluationSubscription

func (m Message) EvaluationSubscription(vars map[string]any) (string, error)

type MessageEventDefinition

type MessageEventDefinition struct {
	EventDefinition
	MessageRef string `xml:"messageRef,attr"`
}

type MultiInstanceLoopCharacteristics

type MultiInstanceLoopCharacteristics struct {
	IsSequential        bool                `xml:"isSequential,attr"`
	LoopCharacteristics LoopCharacteristics `xml:"extensionElements>loopCharacteristics"`
	CompletionCondition *FormalExpression   `xml:"completionCondition"`
}

MultiInstanceLoopCharacteristics is a loop characteristics for multi instance

type Output

type Output struct {
	Source string `xml:"source,attr" xml:"name,attr"`
	Target string `xml:"target,attr" xml:",innerxml"`
}

func (Output) OutputTarget

func (o Output) OutputTarget(src, tar vars.Mapping) error

type ParallelGateway

type ParallelGateway struct {
	Gateway
	// Camunda extensions
	Async     bool `xml:"async,attr"`
	Exclusive bool `xml:"exclusive,attr"`
}

type Process

type Process struct {
	BaseElement
	Name                         string                    `xml:"name,attr"`
	ProcessType                  ProcessType               `xml:"processType,attr"`
	IsClosed                     bool                      `xml:"isClosed,attr"`
	IsExecutable                 bool                      `xml:"isExecutable,attr"`
	DefinitionalCollaborationRef string                    `xml:"definitionalCollaborationRef,attr"`
	StartEvents                  []*StartEvent             `xml:"startEvent"`
	EndEvents                    []*EndEvent               `xml:"endEvent"`
	UserTasks                    []*UserTask               `xml:"userTask"`
	ServiceTasks                 []*ServiceTask            `xml:"serviceTask"`
	BusinessRules                []*BusinessRuleTask       `xml:"businessRuleTask"`
	SequenceFlows                []*SequenceFlow           `xml:"sequenceFlow"`
	CallActivities               []*CallActivity           `xml:"callActivity"`
	ExclusiveGateways            []*ExclusiveGateway       `xml:"exclusiveGateway"`
	InclusiveGateways            []*InclusiveGateway       `xml:"inclusiveGateway"`
	ParallelGateways             []*ParallelGateway        `xml:"parallelGateway"`
	EventBasedGateways           []*EventBasedGateway      `xml:"eventBasedGateway"`
	IntermediateCatchEvents      []*IntermediateCatchEvent `xml:"intermediateCatchEvent"`
	// camunda:properties
	VersionTag string `xml:"versionTag,attr"`
}

func (Process) FindBaseElementsById

func (pr Process) FindBaseElementsById(id string) (elements []Elementor)

type ProcessType

type ProcessType string
const (
	ProcessTypeNode    ProcessType = "None"
	ProcessTypePublic  ProcessType = "Public"
	ProcessTypePrivate ProcessType = "Private"
)

type ReceiveTask

type ReceiveTask struct {
	Task
	MessageRef   string        `xml:"messageRef,attr"`
	Outputs      []Output      `xml:"extensionElements>ioMapping>output,omitempty"`
	Subscription *Subscription `xml:"extensionElements>subscription"`
}

type RootElement

type RootElement struct {
	BaseElement
}

type Script

type Script struct {
	Expression     string `xml:"expression,attr"`
	ResultVariable string `xml:"resultVariable,attr"`
}

type ScriptTask

type ScriptTask struct {
	Task
	TaskDefinition *TaskDefinition `xml:"extensionElements>taskDefinition,omitempty"`
	Inputs         []Input         `xml:"extensionElements>ioMapping>input,omitempty"`
	Outputs        []Output        `xml:"extensionElements>ioMapping>output,omitempty"`
	Headers        []Header        `xml:"extensionElements>taskHeaders>header,omitempty"`
	Script         *Script         `xml:"extensionElements>script,omitempty"`
}

type SendTask

type SendTask struct {
	Task
	TaskDefinition *TaskDefinition `xml:"extensionElements>taskDefinition,omitempty"`
	Inputs         []Input         `xml:"extensionElements>ioMapping>input,omitempty"`
	Outputs        []Output        `xml:"extensionElements>ioMapping>output,omitempty"`
	Headers        []Header        `xml:"extensionElements>taskHeaders>header,omitempty"`
}

type SequenceFlow

type SequenceFlow struct {
	FlowElement
	ConditionExpression *ConditionExpression `xml:"conditionExpression"`
	SourceRef           string               `xml:"sourceRef,attr"`
	TargetRef           string               `xml:"targetRef,attr"`
	IsImmediate         bool                 `xml:"isImmediate,attr"`
}

func (SequenceFlow) GetID

func (s SequenceFlow) GetID() string

type ServiceTask

type ServiceTask struct {
	Task
	TaskDefinition *TaskDefinition `xml:"extensionElements>taskDefinition,omitempty"`
	Inputs         []Input         `xml:"extensionElements>ioMapping>input,omitempty"`
	Outputs        []Output        `xml:"extensionElements>ioMapping>output,omitempty"`
	Headers        []Header        `xml:"extensionElements>taskHeaders>header,omitempty"`
}

type Signal

type Signal struct {
	RootElement
	Name string `xml:"name,attr"`
}

type SignalEventDefinition

type SignalEventDefinition struct {
	EventDefinition
	SignalRef string `xml:"signalRef,attr"`
}

type StartEvent

type StartEvent struct {
	CatchEvent
	MessageEventDefinition *MessageEventDefinition `xml:"messageEventDefinition,omitempty"`
	IsInterrupting         bool                    `xml:"isInterrupting,attr"`
	Outputs                []Output                `xml:"extensionElements>ioMapping>output,omitempty"`
}

type Subscription

type Subscription struct {
	CorrelationKey string `xml:"correlationKey,attr"`
}

type Task

type Task struct {
	Activity
	// Camunda extensions
	Async bool `xml:"async,attr"`
}

type TaskDefinition

type TaskDefinition struct {
	TypeName string `xml:"type,attr"`
	Retries  string `xml:"retries,attr"`
}

func (TaskDefinition) GetRetries

func (t TaskDefinition) GetRetries() (retries int, err error)

func (TaskDefinition) GetType

func (t TaskDefinition) GetType() (string, error)

type ThrowEvent

type ThrowEvent struct {
	Event
}

type TimerEventDefinition

type TimerEventDefinition struct {
	EventDefinition
	TimeDate     *Expression `xml:"timeDate"`
	TimeDuration *Expression `xml:"timeDuration"`
	TimeCycle    *Expression `xml:"timeCycle"`
}

type UserTask

type UserTask struct {
	Task
	Form          *FormDefinition                   `xml:"extensionElements>formDefinition"`
	Assignment    *AssignmentDefinition             `xml:"extensionElements>assignmentDefinition"`
	Inputs        []Input                           `xml:"extensionElements>ioMapping>input,omitempty"`
	Outputs       []Output                          `xml:"extensionElements>ioMapping>output,omitempty"`
	Headers       []Header                          `xml:"extensionElements>taskHeaders>header,omitempty"`
	MultiInstance *MultiInstanceLoopCharacteristics `xml:"multiInstanceLoopCharacteristics"`
}

Jump to

Keyboard shortcuts

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