Search in sources :

Example 16 with ProcessInstanceList

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

the class RuntimeDataServiceBase method getProcessInstancesByDeploymentId.

public ProcessInstanceList getProcessInstancesByDeploymentId(String containerId, List<Integer> status, Integer page, Integer pageSize, String sort, boolean sortOrder) {
    if (sort == null || sort.isEmpty()) {
        sort = "ProcessInstanceId";
    }
    if (status == null || status.isEmpty()) {
        status = new ArrayList<Integer>();
        status.add(ProcessInstance.STATE_ACTIVE);
    }
    logger.debug("About to search for process instance belonging to container '{}' with page {} and page size {}", containerId, page, pageSize);
    Collection<ProcessInstanceDesc> instances = runtimeDataService.getProcessInstancesByDeploymentId(containerId, status, buildQueryContext(page, pageSize, sort, sortOrder));
    logger.debug("Found {} process instance for container '{}', statuses '{}'", instances.size(), containerId, status);
    ProcessInstanceList processInstanceList = convertToProcessInstanceList(instances);
    logger.debug("Returning result of process instance search: {}", processInstanceList);
    return processInstanceList;
}
Also used : ProcessInstanceList(org.kie.server.api.model.instance.ProcessInstanceList) ConvertUtils.convertToProcessInstanceList(org.kie.server.services.jbpm.ConvertUtils.convertToProcessInstanceList) ProcessInstanceDesc(org.jbpm.services.api.model.ProcessInstanceDesc)

Example 17 with ProcessInstanceList

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

the class RuntimeDataServiceBase method getProcessInstances.

public ProcessInstanceList getProcessInstances(List<Integer> status, String initiator, String processName, Integer page, Integer pageSize, String sort, boolean sortOrder) {
    if (sort == null || sort.isEmpty()) {
        sort = "ProcessInstanceId";
    }
    if (status == null || status.isEmpty()) {
        status = new ArrayList<Integer>();
        status.add(ProcessInstance.STATE_ACTIVE);
    }
    Collection<ProcessInstanceDesc> instances = null;
    if (processName != null && !processName.isEmpty()) {
        logger.debug("About to search for process instances with process name '{}' with page {} and page size {}", processName, page, pageSize);
        instances = runtimeDataService.getProcessInstancesByProcessName(status, processName, nullEmpty(initiator), buildQueryContext(page, pageSize, sort, sortOrder));
        logger.debug("Found {} process instances for process name '{}', statuses '{}'", instances.size(), processName, status);
    } else {
        logger.debug("About to search for process instances with page {} and page size {}", page, pageSize);
        instances = runtimeDataService.getProcessInstances(status, nullEmpty(initiator), buildQueryContext(page, pageSize, sort, sortOrder));
        logger.debug("Found {} process instances , statuses '{}'", instances.size(), status);
    }
    ProcessInstanceList processInstanceList = convertToProcessInstanceList(instances);
    logger.debug("Returning result of process instance search: {}", processInstanceList);
    return processInstanceList;
}
Also used : ProcessInstanceList(org.kie.server.api.model.instance.ProcessInstanceList) ConvertUtils.convertToProcessInstanceList(org.kie.server.services.jbpm.ConvertUtils.convertToProcessInstanceList) ProcessInstanceDesc(org.jbpm.services.api.model.ProcessInstanceDesc)

Example 18 with ProcessInstanceList

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

the class JmsResponseHandlerIntegrationTest method testGetProcessInstancesUseOfAsyncResponseHandlerWithMarshaller.

@Test
public void testGetProcessInstancesUseOfAsyncResponseHandlerWithMarshaller() throws Exception {
    ResponseCallback callback = new BlockingResponseCallback(createMarshaller());
    testGetProcessInstancesResponseHandler(new AsyncResponseHandler(callback));
    // now let's check if response has arrived
    ProcessInstanceList processInstanceList = callback.get(ProcessInstanceList.class);
    assertThat(processInstanceList).isNotNull();
    assertThat(processInstanceList.getItems()).isNotNull().hasSize(1);
}
Also used : ProcessInstanceList(org.kie.server.api.model.instance.ProcessInstanceList) AsyncResponseHandler(org.kie.server.client.jms.AsyncResponseHandler) BlockingResponseCallback(org.kie.server.client.jms.BlockingResponseCallback) ResponseCallback(org.kie.server.client.jms.ResponseCallback) BlockingResponseCallback(org.kie.server.client.jms.BlockingResponseCallback) Test(org.junit.Test) JbpmKieServerBaseIntegrationTest(org.kie.server.integrationtests.jbpm.JbpmKieServerBaseIntegrationTest)

