Search in sources :

Example 11 with TaskSummaryList

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

the class CaseManagementRuntimeDataServiceBase method getCaseTasksAsBusinessAdmin.

public TaskSummaryList getCaseTasksAsBusinessAdmin(String caseId, String user, List<String> status, Integer page, Integer pageSize, String sort, boolean sortOrder) {
    List<Status> actualStatus = safeTaskStatus(status);
    user = getUser(user);
    sort = safeTaskSummarySort(sort);
    Collection<TaskSummary> taskSummaries = caseRuntimeDataService.getCaseTasksAssignedAsBusinessAdmin(caseId, user, actualStatus, ConvertUtils.buildQueryContext(page, pageSize, sort, sortOrder));
    TaskSummaryList tasks = ConvertUtils.convertToTaskSummaryList(taskSummaries);
    return tasks;
}
Also used : CaseStatus(org.jbpm.casemgmt.api.model.CaseStatus) Status(org.kie.api.task.model.Status) TaskSummary(org.kie.api.task.model.TaskSummary) TaskSummaryList(org.kie.server.api.model.instance.TaskSummaryList)

Example 12 with TaskSummaryList

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

the class CaseManagementRuntimeDataServiceBase method getCaseTasksAsStakeholder.

public TaskSummaryList getCaseTasksAsStakeholder(String caseId, String user, List<String> status, Integer page, Integer pageSize, String sort, boolean sortOrder) {
    List<Status> actualStatus = safeTaskStatus(status);
    user = getUser(user);
    sort = safeTaskSummarySort(sort);
    Collection<TaskSummary> taskSummaries = caseRuntimeDataService.getCaseTasksAssignedAsStakeholder(caseId, user, actualStatus, ConvertUtils.buildQueryContext(page, pageSize, sort, sortOrder));
    TaskSummaryList tasks = ConvertUtils.convertToTaskSummaryList(taskSummaries);
    return tasks;
}
Also used : CaseStatus(org.jbpm.casemgmt.api.model.CaseStatus) Status(org.kie.api.task.model.Status) TaskSummary(org.kie.api.task.model.TaskSummary) TaskSummaryList(org.kie.server.api.model.instance.TaskSummaryList)

Example 13 with TaskSummaryList

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

the class JmsResponseHandlerIntegrationTest method testGetTasksUseOfAsyncResponseHandlerWithMarshaller.

@Test
public void testGetTasksUseOfAsyncResponseHandlerWithMarshaller() throws Exception {
    ResponseCallback callback = new BlockingResponseCallback(createMarshaller());
    testGetTaskResponseHandler(new AsyncResponseHandler(callback));
    // now let's check if response has arrived
    TaskSummaryList taskSummaryList = callback.get(TaskSummaryList.class);
    assertThat(taskSummaryList).isNotNull();
    assertThat(taskSummaryList.getItems()).isNotNull().hasSize(1);
}
Also used : 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) TaskSummaryList(org.kie.server.api.model.instance.TaskSummaryList) Test(org.junit.Test) JbpmKieServerBaseIntegrationTest(org.kie.server.integrationtests.jbpm.JbpmKieServerBaseIntegrationTest)

Example 14 with TaskSummaryList

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

the class KieClientServicesIntegrationTest method createRouteBuilder.

@Override
protected RouteBuilder createRouteBuilder() throws Exception {
    KieServerInfo info = new KieServerInfo("mock", "1.2.3");
    List<String> capabilities = Arrays.asList(KieServerConstants.CAPABILITY_BPM, KieServerConstants.CAPABILITY_BPM_UI, KieServerConstants.CAPABILITY_BRM, KieServerConstants.CAPABILITY_BRP, KieServerConstants.CAPABILITY_CASE, KieServerConstants.CAPABILITY_DMN);
    info.setCapabilities(capabilities);
    ServiceResponse<KieServerInfo> response = new ServiceResponse<KieServerInfo>(ResponseType.SUCCESS, "Kie Server info");
    response.setResult(info);
    stubFor(get(urlEqualTo("/")).willReturn(aResponse().withStatus(200).withHeader("Content-Type", "application/xml").withBody(toXML(response, KieServerInfo.class, ServiceResponse.class))));
    // case mock response
    ProcessDefinitionList caseResponse = new ProcessDefinitionList();
    caseResponse.setProcesses(new ProcessDefinition[] { new ProcessDefinition() });
    stubFor(get(urlMatching("/queries/cases/processes.*")).willReturn(aResponse().withStatus(200).withHeader("Content-Type", "application/xml").withBody(toXML(caseResponse, ProcessDefinitionList.class, ProcessDefinition.class))));
    // document mock response
    DocumentInstance documentResponse = new DocumentInstance();
    documentResponse.setIdentifier("1234");
    stubFor(get(urlMatching("/documents/1234")).willReturn(aResponse().withStatus(200).withHeader("Content-Type", "application/xml").withBody(toXML(documentResponse, DocumentInstance.class))));
    // job service mock response
    RequestInfoInstanceList jobResponse = new RequestInfoInstanceList();
    stubFor(get(urlMatching("/jobs.*")).willReturn(aResponse().withStatus(200).withHeader("Content-Type", "application/xml").withBody(toXML(jobResponse, RequestInfoInstanceList.class))));
    // query service mock response
    NodeInstanceList queryResponse = new NodeInstanceList();
    stubFor(get(urlMatching("/queries/processes/instances/100/nodes/instances.*")).willReturn(aResponse().withStatus(200).withHeader("Content-Type", "application/xml").withBody(toXML(queryResponse, NodeInstanceList.class))));
    // solver service mock response
    SolverInstanceList solverResponse = new SolverInstanceList();
    stubFor(get(urlMatching("/containers/my-container/solvers")).willReturn(aResponse().withStatus(200).withHeader("Content-Type", "application/xml").withBody(toXML(solverResponse, SolverInstanceList.class))));
    // ui service mock response
    stubFor(get(urlMatching("/containers/my-container/forms/processes/my-process.*")).willReturn(aResponse().withStatus(200).withHeader("Content-Type", "application/xml").withBody("my form")));
    // user task mock response
    TaskSummaryList userTaskResponse = new TaskSummaryList();
    stubFor(get(urlMatching("/queries/tasks/instances.*")).willReturn(aResponse().withStatus(200).withHeader("Content-Type", "application/xml").withBody(toXML(userTaskResponse, TaskSummaryList.class))));
    return new RouteBuilder() {

        @Override
        public void configure() {
            from("direct:start").to("kie:" + getAuthenticadUrl("admin", "admin")).to("mock:result");
        }
    };
}
Also used : RouteBuilder(org.apache.camel.builder.RouteBuilder) ProcessDefinitionList(org.kie.server.api.model.definition.ProcessDefinitionList) RequestInfoInstanceList(org.kie.server.api.model.instance.RequestInfoInstanceList) KieServerInfo(org.kie.server.api.model.KieServerInfo) ProcessDefinition(org.kie.server.api.model.definition.ProcessDefinition) NodeInstanceList(org.kie.server.api.model.instance.NodeInstanceList) SolverInstanceList(org.kie.server.api.model.instance.SolverInstanceList) TaskSummaryList(org.kie.server.api.model.instance.TaskSummaryList) ServiceResponse(org.kie.server.api.model.ServiceResponse) DocumentInstance(org.kie.server.api.model.instance.DocumentInstance)

