cancel
Showing results for 
Search instead for 
Did you mean: 

How to generate process instance diagram with active task

andrey_nikolov
Champ in-the-making
Champ in-the-making
I would like to generate process instance diagram (image) with active tasks and flows highlighted.

How can we do that programmatically in Activiti 5.21.0? Most examples in the forums are 3+ years old and somewhat deprecated.

Process Diagram Generator code sample in most examples reports 'Cannot make a static reference to the non-static method generateDiagram(model …) from the type ProcessDiagramGenerator'.

How can we get an instance of class that implements ProcessDiagramGenerator interface? Is there another approach you would recommend?


   String processInstanceId = …
   String processDefinitionId = …

   ProcessDefinition pde = repositoryService.getProcessDefinition(processDefinitionId);
   if (pde != null && pde.hasGraphicalNotation()) {
      BpmnModel model = repositoryService.getBpmnModel(pde.getId());
      List<String> activities = runtimeService.getActiveActivityIds(processInstanceId);
      List<String> flows = new ArrayList<String>();
      InputStream stream = ProcessDiagramGenerator.generateDiagram(model, "PNG", activities, flows);
   }
1 REPLY 1

daveychu
Champ in-the-making
Champ in-the-making
You can use DefaultProcessDiagramGenerator.