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");
}
};
}
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);
}
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;
}
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;
}
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;
}
Aggregations