Search in sources :

Example 6 with RequestInfoInstanceList

use of org.kie.server.api.model.instance.RequestInfoInstanceList in project droolsjbpm-integration by kiegroup.

the class JobServicesClientImpl method getRequestsByCommand.

@Override
public List<RequestInfoInstance> getRequestsByCommand(String command, List<String> statuses, Integer page, Integer pageSize) {
    RequestInfoInstanceList list = null;
    if (config.isRest()) {
        Map<String, Object> valuesMap = new HashMap<String, Object>();
        valuesMap.put(JOB_CMD_NAME, command);
        String statusQuery = getAdditionalParams("", "status", statuses);
        String queryString = getPagingQueryString(statusQuery, page, pageSize);
        list = makeHttpGetRequestAndCreateCustomResponse(build(loadBalancer.getUrl(), JOB_URI + "/" + JOB_INSTANCES_BY_CMD_GET_URI, valuesMap) + queryString, RequestInfoInstanceList.class);
    } else {
        CommandScript script = new CommandScript(Collections.singletonList((KieServerCommand) new DescriptorCommand("JobService", "getRequestsByCommand", new Object[] { command, 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)

Example 7 with RequestInfoInstanceList

use of org.kie.server.api.model.instance.RequestInfoInstanceList in project droolsjbpm-integration by kiegroup.

the class JobServicesClientImpl method getRequestsByContainer.

@Override
public List<RequestInfoInstance> getRequestsByContainer(String containerId, List<String> statuses, Integer page, Integer pageSize) {
    RequestInfoInstanceList list = null;
    if (config.isRest()) {
        Map<String, Object> valuesMap = new HashMap<String, Object>();
        valuesMap.put(CONTAINER_ID, containerId);
        String statusQuery = getAdditionalParams("", "status", statuses);
        String queryString = getPagingQueryString(statusQuery, page, pageSize);
        list = makeHttpGetRequestAndCreateCustomResponse(build(loadBalancer.getUrl(), JOB_URI + "/" + JOB_INSTANCES_BY_CONTAINER_GET_URI, valuesMap) + queryString, RequestInfoInstanceList.class);
    } else {
        CommandScript script = new CommandScript(Collections.singletonList((KieServerCommand) new DescriptorCommand("JobService", "getRequestsByContainer", new Object[] { containerId, 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)

Example 8 with RequestInfoInstanceList

use of org.kie.server.api.model.instance.RequestInfoInstanceList in project droolsjbpm-integration by kiegroup.

the class JobServicesClientImpl method getRequestsByBusinessKey.

@Override
public List<RequestInfoInstance> getRequestsByBusinessKey(String businessKey, Integer page, Integer pageSize) {
    RequestInfoInstanceList list = null;
    if (config.isRest()) {
        Map<String, Object> valuesMap = new HashMap<String, Object>();
        valuesMap.put(JOB_KEY, businessKey);
        String queryString = getPagingQueryString("", page, pageSize);
        list = makeHttpGetRequestAndCreateCustomResponse(build(loadBalancer.getUrl(), JOB_URI + "/" + JOB_INSTANCES_BY_KEY_GET_URI, valuesMap) + queryString, RequestInfoInstanceList.class);
    } else {
        CommandScript script = new CommandScript(Collections.singletonList((KieServerCommand) new DescriptorCommand("JobService", "getRequestsByBusinessKey", new Object[] { businessKey, 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)

Example 9 with RequestInfoInstanceList

use of org.kie.server.api.model.instance.RequestInfoInstanceList in project droolsjbpm-integration by kiegroup.

the class ExecutorServiceBase method getRequestsByContainer.

public RequestInfoInstanceList getRequestsByContainer(String containerId, List<String> statuses, Integer page, Integer pageSize) {
    List<STATUS> statusList = convertStatusList(statuses);
    List<RequestInfo> requests = executorService.getRequestsByDeployment(containerId, statusList, buildQueryContext(page, pageSize));
    RequestInfoInstanceList result = convertToRequestInfoList(requests, false, false);
    return result;
}
Also used : STATUS(org.kie.api.executor.STATUS) RequestInfoInstanceList(org.kie.server.api.model.instance.RequestInfoInstanceList) RequestInfo(org.kie.api.executor.RequestInfo)

Example 10 with RequestInfoInstanceList

use of org.kie.server.api.model.instance.RequestInfoInstanceList in project droolsjbpm-integration by kiegroup.

the class ExecutorServiceBase method getRequestsByCommand.

public RequestInfoInstanceList getRequestsByCommand(String command, List<String> statuses, Integer page, Integer pageSize) {
    List<STATUS> statusList = convertStatusList(statuses);
    List<RequestInfo> requests = executorService.getRequestsByCommand(command, statusList, buildQueryContext(page, pageSize));
    RequestInfoInstanceList result = convertToRequestInfoList(requests, false, false);
    return result;
}
Also used : STATUS(org.kie.api.executor.STATUS) RequestInfoInstanceList(org.kie.server.api.model.instance.RequestInfoInstanceList) RequestInfo(org.kie.api.executor.RequestInfo)

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