artifacts

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2026 License: LGPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

Package artifacts provides BPMN artifact implementations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Artifact

type Artifact interface {
	foundation.BaseObject
	// contains filtered or unexported methods
}

Artifact is one of the standard's three artifacts a container carries: an Association, a TextAnnotation, or a Group (ADR-039 §2.2). Artifacts are model-only (SAD-001 §14): parsed and preserved for BPMN loading, never executed — no engine decision reads one. The unexported marker keeps the set closed to this package's kinds: the engine cannot re-emit an artifact kind it does not know, so an open set would admit inert values that die at the first export.

func Append added in v0.12.0

func Append(existing []Artifact, arts ...Artifact) ([]Artifact, error)

Append validates arts — no nil entry, no id duplicating existing or each other — and returns existing extended with them. It is the one implementation of the collection invariant both containers (Process and SubProcess) delegate to, so the rule cannot fork between them.

type Association

type Association struct {
	foundation.BaseElement
	// contains filtered or unexported fields
}

An Association links two model elements: typically a TextAnnotation to the element it annotates. The compensation shape of BPMN's <association> is NOT represented here — the model realizes it as the boundary event's handler (ADR-039 §2.4) — so an Association in a container's artifact collection is always the plain, non-executable line.

func MustAssociation added in v0.12.0

func MustAssociation(
	source, target foundation.Identifyer,
	direction AssociationDirection,
	baseOpts ...options.Option,
) *Association

MustAssociation tries to create an association and panics on error. For tests and examples.

func NewAssociation added in v0.12.0

func NewAssociation(
	source, target foundation.Identifyer,
	direction AssociationDirection,
	baseOpts ...options.Option,
) (*Association, error)

NewAssociation creates an association from source to target.

Both ends are mandatory — the standard's schema requires sourceRef and targetRef (§8.4.1) — so a nil end is refused. An empty direction takes the standard's own default None (§8.4.1); anything outside the §8.4.1 enumeration is refused.

func (*Association) Direction

func (a *Association) Direction() AssociationDirection

Direction returns the association's direction.

func (*Association) Source

func (a *Association) Source() foundation.Identifyer

Source returns the element the association connects from.

func (*Association) Target

func (a *Association) Target() foundation.Identifyer

Target returns the element the association connects to.

type AssociationDirection

type AssociationDirection string

AssociationDirection defines the direction of an association.

const (
	// DirectionNone represents no association direction — the standard's
	// default (§8.4.1). The string values are the spec's own literals.
	DirectionNone AssociationDirection = "None"
	// DirectionOne represents one-way association direction.
	DirectionOne AssociationDirection = "One"
	// DirectionBoth represents bi-directional association direction.
	DirectionBoth AssociationDirection = "Both"
)

type Category

type Category struct {
	foundation.BaseElement
	// contains filtered or unexported fields
}

Category can have user-defined semantics, and can be used for documentation or analysis purposes. For example, BaseElements can be categorized as being customer oriented vs. support oriented. Furthermore, the cost and time of Activities per Category can be calculated.

func MustCategory added in v0.10.0

func MustCategory(name string, baseOpts ...options.Option) *Category

MustCategory is the panic-on-error NewCategory twin for tests and static process construction.

func NewCategory

func NewCategory(
	name string,
	baseOpts ...options.Option,
) (*Category, error)

NewCategory creates a new Category and returns its pointer, or an error on an invalid option (FIX-026 — caller options are validated, never a deferred panic).

func (*Category) AddCategoryValues

func (c *Category) AddCategoryValues(cvv ...*CategoryValue) int

AddCategoryValues adds CategoryValues from the list into the Category and binds the added CategoryValue to the Category. It returns a number of added CategoryValues.

func (*Category) CategoryValues

func (c *Category) CategoryValues() []CategoryValue

CategoryValues returns list of copies of CategoryValues binded to Category.

func (*Category) Name

func (c *Category) Name() string

Name returns the Category name.

func (*Category) RemoveCategoryValues

func (c *Category) RemoveCategoryValues(cvVals ...string) int

RemoveCategoryValues removes given CategoryValues from the Category and for removed ones clears its binding to Category. It returns a number of removed elements.

type CategoryValue

type CategoryValue struct {
	Value string
	foundation.BaseElement
	// contains filtered or unexported fields
}

CategoryValue represents a value within a category.

func MustCategoryValue added in v0.10.0

func MustCategoryValue(
	value string,
	baseOpts ...options.Option,
) *CategoryValue

MustCategoryValue is the panic-on-error NewCategoryValue twin for tests and static process construction.

func NewCategoryValue

func NewCategoryValue(
	value string,
	baseOpts ...options.Option,
) (*CategoryValue, error)

NewCategoryValue creates a new CategoryValue and returns its pointer.

func (*CategoryValue) AddBaseElement added in v0.1.1

func (cv *CategoryValue) AddBaseElement(fee ...flow.Element) int

AddBaseElement adds BaseElements to the CategoryValue. It returns a number of added BaseElements

func (*CategoryValue) BaseElements added in v0.1.1

func (cv *CategoryValue) BaseElements() []flow.Element

BaseElements returns a list of categorized BaseElements from CategoryValue.

func (*CategoryValue) Category

func (cv *CategoryValue) Category() *Category

Category returns category the CategoryValue binded to.

func (*CategoryValue) RemoveBaseElement added in v0.1.1

func (cv *CategoryValue) RemoveBaseElement(feeID ...string) int

RemoveBaseElement removes BaseElements from the CategoryValue.

type Group

type Group struct {
	CategoryValue *CategoryValue
	foundation.BaseElement
}

The Group object is an Artifact that provides a visual mechanism to group elements of a diagram informally. The grouping is tied to the CategoryValue supporting element. That is, a Group is a visual depiction of a single CategoryValue. The graphical elements within the Group will be assigned the CategoryValue of the Group.

func MustGroup

func MustGroup(
	categoryName string,
	baseOpts ...options.Option,
) *Group

MustGroup tries to create a new Group and returns its pointer on success or fires panic on error.

func NewGroup

func NewGroup(
	categoryName string,
	baseOpts ...options.Option,
) (*Group, error)

NewGroup creates a new Group and returns its pointer

type TextAnnotation added in v0.12.0

type TextAnnotation struct {
	foundation.BaseElement
	// contains filtered or unexported fields
}

A TextAnnotation is a modeller's comment: "Text Annotations are a mechanism for a modeler to provide additional information for the reader of a BPMN Diagram" (§8.4.1). Carried for BPMN loading (ADR-039), never read by the engine.

func MustTextAnnotation added in v0.12.0

func MustTextAnnotation(
	text, textFormat string,
	baseOpts ...options.Option,
) *TextAnnotation

MustTextAnnotation tries to create a text annotation and panics on error. For tests and examples.

func NewTextAnnotation added in v0.12.0

func NewTextAnnotation(
	text, textFormat string,
	baseOpts ...options.Option,
) (*TextAnnotation, error)

NewTextAnnotation creates a text annotation.

Both attributes are optional in the standard (0..1), so an empty text is accepted — an annotation is a carrier, and refusing a diagram over an empty comment would fail a conformant model. An empty textFormat takes the standard's default "text/plain" (§8.4.1).

func (*TextAnnotation) Text added in v0.12.0

func (ta *TextAnnotation) Text() string

Text returns the annotation's text.

func (*TextAnnotation) TextFormat added in v0.12.0

func (ta *TextAnnotation) TextFormat() string

TextFormat returns the format of the annotation's text.

Jump to

Keyboard shortcuts

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