Example 15 with TaskSummaryList

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

the class CaseServicesClientImpl method findCaseTasksAssignedAsBusinessAdministrator.

@Override
public List<TaskSummary> findCaseTasksAssignedAsBusinessAdministrator(String caseId, String userId, List<String> status, Integer page, Integer pageSize, String sort, boolean sortOrder) {
    TaskSummaryList result = null;
    if (config.isRest()) {
        Map<String, Object> valuesMap = new HashMap<String, Object>();
        valuesMap.put(CASE_ID, caseId);
        String userQuery = getUserQueryStr(userId);
        String statusQuery = getAdditionalParams(userQuery, "status", status);
        String queryString = getPagingQueryString(statusQuery, page, pageSize) + "&sort=" + sort + "&sortOrder=" + sortOrder;
        result = makeHttpGetRequestAndCreateCustomResponse(build(loadBalancer.getUrl(), CASE_QUERY_URI + "/" + CASE_TASKS_AS_ADMIN_GET_URI, valuesMap) + queryString, TaskSummaryList.class);
    } else {
        CommandScript script = new CommandScript(Collections.singletonList((KieServerCommand) new DescriptorCommand("CaseQueryService", "getCaseTasksAsBusinessAdmin", new Object[] { caseId, userId, safeList(status), page, pageSize, sort, sortOrder })));
        ServiceResponse<TaskSummaryList> response = (ServiceResponse<TaskSummaryList>) executeJmsCommand(script, DescriptorCommand.class.getName(), KieServerConstants.CAPABILITY_CASE).getResponses().get(0);
        throwExceptionOnFailure(response);
        if (shouldReturnWithNullResponse(response)) {
            return null;
        }
        result = response.getResult();
    }
    if (result != null && result.getTasks() != null) {
        return Arrays.asList(result.getTasks());
    }
    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) CommandScript(org.kie.server.api.commands.CommandScript) TaskSummaryList(org.kie.server.api.model.instance.TaskSummaryList)

Aggregations

TaskSummaryList (org.kie.server.api.model.instance.TaskSummaryList)37 HashMap (java.util.HashMap)14 ServiceResponse (org.kie.server.api.model.ServiceResponse)14 CommandScript (org.kie.server.api.commands.CommandScript)13 DescriptorCommand (org.kie.server.api.commands.DescriptorCommand)13 KieServerCommand (org.kie.server.api.model.KieServerCommand)13 TaskSummary (org.kie.api.task.model.TaskSummary)12 ApiOperation (io.swagger.annotations.ApiOperation)9 ApiResponses (io.swagger.annotations.ApiResponses)9 GET (javax.ws.rs.GET)9 Path (javax.ws.rs.Path)9 Produces (javax.ws.rs.Produces)9 Variant (javax.ws.rs.core.Variant)9 Header (org.kie.server.remote.rest.common.Header)9 RestUtils.buildConversationIdHeader (org.kie.server.remote.rest.common.util.RestUtils.buildConversationIdHeader)9 RestUtils.createCorrectVariant (org.kie.server.remote.rest.common.util.RestUtils.createCorrectVariant)9 RestUtils.getVariant (org.kie.server.remote.rest.common.util.RestUtils.getVariant)9 Status (org.kie.api.task.model.Status)8 DeploymentNotFoundException (org.jbpm.services.api.DeploymentNotFoundException)6 ProcessInstanceNotFoundException (org.jbpm.services.api.ProcessInstanceNotFoundException)6