ProcessInstanceAdminServiceImpl implements ProcessInstanceAdminService { @Override public Collection<ProcessNode> getProcessNodes(long processInstanceId) throws ProcessInstanceNotFoundException { ProcessInstanceDesc pi = runtimeDataService.getProcessInstanceById(processInstanceId); if (pi == null) { throw new ProcessInstanceNotFoundException("Process instance with id " + processInstanceId + " not found"); } Collection<ProcessNode> nodes = processService.execute(pi.getDeploymentId(), ProcessInstanceIdContext.get(processInstanceId), new ListNodesCommand(processInstanceId)); return nodes; } ProcessInstanceAdminServiceImpl(); void setProcessService(ProcessService processService); void setRuntimeDataService(RuntimeDataService runtimeDataService); void setIdentityProvider(IdentityProvider identityProvider); void setCommandService(TransactionalCommandService commandService); @Override Collection<ProcessNode> getProcessNodes(long processInstanceId); @Override void cancelNodeInstance(long processInstanceId, long nodeInstanceId); @Override void retriggerNodeInstance(long processInstanceId, long nodeInstanceId); @Override void updateTimer(long processInstanceId, long timerId, long delay, long period, int repeatLimit); @Override void updateTimerRelative(long processInstanceId, long timerId, long delay, long period, int repeatLimit); @Override Collection<TimerInstance> getTimerInstances(long processInstanceId); @Override void triggerNode(long processInstanceId, long nodeId); @Override Collection<NodeInstanceDesc> getActiveNodeInstances(long processInstanceId); @Override void acknowledgeError(String... errorId); @Override ExecutionError getError(String errorId); @Override List<ExecutionError> getErrors(boolean includeAcknowledged, QueryContext queryContext); @Override List<ExecutionError> getErrorsByProcessId(String deploymentId, String processId, boolean includeAcknowledged, QueryContext queryContext); @Override List<ExecutionError> getErrorsByProcessInstanceId(long processInstanceId, boolean includeAcknowledged, QueryContext queryContext); @Override List<ExecutionError> getErrorsByProcessInstanceId(long processInstanceId, String nodeName, boolean includeAcknowledged, QueryContext queryContext); @Override List<ExecutionError> getErrorsByDeploymentId(String containerId, boolean includeAcknowledged, QueryContext queryContext);  }
@Test public void testGetNodes() { processInstanceId = processService.startProcess(deploymentUnit.getIdentifier(), "org.jbpm.writedocument"); assertNotNull(processInstanceId); Collection<ProcessNode> processNodes = processAdminService.getProcessNodes(processInstanceId); assertNotNull(processNodes); assertEquals(8, processNodes.size()); Map<String, String> mappedNodes = processNodes.stream().collect(Collectors.toMap(ProcessNode::getNodeName, ProcessNode::getNodeType)); assertEquals("StartNode", mappedNodes.get("Start")); assertEquals("HumanTaskNode", mappedNodes.get("Write a Document")); assertEquals("Split", mappedNodes.get("Review and Translate")); assertEquals("HumanTaskNode", mappedNodes.get("Translate Document")); assertEquals("HumanTaskNode", mappedNodes.get("Review Document")); assertEquals("Join", mappedNodes.get("Reviewed and Translated")); assertEquals("ActionNode", mappedNodes.get("Report")); assertEquals("EndNode", mappedNodes.get("End")); }