Example 19 with ProcessInstanceList

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

the class ProcessServiceBase method getProcessInstancesByParent.

public ProcessInstanceList getProcessInstancesByParent(long parentProcessInstanceId, List<Integer> status, Integer page, Integer pageSize, String sort, boolean sortOrder) {
    if (sort == null || sort.isEmpty()) {
        sort = "ProcessInstanceId";
    }
    if (status == null || status.isEmpty()) {
        status = new ArrayList<Integer>();
        status.add(ProcessInstance.STATE_ACTIVE);
    }
    Collection<ProcessInstanceDesc> instances = runtimeDataService.getProcessInstancesByParent(parentProcessInstanceId, status, buildQueryContext(page, pageSize, sort, sortOrder));
    logger.debug("Found {} process instances , statuses '{}'", instances.size(), status);
    ProcessInstanceList processInstanceList = convertToProcessInstanceList(instances);
    logger.debug("Returning result of process instance search: {}", processInstanceList);
    return processInstanceList;
}
Also used : ProcessInstanceList(org.kie.server.api.model.instance.ProcessInstanceList) ConvertUtils.convertToProcessInstanceList(org.kie.server.services.jbpm.ConvertUtils.convertToProcessInstanceList) ProcessInstanceDesc(org.jbpm.services.api.model.ProcessInstanceDesc)

Example 20 with ProcessInstanceList

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

the class RuntimeDataServiceBase method getProcessInstancesByProcessId.

public ProcessInstanceList getProcessInstancesByProcessId(String processId, List<Integer> status, String initiator, Integer page, Integer pageSize, String sort, boolean sortOrder) {
    if (sort == null || sort.isEmpty()) {
        sort = "ProcessInstanceId";
    }
    if (status == null || status.isEmpty()) {
        status = new ArrayList<Integer>();
        status.add(ProcessInstance.STATE_ACTIVE);
    }
    logger.debug("About to search for process instances with process id '{}' with page {} and page size {}", processId, page, pageSize);
    Collection<ProcessInstanceDesc> instances = runtimeDataService.getProcessInstancesByProcessId(status, processId, nullEmpty(initiator), buildQueryContext(page, pageSize, sort, sortOrder));
    logger.debug("Found {} process instance for process id '{}', statuses '{}'", instances.size(), processId, status);
    ProcessInstanceList processInstanceList = convertToProcessInstanceList(instances);
    logger.debug("Returning result of process instance search: {}", processInstanceList);
    return processInstanceList;
}
Also used : ProcessInstanceList(org.kie.server.api.model.instance.ProcessInstanceList) ConvertUtils.convertToProcessInstanceList(org.kie.server.services.jbpm.ConvertUtils.convertToProcessInstanceList) ProcessInstanceDesc(org.jbpm.services.api.model.ProcessInstanceDesc)

Aggregations

ProcessInstanceList (org.kie.server.api.model.instance.ProcessInstanceList)34 HashMap (java.util.HashMap)15 CommandScript (org.kie.server.api.commands.CommandScript)14 DescriptorCommand (org.kie.server.api.commands.DescriptorCommand)14 KieServerCommand (org.kie.server.api.model.KieServerCommand)14 ServiceResponse (org.kie.server.api.model.ServiceResponse)14 GET (javax.ws.rs.GET)9 Path (javax.ws.rs.Path)9 Produces (javax.ws.rs.Produces)9 ApiOperation (io.swagger.annotations.ApiOperation)8 ApiResponses (io.swagger.annotations.ApiResponses)8 ProcessInstanceDesc (org.jbpm.services.api.model.ProcessInstanceDesc)8 Header (org.kie.server.remote.rest.common.Header)8 RestUtils.buildConversationIdHeader (org.kie.server.remote.rest.common.util.RestUtils.buildConversationIdHeader)7 ConvertUtils.convertToProcessInstanceList (org.kie.server.services.jbpm.ConvertUtils.convertToProcessInstanceList)6 ArrayList (java.util.ArrayList)5 Variant (javax.ws.rs.core.Variant)4 ProcessInstance (org.kie.server.api.model.instance.ProcessInstance)4 RestUtils.createCorrectVariant (org.kie.server.remote.rest.common.util.RestUtils.createCorrectVariant)3 DeploymentNotFoundException (org.jbpm.services.api.DeploymentNotFoundException)2