Source:
<code>public String getActiveProcessImage(String containerId, long procInstId, String completedNodeColor, String completedNodeBorderColor, String activeNodeBorderColor) { ProcessInstanceDesc instance = dataService.getProcessInstanceById(procInstId); if (instance == null) { throw new ProcessInstanceNotFoundException("No instance found for process instance id " + procInstId); } String imageSVGString = null; byte[] imageSVG = getProcessImageAsBytes(instance.getDeploymentId(), instance.getProcessId()); if (imageSVG != null) { Map<String, String> subProcessLinks = new HashMap<>(); Collection<NodeInstanceDesc> activeLogs = dataService.getProcessInstanceHistoryActive(procInstId, new QueryContext(0, MAX_NODES)); <START> Collection<NodeInstanceDesc> completedLogs = dataService.getProcessInstanceHistoryCompleted(procInstId, new QueryContext(0, MAX_NODES)); <END> 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, completedNodeColor, completedNodeBorderColor, activeNodeBorderColor); return imageSVGString; } throw new IllegalArgumentException("No process found for " + instance.getProcessId() + " within container " + containerId); }</code><technical_language>consider paging for that</technical_language>

Target:
public String getActiveProcessImage(String containerId, long procInstId, String completedNodeColor, String completedNodeBorderColor, String activeNodeBorderColor) { ProcessInstanceDesc instance = dataService.getProcessInstanceById(procInstId); if (instance == null) { throw new ProcessInstanceNotFoundException("No instance found for process instance id " + procInstId); } String imageSVGString = null; byte[] imageSVG = getProcessImageAsBytes(instance.getDeploymentId(), instance.getProcessId()); if (imageSVG != null) { Map<String, String> subProcessLinks = new HashMap<>(); QueryContext qc = MAX_NODES > 0 ? new QueryContext(0, MAX_NODES) : null; Collection<NodeInstanceDesc> activeLogs = dataService.getProcessInstanceHistoryActive(procInstId, qc); Collection<NodeInstanceDesc> completedLogs = dataService.getProcessInstanceHistoryCompleted(procInstId, qc); 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, completedNodeColor, completedNodeBorderColor, activeNodeBorderColor); return imageSVGString; } throw new IllegalArgumentException("No process found for " + instance.getProcessId() + " within container " + containerId); }