Skip to content

Sequence Flow

Bases: Task

An API from Sequence Flow from BPMN. This classes holds SequenceFlowElement as elements.

Attributes:

Name Type Description
root _Element

root of BPMN loaded as XML.

Source code in bpmn_parser/_sequence_flow.py
class SequenceFlow(Task):
    """An API from Sequence Flow from BPMN. This classes holds `SequenceFlowElement` as elements.

    Attributes:
        root (_Element): root of BPMN loaded as XML.
    """

    def __init__(self, root: _Element):
        super().__init__(root)
        self._items: Optional[list[SequenceFlowElement]] = None

    @property
    def list(self):
        if self._items is not None:
            return self._items

        self._items = []
        for sequence_flow in self.root.xpath(
            '//bpmn:sequenceFlow', namespaces={'bpmn': self.bpmn_tag}
        ):
            if condition_expression := sequence_flow.xpath(
                './/bpmn:conditionExpression', namespaces={'bpmn': self.bpmn_tag}
            ):
                condition_expression = ConditionExpressionElement(
                    type=condition_expression[0].get(
                        self._build_xml_schema_attrib('type')
                    ),
                    condition=condition_expression[0].text,
                )

            self._items.append(
                SequenceFlowElement(
                    id=sequence_flow.get('id'),
                    name=sequence_flow.get('name'),
                    source_ref=sequence_flow.get('sourceRef'),
                    target_ref=sequence_flow.get('targetRef'),
                    condition_expression=condition_expression or None,
                )
            )
        return self._items

Bases: BPMNElement

Parse an Sequence Flow from BPMN.

Attributes:

Name Type Description
source_ref str

source reference from this element in BPMN.

target_ref str

target reference from this element in BPMN.

condition_expression Union[ConditionExpressionElement, None]

a condition expression implemented in this element in BPMN.

Source code in bpmn_parser/_sequence_flow.py
@dataclass
class SequenceFlowElement(BPMNElement):
    """Parse an Sequence Flow from BPMN.

    Attributes:
        source_ref (str): source reference from this element in BPMN.
        target_ref (str): target reference from this element in BPMN.
        condition_expression (Union[ConditionExpressionElement, None]): a condition
            expression implemented in this element in BPMN.
    """

    source_ref: str
    target_ref: str
    condition_expression: Union[ConditionExpressionElement, None]
type(bpmn_parser.sequence_flow)
Output
bpmn_parser._sequence_flow.SequenceFlow

bpmn_parser.sequence_flow
Output
SequenceFlow(items=4)

List

List all intermedicate catch events elements founded in .bpmn file.

bpmn_parser.sequence_flow.list

Output
[
    SequenceFlowElement(
        id='Flow_12kpqpg',
        name=None,
        source_ref='Activity_ManuallyScreening',
        target_ref='Gateway_0v0migw',
        condition_expression=None),
    SequenceFlowElement(
        id='Flow_0kt31nl',
        name='Not',
        source_ref='Gateway_13p78ag',
        target_ref='Gateway_0v0migw',
        condition_expression=None),
    SequenceFlowElement(
        id='Flow_1ab06b8',
        name='Yes',
        source_ref='Gateway_0djd7kh',
        target_ref='Gateway_13p78ag',
        condition_expression=ConditionExpressionElement(
            type='bpmn:tFormalExpression',
            condition='${pre_triagem__is_processo_atualizado == true || pre_triagem__tentativas_atualizacao >= 10}')
        ),
    SequenceFlowElement(
        id='Flow_07n3h98',
        name='Yes',
        source_ref='Gateway_13p78ag',
        target_ref='Activity_ManuallyScreening',
        condition_expression=ConditionExpressionElement(
            type='bpmn:tFormalExpression',
            condition='${pre_screening_success == false}')
        ),
]

Get

Get a specific exclusive gateway by your ID.

bpmn_parser.sequence_flow.get('Flow_1ab06b8')

Output
SequenceFlowElement(
    id='Flow_1ab06b8',
    name='Yes',
    source_ref='Gateway_0djd7kh',
    target_ref='Gateway_13p78ag',
    condition_expression=ConditionExpressionElement(
        type='bpmn:tFormalExpression',
        condition='${pre_triagem__is_processo_atualizado == true || pre_triagem__tentativas_atualizacao >= 10}'
    )
)