CaseRuntimeDataServiceImpl implements CaseRuntimeDataService, DeploymentEventListener { protected List<Integer> resolveCaseStatuses(List<CaseStatus> caseStatusesList) { return caseStatusesList != null ? caseStatusesList.stream().map(event -> event.getId()).collect(Collectors.toList()) : null; } CaseRuntimeDataServiceImpl(); CaseIdGenerator getCaseIdGenerator(); void setCaseIdGenerator(CaseIdGenerator caseIdGenerator); void setRuntimeDataService(RuntimeDataService runtimeDataService); void setCaseService(CaseService caseService); void setCommandService(TransactionalCommandService commandService); void setIdentityProvider(IdentityProvider identityProvider); void setDeploymentRolesManager(DeploymentRolesManager deploymentRolesManager); @Override void onDeploy(DeploymentEvent event); @Override void onUnDeploy(DeploymentEvent event); @Override void onActivate(DeploymentEvent event); @Override void onDeactivate(DeploymentEvent event); @Override CaseDefinition getCase(String deploymentId, String caseDefinitionId); @Override Collection<CaseDefinition> getCases(QueryContext queryContext); @Override Collection<CaseDefinition> getCases(String filter, QueryContext queryContext); @Override Collection<CaseDefinition> getCasesByDeployment(String deploymentId, QueryContext queryContext); @Override Collection<ProcessDefinition> getProcessDefinitions(QueryContext queryContext); @Override Collection<ProcessDefinition> getProcessDefinitions(String filter, QueryContext queryContext); @Override Collection<ProcessDefinition> getProcessDefinitionsByDeployment(String deploymentId, QueryContext queryContext); @Override Collection<ProcessInstanceDesc> getProcessInstancesForCase(String caseId, QueryContext queryContext); @Override Collection<ProcessInstanceDesc> getProcessInstancesForCase(String caseId, List<Integer> processStates, QueryContext queryContext); @Override Collection<CaseMilestoneInstance> getCaseInstanceMilestones(String caseId, boolean achievedOnly, QueryContext queryContext); @Override Collection<CaseStageInstance> getCaseInstanceStages(String caseId, boolean activeOnly, QueryContext queryContext); @Override Collection<org.jbpm.services.api.model.NodeInstanceDesc> getActiveNodesForCase(String caseId, QueryContext queryContext); @Override Collection<org.jbpm.services.api.model.NodeInstanceDesc> getCompletedNodesForCase(String caseId, QueryContext queryContext); @Override Collection<CaseInstance> getCaseInstances(QueryContext queryContext); @Override Collection<CaseInstance> getCaseInstances(boolean withData, QueryContext queryContext); @Override Collection<CaseInstance> getCaseInstances(List<CaseStatus> statuses, QueryContext queryContext); @Override Collection<CaseInstance> getCaseInstances(List<CaseStatus> statuses, boolean withData, QueryContext queryContext); @Override Collection<CaseInstance> getSubCaseInstancesByParentCaseId(String parentCaseId, List<CaseStatus> statuses, QueryContext queryContext); @Override Collection<CaseInstance> getAllDescendantSubCaseInstancesByParentCaseId(String parentCaseId, List<CaseStatus> statuses); @Override Collection<CaseInstance> getCaseInstancesByDeployment(String deploymentId, List<CaseStatus> statuses, QueryContext queryContext); @Override Collection<CaseInstance> getCaseInstancesByDeployment(String deploymentId, List<CaseStatus> statuses, boolean withData, QueryContext queryContext); @Override Collection<CaseInstance> getCaseInstancesByDefinition(String definitionId, List<CaseStatus> statuses, QueryContext queryContext); @Override Collection<CaseInstance> getCaseInstancesByDefinition(String definitionId, List<CaseStatus> statuses, boolean withData, QueryContext queryContext); @Override Collection<CaseInstance> getCaseInstancesOwnedBy(String owner, List<CaseStatus> statuses, QueryContext queryContext); @Override Collection<CaseInstance> getCaseInstancesOwnedBy(String owner, List<CaseStatus> statuses, boolean withData, QueryContext queryContext); @Override Collection<CaseInstance> getCaseInstancesByRole(String roleName, List<CaseStatus> statuses, QueryContext queryContext); @Override Collection<CaseInstance> getCaseInstancesByRole(String roleName, List<CaseStatus> statuses, boolean withData, QueryContext queryContext); @Override Collection<CaseInstance> getCaseInstancesAnyRole(List<CaseStatus> statuses, QueryContext queryContext); @Override Collection<CaseInstance> getCaseInstancesAnyRole(List<CaseStatus> statuses, boolean withData, QueryContext queryContext); @Override Collection<CaseInstance> getCaseInstancesByDataItem(String dataItemName, List<CaseStatus> statuses, QueryContext queryContext); @Override Collection<CaseInstance> getCaseInstancesByDataItem(String dataItemName, List<CaseStatus> statuses, boolean withData, QueryContext queryContext); @Override Collection<CaseInstance> getCaseInstancesByDataItemAndValue(String dataItemName, String dataItemValue, List<CaseStatus> statuses, QueryContext queryContext); @Override Collection<CaseInstance> getCaseInstancesByDataItemAndValue(String dataItemName, String dataItemValue, List<CaseStatus> statuses, boolean withData, QueryContext queryContext); @Override CaseInstance getCaseInstanceById(String caseId); @Override Collection<AdHocFragment> getAdHocFragmentsForCase(String caseId); @Override List<TaskSummary> getCaseTasksAssignedAsPotentialOwner(String caseId, String userId, List<Status> status, QueryContext queryContext); @Override List<TaskSummary> getCaseTasksAssignedAsBusinessAdmin(String caseId, String userId, List<Status> status, QueryContext queryContext); @Override List<TaskSummary> getCaseTasksAssignedAsStakeholder(String caseId, String userId, List<Status> status, QueryContext queryContext); List<CaseStageInstance> internalGetCaseStages(CaseDefinition caseDef, String caseId, boolean activeOnly, QueryContext queryContext); @Override Collection<CaseFileItem> getCaseInstanceDataItems(String caseId, QueryContext queryContext); @Override Collection<CaseFileItem> getCaseInstanceDataItemsByName(String caseId, List<String> names, QueryContext queryContext); @Override Collection<CaseFileItem> getCaseInstanceDataItemsByType(String caseId, List<String> types, QueryContext queryContext);  }
@Test public void testResolveCaseStatuses() { List<CaseStatus> testStatuses = Arrays.asList(CaseStatus.CANCELLED, CaseStatus.CLOSED, CaseStatus.OPEN); List<Integer> resolvedTestStatuses = ((CaseRuntimeDataServiceImpl) caseRuntimeDataService).resolveCaseStatuses(testStatuses); List<Integer> resultStatuses = Arrays.asList(3, 2, 1); List<Integer> invalidResultStatuses = Arrays.asList(1, 2, 3); assertTrue(resolvedTestStatuses.equals(resultStatuses)); assertFalse(resolvedTestStatuses.equals(invalidResultStatuses)); }