Search in sources :

Example 6 with ProcessDefinitionList

use of org.kie.server.api.model.definition.ProcessDefinitionList 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 7 with ProcessDefinitionList

use of org.kie.server.api.model.definition.ProcessDefinitionList in project droolsjbpm-integration by kiegroup.

the class ConvertUtils method convertToProcessList.

public static ProcessDefinitionList convertToProcessList(Collection<ProcessDefinition> definitions) {
    if (definitions == null) {
        return new ProcessDefinitionList(new org.kie.server.api.model.definition.ProcessDefinition[0]);
    }
    List<org.kie.server.api.model.definition.ProcessDefinition> processes = new ArrayList<org.kie.server.api.model.definition.ProcessDefinition>(definitions.size());
    for (ProcessDefinition pd : definitions) {
        org.kie.server.api.model.definition.ProcessDefinition definition = convertToProcess(pd);
        processes.add(definition);
    }
    return new ProcessDefinitionList(processes);
}
Also used : ProcessDefinitionList(org.kie.server.api.model.definition.ProcessDefinitionList) ArrayList(java.util.ArrayList) ProcessDefinition(org.jbpm.services.api.model.ProcessDefinition)

Example 8 with ProcessDefinitionList

use of org.kie.server.api.model.definition.ProcessDefinitionList in project droolsjbpm-integration by kiegroup.

the class RuntimeDataServiceBase method getProcessesByFilter.

public ProcessDefinitionList getProcessesByFilter(String filter, Integer page, Integer pageSize, String sort, boolean sortOrder) {
    Collection<ProcessDefinition> definitions;
    if (sort == null || sort.isEmpty()) {
        sort = "ProcessName";
    }
    if (filter != null && !filter.isEmpty()) {
        logger.debug("About to search for process definitions with filter '{}' with page {} and page size {}", filter, page, pageSize);
        definitions = runtimeDataService.getProcessesByFilter(filter, buildQueryContext(page, pageSize, sort, sortOrder));
        logger.debug("Found {} process definitions with filter '{}'", definitions.size(), filter);
    } else {
        logger.debug("About to search for process definitions with page {} and page size {}", page, pageSize);
        definitions = runtimeDataService.getProcesses(buildQueryContext(page, pageSize, sort, sortOrder));
        logger.debug("Found {} process definitions", definitions.size(), filter);
    }
    ProcessDefinitionList processDefinitionList = convertToProcessList(definitions);
    logger.debug("Returning result of process definition search: {}", processDefinitionList);
    return processDefinitionList;
}
Also used : ProcessDefinitionList(org.kie.server.api.model.definition.ProcessDefinitionList) ProcessDefinition(org.jbpm.services.api.model.ProcessDefinition)

Example 9 with ProcessDefinitionList

use of org.kie.server.api.model.definition.ProcessDefinitionList in project droolsjbpm-integration by kiegroup.

the class RuntimeDataServiceBase method getProcessesById.

public ProcessDefinitionList getProcessesById(String processId) {
    Collection<ProcessDefinition> definitions = runtimeDataService.getProcessesById(processId);
    ProcessDefinitionList processDefinitionList = convertToProcessList(definitions);
    logger.debug("Returning result of process definition search: {}", processDefinitionList);
    return processDefinitionList;
}
Also used : ProcessDefinitionList(org.kie.server.api.model.definition.ProcessDefinitionList) ProcessDefinition(org.jbpm.services.api.model.ProcessDefinition)

Example 10 with ProcessDefinitionList

use of org.kie.server.api.model.definition.ProcessDefinitionList in project droolsjbpm-integration by kiegroup.

the class RuntimeDataServiceBase method getProcessesByDeploymentIdUncatch.

private ProcessDefinitionList getProcessesByDeploymentIdUncatch(String containerId, Integer page, Integer pageSize, String sort, boolean sortOrder) {
    containerId = context.getContainerId(containerId, ContainerLocatorProvider.get().getLocator());
    logger.debug("About to search for process definitions within container '{}' with page {} and page size {}", containerId, page, pageSize);
    if (sort == null || sort.isEmpty()) {
        sort = "ProcessName";
    }
    Collection<ProcessDefinition> definitions = runtimeDataService.getProcessesByDeploymentId(containerId, buildQueryContext(page, pageSize, sort, sortOrder));
    logger.debug("Found {} process definitions within container '{}'", definitions.size(), containerId);
    ProcessDefinitionList processDefinitionList = convertToProcessList(definitions);
    logger.debug("Returning result of process definition search: {}", processDefinitionList);
    return processDefinitionList;
}
Also used : ProcessDefinitionList(org.kie.server.api.model.definition.ProcessDefinitionList) ProcessDefinition(org.jbpm.services.api.model.ProcessDefinition)

Aggregations

ProcessDefinitionList (org.kie.server.api.model.definition.ProcessDefinitionList)19 ApiOperation (io.swagger.annotations.ApiOperation)6 ApiResponses (io.swagger.annotations.ApiResponses)6 HashMap (java.util.HashMap)6 GET (javax.ws.rs.GET)6 Produces (javax.ws.rs.Produces)6 ServiceResponse (org.kie.server.api.model.ServiceResponse)6 Header (org.kie.server.remote.rest.common.Header)6 RestUtils.buildConversationIdHeader (org.kie.server.remote.rest.common.util.RestUtils.buildConversationIdHeader)6 Path (javax.ws.rs.Path)5 ProcessDefinition (org.jbpm.services.api.model.ProcessDefinition)5 CommandScript (org.kie.server.api.commands.CommandScript)5 DescriptorCommand (org.kie.server.api.commands.DescriptorCommand)5 KieServerCommand (org.kie.server.api.model.KieServerCommand)5 Variant (javax.ws.rs.core.Variant)3 RestUtils.createCorrectVariant (org.kie.server.remote.rest.common.util.RestUtils.createCorrectVariant)3 RestUtils.getVariant (org.kie.server.remote.rest.common.util.RestUtils.getVariant)3 ArrayList (java.util.ArrayList)2 WebTarget (javax.ws.rs.client.WebTarget)1 Response (javax.ws.rs.core.Response)1