AnsweredAssumed Answered

How to generate process instance diagram with active task

Question asked by andrey.nikolov on Jul 23, 2016
Latest reply on Jul 23, 2016 by daveychu
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);
   }

Outcomes