use of org.kie.server.api.model.cases.CaseFileDataItem in project droolsjbpm-integration by kiegroup.
the class CaseRuntimeDataServiceIntegrationTest method testGetCaseInstanceDataItems.
@Test
public void testGetCaseInstanceDataItems() {
String caseClaimId = startCarInsuranceClaimCase(USER_YODA, USER_JOHN, USER_YODA);
assertNotNull(caseClaimId);
List<CaseFileDataItem> dataItems = caseClient.getCaseInstanceDataItems(caseClaimId, 0, 10);
assertNotNull(dataItems);
assertEquals(1, dataItems.size());
List<CaseStage> stages = caseClient.getStages(CONTAINER_ID, caseClaimId, true, 0, 10);
assertEquals(1, stages.size());
assertBuildClaimReportCaseStage(stages.iterator().next(), "Active");
stages = caseClient.getStages(CONTAINER_ID, caseClaimId, true, 0, 10);
assertEquals(1, stages.size());
assertBuildClaimReportCaseStage(stages.iterator().next(), "Active");
caseClient.putCaseInstanceData(CONTAINER_ID, caseClaimId, "claimReportDone", Boolean.TRUE);
dataItems = caseClient.getCaseInstanceDataItems(caseClaimId, 0, 10);
assertNotNull(dataItems);
assertEquals(2, dataItems.size());
CaseFileDataItem dataItem = dataItems.stream().filter(n -> "claimReportDone".equals(n.getName())).findAny().get();
assertEquals(caseClaimId, dataItem.getCaseId());
assertEquals("claimReportDone", dataItem.getName());
assertEquals("true", dataItem.getValue());
assertEquals(Boolean.class.getName(), dataItem.getType());
assertEquals(USER_YODA, dataItem.getLastModifiedBy());
dataItems = caseClient.getCaseInstanceDataItemsByType(caseClaimId, Arrays.asList(Boolean.class.getName()), 0, 10);
assertNotNull(dataItems);
assertEquals(1, dataItems.size());
dataItems = caseClient.getCaseInstanceDataItemsByType(caseClaimId, Arrays.asList(String.class.getName()), 0, 10);
assertNotNull(dataItems);
assertEquals(1, dataItems.size());
dataItems = caseClient.getCaseInstanceDataItemsByName(caseClaimId, Arrays.asList("claimReportDone"), 0, 10);
assertNotNull(dataItems);
assertEquals(1, dataItems.size());
dataItems = caseClient.getCaseInstanceDataItemsByName(caseClaimId, Arrays.asList("notExisting"), 0, 10);
assertNotNull(dataItems);
assertEquals(0, dataItems.size());
stages = caseClient.getStages(CONTAINER_ID, caseClaimId, false, 0, 10);
assertEquals(3, stages.size());
assertBuildClaimReportCaseStage(stages.get(0), "Completed");
assertClaimAssesmentCaseStage(stages.get(1), "Active");
assertEscalateRejectedClaimCaseStage(stages.get(2), "Available");
stages = caseClient.getStages(CONTAINER_ID, caseClaimId, true, 0, 10);
assertEquals(1, stages.size());
assertClaimAssesmentCaseStage(stages.iterator().next(), "Active");
}
use of org.kie.server.api.model.cases.CaseFileDataItem in project droolsjbpm-integration by kiegroup.
the class ConvertUtils method transformCaseFileDataItems.
public static CaseFileDataItemList transformCaseFileDataItems(Collection<CaseFileItem> caseFileItems) {
if (caseFileItems == null) {
return new CaseFileDataItemList(new CaseFileDataItem[0]);
}
List<CaseFileDataItem> caseFileDataItems = new ArrayList<CaseFileDataItem>(caseFileItems.size());
for (CaseFileItem item : caseFileItems) {
CaseFileDataItem caseFileDataItem = transformCaseFileDataItem(item);
caseFileDataItems.add(caseFileDataItem);
}
return new CaseFileDataItemList(caseFileDataItems);
}
Aggregations