use of org.kie.server.api.model.cases.CaseInstanceList in project droolsjbpm-integration by kiegroup.
the class CaseManagementRuntimeDataServiceBase method getCaseInstancesByCaseFileData.
public CaseInstanceList getCaseInstancesByCaseFileData(String dataItemName, String dataItemValue, List<String> status, Integer page, Integer pageSize, String sort, boolean sortOrder, boolean withData) {
List<CaseStatus> caseStatus = safeCaseStatus(status);
sort = safeCaseInstanceSort(sort);
Collection<org.jbpm.casemgmt.api.model.instance.CaseInstance> caseInstanceDescs = null;
if (dataItemValue != null && !dataItemValue.isEmpty()) {
caseInstanceDescs = caseRuntimeDataService.getCaseInstancesByDataItemAndValue(dataItemName, dataItemValue, caseStatus, withData, ConvertUtils.buildQueryContext(page, pageSize, sort, sortOrder));
} else {
caseInstanceDescs = caseRuntimeDataService.getCaseInstancesByDataItem(dataItemName, caseStatus, withData, ConvertUtils.buildQueryContext(page, pageSize, sort, sortOrder));
}
List<CaseInstance> caseInstances = ConvertUtils.transformCaseInstances(caseInstanceDescs);
CaseInstanceList caseInstancesList = new CaseInstanceList(caseInstances);
return caseInstancesList;
}
use of org.kie.server.api.model.cases.CaseInstanceList in project droolsjbpm-integration by kiegroup.
the class CaseManagementRuntimeDataServiceBase method getCaseInstancesByDefinition.
public CaseInstanceList getCaseInstancesByDefinition(String containerId, String caseDefinitionId, List<String> status, Integer page, Integer pageSize, String sort, boolean sortOrder, boolean withData) {
List<CaseStatus> caseStatus = safeCaseStatus(status);
sort = safeCaseInstanceSort(sort);
Collection<org.jbpm.casemgmt.api.model.instance.CaseInstance> caseInstanceDescs = caseRuntimeDataService.getCaseInstancesByDefinition(caseDefinitionId, caseStatus, withData, ConvertUtils.buildQueryContext(page, pageSize, sort, sortOrder));
List<CaseInstance> caseInstances = ConvertUtils.transformCaseInstances(caseInstanceDescs);
CaseInstanceList caseInstancesList = new CaseInstanceList(caseInstances);
return caseInstancesList;
}
use of org.kie.server.api.model.cases.CaseInstanceList in project droolsjbpm-integration by kiegroup.
the class CaseManagementRuntimeDataServiceBase method getCaseInstancesByContainer.
public CaseInstanceList getCaseInstancesByContainer(String containerId, List<String> status, Integer page, Integer pageSize, String sort, boolean sortOrder, boolean withData) {
List<CaseStatus> caseStatus = safeCaseStatus(status);
sort = safeCaseInstanceSort(sort);
Collection<org.jbpm.casemgmt.api.model.instance.CaseInstance> caseInstanceDescs = caseRuntimeDataService.getCaseInstancesByDeployment(containerId, caseStatus, withData, ConvertUtils.buildQueryContext(page, pageSize, sort, sortOrder));
List<CaseInstance> caseInstances = ConvertUtils.transformCaseInstances(caseInstanceDescs);
CaseInstanceList caseInstancesList = new CaseInstanceList(caseInstances);
return caseInstancesList;
}
use of org.kie.server.api.model.cases.CaseInstanceList in project droolsjbpm-integration by kiegroup.
the class CaseServicesClientImpl method getCaseInstancesByDefinition.
@Override
public List<CaseInstance> getCaseInstancesByDefinition(String containerId, String caseDefinitionId, List<String> status, Integer page, Integer pageSize, String sort, boolean sortOrder, boolean withData) {
CaseInstanceList list = null;
if (config.isRest()) {
Map<String, Object> valuesMap = new HashMap<String, Object>();
valuesMap.put(CONTAINER_ID, containerId);
valuesMap.put(CASE_DEF_ID, caseDefinitionId);
String queryString = getPagingQueryString("", page, pageSize);
queryString = getAdditionalParams(queryString, "status", status);
queryString = getSortingQueryString(queryString, sort, sortOrder);
queryString = getAdditionalParams(queryString, "withData", Collections.singletonList(withData));
list = makeHttpGetRequestAndCreateCustomResponse(build(loadBalancer.getUrl(), CASE_URI + "/" + CASE_INSTANCES_BY_DEF_GET_URI, valuesMap) + queryString, CaseInstanceList.class);
} else {
CommandScript script = new CommandScript(Collections.singletonList((KieServerCommand) new DescriptorCommand("CaseQueryService", "getCaseInstancesByDefinition", new Object[] { containerId, caseDefinitionId, safeList(status), page, pageSize, sort, sortOrder, withData })));
ServiceResponse<CaseInstanceList> response = (ServiceResponse<CaseInstanceList>) 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.CaseInstanceList in project droolsjbpm-integration by kiegroup.
the class CaseServicesClientImpl method getCaseInstancesOwnedBy.
@Override
public List<CaseInstance> getCaseInstancesOwnedBy(String owner, List<String> status, Integer page, Integer pageSize, String sort, boolean sortOrder, boolean withData) {
CaseInstanceList list = null;
if (config.isRest()) {
Map<String, Object> valuesMap = new HashMap<String, Object>();
String queryString = getPagingQueryString("?owner=" + owner, page, pageSize);
queryString = getAdditionalParams(queryString, "status", status);
queryString = getSortingQueryString(queryString, sort, sortOrder);
queryString = getAdditionalParams(queryString, "withData", Collections.singletonList(withData));
list = makeHttpGetRequestAndCreateCustomResponse(build(loadBalancer.getUrl(), CASE_QUERY_URI + "/" + CASE_ALL_INSTANCES_GET_URI, valuesMap) + queryString, CaseInstanceList.class);
} else {
CommandScript script = new CommandScript(Collections.singletonList((KieServerCommand) new DescriptorCommand("CaseQueryService", "getCaseInstancesOwnedBy", new Object[] { owner, safeList(status), page, pageSize, sort, sortOrder, withData })));
ServiceResponse<CaseInstanceList> response = (ServiceResponse<CaseInstanceList>) 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();
}
Aggregations