Skip to content

Exclusive Gateway

Bases: Task

An API from Exclusive Gateway from BPMN. This classes holds ExclusiveGatewayElement as elements.

Attributes:

Name Type Description
root _Element

root of BPMN loaded as XML.

Source code in bpmn_parser/_exclusive_gateway.py
class ExclusiveGateway(Task):
    """An API from Exclusive Gateway from BPMN. This classes holds `ExclusiveGatewayElement` as elements.

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

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

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

        self._items = []
        for exclusive_gateway in self.root.xpath(
            '//bpmn:exclusiveGateway', namespaces={'bpmn': self.bpmn_tag}
        ):
            self._items.append(
                ExclusiveGatewayElement(
                    id=exclusive_gateway.get('id'),
                    name=exclusive_gateway.get('name'),
                )
            )
        return self._items

Bases: BPMNElement

Parse an Exclusive Gateway from BPMN

Source code in bpmn_parser/_exclusive_gateway.py
@dataclass
class ExclusiveGatewayElement(BPMNElement):
    """Parse an Exclusive Gateway from BPMN"""

    pass
type(bpmn_parser.exclusive_gateway)
Output
bpmn_parser._exclusive_gateway.ExclusiveGateway

bpmn_parser.exclusive_gateway
Output
ExclusiveGateway(items=3)

List

List all exclusive gateways elements founded in .bpmn file.

bpmn_parser.exclusive_gateway.list

Output
[
    ExclusiveGatewayElement(
        id='Gateway_04151fm',
        name=None
    ),
    ExclusiveGatewayElement(
        id='Gateway_0ony4ks',
        name='Which flow?'
    ),
    ExclusiveGatewayElement(
        id='Gateway_0v0migw',
        name=None
    ),
]

Get

Get a specific exclusive gateway by your ID.

bpmn_parser.exclusive_gateway.get('Gateway_04151fm')

Output
ExclusiveGatewayElement(
    id='Gateway_04151fm',
    name=None
),