Interface IStructuredBpmnModelPart
-
- All Superinterfaces:
IWorkflowBpmnAlignmentItem<Object,IStructuredBpmnModelPart>
public interface IStructuredBpmnModelPart extends IWorkflowBpmnAlignmentItem<Object,IStructuredBpmnModelPart>
Represents a part of a BPMN model for a workflow node or trigger. The workflow is based on the concept of structured programming, which does not allow arbitrary jumps in the control flow. A structured BPMN model part consists of many BPMNflow elements
, with the following restrictions:- There is only one point of entry where the sequence flow enters the part. We call this the in port or incoming interface.
- The structured model part then routes the sequence flow through its internal structure, which behaves like a black box.
- At the end, the sequence flow emerges at the out port (also called outgoing interface). Each part may only have a single out port, i.e. sequence flows must be merged within the part's internal structure.
Computing positions and dimensions
Implementations can compute the layout for the BPMN elements in any way they like. However, the workflow engine provides several convenience methods to ease the layout computation.
When modelling a workflow process as BPMN, the usual approach is to first create a nested tree of
alignment items
, making use of thelayouter
. Leaf nodes in this tree are usually alignment itemscontaining
BPMN elements such asStartEvent
Task
,Gateway
,SubProcess
, orEndEvent
; whereas other nodes are often used to align or pad the leaf nodes.This tree of alignment items then gets resolved to a flat map, using
flattenToMap
. This resolves the positions of all nested alignment items.Finally, the various method on
IFlattenedAlignmentItemMap
can be used to create theBPMN shapes
,BPMN edges
andsequence flows
. For example, usecreateStartEventShape
etc. to create a BPMN shape at the resolved position; orflow
to create a sequence flow between two BPMNflow nodes
.Defaults
To ease the BPMN model process and prevent common issues, the workflow engine sets certain properties to sensible values automatically.
FlowNode
normally need not beadded to a container
manually. All flow nodes of a structured BPMN part are added to theFlowElementsContainer
of its parent part automatically. You only need to set the container when you create e.g. aSubProcess
and wish to add the flow node to that sub process.Artifact
normally need not beadded to a container
manually. All artifacts of a structured BPMN part are added to theArtifactsContainer
of its parent part automatically. You only need to set the container when you create e.g. aSubProcess
and wish to add the artifact to that sub process.DiagramElement
normally need not beadded to a plane
manually. All diagram elements are added to the main plane automatically. BPMN diagram elements are drawn from first to last, so elements drawn later lie on top of elements drawn earlier. The engine adds diagram elements from the children of a workflow node after the diagram elements of the parent node. You are responsible, however, for the order of BPMN elements you create for a structured BPMN part. Diagram elements of a part are added in the order they were created.
Coordinates
All flow elements within the structured model are positioned relative to the top-left corner of the part. A part can also contain other
parts
, which are positioned relative to the part's top-left corner as well. If this part represents aWorkflowNode
, nested parts represent the node'schildren
.For example, a condition
WorkflowNode
(if-else) consist of 2 children, one child for the "if" branch and one for the "else" branch. Both children have a part with the necessaryflow elements
(such as a "Send email" or "Create PDF"ServiceTask
). The if-else node itself also has a part, with the "if" and "else" part as itschild parts
; and anExclusiveGateway
as one of itsownedBpmnElements()
.Children
As mentioned, each part can contain
childParts()
, which correspond to e.g. thechildren
of aWorkflowNode
. For each child of a part, the parts also defined the following data:- the
position
of the child, relative to the top-left corner of this part - the
flow elements container
to whichFlowElement
created by the child part should be added to. The container may be null when a part does not define a container for its child parts. For example, atry-catch
node wraps its first child part representing the "try" block in aSubProcess
container (to catch errors), but does not wrap its second child part representing the "catch" block in a container (to allow errors thrown in the catch block to propagate upwards). As such, the structured model part for a try-catch node contains two child parts, with a container set for the first child part, but no container set for the second child part. - the
lane
to whichFlowNode
created by the child part should be added to. The lane may be null when a part does not define a lane for its child parts. For example, eachWorkflowTask
creates a new lane for its children (thetrigger
and theroot node
). As another example, aSubProcess
could also, in principle, definelanes
for its content.
Interconnections
When converting a workflow node to a BPMN model, the tree of
workflow nodes
is converted to a tree ofstructured BPMN model parts
, starting at the tree's leaf nodes (innermost nodes).SequenceFlow
connectBPMN elements
and often need to be drawn between different BPMN elements from different parts. For example, the BPMN diagram for an if-else node needs to draw a sequence flow from theExclusiveGateway
to the firstFlowNode
in the "if" and "else" branchAs we treat the each
structured model part
as a black box, you should not look into the part's internal structure. In general, it's also not guaranteed that achild part
has aFlowNode
for the sequence flow -- theFlowNode
might be nested within the child part as a grandchild part, or even be in a completely different part if the child isempty
.Instead, we draw
interconnections
betweenBPMN elements
andstructured model parts
. An interconnection represents a part (segment) of a sequence flow. Once the BPMN diagram was modeled, the workflow engine assembles all interconnection into sequence flows.There are 3 different types of interconnections:
FlowNode
->IStructuredBpmnModelPart
IStructuredBpmnModelPart
->IStructuredBpmnModelPart
IStructuredBpmnModelPart
->FlowNode
BpmnEdge
starts at a flow node (type 1), goes through one or more structured BPMN model parts (type 2), and ends at a flow node (type 3). Each interconnection may define additionwaypoints
to help in routing the edge. Thein port
andout port
of a structured BPMN model part are added automatically as waypoints by the workflow engine, and should not be added manually.Port and raisables
Each structured BPMN model part contains data regarding how it interacts with other parts. The
SequenceFlow
enters the part at theinPort()
, is routed through the internal structure of the part, and emerges at theout port
. The in port may be null when the part has no valid entry point, such as aStartEvent
representing aWorkflowTrigger
. The out port may be null when the part has no valid exit point, such as anEndEvent
representing aWorkflowNode
with areturn statement
.A
WorkflowNode
may complete abruptly by throwing anAbstractAbruptCompletionException
. In the BPMN diagram, this is modeled asthrow events
(such as anerror event
forNodeThrewException
). Each part also contains a list ofraisable errors
,escalations
, andsignals
that can be thrown via error, escalation, and signal throw events. These include the raisables from the BPMN elements of the part itself, as well as any raisables from itschild parts
.- Since:
- 8.4.0
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description Rectangular2DDouble
boundingBox()
The bounding box of this part, i.e.default List<Positioned<? extends IStructuredBpmnModelPart,Point2DDouble>>
childAlignmentItems()
The children of this alignment item, together with their position.List<IStructuredBpmnModelPartChild>
childParts()
Child parts of this part.String
id()
The unique ID of this part.Double
inPort()
The incoming interface of this structured model part.List<IWorkflowBpmnInterconnection>
interconnections()
List of connections between elements from differentparts
.Double
outPort()
The outgoing interface of this structured model part.List<de.xima.bpmn_model.api.behavior.BpmnElement<?>>
ownedBpmnElements()
BPMN elements that are owned by this part, including alldiagram elements
.Map<String,BpmnRaisableError>
raisableErrors()
Errors that can potentially be thrown (but are not necessarily thrown) by this BPMN model part, usually via athrow event
.Map<String,BpmnRaisableEscalation>
raisableEscalations()
Escalations that can potentially be thrown (but are not necessarily thrown) by this BPMN model part, usually via athrow event
.Map<String,BpmnRaisableSignal>
raisableSignals()
Signals that can potentially be thrown (but are not necessarily thrown) by this BPMN model part, usually via athrow event
.-
Methods inherited from interface de.xima.fc.interfaces.workflow.bpmn.IWorkflowBpmnAlignmentItem
point, point, portDirection, value
-
-
-
-
Method Detail
-
boundingBox
Rectangular2DDouble boundingBox()
The bounding box of this part, i.e. the width and height of this part. All positions are relative to the top-left corner of this part, so no explicit x and y coordinates are needed.- Specified by:
boundingBox
in interfaceIWorkflowBpmnAlignmentItem<Object,IStructuredBpmnModelPart>
- Returns:
- The bounding box of this part.
-
childAlignmentItems
default List<Positioned<? extends IStructuredBpmnModelPart,Point2DDouble>> childAlignmentItems()
Description copied from interface:IWorkflowBpmnAlignmentItem
The children of this alignment item, together with their position. The position is always relative to the top-left corner of this alignment item.- Specified by:
childAlignmentItems
in interfaceIWorkflowBpmnAlignmentItem<Object,IStructuredBpmnModelPart>
- Returns:
- The children of this alignment item, together with their position.
-
childParts
List<IStructuredBpmnModelPartChild> childParts()
Child parts of this part. Each child part has a position relative to the top-left corner of this part; as well as aFlowElementsContainer
for the root elements of the child part.- Returns:
- A list of child parts contained in this part.
-
id
String id()
The unique ID of this part. Must be unique only within the scope of a single BPMN diagram.- Returns:
- The unique ID of this part.
-
inPort
Double inPort()
The incoming interface of this structured model part. That is, represents the in port that accepts an incoming sequence flow. The sequence flow gets routed through the internal structure of this part, and emerges at the outgoing interface (out port). Each part for a workflow node always has one (and only one) incoming interface.This value indicates the position of the in port of a structured BPMN model part. The meaning of this value depends on the
flow direction
:EAST
- The distance from the top edge of the part to the position to the in port. The in port is on the left edge of the part's bounding box.
WEST
- The distance from the top edge of the part to the position to the in port. The in port is on the right edge of the part's bounding box.
SOUTH
- The distance from the left edge of the part to the position to the in port. The in port is on the top edge of the part's bounding box.
NORTH
- The distance from the left edge of the part to the position to the in port. The in port is on the bottom edge of the part's bounding box.
May be null if this part represents the starts of a processing chain, e.g. a start event such as a workflow trigger or the start event inside a sub process.
- Specified by:
inPort
in interfaceIWorkflowBpmnAlignmentItem<Object,IStructuredBpmnModelPart>
- Returns:
- The position of the in port of this part, relative to the top or left edge.
-
interconnections
List<IWorkflowBpmnInterconnection> interconnections()
List of connections between elements from differentparts
. For these, the correspondingSequenceFlow
andBpmnEdge
cannot be created right now, as the source and target are not known or were not created yet. The interconnections represent the required data, so that the workflow engine can create the sequence flows and edges later. There are different types of interconnections:- Between 2
child parts
- From an
owned
FlowNode
to achild part
- From a
child part
to anowned
FlowNode
- From the
in port
of this part to achild part
orowned
FlowNode
- From a
child part
orowned
FlowNode
to theout port
of this part
way points
. These are the points required to route the edge through this part. As such, the points are relative to the top-left corner of this part. Theflow
,edge
and eachway point
must beowned
by this part.- Returns:
- A list of interconnections between elements from different parts.
- Between 2
-
outPort
Double outPort()
The outgoing interface of this structured model part. That is, represents the out port where the sequence emerges from this part again, after it entered this part at the incoming interface (in port). Other parts can connect to this part via the incoming and outgoing interfaces.This value indicates the position of the out port of a structured BPMN model part. The meaning of this value depends on the
flow direction
:EAST
- The distance from the top edge of the part to the position to the out port. The out port is on the right edge of the part's bounding box.
WEST
- The distance from the top edge of the part to the position to the out port. The out port is on the left edge of the part's bounding box.
SOUTH
- The distance from the left edge of the part to the position to the out port. The out port is on the bottom edge of the part's bounding box.
NORTH
- The distance from the left edge of the part to the position to the out port. The out port is on the top edge of the part's bounding box.
May be null if execution of this part never finishes successfully.
- Specified by:
outPort
in interfaceIWorkflowBpmnAlignmentItem<Object,IStructuredBpmnModelPart>
- Returns:
- The position of the out port of this part, relative to the top or left edge.
-
ownedBpmnElements
List<de.xima.bpmn_model.api.behavior.BpmnElement<?>> ownedBpmnElements()
BPMN elements that are owned by this part, including alldiagram elements
. EachBpmnElement
is owned by exactly one structured part. As such, does NOT include nested flow elements fromchildParts()
. All positions are relative to the top-left corner of this part.- Returns:
- A list of flow elements contained in this part.
-
raisableErrors
Map<String,BpmnRaisableError> raisableErrors()
Errors that can potentially be thrown (but are not necessarily thrown) by this BPMN model part, usually via athrow event
. This must include all errors ofchild parts
.The set contains the
error codes
. The error code is the unique identifier of an error.- Returns:
- A list of errors that can be thrown by this part.
-
raisableEscalations
Map<String,BpmnRaisableEscalation> raisableEscalations()
Escalations that can potentially be thrown (but are not necessarily thrown) by this BPMN model part, usually via athrow event
. This must include all escalations ofchild parts
.The set contains the
escalation codes
. The escalation code is the unique identifier of an escalation.- Returns:
- A list of escalations that can be thrown by this part.
-
raisableSignals
Map<String,BpmnRaisableSignal> raisableSignals()
Signals that can potentially be thrown (but are not necessarily thrown) by this BPMN model part, usually via athrow event
. This must include all signals ofchild parts
.The set contains the
signal names
. The signal name is the unique identifier of a signal.- Returns:
- A list of signals that can be thrown by this part.
-
-