Skip to content

Service Task

Bases: Task

An API from Service Task from BPMN. This classes holds ServiceTaskElement as elements.

Attributes:

Name Type Description
root _Element

root of BPMN loaded as XML.

Source code in bpmn_parser/_service_task.py
class ServiceTask(Task):
    """An API from Service Task from BPMN. This classes holds `ServiceTaskElement` as elements.

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

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

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

        self._items = []
        for service_task in self.root.xpath(
            '//bpmn:serviceTask', namespaces={'bpmn': self.bpmn_tag}
        ):
            self._items.append(
                ServiceTaskElement(
                    id=service_task.get('id'),
                    name=service_task.get('name'),
                    topic_name=service_task.get(self._build_camunda_attrib('topic')),
                    type=service_task.get(self._build_camunda_attrib('type')),
                    execution_listeners=self._get_execution_listeners(service_task),
                )
            )
        return self._items

Bases: TaskElement

Parse an Service Task from BPMN.

Attributes:

Name Type Description
topic_name str

topic name of element in BPMN.

type str

type of element in BPMN.

Source code in bpmn_parser/_service_task.py
@dataclass
class ServiceTaskElement(TaskElement):
    """Parse an Service Task from BPMN.

    Attributes:
        topic_name (str): topic name of element in BPMN.
        type (str): type of element in BPMN.
    """

    topic_name: str
    type: str
type(bpmn_parser.service_task)
Output
bpmn_parser._service_task.ServiceTask

bpmn_parser.service_task
Output
ServiceTask(items=4)

List

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

bpmn_parser.service_task.list

Output
[
    ServiceTaskElement(
        id='Activity_QueryData',
        name='Query Data',
        execution_listeners=[],
        topic_name='query-data',
        type='external'
    ),
    ServiceTaskElement(
        id='Activity_PreScreening',
        name='Pre-Screening',
        execution_listeners=[],
        topic_name='pre-screening',
        type='external'
    ),
    ServiceTaskElement(
        id='Activity_SomeExternalTask',
        name='Some External Task',
        execution_listeners=[],
        topic_name='some-external-task',
        type='external'
    ),
    ServiceTaskElement(
        id='Activity_ValidateData',
        name='Validate Data',
        execution_listeners=[],
        topic_name='validate-data',
        type='external')
]

Get

Get a specific exclusive gateway by your ID.

bpmn_parser.service_task.get('Activity_QueryData')

Output
ServiceTaskElement(
    id='Activity_QueryData',
    name='Query Data',
    execution_listeners=[],
    topic_name='query-data',
    type='external'
)