CaseRuntimeDataServiceImpl implements CaseRuntimeDataService, DeploymentEventListener { @Override public Collection<ProcessDefinition> getProcessDefinitions(QueryContext queryContext) { Collection<ProcessDefinition> cases = availableProcesses.stream() .filter(caseDef -> caseDef.isActive()) .sorted(new ProcessDefinitionComparator(queryContext.getOrderBy(), queryContext.isAscending())) .skip(queryContext.getOffset()) .limit(queryContext.getCount()) .collect(toList()); return cases; } 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 testGetProcessDefinitions() { Collection<ProcessDefinition> processes = caseRuntimeDataService.getProcessDefinitions(new QueryContext()); assertNotNull(processes); assertEquals(2, processes.size()); Map<String, ProcessDefinition> mappedProcesses = mapProcesses(processes); assertTrue(mappedProcesses.containsKey("UserTask")); assertTrue(mappedProcesses.containsKey("DataVerification")); processes = caseRuntimeDataService.getProcessDefinitions("User", new QueryContext()); assertNotNull(processes); assertEquals(1, processes.size()); mappedProcesses = mapProcesses(processes); assertTrue(mappedProcesses.containsKey("UserTask")); processes = caseRuntimeDataService.getProcessDefinitionsByDeployment(deploymentUnit.getIdentifier(), new QueryContext()); assertNotNull(processes); assertEquals(2, processes.size()); mappedProcesses = mapProcesses(processes); assertTrue(mappedProcesses.containsKey("UserTask")); assertTrue(mappedProcesses.containsKey("DataVerification")); }