Activiti 7 Task Query

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

Activiti 7 Task Query

I would like some guidance on how to query user tasks for a process. My process has two user tasks and what I have managed to do is to start a process programmatically but cannot proceed beyond that in terms of querying the tasks of the process and completing the tasks.

This is what I have in code:

Map<String, Object> variables = new HashMap<>();
		User user = userRepository.findByUsername(assignee);
		System.out.println("Last Name: "+user.getLastname());
		variables.put("user", user);
		variables.put("memberID", member.getId());
		variables.put("Owner", user.getUsername());
		
        ProcessInstance processInstance =  processRuntime.start(ProcessPayloadBuilder
                .start()
                .withProcessDefinitionKey(process_key)
                .withName(member.getFullname())
                .withVariables(variables)
                .build());
       
      
        GetTasksPayload getTasksPayload = new GetTasksPayload();
        getTasksPayload.setProcessInstanceId(processInstance.getId());
        getTasksPayload.setAssigneeId(user.getUsername());
              
        Page<Task> tasks = taskRuntime.tasks(Pageable.of(0, 10), getTasksPayload);
       
       tasks.getContent().forEach(task -> {
            System.out.println("Task Name is :"+ task.getName());
        });
       

The .foreach part does not print as expected.

Please assist.