AnsweredAssumed Answered

The way that the diagram-viewer deal with processIntance which finished itself.

Question asked by jin1 on Jun 28, 2016
Latest reply on Jun 29, 2016 by jbarrez
When I integrate with the  diagram-viewer to tracing the flow going,there is a demand that user want to know how the process finished,especially when the task can cause the end event by "rejected" or "approved" with a Exclusive Gateway(For example).
But the diagram-viewer can not deal with the finished process instance,because the
class (ps: in the
package.) has that code snippet:

ProcessInstance processInstance = runtimeService.createProcessInstanceQuery().processInstanceId(processInstanceId).singleResult();
         ProcessDefinitionEntity processDefinition = (ProcessDefinitionEntity) repositoryService.getProcessDefinition(processInstance.getProcessDefinitionId());

the above code will throw out a
because the
processInstance = null
I extended it by add this

if (processInstance == null) {
            HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery()
            ProcessDefinitionEntity processDefinition = (ProcessDefinitionEntity) repositoryService

            responseJSON.put("processDefinitionId", historicProcessInstance.getProcessDefinitionId());
            highLightedActivities = Collections.emptyList();
            highLightedFlows = getHighLightedFlows(processDefinition, processInstanceId);
         } else {//TODO

now,we can get the red-wat sequence flow.
But there is still a puzzle , whether this extension broken The Design Concept?
Is process tracking only occurring at run time?