use of org.kie.server.api.model.definition.ProcessDefinitionList in project droolsjbpm-integration by kiegroup.
the class CaseServicesClientImpl method findProcesses.
@Override
public List<ProcessDefinition> findProcesses(String filter, Integer page, Integer pageSize, String sort, boolean sortOrder) {
ProcessDefinitionList result = null;
if (config.isRest()) {
Map<String, Object> valuesMap = new HashMap<String, Object>();
String queryString = getPagingQueryString("?filter=" + filter + "&sort=" + sort + "&sortOrder=" + sortOrder, page, pageSize);
result = makeHttpGetRequestAndCreateCustomResponse(build(loadBalancer.getUrl(), CASE_QUERY_URI + "/" + CASE_ALL_PROCESSES_INSTANCES_GET_URI, valuesMap) + queryString, ProcessDefinitionList.class);
} else {
CommandScript script = new CommandScript(Collections.singletonList((KieServerCommand) new DescriptorCommand("CaseQueryService", "getProcessDefinitions", new Object[] { filter, "", page, pageSize, sort, sortOrder })));
ServiceResponse<ProcessDefinitionList> response = (ServiceResponse<ProcessDefinitionList>) 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.getProcesses() != null) {
return Arrays.asList(result.getProcesses());
}
return Collections.emptyList();
}
use of org.kie.server.api.model.definition.ProcessDefinitionList in project droolsjbpm-integration by kiegroup.
the class CaseServicesClientImpl method findProcessesByContainerId.
@Override
public List<ProcessDefinition> findProcessesByContainerId(String containerId, Integer page, Integer pageSize, String sort, boolean sortOrder) {
ProcessDefinitionList result = null;
if (config.isRest()) {
Map<String, Object> valuesMap = new HashMap<String, Object>();
valuesMap.put(CONTAINER_ID, containerId);
String queryString = getPagingQueryString("?sort=" + sort + "&sortOrder=" + sortOrder, page, pageSize);
result = makeHttpGetRequestAndCreateCustomResponse(build(loadBalancer.getUrl(), CASE_QUERY_URI + "/" + CASE_PROCESSES_BY_CONTAINER_INSTANCES_GET_URI, valuesMap) + queryString, ProcessDefinitionList.class);
} else {
CommandScript script = new CommandScript(Collections.singletonList((KieServerCommand) new DescriptorCommand("CaseQueryService", "getProcessDefinitions", new Object[] { "", containerId, page, pageSize, sort, sortOrder })));
ServiceResponse<ProcessDefinitionList> response = (ServiceResponse<ProcessDefinitionList>) 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.getProcesses() != null) {
return Arrays.asList(result.getProcesses());
}
return Collections.emptyList();
}
use of org.kie.server.api.model.definition.ProcessDefinitionList in project droolsjbpm-integration by kiegroup.
the class CaseManagementRuntimeDataServiceBase method getProcessDefinitions.
public ProcessDefinitionList getProcessDefinitions(String filter, String containerId, Integer page, Integer pageSize, String sort, boolean sortOrder) {
Collection<org.jbpm.services.api.model.ProcessDefinition> processDescs = null;
sort = safeCaseDefinitionSort(sort);
if (containerId != null && !containerId.isEmpty()) {
try {
containerId = context.getContainerId(containerId, ContainerLocatorProvider.get().getLocator());
} catch (IllegalArgumentException e) {
// container was not found by locator use given
}
processDescs = caseRuntimeDataService.getProcessDefinitionsByDeployment(containerId, ConvertUtils.buildQueryContext(page, pageSize, sort, sortOrder));
} else if (filter != null && !filter.isEmpty()) {
processDescs = caseRuntimeDataService.getProcessDefinitions(filter, ConvertUtils.buildQueryContext(page, pageSize, sort, sortOrder));
} else {
processDescs = caseRuntimeDataService.getProcessDefinitions(ConvertUtils.buildQueryContext(page, pageSize, sort, sortOrder));
}
ProcessDefinitionList processDefinitions = ConvertUtils.transformProcesses(processDescs);
return processDefinitions;
}
use of org.kie.server.api.model.definition.ProcessDefinitionList in project droolsjbpm-integration by kiegroup.
the class ConvertUtils method transformProcesses.
public static ProcessDefinitionList transformProcesses(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 = transformProcess(pd);
processes.add(definition);
}
return new ProcessDefinitionList(processes);
}
Aggregations