Skip to content

User Task

Bases: Task

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

Attributes:

Name Type Description
root _Element

root of BPMN loaded as XML.

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

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

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

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

        self._items = []
        for user_task in self.root.xpath(
            '//bpmn:userTask', namespaces={'bpmn': self.bpmn_tag}
        ):
            self._items.append(
                UserTaskElement(
                    id=user_task.get('id'),
                    name=user_task.get('name'),
                    form_key=user_task.get(self._build_camunda_attrib('formKey')),
                    candidate_groups=user_task.get(
                        self._build_camunda_attrib('candidateGroups')
                    ),
                    due_date=user_task.get(self._build_camunda_attrib('dueDate')),
                    priority=user_task.get(self._build_camunda_attrib('priority')),
                    execution_listeners=self._get_execution_listeners(user_task),
                )
            )
        return self._items

Bases: TaskElement

Parse an Service Task from BPMN.

Attributes:

Name Type Description
form_key str

form key of element in BPMN.

candidate_groups str

candidate groups of element in BPMN.

due_date str

due date of element in BPMN.

priority str

priority of element in BPMN.

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

    Attributes:
        form_key (str): form key of element in BPMN.
        candidate_groups (str): candidate groups of element in BPMN.
        due_date (str): due date of element in BPMN.
        priority (str): priority of element in BPMN.
    """

    form_key: str
    candidate_groups: str
    due_date: str
    priority: str
type(bpmn_parser.user_task)
Output
bpmn_parser._user_task.UserTask

bpmn_parser.user_task
Output
UserTask(items=2)

List

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

bpmn_parser.user_task.list

Output
[
    UserTaskElement(
        id='Activity_HandleDataManually',
        name='Handle Data Manually',
        execution_listeners=[
            ExecutionListener(
                expression="${execution.setVariable('task_created_at', dateTime().plusHours(3).toDate())}",
                event='start'
            )
        ],
        form_key='embedded:deployment:HandleDataManually.json',
        candidate_groups='some-group',
        due_date='${dateTime().plusDays(2).toDate()}',
        priority="${execution.getVariable('is_priority') == true ? 75 : 50}"
    ),
    UserTaskElement(
        id='Activity_ManuallyScreening',
        name='Manually Screening',
        execution_listeners=[
            ExecutionListener(
                expression="${execution.setVariable('task_created_at', dateTime().plusHours(3).toDate())}",
                event='start'
            )
        ],
        form_key='embedded:deployment:ManuallyScreening.json',
        candidate_groups='some-group',
        due_date='${dateTime().plusDays(2).toDate()}',
        priority="${execution.getVariable('is_priority') == true ? 75 : 50}")
]

Get

Get a specific exclusive gateway by your ID.

bpmn_parser.user_task.get('Activity_QueryData')

Output
UserTaskElement(
    id='Activity_HandleDataManually',
    name='Handle Data Manually',
    execution_listeners=[
        ExecutionListener(
            expression="${execution.setVariable('task_created_at', dateTime().plusHours(3).toDate())}",
            event='start'
        )
    ],
    form_key='embedded:deployment:HandleDataManually.json',
    candidate_groups='some-group',
    due_date='${dateTime().plusDays(2).toDate()}',
    priority="${execution.getVariable('is_priority') == true ? 75 : 50}"
)