public static ExecutionErrorInstanceList convertToErrorInstanceList(List<ExecutionError> executionErrors) { if (executionErrors == null) { return new ExecutionErrorInstanceList(new ExecutionErrorInstance[0]); } List<ExecutionErrorInstance> executionErrorInstances = new ArrayList<ExecutionErrorInstance>(executionErrors.size()); for (ExecutionError error : executionErrors) { ExecutionErrorInstance errorInstance = convertToErrorInstance(error); executionErrorInstances.add(errorInstance); } return new ExecutionErrorInstanceList(executionErrorInstances); }
@Override public List<ExecutionErrorInstance> getErrorsByTaskId(String containerId, Long taskId, boolean includeAcknowledged, Integer page, Integer pageSize) { ExecutionErrorInstanceList result = null; if( config.isRest() ) { Map<String, Object> valuesMap = new HashMap<String, Object>(); valuesMap.put(CONTAINER_ID, containerId); valuesMap.put(TASK_INSTANCE_ID, taskId); String queryString = "?includeAck=" + includeAcknowledged; queryString = getPagingQueryString(queryString, page, pageSize); result = makeHttpGetRequestAndCreateCustomResponse( build(loadBalancer.getUrl(), ADMIN_TASK_URI + "/" + ERRORS_BY_TASK_ID_GET_URI, valuesMap) + queryString, ExecutionErrorInstanceList.class); } else { CommandScript script = new CommandScript( Collections.singletonList( (KieServerCommand) new DescriptorCommand( "UserTaskAdminService", "getExecutionErrorsByTaskId", new Object[]{containerId, taskId, includeAcknowledged, page, pageSize, "", true}) ) ); ServiceResponse<ExecutionErrorInstanceList> response = (ServiceResponse<ExecutionErrorInstanceList>) 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(); }
@Override public List<ExecutionErrorInstance> getErrorsByProcessInstanceAndNode(String containerId, Long processInstanceId, String nodeName, boolean includeAcknowledged, Integer page, Integer pageSize) { ExecutionErrorInstanceList result = null; if( config.isRest() ) { Map<String, Object> valuesMap = new HashMap<String, Object>(); valuesMap.put(CONTAINER_ID, containerId); valuesMap.put(PROCESS_INST_ID, processInstanceId); String queryString = "?includeAck=" + includeAcknowledged +"&node=" + nodeName; queryString = getPagingQueryString(queryString, page, pageSize); result = makeHttpGetRequestAndCreateCustomResponse( build(loadBalancer.getUrl(), ADMIN_PROCESS_URI + "/" + ERRORS_BY_PROCESS_INST_GET_URI + queryString, valuesMap), ExecutionErrorInstanceList.class); } else { CommandScript script = new CommandScript( Collections.singletonList( (KieServerCommand) new DescriptorCommand( "ProcessAdminService", "getExecutionErrorsByProcessInstance", new Object[]{containerId, processInstanceId, nodeName, includeAcknowledged, page, pageSize, "", true}) ) ); ServiceResponse<ExecutionErrorInstanceList> response = (ServiceResponse<ExecutionErrorInstanceList>) 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(); }
@Override public List<ExecutionErrorInstance> getErrorsByTaskInfo(String containerId, Long processId, String taskName, boolean includeAcknowledged, Integer page, Integer pageSize) { ExecutionErrorInstanceList result = null; if( config.isRest() ) { Map<String, Object> valuesMap = new HashMap<String, Object>(); valuesMap.put(CONTAINER_ID, containerId); String queryString = "?includeAck=" + includeAcknowledged+"&name=" + taskName + "&process=" + processId; queryString = getPagingQueryString(queryString, page, pageSize); result = makeHttpGetRequestAndCreateCustomResponse( build(loadBalancer.getUrl(), ADMIN_TASK_URI + "/" + ERRORS_GET_URI, valuesMap) + queryString, ExecutionErrorInstanceList.class); } else { CommandScript script = new CommandScript( Collections.singletonList( (KieServerCommand) new DescriptorCommand( "UserTaskAdminService", "getExecutionErrorsByTaskName", new Object[]{containerId, processId, taskName, includeAcknowledged, page, pageSize, "", true}) ) ); ServiceResponse<ExecutionErrorInstanceList> response = (ServiceResponse<ExecutionErrorInstanceList>) 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(); }
@Override public List<ExecutionErrorInstance> getErrors(String containerId, boolean includeAcknowledged, Integer page, Integer pageSize) { ExecutionErrorInstanceList result = null; if( config.isRest() ) { Map<String, Object> valuesMap = new HashMap<String, Object>(); valuesMap.put(CONTAINER_ID, containerId); String queryString = "?includeAck=" + includeAcknowledged; queryString = getPagingQueryString(queryString, page, pageSize); result = makeHttpGetRequestAndCreateCustomResponse( build(loadBalancer.getUrl(), ADMIN_PROCESS_URI + "/" + ERRORS_GET_URI + queryString, valuesMap), ExecutionErrorInstanceList.class); } else { CommandScript script = new CommandScript( Collections.singletonList( (KieServerCommand) new DescriptorCommand( "ProcessAdminService", "getExecutionErrors", new Object[]{containerId, includeAcknowledged, page, pageSize, "", true}) ) ); ServiceResponse<ExecutionErrorInstanceList> response = (ServiceResponse<ExecutionErrorInstanceList>) 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(); }
@Override public List<ExecutionErrorInstance> getTaskErrors(String containerId, boolean includeAcknowledged, Integer page, Integer pageSize) { ExecutionErrorInstanceList result = null; if( config.isRest() ) { Map<String, Object> valuesMap = new HashMap<String, Object>(); valuesMap.put(CONTAINER_ID, containerId); String queryString = "?includeAck=" + includeAcknowledged; queryString = getPagingQueryString(queryString, page, pageSize); result = makeHttpGetRequestAndCreateCustomResponse( build(loadBalancer.getUrl(), ADMIN_TASK_URI + "/" + ERRORS_GET_URI, valuesMap) + queryString, ExecutionErrorInstanceList.class); } else { CommandScript script = new CommandScript( Collections.singletonList( (KieServerCommand) new DescriptorCommand( "UserTaskAdminService", "getExecutionErrorsByTaskName", new Object[]{containerId, "", "", includeAcknowledged, page, pageSize, "", true}) ) ); ServiceResponse<ExecutionErrorInstanceList> response = (ServiceResponse<ExecutionErrorInstanceList>) 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(); }