use of org.kie.server.api.model.instance.RequestInfoInstanceList in project droolsjbpm-integration by kiegroup.
the class JobServicesClientImpl method getRequestsByStatus.
@Override
public List<RequestInfoInstance> getRequestsByStatus(List<String> statuses, Integer page, Integer pageSize) {
RequestInfoInstanceList list = null;
if (config.isRest()) {
Map<String, Object> valuesMap = new HashMap<String, Object>();
String statusQuery = getAdditionalParams("", "status", statuses);
String queryString = getPagingQueryString(statusQuery, page, pageSize);
list = makeHttpGetRequestAndCreateCustomResponse(build(loadBalancer.getUrl(), JOB_URI, valuesMap) + queryString, RequestInfoInstanceList.class);
} else {
CommandScript script = new CommandScript(Collections.singletonList((KieServerCommand) new DescriptorCommand("JobService", "getRequestsByStatus", new Object[] { safeList(statuses), page, pageSize })));
ServiceResponse<RequestInfoInstanceList> response = (ServiceResponse<RequestInfoInstanceList>) executeJmsCommand(script, DescriptorCommand.class.getName(), "BPM").getResponses().get(0);
throwExceptionOnFailure(response);
if (shouldReturnWithNullResponse(response)) {
return null;
}
list = response.getResult();
}
if (list != null && list.getRequestInfoInstances() != null) {
return Arrays.asList(list.getRequestInfoInstances());
}
return Collections.emptyList();
}
Aggregations