AnsweredAssumed Answered

Public API for process instance diagram

Question asked by arkadi on Jul 1, 2011
Latest reply on Jul 4, 2011 by jbarrez
I checked activiti-rest component to borrow some code to create process diagram with active tasks highlighted. Then I fond that a little bit of non-official API is required for that.

public InputStream diagram() {
    // from activiti-rest
    ProcessDefinitionEntity pde = (ProcessDefinitionEntity) ((RepositoryServiceImpl) engine.getRepositoryService()).getDeployedProcessDefinition(task.getProcessDefinitionId());
    // the following doesn't work
    //ProcessDefinitionEntity pde = (ProcessDefinitionEntity) engine.getRepositoryService().createProcessDefinitionQuery().processDefinitionId(task.getProcessDefinitionId()).singleResult();
    if (pde == null || !pde.isGraphicalNotationDefined()) {
        log.warn("No diagram defined for process definition id " + task.getProcessDefinitionId());
        return null;
    }
    return ProcessDiagramGenerator.generateDiagram(pde, "png",
            engine.getRuntimeService().getActiveActivityIds(task.getProcessInstanceId()));
}
Is there a better way to generate the diagram or should I raise an issue to track the required enhancement?

Outcomes