Reputation: 2591
There is a comparatively easy way to get process definition name by key, but I can't find any way (except to just parse BPMNModel) to get task definition name by task definition id (and, for example, process definition id). Does anyone know about something similar?
EDIT
I know that I can get task name by task instance (that is, org.camunda.bpm.engine.task.Task#getName
), but I need to get task name by task definition (that is, I have no instances of org.camunda.bpm.engine.task.Task
).
Upvotes: 0
Views: 4207
Reputation: 1373
With the TaskService you can create a query for tasks by calling its method createTaskQuery(). The created task query object then offers several methods to narrow down the query by passing query parameters, e.g.
The query then returns either a list() of Task objects or a singleResult() Task. And the Task interface has a method getName():
Task task = taskService.createTaskQuery().taskDefinitionKey("myKey").singleResult();
String name = task.getName();
Upvotes: 2