class Delete(pycamunda.base.CamundaRequest): id_ = PathParameter('id') cascade = QueryParameter('cascade') skip_custom_listeners = QueryParameter('skipCustomListeners') skip_io_mappings = QueryParameter('skipIoMappings') def __init__(self, url: str, id_: str, cascade: bool = False, skip_custom_listeners: bool = False, skip_io_mappings: bool = False): """Delete a deployment. :param url: Camunda Rest engine URL. :param id_: Id of the the deployment. :param cascade: Whether to cascade the action to all process instances (including historic). :param skip_custom_listeners: Whether to skip custom listeners and notify only builtin ones. :param skip_io_mappings: Whether to skip input/output mappings. """ super().__init__(url=url + URL_SUFFIX + '/{id}') self.id_ = id_ self.cascade = cascade self.skip_custom_listeners = skip_custom_listeners self.skip_io_mappings = skip_io_mappings def __call__(self, *args, **kwargs) -> None: """Send the request.""" super().__call__(pycamunda.base.RequestMethod.DELETE, *args, **kwargs)
class Delete(pycamunda.base.CamundaRequest): id_ = PathParameter('id') skip_custom_listeners = QueryParameter('skipCustomListeners') skip_io_mappings = QueryParameter('skipIoMappings') skip_subprocesses = QueryParameter('skipSubprocesses') fail_if_not_exists = QueryParameter('failIfNotExists') def __init__(self, url: str, id_: str, skip_custom_listeners: bool = False, skip_io_mappings: bool = False, skip_subprocesses: bool = False, fail_if_not_exists: bool = True): """Delete a process instance. :param url: Camunda Rest engine URL. :param id_: Id of the process instance. :param skip_custom_listeners: Whether to skip custom listeners and notify only builtin ones. :param skip_io_mappings: Whether to skip input/output mappings. :param skip_subprocesses: Whether to skip subprocesses. :param fail_if_not_exists: Whether to fail if the provided process instance id is not found. """ super().__init__(url=url + URL_SUFFIX + '/{id}') self.id_ = id_ self.skip_custom_listeners = skip_custom_listeners self.skip_io_mappings = skip_io_mappings self.skip_subprocesses = skip_subprocesses self.fail_if_not_exists = fail_if_not_exists def __call__(self, *args, **kwargs): """Send the request.""" super().__call__(pycamunda.base.RequestMethod.DELETE, *args, **kwargs)
class Count(pycamunda.base.CamundaRequest): id_ = QueryParameter('filterId') resource_type = QueryParameter('resourceType') name = QueryParameter('name') name_like = QueryParameter('nameLike') owner = QueryParameter('owner') def __init__(self, url: str, id_: str = None, name: str = None, name_like: str = None, owner: str = None): """Count filters. :param url: Camunda Rest engine URL. :param id_: Id of the filter. :param name: Filter by the name of the filter. :param name_like: Filter by a substring of the name of the filter. :param owner: Filter by the user id of the owner of the filter. """ super().__init__(url=url + URL_SUFFIX + '/count') self.id_ = id_ self.resource_type = 'Task' self.name = name self.name_like = name_like self.owner = owner def __call__(self, *args, **kwargs) -> int: """Send the request""" response = super().__call__(pycamunda.base.RequestMethod.GET, *args, **kwargs) return response.json()['count']
class GetActivityInstanceStats(pycamunda.base.CamundaRequest): id_ = PathParameter('id') key = PathParameter('key') tenant_id = PathParameter('tenant-id') failed_jobs = QueryParameter('failedJobs') incidents = QueryParameter('incidents', provide=pycamunda.base.value_is_true) incidents_for_type = QueryParameter('incidentsForType') def __init__( self, url: str, id_: str = None, key: str = None, tenant_id: str = None, failed_jobs: bool = None, incidents: bool = False, incidents_for_type: typing.Union[str, pycamunda.incident.IncidentType] = None ): """Get runtime statistics for a process definition. Does not include historic data. :param url: Camunda Rest engine URL. :param id_: Id of the process definition. :param key: Key of the process definition. :param tenant_id: Id of the tenant the process definition belongs to. :param failed_jobs: Whether the number of failed jobs should be included. :param incidents: Whether to include the number of incidents. :param incidents_for_type: Include only incidents of a specific type. """ if incidents and incidents_for_type is not None: raise pycamunda.PyCamundaException( 'Either \'incidents\' or \'incidents_for_type\' can be provided, not both.' ) super().__init__(url=url + URL_SUFFIX + '/{path}/statistics') self.id_ = id_ self.key = key self.tenant_id = tenant_id self.failed_jobs = failed_jobs self.incidents = incidents self.incident_type = None if incidents_for_type is not None: self.incidents_for_type = pycamunda.incident.IncidentType(incidents_for_type) @property def url(self): if self.id_ is not None: return self._url.format(path=self.id_) if self.tenant_id is not None: return self._url.format(path=f'key/{self.key}/tenant-id/{self.tenant_id}') return self._url.format(path=f'key/{self.key}') def __call__(self, *args, **kwargs) -> typing.Tuple[ActivityStats]: """Send the request.""" response = super().__call__(pycamunda.base.RequestMethod.GET, *args, **kwargs) return tuple(ActivityStats.load(activity_json) for activity_json in response.json())
class Delete(pycamunda.base.CamundaRequest): id_ = PathParameter('id') key = PathParameter('key') tenant_id = PathParameter('tenant-id') cascade = QueryParameter('cascade') skip_custom_listeners = QueryParameter('skipCustomListeners') skip_io_mappings = QueryParameter('skipIoMappings') def __init__( self, url: str, id_: str = None, key: str = None, tenant_id: str = None, cascade: bool = False, skip_custom_listeners: bool = False, skip_io_mappings: bool = False ): """Delete a process definition. :param url: Camunda Rest engine URL. :param id_: Id of the process definition. :param key: Key of the process definition. :param tenant_id: Id of the tenant the process definition belongs to. :param cascade: Whether to cascade the deletion to process instances of the definition. :param skip_custom_listeners: Whether to skip custom listeners and notify only builtin ones. :param skip_io_mappings: Whether to skip input/output mappings. """ super().__init__(url=url + URL_SUFFIX + '/{path}') self.id_ = id_ self.key = key self.tenant_id = tenant_id self.cascade = cascade self.skip_custom_listeners = skip_custom_listeners self.skip_io_mappings = skip_io_mappings @property def url(self): if self.id_ is not None: return self._url.format(path=self.id_) if self.tenant_id is not None: return self._url.format(path=f'key/{self.key}/tenant-id/{self.tenant_id}') return self._url.format(path=f'key/{self.key}') def __call__(self, *args, **kwargs) -> None: """Send the request.""" super().__call__(pycamunda.base.RequestMethod.DELETE, *args, **kwargs)
class Count(pycamunda.base.CamundaRequest): id_ = QueryParameter('id') first_name = QueryParameter('firstName') first_name_like = QueryParameter('firstNameLike') last_name = QueryParameter('lastName') last_name_like = QueryParameter('lastNameLike') email = QueryParameter('email') email_like = QueryParameter('emailLike') member_of_group = QueryParameter('memberOfGroup') member_of_tenant = QueryParameter('memberOfTenant') def __init__(self, url: str, id_: str = None, first_name: str = None, first_name_like: str = None, last_name: str = None, last_name_like: str = None, email: str = None, email_like: str = None, member_of_group: str = None, member_of_tenant: str = None): """Count users. :param url: Camunda Rest engine URL. :param id_: Id of the user. :param first_name: Filter by the first name of the user. :param first_name_like: Filter by a substring of the first name. :param last_name: Filter by the last name of the user. :param last_name_like: Filter by a substring of the last name. :param email: Filter by the email of the user. :param email_like: Filter by a substring of the email. :param member_of_group: Filter for users which are a member of a group. :param member_of_tenant: Filter for users which are a member of a tenant. """ super().__init__(url=url + URL_SUFFIX + '/count') self.id_ = id_ self.first_name = first_name self.first_name_like = first_name_like self.last_name = last_name self.last_name_like = last_name_like self.email = email self.email_like = email_like self.member_of_group = member_of_group self.member_of_tenant = member_of_tenant def __call__(self, *args, **kwargs) -> int: """Send the request""" response = super().__call__(pycamunda.base.RequestMethod.GET, *args, **kwargs) return response.json()['count']
class VariablesGetList(pycamunda.base.CamundaRequest): process_instance_id = PathParameter('id') deserialize_values = QueryParameter('deserializeValues') def __init__(self, url: str, process_instance_id: str, deserialize_values: bool = False): """Get variables of a process instance. :param url: Camunda Rest engine URL. :param process_instance_id: Id of the process instance. :param deserialize_values: Whether serializable variable values are deserialized on server side. """ super().__init__(url=url + URL_SUFFIX + '/{id}/variables') self.process_instance_id = process_instance_id self.deserialize_values = deserialize_values def __call__(self, *args, **kwargs) -> typing.Dict[str, pycamunda.variable.Variable]: """Send the request.""" response = super().__call__(pycamunda.base.RequestMethod.GET, *args, **kwargs) return { name: pycamunda.variable.Variable.load(data=var_json) for name, var_json in response.json().items() }
class IdentityLinksGetList(pycamunda.base.CamundaRequest): task_id = PathParameter('id') type_ = QueryParameter('type') def __init__(self, url: str, task_id: str = None, type_: str = None) -> None: """Get the identity links of an user task. An identity link is a relationship between an user task and an user or a group. E.g. when the user is the assignee / owner or one of the candidate users of the task. :param url: Camunda Rest engine URL. :param task_id: Id of the task. :param type_: Type of the identity link. Can be any custom string. Pre-defined types are 'assignee' (user), 'owner' (user) and 'candidate' (user / group). """ super().__init__(url=url + URL_SUFFIX + '/{id}/identity-links') self.task_id = task_id self.type_ = type_ def __call__(self, *args, **kwargs) -> typing.Tuple[IdentityLink]: """Send the request.""" response = super().__call__(pycamunda.base.RequestMethod.GET, *args, **kwargs) return tuple(IdentityLink.load(link_json) for link_json in response.json())
class LocalVariablesGetList(pycamunda.base.CamundaRequest): task_id = PathParameter('id') deserialize_values = QueryParameter('deserializeValues') def __init__( self, url: str, task_id: str, deserialize_values: bool = False ): """Get local variables of an user task. Local variables are variables that do only exist in the context of a task. :param url: Camunda Rest engine URL. :param task_id: Id of the task. :param deserialize_values: Whether serializable variable values are deserialized on server side. """ super().__init__(url=url + URL_SUFFIX + '/{id}/localVariables') self.task_id = task_id self.deserialize_values = deserialize_values def __call__(self, *args, **kwargs) -> typing.Dict[str, pycamunda.variable.Variable]: """Send the request.""" response = super().__call__(pycamunda.base.RequestMethod.GET, *args, **kwargs) return { name: pycamunda.variable.Variable.load(data=var_json) for name, var_json in response.json().items() }
class GetProcessInstanceStats(pycamunda.base.CamundaRequest): failed_jobs = QueryParameter('failedJobs') incidents = QueryParameter('incidents', provide=pycamunda.base.value_is_true) root_incidents = QueryParameter('rootIncidents', provide=pycamunda.base.value_is_true) incidents_for_type = QueryParameter('incidentsForType') def __init__(self, url: str, failed_jobs: bool = False, incidents: bool = False, root_incidents: bool = False, incidents_for_type: typing.Union[ str, pycamunda.incident.IncidentType] = None): """Get runtime statistics grouped by process definition. Does not include historic data. :param url: Camunda Rest engine URL. :param failed_jobs: Whether the number of failed jobs should be included. :param incidents: Whether to include the number of incidents. :param root_incidents: Whether to include the corresponding number of root incidents for each incident type. :param incidents_for_type: Include only incidents of a specific type. """ if sum( (incidents, root_incidents, incidents_for_type is not None)) > 1: raise pycamunda.PyCamundaException( 'Either \'incidents\', \'root_incidents\' or \'incidents_for_type\' can be ' 'provided, not multiple of them.') super().__init__(url=url + URL_SUFFIX + '/statistics') self.failed_jobs = failed_jobs self.incidents = incidents self.root_incidents = root_incidents self.incidents_for_type = None if incidents_for_type is not None: self.incidents_for_type = pycamunda.incident.IncidentType( incidents_for_type) def __call__(self, *args, **kwargs) -> typing.Tuple[ProcessInstanceStats]: """Send the request.""" response = super().__call__(pycamunda.base.RequestMethod.GET, *args, **kwargs) return tuple( ProcessInstanceStats.load(stats_json) for stats_json in response.json())
class Get(pycamunda.base.CamundaRequest): id_ = PathParameter('id') case_definition_id = QueryParameter('caseDefinitionId') business_key = QueryParameter('businessKey') active = QueryParameter('active', provide=pycamunda.base.value_is_true) completed = QueryParameter('completed', provide=pycamunda.base.value_is_true) tenant_id = QueryParameter('tenantId') def __init__(self, url: str, id_: str, case_definition_id: str = None, business_key: str = None, active: bool = False, completed: bool = False, tenant_id: typing.Iterable[str] = None): """Get a case instance. :param url: Camunda Rest engine URL. :param id_: Id of the case instance. :param case_definition_id: Id of the case definition the case instance belongs to. :param business_key: The business key of the case instance. :param active: Whether the case instance is active. :param completed: Whether the case instance is completed. :param tenant_id: The tenant id of the case instance. """ super().__init__(url=url + URL_SUFFIX + '/{id}') self.id_ = id_ self.business_key = business_key self.case_definition_id = case_definition_id self.active = active self.completed = completed self.tenant_id = tenant_id def __call__(self, *args, **kwargs) -> CaseInstance: """Send the request.""" response = super().__call__(pycamunda.base.RequestMethod.GET, *args, **kwargs) return CaseInstance.load(response.json())
class Count(pycamunda.base.CamundaRequest): batch_id = QueryParameter('batchId') type_ = QueryParameter('type') tenant_id_in = QueryParameter('tenantIdIn') without_tenant_id = QueryParameter('withoutTenantId', provide=pycamunda.base.value_is_true) suspended = QueryParameter('suspended', provide=pycamunda.base.value_is_true) def __init__( self, url: str, batch_id: str = None, type_: str = None, tenant_id_in: typing.Iterable[str] = None, without_tenant_id: bool = False, suspended: bool = False, ): """Count batches. :param url: Camunda Rest engine URL. :param batch_id: Filter by id. :param type_: Filter by batch type. :param tenant_id_in: Filter whether the tenant id is one of multiple ones. :param without_tenant_id: Whether to include only batches that belong to no tenant. :param suspended: Whether to include only suspended batches. """ super().__init__(url=url + URL_SUFFIX + '/count') self.batch_id = batch_id self.type_ = type_ self.tenant_id_in = tenant_id_in self.without_tenant_id = without_tenant_id self.suspended = suspended def __call__(self, *args, **kwargs) -> int: """Send the request.""" response = super().__call__(pycamunda.base.RequestMethod.GET, *args, **kwargs) return response.json()['count']
class Check(pycamunda.base.CamundaRequest): permission_name = QueryParameter('permissionName') permission_value = QueryParameter('permissionValue') resource_name = QueryParameter('resourceName') resource_type = QueryParameter('resourceType') resource_id = QueryParameter('resourceId') def __init__(self, url: str, permission_name: str, permission_value: int, resource_name: str, resource_type: typing.Union[str, pycamunda.resource.ResourceType], resource_id: str = None): """Check the authorization of the currently authenticated user. :param url: Camunda Rest engine URL. :param permission_name: Name of the permission to check. :param permission_value: Value of the permission to check for. :param resource_name: Name of the resource to check for. :param resource_type: Type of the resource to check for. :param resource_id: Id of the resource to check for. """ super().__init__(url=url + URL_SUFFIX + '/check') self.permission_name = permission_name self.permission_value = permission_value self.resource_name = resource_name self.resource_type = resource_type self.resource_id = resource_id def __call__(self, *args, **kwargs) -> Permission: """Send the request.""" response = super().__call__(pycamunda.base.RequestMethod.GET, *args, **kwargs) return Permission.load(data=response.json())
class Delete(pycamunda.base.CamundaRequest): id_ = PathParameter('id') cascade = QueryParameter('cascade', provide=pycamunda.base.value_is_true) def __init__(self, url: str, id_: str, cascade: bool = False): """Delete a batch. :param url: Camunda Rest engine URL. :param id_: Id of the batch. :param cascade: Whether to cascade the deletion to historic batch and historic job logs. """ super().__init__(url=url + URL_SUFFIX + '/{id}') self.id_ = id_ self.cascade = cascade def __call__(self, *args, **kwargs) -> None: """Send the request.""" super().__call__(pycamunda.base.RequestMethod.DELETE, *args, **kwargs)
class LocalVariablesGet(pycamunda.base.CamundaRequest): task_id = PathParameter('id') var_name = PathParameter('varName') deserialize_value = QueryParameter('deserializeValue') def __init__( self, url: str, task_id: str, var_name: str, deserialize_value: bool = False, binary: bool = False ): """Get a local variable of an user task. Local variables are variables that do only exist in the context of a task. :param url: Camunda Rest engine URL. :param task_id: Id of the task. :param var_name: Name of the variable. :param deserialize_value: Whether serializable variable values are deserialized on server side. :param binary: Whether the requested variable is a binary array or file variable. """ super().__init__(url=url + URL_SUFFIX + '/{id}/localVariables/{varName}') self.task_id = task_id self.var_name = var_name self.deserialize_value = deserialize_value self.binary = binary @property def url(self): return super().url + ('/data' if self.binary else '') def __call__(self, *args, **kwargs) -> pycamunda.variable.Variable: """Send the request.""" response = super().__call__(pycamunda.base.RequestMethod.GET, *args, **kwargs) if self.binary: return response.content return pycamunda.variable.Variable.load(data=response.json())
class Get(pycamunda.base.CamundaRequest): id_ = PathParameter('filterId') item_count = QueryParameter('itemCount') def __init__(self, url: str, id_: str, item_count: bool = False): """Query for a filter. :param url: Camunda Rest engine URL. :param id_: Id of the filter. :param item_count: Return the number of items matched by the respective filter. """ super().__init__(url=url + URL_SUFFIX + '/{filterId}') self.id_ = id_ self.item_count = item_count def __call__(self, *args, **kwargs) -> Filter: """Send the request""" response = super().__call__(pycamunda.base.RequestMethod.GET, *args, **kwargs) return Filter.load(response.json())
class Count(pycamunda.base.CamundaRequest): id_ = QueryParameter('id') type_ = QueryParameter('type') user_id_in = QueryParameter('userIdIn') group_id_in = QueryParameter('groupIdIn') resource_type = QueryParameter('resourceType') resource_id = QueryParameter('resourceId') def __init__( self, url: str, id_: str = None, type_: typing.Union[str, AuthorizationType] = None, user_id_in: typing.Iterable[str] = None, group_id_in: typing.Iterable[str] = None, resource_type: typing.Union[str, pycamunda.resource.ResourceType] = None, resource_id: int = None, ): """Get the size of the result returned by the Get List request. :param url: Camunda Rest engine URL. :param id_: Filter by the id of the authorization. :param type_: Filter by the authorization type. :param user_id_in: Filter whether the user id is one of multiple ones. :param group_id_in: Filter whether the group id is one of multiple ones. :param resource_type: Filter by the resource type. :param resource_id: Filter by the resource id. """ super().__init__(url=url + URL_SUFFIX + '/count') self.id_ = id_ self.type_ = None if type_ is not None: self.type_ = AuthorizationType(type_) self.user_id_in = user_id_in self.group_id_in = group_id_in self.resource_type = None if type_ is not None: self.resource_type = pycamunda.resource.ResourceType(resource_type) self.resource_id = resource_id def __call__(self, *args, **kwargs) -> int: """Send the request.""" response = super().__call__(pycamunda.base.RequestMethod.GET, *args, **kwargs) return int(response.json()['count'])
class VariablesGet(pycamunda.base.CamundaRequest): process_instance_id = PathParameter('id') var_name = PathParameter('varName') deserialize_value = QueryParameter('deserializeValue') def __init__(self, url: str, process_instance_id: str, var_name: str, deserialize_value: bool = False, binary: bool = False): """Get a variable of a process instance. :param url: Camunda Rest engine URL. :param process_instance_id: Id of the process instance. :param var_name: Name of the variable. :param deserialize_value: Whether serializable variable values are deserialized on server side. :param binary: Whether the requested variable is a binary array or file variable. """ super().__init__(url=url + URL_SUFFIX + '/{id}/variables/{varName}') self.process_instance_id = process_instance_id self.var_name = var_name self.deserialize_value = deserialize_value self.binary = binary @property def url(self): return super().url + ('/data' if self.binary else '') def __call__(self, *args, **kwargs) -> typing.Union[pycamunda.variable.Variable, bytes]: """Send the request.""" response = super().__call__(pycamunda.base.RequestMethod.GET, *args, **kwargs) if self.binary: return response.content return pycamunda.variable.Variable.load(data=response.json())
class Get(pycamunda.base.CamundaRequest): id_ = PathParameter('id') deserialize_value = QueryParameter('deserializeValue') def __init__(self, url: str, id_: str, deserialize_value: bool = False): """Get a variable instance. :param url: Camunda Rest engine URL. :param id_: Id of the variable instance. :param deserialize_value: Whether serializable variable values are deserialized on server side. """ super().__init__(url=url + URL_SUFFIX + '/{id}') self.id_ = id_ self.deserialize_value = deserialize_value def __call__(self, *args, **kwargs) -> VariableInstance: """Send the request.""" response = super().__call__(pycamunda.base.RequestMethod.GET, *args, **kwargs) return VariableInstance.load(response.json())
class Count(pycamunda.base.CamundaRequest): id_ = QueryParameter('id') name = QueryParameter('name') name_like = QueryParameter('nameLike') user_member = QueryParameter('userMember') group_member = QueryParameter('groupMember') including_groups_of_user = QueryParameter( 'includingGroupsOfUser', provide=pycamunda.base.value_is_true) def __init__(self, url: str, id_: str = None, name: str = None, name_like: str = None, user_member: str = None, group_member: str = None, including_groups_of_user: bool = False): """Count tenants. :param url: Camunda Rest engine URL. :param id_: Filter by the id of the tenant. :param name: Filter by the name of the tenant. :param name_like: Filter by a substring of the name. :param user_member: Filter for tenants where the given user is member of. :param group_member: Filter for tenants where the given group is a member of. :param including_groups_of_user: Filter for tenants where the user or one of his groups is a member of. Can only be used with `user_member` parameter. """ super().__init__(url=url + URL_SUFFIX + '/count') self.id_ = id_ self.name = name self.name_like = name_like self.user_member = user_member self.group_member = group_member self.including_groups_of_user = including_groups_of_user def __call__(self, *args, **kwargs) -> int: """Send the request""" response = super().__call__(pycamunda.base.RequestMethod.GET, *args, **kwargs) return response.json()['count']
class GetList(pycamunda.base.CamundaRequest): process_instance_ids = QueryParameter('processInstanceIds') business_key = QueryParameter('businessKey') business_key_like = QueryParameter('businessKeyLike') case_instance_id = QueryParameter('caseInstanceId') process_definition_id = QueryParameter('processDefinitionId') process_definition_key = QueryParameter('processDefinitionKey') process_definition_key_in = QueryParameter('processDefinitionKeyIn') process_definition_key_not_in = QueryParameter('processDefinitionKeyNotIn') deployment_id = QueryParameter('deploymentId') super_process_instance = QueryParameter('superProcessInstance') sub_process_instance = QueryParameter('subProcessInstance') super_case_instance_id = QueryParameter('superCaseInstance') sub_case_instance_id = QueryParameter('subCaseInstance') active = QueryParameter('active', provide=pycamunda.base.value_is_true) suspended = QueryParameter('suspended', provide=pycamunda.base.value_is_true) with_incident = QueryParameter('withIncident') incident_id = QueryParameter('incidentId') incident_type = QueryParameter('incidentType') incident_message = QueryParameter('incidentMessage') incident_message_like = QueryParameter('incidentMessageLike') tenant_id_in = QueryParameter('tenantIdIn') without_tenant_id = QueryParameter('withoutTenantId', provide=pycamunda.base.value_is_true) activity_id_in = QueryParameter('activityIdIn') root_process_instances = QueryParameter('rootProcessInstances') leaf_process_instances = QueryParameter('leafProcessInstances') process_definition_without_tenant_id_in = QueryParameter( 'processDefinitionWithoutTenantIdIn') variables = QueryParameter('variables') variable_names_ignore_case = QueryParameter('variableNamesIgnoreCase') variable_values_ignore_case = QueryParameter('variableValuesIgnoreCase') sort_by = QueryParameter('sortBy', mapping={ 'instance_id': 'instanceId', 'definition_key': 'definitionKey', 'definition_id': 'definitionId', 'tenant_id': 'tenantId', 'business_key': 'businessKey' }) ascending = QueryParameter('sortOrder', mapping={ True: 'asc', False: 'desc' }, provide=lambda self, obj, obj_type: vars(obj). get('sort_by', None) is not None) first_result = QueryParameter('firstResult') max_results = QueryParameter('maxResults') def __init__( self, url: str, process_instance_ids: typing.Iterable[str] = None, business_key: str = None, business_key_like: str = None, case_instance_id: str = None, process_definition_id: str = None, process_definition_key: str = None, process_definition_key_in: typing.Iterable[str] = None, process_definition_key_not_in: typing.Iterable[str] = None, deployment_id: str = None, super_process_instance: str = None, sub_process_instance: str = None, super_case_instance_id: str = None, sub_case_instance_id: str = None, active: bool = False, suspended: bool = False, with_incident: bool = None, incident_id: str = None, incident_type: typing.Union[ str, pycamunda.incident.IncidentType] = None, incident_message: str = None, incident_message_like: str = None, tenant_id_in: typing.Iterable[str] = None, without_tenant_id: bool = False, activity_id_in: typing.Iterable[str] = None, root_process_instances: bool = None, leaf_process_instances: bool = None, process_definition_without_tenant_id_in: bool = None, variables=None, # TODO add annotation variable_names_ignore_case: bool = None, variable_values_ignore_case: bool = None, sort_by: str = None, ascending: bool = True, first_result: int = None, max_results: int = None): """Get a list of process instances. :param url: Camunda Rest engine URL. :param process_instance_ids: Filter by process instance ids. :param business_key: Filter by business key. :param business_key_like: Filter by a substring of the business key. :param case_instance_id: Filter by case instance id. :param process_definition_id: Filter by process definition id. :param process_definition_key: Filter by process definition key. :param process_definition_key_in: Filter whether the process definition key is one of multiple ones. :param process_definition_key_not_in: Filter whether the process definition key is not one of multiple ones. :param deployment_id: Filter by deployment id. :param super_process_instance: Filter process instances that are a sub process of the provided id. :param sub_process_instance: Filter process instances that are a super process of the provided id. :param super_case_instance_id: Filter process instances that are a sub process of the provided case instance id. :param sub_case_instance_id: Filter process instances that are a super process of the provided case instance id. :param active: Whether to include only active process instances. :param suspended: Whether to include only suspended process instances. :param with_incident: Whether to include only process instances that have incidents. :param incident_id: Filter by incident id. :param incident_type: Filter by incident type. :param incident_message: Filter by the incident message. :param incident_message_like: Filter by a substring the incident message. :param tenant_id_in: Filter whether the tenant id is one of multiple ones. :param without_tenant_id: Whether to include only process instances that belong to no tenant. :param activity_id_in: Filter whether the activity id is one of multiple ones. :param root_process_instances: Include only top level process instances. :param leaf_process_instances: Include only bottom level process instances. :param process_definition_without_tenant_id_in: Include only process instance where the process definition has no tenant id. :param variables: # TODO (add via its own method?) :param variable_names_ignore_case: Whether to ignore case sensitivity for variables names. :param variable_values_ignore_case: Whether to ignore case sensitivity for variable values. :param sort_by: Sort the results by 'instance_id', 'definition_key', 'definition_id', 'tenant_id', 'business_key'. :param ascending: Sort order. :param first_result: Pagination of results. Index of the first result to return. :param max_results: Pagination of results. Maximum number of results to return. """ super().__init__(url=url + URL_SUFFIX) self.process_instance_ids = process_instance_ids self.business_key = business_key self.business_key_like = business_key_like self.case_instance_id = case_instance_id self.process_definition_id = process_definition_id self.process_definition_key = process_definition_key self.process_definition_key_in = process_definition_key_in self.process_definition_key_not_in = process_definition_key_not_in self.deployment_id = deployment_id self.super_process_instance = super_process_instance self.sub_process_instance = sub_process_instance self.super_case_instance_id = super_case_instance_id self.sub_case_instance_id = sub_case_instance_id self.active = active self.suspended = suspended self.with_incident = with_incident self.incident_id = incident_id self.incident_type = None if incident_type is not None: self.incident_type = pycamunda.incident.IncidentType(incident_type) self.incident_message = incident_message self.incident_message_like = incident_message_like self.tenant_id_in = tenant_id_in self.without_tenant_id = without_tenant_id self.activity_id_in = activity_id_in self.root_process_instances = root_process_instances self.leaf_process_instances = leaf_process_instances self.process_definition_without_tenant_id_in = process_definition_without_tenant_id_in self.variables = variables self.variable_names_ignore_case = variable_names_ignore_case self.variable_values_ignore_case = variable_values_ignore_case self.sort_by = sort_by self.ascending = ascending self.first_result = first_result self.max_results = max_results def __call__(self, *args, **kwargs) -> typing.Tuple[ProcessInstance]: """Send the request.""" response = super().__call__(pycamunda.base.RequestMethod.GET, *args, **kwargs) return tuple( ProcessInstance.load(instance_json) for instance_json in response.json())
class Count(pycamunda.base.CamundaRequest): id_ = QueryParameter('caseDefinitionId') id_in = QueryParameter('caseDefinitionIdIn') name = QueryParameter('name') name_like = QueryParameter('nameLike') deployment_id = QueryParameter('deploymentId') key = QueryParameter('key') key_like = QueryParameter('keyLike') category = QueryParameter('category') category_like = QueryParameter('categoryLike') version = QueryParameter('version') latest_version = QueryParameter('latestVersion', provide=pycamunda.base.value_is_true) resource_name = QueryParameter('resourceName') resource_name_like = QueryParameter('resourceNameLike') tenant_id_in = QueryParameter('tenantIdIn') without_tenant_id = QueryParameter('withoutTenantId', provide=pycamunda.base.value_is_true) include_without_tenant_id = QueryParameter( 'includeCaseDefinitionsWithoutTenantId', provide=pycamunda.base.value_is_true) def __init__(self, url: str, id_: str = None, id_in: typing.Iterable[str] = None, name: str = None, name_like: str = None, deployment_id: str = None, key: str = None, key_like: str = None, category: str = None, category_like: str = None, version: int = None, latest_version: bool = False, resource_name: str = None, resource_name_like: str = None, tenant_id_in: typing.Iterable[str] = None, without_tenant_id: bool = False, include_without_tenant_id: bool = False): """Count case definitions. :param url: Camunda Rest engine URL. :param id_: Filter by id. :param id_in: Filter whether the id is one of multiple ones. :param name: Filter by name. :param name_like: Filter by a substring of the name. :param deployment_id: Filter by deployment id. :param key: Key of the case definition. :param key_like: Filter by a substring of the key. :param category: Filter by category. :param category_like: Filter by a substring of the category. :param version: Filter by version. :param latest_version: Whether to include only the latest versions. :param resource_name: Filter by resource name. :param resource_name_like: Filter by a substring of the resource name. :param tenant_id_in: Filter whether the tenant id is one of multiple ones. :param without_tenant_id: Whether to include only case definitions that belong to no tenant. :param include_without_tenant_id: Whether to include case definitions that belong to no tenant. """ super().__init__(url=url + URL_SUFFIX + '/count') self.id_ = id_ self.id_in = id_in self.name = name self.name_like = name_like self.deployment_id = deployment_id self.key = key self.key_like = key_like self.category = category self.category_like = category_like self.version = version self.latest_version = latest_version self.resource_name = resource_name self.resource_name_like = resource_name_like self.tenant_id_in = tenant_id_in self.without_tenant_id = without_tenant_id self.include_without_tenant_id = include_without_tenant_id def __call__(self, *args, **kwargs) -> int: """Send the request.""" response = super().__call__(pycamunda.base.RequestMethod.GET, *args, **kwargs) return response.json()['count']
class GetList(pycamunda.base.CamundaRequest): case_instance_id = QueryParameter('caseInstanceId') business_key = QueryParameter('businessKey') case_definition_id = QueryParameter('caseDefinitionId') case_definition_key = QueryParameter('caseDefinitionKey') deployment_id = QueryParameter('deploymentId') super_process_instance = QueryParameter('superProcessInstance') sub_process_instance = QueryParameter('subProcessInstance') super_case_instance = QueryParameter('superCaseInstance') sub_case_instance = QueryParameter('subCaseInstance') active = QueryParameter('active', provide=pycamunda.base.value_is_true) completed = QueryParameter('completed', provide=pycamunda.base.value_is_true) tenant_id_in = QueryParameter('tenantIdIn') without_tenant_id = QueryParameter('withoutTenantId', provide=pycamunda.base.value_is_true) variables = QueryParameter('variables') variable_names_ignore_case = QueryParameter( 'variableNamesIgnoreCase', provide=pycamunda.base.value_is_true) variable_values_ignore_case = QueryParameter( 'variableValuesIgnoreCase', provide=pycamunda.base.value_is_true) sort_by = QueryParameter('sortBy', mapping={ 'case_instance_id': 'caseInstanceId', 'case_definition_key': 'caseDefinitionKey', 'case_definition_id': 'caseDefinitionId', 'tenant_id': 'tenantId' }) ascending = QueryParameter('sortOrder', mapping={ True: 'asc', False: 'desc' }, provide=lambda self, obj, obj_type: vars(obj). get('sort_by', None) is not None) first_result = QueryParameter('firstResult') max_results = QueryParameter('maxResults') def __init__(self, url: str, case_instance_id: str = None, business_key: str = None, case_definition_id: str = None, case_definition_key: str = None, deployment_id: str = None, super_process_instance: str = None, sub_process_instance: str = None, super_case_instance: str = None, sub_case_instance: str = None, active: bool = False, completed: bool = False, tenant_id_in: typing.Iterable[str] = None, without_tenant_id: bool = False, variable_names_ignore_case: bool = False, variable_values_ignore_case: bool = False, sort_by: str = None, ascending: bool = True, first_result: int = None, max_results: int = None): """Get a list of case instances. :param url: Camunda Rest engine URL. :param case_instance_id: Filter by case instance id. :param business_key: Filter by business key. :param case_definition_id: Filter by case definition id. :param case_definition_key: Filter by case definition key. :param deployment_id: Filter by deployment id. :param super_process_instance: Filter by the id of the super process instance. :param sub_process_instance: Filter by the id of sub process instance. :param super_case_instance: Filter by the id of the super case instance. :param sub_case_instance: Filter by the id of sub case instance. :param active: Whether to include only active case instances. :param completed: Whether to include only complete case instances. :param tenant_id_in: Filter whether the tenant id is one of multiple ones. :param without_tenant_id: Whether to include only case instances that belong to no tenant. :param variable_names_ignore_case: Whether to match variables names case-insensitively. :param variable_values_ignore_case: Whether to match variables values case-insensitively. :param sort_by: Sort the results by 'batch_id' or 'tenant_id'. :param ascending: Sort order. :param first_result: Pagination of results. Index of the first result to return. :param max_results: Pagination of results. Maximum number of results to return. """ super().__init__(url=url + URL_SUFFIX) self.case_instance_id = case_instance_id self.business_key = business_key self.case_definition_id = case_definition_id self.case_definition_key = case_definition_key self.deployment_id = deployment_id self.super_process_instance = super_process_instance self.sub_process_instance = sub_process_instance self.super_case_instance = super_case_instance self.sub_case_instance = sub_case_instance self.active = active self.completed = completed self.tenant_id_in = tenant_id_in self.without_tenant_id = without_tenant_id self.variable_names_ignore_case = variable_names_ignore_case self.variable_values_ignore_case = variable_values_ignore_case self.sort_by = sort_by self.ascending = ascending self.first_result = first_result self.max_results = max_results self.variables = {} def add_variable(self, name: str, value: str, type_: str = None, value_info: typing.Mapping = None) -> None: """Only include case instances with variables with specific values. :param name: Name of the variable. :param value: Value of the variable. :param type_: Value type of the variable. :param value_info: Additional information regarding the value type. """ self.variables[name] = { 'value': value, 'type': type_, 'valueInfo': value_info } def __call__(self, *args, **kwargs) -> typing.Tuple[CaseInstance]: """Send the request.""" response = super().__call__(pycamunda.base.RequestMethod.GET, *args, **kwargs) return tuple( CaseInstance.load(batch_json) for batch_json in response.json())
class GetList(pycamunda.base.CamundaRequest): incident_id = QueryParameter('incidentId') incident_type = QueryParameter('incidentType') incident_message = QueryParameter('incidentMessage') process_definition_id = QueryParameter('processDefinitionId') process_definition_key_in = QueryParameter('processDefinitionKeyIn') process_instance_id = QueryParameter('processInstanceId') execution_id = QueryParameter('executionId') activity_id = QueryParameter('activityId') cause_incident_id = QueryParameter('causeIncidentId') root_cause_incident_id = QueryParameter('rootCauseIncidentId') configuration = QueryParameter('configuration') tenant_id_in = QueryParameter('tenantIdIn') job_definition_id_in = QueryParameter('jobDefinitionIdIn') sort_by = QueryParameter('sortBy', mapping={ 'incident_id': 'incidentId', 'incident_message': 'incidentMessage', 'incident_timestamp': 'incidentTimestamp', 'incident_type': 'incidentType', 'execution_id': 'executionId', 'activity_id': 'activityId', 'process_instance_id': 'processInstanceId', 'process_definition_id': 'processDefinitionId', 'cause_incident_id': 'causeIncidentId', 'root_cause_incident_id': 'rootCauseIncidentId', 'configuration': 'configuration', 'tenant_id': 'tenantId' }) ascending = QueryParameter('sortOrder', mapping={ True: 'asc', False: 'desc' }, provide=lambda self, obj, obj_type: vars(obj). get('sort_by', None) is not None) def __init__(self, url: str, incident_id: str = None, incident_type: str = None, incident_message: str = None, process_definition_id: str = None, process_definition_key_in: typing.Iterable[str] = None, process_instance_id: str = None, execution_id: str = None, activity_id: str = None, cause_incident_id: str = None, root_cause_incident_id: str = None, configuration: str = None, tenant_id_in: typing.Iterable[str] = None, job_definition_id_in: typing.Iterable[str] = None, sort_by: str = None, ascending: bool = True): """Get a list of incidents. :param url: Camunda Rest engine URL. :param incident_id: Filter by incident id. :param incident_type: Filter by incident type. Valid values are 'failedJob' and 'failedExternalTask' :param incident_message: Filter by incident message. :param process_definition_id: Filter by process definition id. :param process_definition_key_in: Filter whether the process definition key is one of multiple ones. :param process_instance_id: Filter by process instance id. :param execution_id: Filter by execution id. :param activity_id: Filter by activity id. :param cause_incident_id: Filter by cause incident id. :param root_cause_incident_id: Filter by root cause incident id. :param configuration: Filter by configuration. :param tenant_id_in: Filter whether the tenant id is one of multiple ones. :param job_definition_id_in: Filter whether the job definition id is one of multiple ones. :param sort_by: Sort the results by 'incident_id', 'incident_message', incident_timestamp', 'incident_type', 'execution_id', 'activity_id', 'process_instance_id', 'process_definition_id', 'cause_incident_id', 'root_cause_incident_id', 'configuration' or 'tenant_id'. :param ascending: Sort order. """ super().__init__(url=url + URL_SUFFIX) self.incident_id = incident_id self.incident_type = incident_type self.incident_message = incident_message self.process_definition_id = process_definition_id self.process_definition_key_in = process_definition_key_in self.process_instance_id = process_instance_id self.execution_id = execution_id self.activity_id = activity_id self.cause_incident_id = cause_incident_id self.root_cause_incident_id = root_cause_incident_id self.configuration = configuration self.tenant_id_in = tenant_id_in self.job_definition_id_in = job_definition_id_in self.sort_by = sort_by self.ascending = ascending def __call__(self, *args, **kwargs) -> typing.Tuple[Incident]: """Send the request.""" response = super().__call__(pycamunda.base.RequestMethod.GET, *args, **kwargs) return tuple( Incident.load(incident_json) for incident_json in response.json())
class GetList(pycamunda.base.CamundaRequest): id_ = QueryParameter('id') name = QueryParameter('name') name_like = QueryParameter('nameLike') user_member = QueryParameter('userMember') group_member = QueryParameter('groupMember') including_groups_of_user = QueryParameter( 'includingGroupsOfUser', provide=pycamunda.base.value_is_true) sort_by = QueryParameter('sortBy', mapping={'id_': 'id', 'name': 'name'}) ascending = QueryParameter('sortOrder', mapping={ True: 'asc', False: 'desc' }, provide=lambda self, obj, obj_type: vars(obj). get('sort_by', None) is not None) first_result = QueryParameter('firstResult') max_results = QueryParameter('maxResults') def __init__(self, url: str, id_: str = None, name: str = None, name_like: str = None, user_member: str = None, group_member: str = None, including_groups_of_user: bool = False, sort_by: str = None, ascending: bool = True, first_result: int = None, max_results: int = None): """Query for a list of tenants using a list of parameters. The size of the result set can be retrieved by using the Count class. :param url: Camunda Rest engine URL. :param id_: Filter by the id of the tenant. :param name: Filter by the name of the tenant. :param name_like: Filter by a substring of the name. :param user_member: Filter for tenants where the given user is member of. :param group_member: Filter for tenants where the given group is a member of. :param including_groups_of_user: Filter for tenants where the user or one of his groups is a member of. Can only be used with `user_member` parameter. :param sort_by: Sort the results by `id_` or `name` of the tenant. :param ascending: Sort order. :param first_result: Pagination of results. Index of the first result to return. :param max_results: Pagination of results. Maximum number of results to return. """ super().__init__(url=url + URL_SUFFIX) self.id_ = id_ self.name = name self.name_like = name_like self.user_member = user_member self.group_member = group_member self.including_groups_of_user = including_groups_of_user self.sort_by = sort_by self.ascending = ascending self.first_result = first_result self.max_results = max_results def __call__(self, *args, **kwargs) -> typing.Tuple[Tenant]: """Send the request""" response = super().__call__(pycamunda.base.RequestMethod.GET, *args, **kwargs) return tuple( Tenant.load(tenant_json) for tenant_json in response.json())
class GetList(pycamunda.base.CamundaRequest): id_ = QueryParameter('id') name = QueryParameter('name') name_like = QueryParameter('nameLike') source = QueryParameter('source') without_source = QueryParameter('withoutSource') tenant_id_in = QueryParameter('tenantIdIn') without_tenant_id = QueryParameter('withoutTenantId', provide=pycamunda.base.value_is_true) include_deployments_without_tenant_id = QueryParameter( 'includeDeploymentsWithoutTenantId', provide=pycamunda.base.value_is_true) after = QueryParameter('after') before = QueryParameter('before') sort_by = QueryParameter('sortBy', mapping={ 'id_': 'id', 'name': 'name', 'definition_time': 'definitionTime', 'tenant_id': 'tenantId', }) ascending = QueryParameter('sortOrder', mapping={ True: 'asc', False: 'desc' }, provide=lambda self, obj, obj_type: vars(obj). get('sort_by', None) is not None) first_result = QueryParameter('firstResult') max_results = QueryParameter('maxResults') def __init__( self, url: str, id_: str = None, name: str = None, name_like: str = None, source: str = None, without_source: bool = None, tenant_id_in: typing.Iterable[str] = None, without_tenant_id: bool = False, include_deployments_without_tenant_id: bool = False, after: dt.datetime = None, before: dt.datetime = None, sort_by: str = None, ascending: bool = True, first_result: int = None, max_results: int = None, ): """Get a list of deployments. :param url: Camunda Rest engine URL. :param id_: Filter by id. :param name: Filter by name. :param name_like: Filter by a substring of the name. :param source: Filter by deployment source. :param without_source: Filter deployments without source. :param tenant_id_in: Filter whether the tenant id is one of multiple ones. :param without_tenant_id: Whether to include only deployments that belong to no tenant. :param include_deployments_without_tenant_id: Whether to include deployments that belong to no tenant. :param after: Filter by the deployment date after the provided data. :param before: Filter by the deployment date before the provided data. :param sort_by: Sort the results by 'id', 'name', 'deployment_time' or 'tenant_id'. :param ascending: Sort order. :param first_result: Pagination of results. Index of the first result to return. :param max_results: Pagination of results. Maximum number of results to return. """ super().__init__(url=url + URL_SUFFIX) self.id_ = id_ self.name = name self.name_like = name_like self.source = source self.without_source = without_source self.tenant_id_in = tenant_id_in self.without_tenant_id = without_tenant_id self.include_deployments_without_tenant_id = include_deployments_without_tenant_id self.after = after self.before = before self.sort_by = sort_by self.ascending = ascending self.first_result = first_result self.max_results = max_results def __call__(self, *args, **kwargs) -> typing.Tuple[Deployment]: """Send the request.""" response = super().__call__(pycamunda.base.RequestMethod.GET, *args, **kwargs) return tuple( Deployment.load(deployment_json) for deployment_json in response.json())
class GetList(pycamunda.base.CamundaRequest): id_ = QueryParameter('id') id_in = QueryParameter('idIn') name = QueryParameter('name') name_like = QueryParameter('nameLike') type_ = QueryParameter('type') member = QueryParameter('member') member_of_tenant = QueryParameter('memberOfTenant') sort_by = QueryParameter('sortBy', mapping={ 'id_': 'id', 'name': 'name', 'type_': 'type' }) ascending = QueryParameter('sortOrder', mapping={ True: 'asc', False: 'desc' }, provide=lambda self, obj, obj_type: vars(obj). get('sort_by', None) is not None) first_result = QueryParameter('firstResult') max_results = QueryParameter('maxResults') def __init__(self, url, id_: str = None, id_in: typing.Iterable[str] = None, name: str = None, name_like: str = None, type_: str = None, member: str = None, member_of_tenant: str = None, sort_by: str = None, ascending: bool = True, first_result: int = None, max_results: int = None): """Get a list of groups. :param url: Camunda Rest engine URL. :param id_: Filter by the id of the group. :param id_in: Filter whether the id of the group is one of multiple ones. :param name: Filter by the name of the group. :param name_like: Filter by a substring of the name of the group. :param type_: Filter by the type of the group. :param member: Filter by a member of the group. :param member_of_tenant: Filter by member of the tenant. :param sort_by: Sort the results by `id_`, `name` or `type_`. :param ascending: Sort order. :param first_result: Pagination of results. Index of the first result to return. :param max_results: Pagination of results. Maximum number of results to return. """ super().__init__(url=url + URL_SUFFIX) self.id_ = id_ self.id_in = id_in self.name = name self.name_like = name_like self.type_ = type_ self.member = member self.member_of_tenant = member_of_tenant self.sort_by = sort_by self.ascending = ascending self.first_result = first_result self.max_results = max_results def __call__(self, *args, **kwargs) -> typing.Tuple[Group]: """Send the request.""" response = super().__call__(pycamunda.base.RequestMethod.GET, *args, **kwargs) return tuple(Group.load(group_json) for group_json in response.json())
class GetList(pycamunda.base.CamundaRequest): name = QueryParameter('variableName') name_like = QueryParameter('variableNameLike') process_instance_id_in = QueryParameter('processInstanceIdIn') execution_id_in = QueryParameter('executionIdIn') case_instance_id_in = QueryParameter('caseInstanceIdIn') case_execution_id_in = QueryParameter('caseExecutionIdIn') task_id_in = QueryParameter('taskIdIn') activity_instance_id_in = QueryParameter('activityInstanceIdIn') tenant_id_in = QueryParameter('tenantIdIn') variable_values = QueryParameter('variableValues') sort_by = QueryParameter('sortBy', mapping={ 'name': 'variableName', 'type_': 'variableType', 'activity_instance_id': 'activityInstanceIdIn', 'tenant_id': 'tenantId' }) ascending = QueryParameter('sortOrder', mapping={ True: 'asc', False: 'desc' }, provide=lambda self, obj, obj_type: vars(obj). get('sort_by', None) is not None) first_result = QueryParameter('firstResult') max_results = QueryParameter('maxResults') deserialize_values = QueryParameter('deserializeValues') def __init__(self, url: str, name: str = None, name_like: str = None, process_instance_id_in: typing.Iterable[str] = None, case_instance_id_in: typing.Iterable[str] = None, case_execution_id_in: typing.Iterable[str] = None, task_id_in: typing.Iterable[str] = None, activity_instance_id_in: typing.Iterable[str] = None, tenant_id_in: typing.Iterable[str] = None, sort_by: str = None, ascending: bool = True, first_result: int = None, max_results: int = None, deserialize_values: bool = False): """Get a list of variable instances. :param url: Camunda Rest engine URL. :param name: Filter by variable name. :param name_like: Filter by a substring of the variable name. :param process_instance_id_in: Filter whether the process instance id is one of multiple ones. :param case_instance_id_in: Filter whether the case instance id is one of multiple ones. :param case_execution_id_in: Filter whether the case execution id is one of multiple ones. :param task_id_in: Filter whether the task id is one of multiple ones. :param activity_instance_id_in: Filter whether the activity instance id is one of multiple ones. :param tenant_id_in: Filter whether the tenant id is one of multiple ones. :param sort_by: Sort the results by 'name', 'type_', 'activity_instance_id' or 'tenant_id'. :param ascending: Sort order. :param first_result: Pagination of results. Index of the first result to return. :param max_results: Pagination of results. Maximum number of results to return. :param deserialize_values: Whether serializable variable values are deserialized on server side. """ super().__init__(url=url + URL_SUFFIX) self.name = name self.name_like = name_like self.process_instance_id_in = process_instance_id_in self.case_instance_id_in = case_instance_id_in self.case_execution_id_in = case_execution_id_in self.task_id_in = task_id_in self.activity_instance_id_in = activity_instance_id_in self.tenant_id_in = tenant_id_in self.sort_by = sort_by self.ascending = ascending self.first_result = first_result self.max_results = max_results self.deserialize_values = deserialize_values self.variable_values = [] def _add_value_filter(self, name: str, criteria: str, value: str) -> None: """Add a filter to include only variables with certain values. :param name: Name of the variable. :param criteria: Filter criteria. Valid values are 'eq' for equal, 'neq' for not equal, 'gt' for greater than, 'gteq' for greater than or equal, 'lt' for less than, 'lteq' for less than or equal and 'like'. :param value: Value to filter for. """ self.variable_values.append((name, criteria, str(value))) def add_equal_value_filter(self, name: str, value: typing.Any) -> None: """Add a filter to include only variables with values equal a provided value. :param name: Name of the variable. :param value: Value to filter for. """ self._add_value_filter(name=name, criteria='eq', value=value) def add_not_equal_value_filter(self, name: str, value: typing.Any) -> None: """Add a filter to include only variables with values not equal a provided value. :param name: Name of the variable. :param value: Value to filter for. """ self._add_value_filter(name=name, criteria='neq', value=value) def add_greater_than_value_filter(self, name: str, value: typing.Any) -> None: """Add a filter to include only variables with values greater than a provided value. :param name: Name of the variable. :param value: Value to filter for. """ self._add_value_filter(name=name, criteria='gt', value=value) def add_greater_than_equal_value_filter(self, name: str, value: typing.Any) -> None: """Add a filter to include only variables with values greater than or equal a provided value. :param name: Name of the variable. :param value: Value to filter for. """ self._add_value_filter(name=name, criteria='gteq', value=value) def add_less_than_value_filter(self, name: str, value: typing.Any) -> None: """Add a filter to include only variables with values less than a provided value. :param name: Name of the variable. :param value: Value to filter for. """ self._add_value_filter(name=name, criteria='lt', value=value) def add_less_than_equal_value_filter(self, name: str, value: typing.Any) -> None: """Add a filter to include only variables with values less than or equal a provided value. :param name: Name of the variable. :param value: Value to filter for. """ self._add_value_filter(name=name, criteria='lteq', value=value) def add_like_value_filter(self, name: str, value: typing.Any) -> None: """Add a filter to include only variables with values like a provided value. :param name: Name of the variable. :param value: Value to filter for. """ self._add_value_filter(name=name, criteria='like', value=value) def query_parameters(self, apply: typing.Callable = ...): params = super().query_parameters(apply=apply) if params['variableValues']: params['variableValues'] = ','.join( ('_'.join(var_val)) for var_val in params['variableValues']) else: del params['variableValues'] return params def __call__(self, *args, **kwargs) -> typing.Tuple[VariableInstance]: """Send the request.""" response = super().__call__(pycamunda.base.RequestMethod.GET, *args, **kwargs) return tuple( VariableInstance.load(variable_json) for variable_json in response.json())
class GetList(pycamunda.base.CamundaRequest): id_ = QueryParameter('caseDefinitionId') id_in = QueryParameter('caseDefinitionIdIn') name = QueryParameter('name') name_like = QueryParameter('nameLike') deployment_id = QueryParameter('deploymentId') key = QueryParameter('key') key_like = QueryParameter('keyLike') category = QueryParameter('category') category_like = QueryParameter('categoryLike') version = QueryParameter('version') latest_version = QueryParameter('latestVersion', provide=pycamunda.base.value_is_true) resource_name = QueryParameter('resourceName') resource_name_like = QueryParameter('resourceNameLike') tenant_id_in = QueryParameter('tenantIdIn') without_tenant_id = QueryParameter('withoutTenantId', provide=pycamunda.base.value_is_true) include_without_tenant_id = QueryParameter( 'includeCaseDefinitionsWithoutTenantId', provide=pycamunda.base.value_is_true) sort_by = QueryParameter('sortBy', mapping={ 'category': 'category', 'key': 'key', 'id_': 'id', 'name': 'name', 'version': 'version', 'deployment_id': 'deploymentId', 'tenant_id': 'tenantId' }) ascending = QueryParameter('sortOrder', mapping={ True: 'asc', False: 'desc' }, provide=lambda self, obj, obj_type: vars(obj). get('sort_by', None) is not None) first_result = QueryParameter('firstResult') max_results = QueryParameter('maxResults') def __init__(self, url: str, id_: str = None, id_in: typing.Iterable[str] = None, name: str = None, name_like: str = None, deployment_id: str = None, key: str = None, key_like: str = None, category: str = None, category_like: str = None, version: str = None, latest_version: bool = False, resource_name: str = None, resource_name_like: str = None, tenant_id_in: typing.Iterable[str] = None, without_tenant_id: bool = False, include_without_tenant_id: bool = False, sort_by: str = None, ascending: bool = True, first_result: int = None, max_results: int = None): """Query for a list of case definitions using a list of parameters. The size of the result set can be retrieved by using the Count method. :param url: Camunda Rest engine URL. :param id_: Filter by id. :param id_in: Filter whether the id is one of multiple ones. :param name: Filter by name. :param name_like: Filter by a substring of the name. :param deployment_id: Filter by deployment id. :param key: Key of the process definition. :param key_like: Filter by a substring of the key. :param category: Filter by category. :param category_like: Filter by a substring of the category. :param version: Filter by version. :param latest_version: Whether to include only the latest versions. :param resource_name: Filter by resource name. :param resource_name_like: Filter by a substring of the resource name. :param tenant_id_in: Filter whether the tenant id is one of multiple ones. :param without_tenant_id: Whether to include only case definitions that belong to no tenant. :param include_without_tenant_id: Whether to include case definitions that belong to no tenant. :param sort_by: Sort the results by 'category', 'key', 'id_', 'name', 'version', 'deployment_id' or 'tenant_id'. Sorting by 'version_tag' is string-based. :param ascending: Sort order. :param first_result: Pagination of results. Index of the first result to return. :param max_results: Pagination of results. Maximum number of results to return. """ super().__init__(url=url + URL_SUFFIX) self.id_ = id_ self.id_in = id_in self.name = name self.name_like = name_like self.deployment_id = deployment_id self.key = key self.key_like = key_like self.category = category self.category_like = category_like self.version = version self.latest_version = latest_version self.resource_name = resource_name self.resource_name_like = resource_name_like self.incident_type = None self.tenant_id_in = tenant_id_in self.without_tenant_id = without_tenant_id self.include_without_tenant_id = include_without_tenant_id self.sort_by = sort_by self.ascending = ascending self.first_result = first_result self.max_results = max_results def __call__(self, *args, **kwargs) -> typing.Tuple[CaseDefinition]: """Send the request.""" response = super().__call__(pycamunda.base.RequestMethod.GET, *args, **kwargs) return tuple( CaseDefinition.load(casedef_json) for casedef_json in response.json())
class Count(pycamunda.base.CamundaRequest): case_instance_id = QueryParameter('caseInstanceId') business_key = QueryParameter('businessKey') case_definition_id = QueryParameter('caseDefinitionId') case_definition_key = QueryParameter('caseDefinitionKey') deployment_id = QueryParameter('deploymentId') super_process_instance = QueryParameter('superProcessInstance') sub_process_instance = QueryParameter('subProcessInstance') super_case_instance = QueryParameter('superCaseInstance') sub_case_instance = QueryParameter('subCaseInstance') active = QueryParameter('active', provide=pycamunda.base.value_is_true) completed = QueryParameter('completed', provide=pycamunda.base.value_is_true) tenant_id_in = QueryParameter('tenantIdIn') without_tenant_id = QueryParameter('withoutTenantId', provide=pycamunda.base.value_is_true) variables = QueryParameter('variables') variable_names_ignore_case = QueryParameter( 'variableNamesIgnoreCase', provide=pycamunda.base.value_is_true) variable_values_ignore_case = QueryParameter( 'variableValuesIgnoreCase', provide=pycamunda.base.value_is_true) def __init__(self, url: str, case_instance_id: str = None, business_key: str = None, case_definition_id: str = None, case_definition_key: str = None, deployment_id: str = None, super_process_instance: str = None, sub_process_instance: str = None, super_case_instance: str = None, sub_case_instance: str = None, active: bool = False, completed: bool = False, tenant_id_in: typing.Iterable[str] = None, without_tenant_id: bool = False, variable_names_ignore_case: bool = False, variable_values_ignore_case: bool = False): """Count a list of case instances. :param url: Camunda Rest engine URL. :param case_instance_id: Filter by case instance id. :param business_key: Filter by business key. :param case_definition_id: Filter by case definition id. :param case_definition_key: Filter by case definition key. :param deployment_id: Filter by deployment id. :param super_process_instance: Filter by the id of the super process instance. :param sub_process_instance: Filter by the id of sub process instance. :param super_case_instance: Filter by the id of the super case instance. :param sub_case_instance: Filter by the id of sub case instance. :param active: Whether to include only active case instances. :param completed: Whether to include only complete case instances. :param tenant_id_in: Filter whether the tenant id is one of multiple ones. :param without_tenant_id: Whether to include only case instances that belong to no tenant. :param variable_names_ignore_case: Whether to match variables names case-insensitively. :param variable_values_ignore_case: Whether to match variables values case-insensitively. """ super().__init__(url=url + URL_SUFFIX + '/count') self.case_instance_id = case_instance_id self.business_key = business_key self.case_definition_id = case_definition_id self.case_definition_key = case_definition_key self.deployment_id = deployment_id self.super_process_instance = super_process_instance self.sub_process_instance = sub_process_instance self.super_case_instance = super_case_instance self.sub_case_instance = sub_case_instance self.active = active self.completed = completed self.tenant_id_in = tenant_id_in self.without_tenant_id = without_tenant_id self.variable_names_ignore_case = variable_names_ignore_case self.variable_values_ignore_case = variable_values_ignore_case self.variables = {} def add_variable(self, name: str, value: str, type_: str = None, value_info: typing.Mapping = None) -> None: """Only count case instances with variables with specific values. :param name: Name of the variable. :param value: Value of the variable. :param type_: Value type of the variable. :param value_info: Additional information regarding the value type. """ self.variables[name] = { 'value': value, 'type': type_, 'valueInfo': value_info } def __call__(self, *args, **kwargs) -> int: """Send the request.""" response = super().__call__(pycamunda.base.RequestMethod.GET, *args, **kwargs) return response.json()['count']