@Override
public List<ProcessNode> getProcessNodes(String containerId, Long processInstanceId) {
ProcessNodeList result = null;
if( config.isRest() ) {
Map<String, Object> valuesMap = new HashMap<String, Object>();
valuesMap.put(CONTAINER_ID, containerId);
valuesMap.put(PROCESS_INST_ID, processInstanceId);
result = makeHttpGetRequestAndCreateCustomResponse(
build(loadBalancer.getUrl(), ADMIN_PROCESS_URI + "/" + NODES_PROCESS_INST_GET_URI, valuesMap), ProcessNodeList.class);
} else {
CommandScript script = new CommandScript( Collections.singletonList( (KieServerCommand)
new DescriptorCommand( "ProcessAdminService", "getProcessNodes", new Object[]{containerId, processInstanceId}) ) );
ServiceResponse<ProcessNodeList> response = (ServiceResponse<ProcessNodeList>) executeJmsCommand( script, DescriptorCommand.class.getName(), "BPM" ).getResponses().get(0);
throwExceptionOnFailure(response);
if (shouldReturnWithNullResponse(response)) {
return null;
}
result = response.getResult();
}
if (result != null && result.getItems() != null) {
return result.getItems();
}
return Collections.emptyList();
}