use of org.kie.server.api.model.cases.CaseDefinitionList in project droolsjbpm-integration by kiegroup.
the class CaseServicesClientImpl method getCaseDefinitionsByContainer.
@Override
public List<CaseDefinition> getCaseDefinitionsByContainer(String containerId, Integer page, Integer pageSize, String sort, boolean sortOrder) {
CaseDefinitionList list = null;
if (config.isRest()) {
Map<String, Object> valuesMap = new HashMap<String, Object>();
valuesMap.put(CONTAINER_ID, containerId);
String queryString = getPagingQueryString("", page, pageSize);
queryString = getSortingQueryString(queryString, sort, sortOrder);
list = makeHttpGetRequestAndCreateCustomResponse(build(loadBalancer.getUrl(), CASE_URI + "/" + CASE_ALL_DEFINITIONS_GET_URI, valuesMap) + queryString, CaseDefinitionList.class);
} else {
CommandScript script = new CommandScript(Collections.singletonList((KieServerCommand) new DescriptorCommand("CaseQueryService", "getCaseDefinitionsByContainer", new Object[] { containerId, page, pageSize, sort, sortOrder })));
ServiceResponse<CaseDefinitionList> response = (ServiceResponse<CaseDefinitionList>) executeJmsCommand(script, DescriptorCommand.class.getName(), KieServerConstants.CAPABILITY_CASE).getResponses().get(0);
throwExceptionOnFailure(response);
if (shouldReturnWithNullResponse(response)) {
return null;
}
list = response.getResult();
}
if (list != null) {
return list.getItems();
}
return Collections.emptyList();
}
use of org.kie.server.api.model.cases.CaseDefinitionList in project droolsjbpm-integration by kiegroup.
the class CaseManagementRuntimeDataServiceBase method getCaseDefinitionsByContainer.
public CaseDefinitionList getCaseDefinitionsByContainer(String containerId, Integer page, Integer pageSize, String sort, boolean sortOrder) {
sort = safeCaseDefinitionSort(sort);
try {
containerId = context.getContainerId(containerId, ContainerLocatorProvider.get().getLocator());
Collection<CaseDefinition> caseDescs = caseRuntimeDataService.getCasesByDeployment(containerId, ConvertUtils.buildQueryContext(page, pageSize, sort, sortOrder));
List<org.kie.server.api.model.cases.CaseDefinition> cases = ConvertUtils.transformCases(caseDescs);
CaseDefinitionList caseList = new CaseDefinitionList(cases);
return caseList;
} catch (IllegalArgumentException e) {
// container was not found by locator
return new CaseDefinitionList();
}
}
Aggregations