use of org.kie.server.api.model.cases.CaseInstance in project droolsjbpm-integration by kiegroup.
the class CaseInstanceMigrationIntegrationTest method assertMigratedCaseInstance.
private void assertMigratedCaseInstance(String caseId) {
CaseInstance cInstance = caseClient.getCaseInstance(CONTAINER_ID_2, caseId);
assertNotNull(cInstance);
assertEquals(caseId, cInstance.getCaseId());
assertEquals(CLAIM_CASE_DEF_ID_2, cInstance.getCaseDefinitionId());
assertEquals(CONTAINER_ID_2, cInstance.getContainerId());
}
use of org.kie.server.api.model.cases.CaseInstance in project droolsjbpm-integration by kiegroup.
the class CaseInstanceMigrationIntegrationTest method assertCaseInstance.
private void assertCaseInstance(String caseId) {
CaseInstance cInstance = caseClient.getCaseInstance(CONTAINER_ID, caseId);
assertNotNull(cInstance);
assertEquals(caseId, cInstance.getCaseId());
assertEquals(CLAIM_CASE_DEF_ID, cInstance.getCaseDefinitionId());
assertEquals(CONTAINER_ID, cInstance.getContainerId());
}
use of org.kie.server.api.model.cases.CaseInstance in project droolsjbpm-integration by kiegroup.
the class CaseManagementRuntimeDataServiceBase method getCaseInstancesByRole.
public CaseInstanceList getCaseInstancesByRole(String roleName, 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.getCaseInstancesByRole(roleName, 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.CaseInstance in project droolsjbpm-integration by kiegroup.
the class CaseManagementRuntimeDataServiceBase method getCaseInstancesAnyRole.
public CaseInstanceList getCaseInstancesAnyRole(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.getCaseInstancesAnyRole(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.CaseInstance in project businessautomation-cop by redhat-cop.
the class GetCasesWithDataResource method getCaseInstancesWithData.
@SuppressWarnings("unchecked")
@GET
@Path("/instancesWithData")
@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
public Response getCaseInstancesWithData(@Context HttpHeaders headers, @QueryParam("dataItem") List<String> dataItems) {
Variant v = getVariant(headers);
String contentType = getContentType(headers);
MarshallingFormat format = MarshallingFormat.fromType(contentType);
if (format == null) {
format = MarshallingFormat.valueOf(contentType);
}
MarshallerHelper marshallerHelper = new MarshallerHelper(registry);
try {
// Fetching all OPEN cases
CaseInstanceList cases = this.caseManagementRuntimeDataService.getCaseInstancesAnyRole(Arrays.asList("open"), 0, 0, "", true);
List<CaseInstance> finalList = new ArrayList<CaseInstance>();
// for every case instance found, let's fetch the case data specified in the query parameter 'dateItems'
for (CaseInstance caseInstance : cases.getItems()) {
String caseFileData = caseManagementServiceBase.getCaseFileData(caseInstance.getContainerId(), caseInstance.getCaseId(), dataItems, format.toString());
logger.debug("Following data were fetched :" + caseFileData + "\n for case instance id:" + caseInstance.getCaseId());
Map<String, Object> caseFileDataUnmarshalled = marshallerHelper.unmarshal(caseInstance.getContainerId(), caseFileData, format.toString(), Map.class, new ByCaseIdContainerLocator(caseInstance.getCaseId()));
caseInstance.setCaseFile(CaseFile.builder().data(caseFileDataUnmarshalled).build());
finalList.add(caseInstance);
}
cases.setCaseInstances(finalList.toArray(new CaseInstance[finalList.size()]));
String result = marshallerHelper.marshal(format.toString(), cases);
logger.debug("Returning OK response with content '{}'", result);
return createResponse(result, v, Response.Status.OK);
} catch (Exception e) {
// backward compatibility
String response = "Execution failed with error : " + e.getMessage();
logger.debug("Returning Failure response with content '{}'", response);
return createResponse(response, v, Response.Status.INTERNAL_SERVER_ERROR);
}
}
Aggregations