public NodeInstanceList getProcessInstanceHistory(long processInstanceId, Boolean active, Boolean completed, Integer page, Integer pageSize) { logger.debug("About to search for node instances with page {} and page size {}", page, pageSize); Collection<NodeInstanceDesc> result = null; if ((Boolean.TRUE.equals(active) && Boolean.TRUE.equals(completed)) || (active == null && completed == null)) { logger.debug("Searching for active and completed node instances for process instance with id {}", processInstanceId); result = runtimeDataService.getProcessInstanceFullHistory(processInstanceId, buildQueryContext(page, pageSize)); } else if (Boolean.TRUE.equals(active)) { logger.debug("Searching for active node instances for process instance with id {}", processInstanceId); result = runtimeDataService.getProcessInstanceHistoryActive(processInstanceId, buildQueryContext(page, pageSize)); } else if (Boolean.TRUE.equals(completed)) { logger.debug("Searching for completed node instances for process instance with id {}", processInstanceId); result = runtimeDataService.getProcessInstanceHistoryCompleted(processInstanceId, buildQueryContext(page, pageSize)); } NodeInstanceList nodeInstanceList = convertToNodeInstanceList(result); logger.debug("Returning result of node instances search: {}", nodeInstanceList); return nodeInstanceList; }
@Override public Collection<NodeInstanceSummary> getProcessInstanceCompletedNodes(long processInstanceId) { ProcessInstanceDesc piDesc = dataService.getProcessInstanceById(processInstanceId); // TODO make use of paging properly as it's currently limiting to 100 return NodeInstanceHelper.adaptCollection(dataService.getProcessInstanceHistoryCompleted( processInstanceId, new QueryContext(0, 100))); }
public String getActiveProcessImage(String containerId, long procInstId) { ProcessInstanceDesc instance = dataService.getProcessInstanceById(procInstId); if (instance == null) { throw new ProcessInstanceNotFoundException("No instance found for process instance id " + procInstId); } String imageSVGString = null; // get SVG String byte[] imageSVG = getProcessImageAsBytes(instance.getDeploymentId(), instance.getProcessId()); if (imageSVG != null) { // find active nodes and modify image Map<String, String> subProcessLinks = new HashMap<>(); Collection<NodeInstanceDesc> activeLogs = dataService.getProcessInstanceHistoryActive(procInstId, new QueryContext(0, 1000)); Collection<NodeInstanceDesc> completedLogs = dataService.getProcessInstanceHistoryCompleted(procInstId, new QueryContext(0, 1000)); Map<Long, String> active = new HashMap<Long, String>(); List<String> completed = new ArrayList<String>(); for (NodeInstanceDesc activeNode : activeLogs) { active.put(activeNode.getId(), activeNode.getNodeId()); populateSubProcessLink(containerId, activeNode, subProcessLinks); } for (NodeInstanceDesc completeNode : completedLogs) { completed.add(completeNode.getNodeId()); active.remove(completeNode.getId()); populateSubProcessLink(containerId, completeNode, subProcessLinks); } ByteArrayInputStream svgStream = new ByteArrayInputStream(imageSVG); imageSVGString = SVGImageProcessor.transform(svgStream, completed, new ArrayList<String>(active.values()), subProcessLinks); return imageSVGString; } throw new IllegalArgumentException("No process found for " + instance.getProcessId() + " within container " + containerId); }
assertEquals(1, activeNodes.size()); Collection<NodeInstanceDesc> completedNodes = runtimeDataService.getProcessInstanceHistoryCompleted( processInstance.getId(), new QueryContext()); assertNotNull(completedNodes); assertEquals(1, activeNodes.size()); completedNodes = runtimeDataService.getProcessInstanceHistoryCompleted( processInstance.getId(), new QueryContext()); assertNotNull(completedNodes); assertEquals(1, activeNodes.size()); completedNodes = runtimeDataService.getProcessInstanceHistoryCompleted( processInstance.getId(), new QueryContext()); assertNotNull(completedNodes); assertEquals(1, activeNodes.size()); completedNodes = runtimeDataService.getProcessInstanceHistoryCompleted( processInstance.getId(), new QueryContext()); assertNotNull(completedNodes); completedNodes = runtimeDataService.getProcessInstanceHistoryCompleted( processInstance.getId(), new QueryContext()); assertNotNull(completedNodes);
Collection<NodeInstanceDesc> nodeInstanceLogs = runtimeDataService.getProcessInstanceHistoryCompleted( processInstance.getId(), new QueryContext());