private InputStream getResourceDiagramInputStream(String PROC_INST_ID_){
try {
HistoricProcessInstance hip = historyService.createHistoricProcessInstanceQuery().processInstanceId(PROC_INST_ID_).singleResult();
List<HistoricActivityInstance> hai = historyService.createHistoricActivityInstanceQuery().processInstanceId(PROC_INST_ID_)
.orderByHistoricActivityInstanceId().asc().list();
List<String> executedActivityIdList = new ArrayList<String>();
for (HistoricActivityInstance activityInstance : hai) {
executedActivityIdList.add(activityInstance.getActivityId());
}
BpmnModel bpmnModel = repositoryService.getBpmnModel(hip.getProcessDefinitionId());
List<String> flowIds = this.getExecutedFlows(bpmnModel, hai);
ProcessDiagramGenerator processDiagramGenerator = processEngine.getProcessEngineConfiguration().getProcessDiagramGenerator();
InputStream imageStream = processDiagramGenerator.generateDiagram(bpmnModel, "png", executedActivityIdList, flowIds, "宋體", "微軟雅黑", "黑體", null, 2.0);
return imageStream;
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
本作品採用《CC 協議》,轉載必須註明作者和本文連結