cancel
Showing results for 
Search instead for 
Did you mean: 

Generating diagram form process instance always stays on the same initial task

gioppoluca
Champ in-the-making
Champ in-the-making
I'm using Activiti in a spring boot application and have a process that has the first activity as asynch as explained in this forum to get it executed from a rest call without keeping the API stuck.
The API return the processID
A second API query for the image of the running process:
Here is the method:

public InputStream getProcessImage(String id){
      System.out.println("ProcessID:"+id);
      ProcessInstance pi;
      pi = runtimeService.createProcessInstanceQuery().processInstanceId(id).singleResult();
      if (pi == null){
         return null;
      }
      System.out.println("Process execution:"+pi.getId());
      BpmnModel bmod = processEngine.getRepositoryService().getBpmnModel(pi.getProcessDefinitionId());
      List<String> actact = runtimeService.getActiveActivityIds(id);
      System.out.println("ActiveActivities:"+actact.toString());
      return new DefaultProcessDiagramGenerator().generateDiagram(bmod,"png",actact);
   }

The active activity is always the first one and the image always has that activiti highlighted even if the process executes normally.
Any hints?
thanks
1 REPLY 1

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi,
can you create jUnit test?
http://forums.activiti.org/content/sticky-how-write-unit-test

Regards
Martin