Java Code Examples for org.activiti.engine.history.HistoricProcessInstanceQuery#list()
The following examples show how to use
org.activiti.engine.history.HistoricProcessInstanceQuery#list() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HistoryServiceTest.java From activiti6-boot2 with Apache License 2.0 | 6 votes |
@Deployment(resources = { "org/activiti/engine/test/api/oneTaskProcess.bpmn20.xml", "org/activiti/engine/test/api/runtime/oneTaskProcess2.bpmn20.xml" }) public void testHistoricProcessInstanceQueryByProcessInstanceIds() { HashSet<String> processInstanceIds = new HashSet<String>(); for (int i = 0; i < 4; i++) { processInstanceIds.add(runtimeService.startProcessInstanceByKey("oneTaskProcess", i + "").getId()); } processInstanceIds.add(runtimeService.startProcessInstanceByKey("oneTaskProcess2", "1").getId()); // start an instance that will not be part of the query runtimeService.startProcessInstanceByKey("oneTaskProcess2", "2"); HistoricProcessInstanceQuery processInstanceQuery = historyService.createHistoricProcessInstanceQuery().processInstanceIds(processInstanceIds); assertEquals(5, processInstanceQuery.count()); List<HistoricProcessInstance> processInstances = processInstanceQuery.list(); assertNotNull(processInstances); assertEquals(5, processInstances.size()); for (HistoricProcessInstance historicProcessInstance : processInstances) { assertTrue(processInstanceIds.contains(historicProcessInstance.getId())); } }
Example 2
Source File: HistoryServiceTest.java From activiti6-boot2 with Apache License 2.0 | 6 votes |
@Deployment(resources = { "org/activiti/engine/test/api/oneTaskProcess.bpmn20.xml", "org/activiti/engine/test/api/runtime/oneTaskProcess2.bpmn20.xml" }) public void testHistoricProcessInstanceQueryByDeploymentId() { org.activiti.engine.repository.Deployment deployment = repositoryService.createDeploymentQuery().singleResult(); HashSet<String> processInstanceIds = new HashSet<String>(); for (int i = 0; i < 4; i++) { processInstanceIds.add(runtimeService.startProcessInstanceByKey("oneTaskProcess", i + "").getId()); } processInstanceIds.add(runtimeService.startProcessInstanceByKey("oneTaskProcess2", "1").getId()); HistoricProcessInstanceQuery processInstanceQuery = historyService.createHistoricProcessInstanceQuery().deploymentId(deployment.getId()); assertEquals(5, processInstanceQuery.count()); assertEquals(deployment.getId(), processInstanceQuery.list().get(0).getDeploymentId()); List<HistoricProcessInstance> processInstances = processInstanceQuery.list(); assertNotNull(processInstances); assertEquals(5, processInstances.size()); processInstanceQuery = historyService.createHistoricProcessInstanceQuery().deploymentId("invalid"); assertEquals(0, processInstanceQuery.count()); }
Example 3
Source File: HistoryServiceTest.java From activiti6-boot2 with Apache License 2.0 | 6 votes |
@Deployment(resources = { "org/activiti/engine/test/api/oneTaskProcess.bpmn20.xml", "org/activiti/engine/test/api/runtime/oneTaskProcess2.bpmn20.xml" }) public void testHistoricProcessInstanceQueryByDeploymentIdIn() { org.activiti.engine.repository.Deployment deployment = repositoryService.createDeploymentQuery().singleResult(); HashSet<String> processInstanceIds = new HashSet<String>(); for (int i = 0; i < 4; i++) { processInstanceIds.add(runtimeService.startProcessInstanceByKey("oneTaskProcess", i + "").getId()); } processInstanceIds.add(runtimeService.startProcessInstanceByKey("oneTaskProcess2", "1").getId()); List<String> deploymentIds = new ArrayList<String>(); deploymentIds.add(deployment.getId()); deploymentIds.add("invalid"); HistoricProcessInstanceQuery processInstanceQuery = historyService.createHistoricProcessInstanceQuery().deploymentIdIn(deploymentIds); assertEquals(5, processInstanceQuery.count()); List<HistoricProcessInstance> processInstances = processInstanceQuery.list(); assertNotNull(processInstances); assertEquals(5, processInstances.size()); deploymentIds = new ArrayList<String>(); deploymentIds.add("invalid"); processInstanceQuery = historyService.createHistoricProcessInstanceQuery().deploymentIdIn(deploymentIds); assertEquals(0, processInstanceQuery.count()); }
Example 4
Source File: HistoryServiceTest.java From activiti6-boot2 with Apache License 2.0 | 6 votes |
@Deployment(resources = { "org/activiti5/engine/test/api/oneTaskProcess.bpmn20.xml", "org/activiti5/engine/test/api/runtime/oneTaskProcess2.bpmn20.xml" }) public void testHistoricProcessInstanceQueryByProcessInstanceIds() { HashSet<String> processInstanceIds = new HashSet<String>(); for (int i = 0; i < 4; i++) { processInstanceIds.add(runtimeService.startProcessInstanceByKey("oneTaskProcess", i + "").getId()); } processInstanceIds.add(runtimeService.startProcessInstanceByKey("oneTaskProcess2", "1").getId()); // start an instance that will not be part of the query runtimeService.startProcessInstanceByKey("oneTaskProcess2", "2"); HistoricProcessInstanceQuery processInstanceQuery = historyService.createHistoricProcessInstanceQuery().processInstanceIds(processInstanceIds); assertEquals(5, processInstanceQuery.count()); List<HistoricProcessInstance> processInstances = processInstanceQuery.list(); assertNotNull(processInstances); assertEquals(5, processInstances.size()); for (HistoricProcessInstance historicProcessInstance : processInstances) { assertTrue(processInstanceIds.contains(historicProcessInstance.getId())); } }
Example 5
Source File: HistoryServiceTest.java From activiti6-boot2 with Apache License 2.0 | 6 votes |
@Deployment(resources = { "org/activiti5/engine/test/api/oneTaskProcess.bpmn20.xml", "org/activiti5/engine/test/api/runtime/oneTaskProcess2.bpmn20.xml" }) public void testHistoricProcessInstanceQueryByDeploymentId() { org.activiti.engine.repository.Deployment deployment = repositoryService.createDeploymentQuery().singleResult(); HashSet<String> processInstanceIds = new HashSet<String>(); for (int i = 0; i < 4; i++) { processInstanceIds.add(runtimeService.startProcessInstanceByKey("oneTaskProcess", i + "").getId()); } processInstanceIds.add(runtimeService.startProcessInstanceByKey("oneTaskProcess2", "1").getId()); HistoricProcessInstanceQuery processInstanceQuery = historyService.createHistoricProcessInstanceQuery().deploymentId(deployment.getId()); assertEquals(5, processInstanceQuery.count()); assertEquals(deployment.getId(), processInstanceQuery.list().get(0).getDeploymentId()); List<HistoricProcessInstance> processInstances = processInstanceQuery.list(); assertNotNull(processInstances); assertEquals(5, processInstances.size()); processInstanceQuery = historyService.createHistoricProcessInstanceQuery().deploymentId("invalid"); assertEquals(0, processInstanceQuery.count()); }
Example 6
Source File: HistoryServiceTest.java From activiti6-boot2 with Apache License 2.0 | 6 votes |
@Deployment(resources = { "org/activiti5/engine/test/api/oneTaskProcess.bpmn20.xml", "org/activiti5/engine/test/api/runtime/oneTaskProcess2.bpmn20.xml" }) public void testHistoricProcessInstanceQueryByDeploymentIdIn() { org.activiti.engine.repository.Deployment deployment = repositoryService.createDeploymentQuery().singleResult(); HashSet<String> processInstanceIds = new HashSet<String>(); for (int i = 0; i < 4; i++) { processInstanceIds.add(runtimeService.startProcessInstanceByKey("oneTaskProcess", i + "").getId()); } processInstanceIds.add(runtimeService.startProcessInstanceByKey("oneTaskProcess2", "1").getId()); List<String> deploymentIds = new ArrayList<String>(); deploymentIds.add(deployment.getId()); deploymentIds.add("invalid"); HistoricProcessInstanceQuery processInstanceQuery = historyService.createHistoricProcessInstanceQuery().deploymentIdIn(deploymentIds); assertEquals(5, processInstanceQuery.count()); List<HistoricProcessInstance> processInstances = processInstanceQuery.list(); assertNotNull(processInstances); assertEquals(5, processInstances.size()); deploymentIds = new ArrayList<String>(); deploymentIds.add("invalid"); processInstanceQuery = historyService.createHistoricProcessInstanceQuery().deploymentIdIn(deploymentIds); assertEquals(0, processInstanceQuery.count()); }
Example 7
Source File: ActivitiWorkflowEngine.java From alfresco-repository with GNU Lesser General Public License v3.0 | 5 votes |
@SuppressWarnings("unchecked") private List<WorkflowInstance> getWorkflowsInternal(WorkflowInstanceQuery workflowInstanceQuery, boolean isActive, int maxItems, int skipCount) { // MNT-9074 My Tasks fails to render if tasks quantity is excessive HistoricProcessInstanceQuery query = createQuery(workflowInstanceQuery, isActive); LinkedList<WorkflowInstance> results = new LinkedList<WorkflowInstance>(); List<HistoricProcessInstance> completedInstances; if (maxItems > 0) { completedInstances = query.orderByProcessInstanceDuration().desc().listPage(skipCount, maxItems); } else { completedInstances = query.list(); } List<WorkflowInstance> completedResults = typeConverter.doSpecialTenantFilterAndSafeConvert(completedInstances, new Function<HistoricProcessInstance, String>() { public String apply(HistoricProcessInstance historicProcessInstance) { ProcessDefinition procDef = activitiUtil.getProcessDefinition(historicProcessInstance.getProcessDefinitionId()); return procDef.getKey(); } }); results.addAll(completedResults); return results; }
Example 8
Source File: AbstractServiceTest.java From herd with Apache License 2.0 | 5 votes |
/** * Deletes all Activiti jobs from the history table. */ protected void deleteAllHistoricJobs() { HistoricProcessInstanceQuery query = activitiHistoryService.createHistoricProcessInstanceQuery(); List<HistoricProcessInstance> historicProcessInstances = query.list(); for (HistoricProcessInstance historicProcessInstance : historicProcessInstances) { activitiHistoryService.deleteHistoricProcessInstance(historicProcessInstance.getId()); } }