Search in sources :

Example 21 with RequestInfoInstanceList

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();
}
Also used : DescriptorCommand(org.kie.server.api.commands.DescriptorCommand) ServiceResponse(org.kie.server.api.model.ServiceResponse) KieServerCommand(org.kie.server.api.model.KieServerCommand) HashMap(java.util.HashMap) RequestInfoInstanceList(org.kie.server.api.model.instance.RequestInfoInstanceList) CommandScript(org.kie.server.api.commands.CommandScript)

Aggregations

RequestInfoInstanceList (org.kie.server.api.model.instance.RequestInfoInstanceList)21 RequestInfo (org.kie.api.executor.RequestInfo)8 ServiceResponse (org.kie.server.api.model.ServiceResponse)8 HashMap (java.util.HashMap)7 CommandScript (org.kie.server.api.commands.CommandScript)7 DescriptorCommand (org.kie.server.api.commands.DescriptorCommand)7 KieServerCommand (org.kie.server.api.model.KieServerCommand)7 ApiOperation (io.swagger.annotations.ApiOperation)5 ApiResponses (io.swagger.annotations.ApiResponses)5 GET (javax.ws.rs.GET)5 Produces (javax.ws.rs.Produces)5 Variant (javax.ws.rs.core.Variant)5 STATUS (org.kie.api.executor.STATUS)5 Header (org.kie.server.remote.rest.common.Header)5 RestUtils.buildConversationIdHeader (org.kie.server.remote.rest.common.util.RestUtils.buildConversationIdHeader)5 RestUtils.createCorrectVariant (org.kie.server.remote.rest.common.util.RestUtils.createCorrectVariant)5 RestUtils.getVariant (org.kie.server.remote.rest.common.util.RestUtils.getVariant)5 Path (javax.ws.rs.Path)4 RouteBuilder (org.apache.camel.builder.RouteBuilder)1 KieServerInfo (org.kie.server.api.model.KieServerInfo)1