Activiti 6 get all tasks by process definition ID

cancel
Showing results for 
Search instead for 
Did you mean: 
shrutim
Member II

Activiti 6 get all tasks by process definition ID

Jump to solution

Hi,

I am using Activiti 6.

I am trying to get all the tasks of a process with Task Type. The need is to Save task details , task Id, task type(Start event, user task etc) with Task Id.

If I go by getting Flow Elements from Process , I get Task types but not task Id.

Found this code snippet in one of forum post, but this doesnt work in Activiti 6. Seems like ActivityImpl is replaced ?

if (processDefinition != null) {

for (ActivityImpl activity : processDefinition.get) {

String type = (String) activity.getProperty("type");

String name = (String) activity.getProperty("name");

String taskId = activity.getId();

System.out.println("type: "+type+" name: "+name + " id: " + taskId);

} }

I have recently started with Activiti so quiet naive at it.

 

1 Solution

Accepted Solutions
abbask01
Senior Member

Re: Activiti 6 get all tasks by process definition ID

Jump to solution

You can use task query from TaskService API provided by engine. inject taskService in your code and create query with appropriate operations.

e.g.

taskService.createTaskQuery().processDefinitionId("your-process-def-id").list();

see javadocs for details on available operations

Regards,
Abbas

View solution in original post

1 Reply
abbask01
Senior Member

Re: Activiti 6 get all tasks by process definition ID

Jump to solution

You can use task query from TaskService API provided by engine. inject taskService in your code and create query with appropriate operations.

e.g.

taskService.createTaskQuery().processDefinitionId("your-process-def-id").list();

see javadocs for details on available operations

Regards,
Abbas