org.activiti.engine.history.HistoricActivityInstanceQuery Java Examples
The following examples show how to use
org.activiti.engine.history.HistoricActivityInstanceQuery.
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: ActivitiServiceTest.java From herd with Apache License 2.0 | 6 votes |
@Test public void testGetHistoricActivityInstancesByProcessInstanceId() { String processInstanceId = "processInstanceId"; HistoricActivityInstanceQuery historicActivityInstanceQuery = mock(HistoricActivityInstanceQuery.class); when(activitiHistoryService.createHistoricActivityInstanceQuery()).thenReturn(historicActivityInstanceQuery); when(historicActivityInstanceQuery.processInstanceId(processInstanceId)).thenReturn(historicActivityInstanceQuery); when(historicActivityInstanceQuery.orderByHistoricActivityInstanceStartTime()).thenReturn(historicActivityInstanceQuery); when(historicActivityInstanceQuery.asc()).thenReturn(historicActivityInstanceQuery); when(historicActivityInstanceQuery.orderByHistoricActivityInstanceEndTime()).thenReturn(historicActivityInstanceQuery); when(historicActivityInstanceQuery.asc()).thenReturn(historicActivityInstanceQuery); List<HistoricActivityInstance> expectedHistoricActivityInstances = new ArrayList<>(); when(historicActivityInstanceQuery.list()).thenReturn(expectedHistoricActivityInstances); List<HistoricActivityInstance> actualHistoricActivityInstances = activitiService.getHistoricActivityInstancesByProcessInstanceId(processInstanceId); assertSame(expectedHistoricActivityInstances, actualHistoricActivityInstances); InOrder inOrder = inOrder(historicActivityInstanceQuery); inOrder.verify(historicActivityInstanceQuery).processInstanceId(processInstanceId); inOrder.verify(historicActivityInstanceQuery).orderByHistoricActivityInstanceStartTime(); inOrder.verify(historicActivityInstanceQuery).asc(); inOrder.verify(historicActivityInstanceQuery).orderByHistoricActivityInstanceEndTime(); inOrder.verify(historicActivityInstanceQuery).asc(); inOrder.verify(historicActivityInstanceQuery).list(); inOrder.verifyNoMoreInteractions(); }
Example #2
Source File: CompensateEventTest.java From activiti6-boot2 with Apache License 2.0 | 6 votes |
@Deployment(resources = {"org/activiti5/engine/test/bpmn/event/compensate/CompensateEventTest.testCompensationStepEndRecorded.bpmn20.xml"}) public void testCompensationStepEndTimeRecorded() { ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("compensationStepEndRecordedProcess"); assertProcessEnded(processInstance.getId()); assertEquals(0, runtimeService.createProcessInstanceQuery().count()); if (!processEngineConfiguration.getHistoryLevel().isAtLeast(HistoryLevel.ACTIVITY)) { return; } final HistoricActivityInstanceQuery query = historyService.createHistoricActivityInstanceQuery().activityId("compensationScriptTask"); assertEquals(1, query.count()); final HistoricActivityInstance compensationScriptTask = query.singleResult(); assertNotNull(compensationScriptTask); assertNotNull(compensationScriptTask.getEndTime()); assertNotNull(compensationScriptTask.getDurationInMillis()); }
Example #3
Source File: CallActivityTest.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
public void testInheritVariablesSubprocess() throws Exception { BpmnModel mainBpmnModel = loadBPMNModel(INHERIT_VARIABLES_MAIN_PROCESS_RESOURCE); BpmnModel childBpmnModel = loadBPMNModel(INHERIT_VARIABLES_CHILD_PROCESS_RESOURCE); processEngine.getRepositoryService() .createDeployment() .name("mainProcessDeployment") .addBpmnModel("mainProcess.bpmn20.xml", mainBpmnModel).deploy(); processEngine.getRepositoryService() .createDeployment() .name("childProcessDeployment") .addBpmnModel("childProcess.bpmn20.xml", childBpmnModel).deploy(); Map<String, Object> variables = new HashMap<String, Object>(); variables.put("var1", "String test value"); variables.put("var2", true); variables.put("var3", 12345); variables.put("var4", 67890); ProcessInstance mainProcessInstance = runtimeService.startProcessInstanceByKey("mainProcess", variables); HistoricActivityInstanceQuery activityInstanceQuery = historyService.createHistoricActivityInstanceQuery(); activityInstanceQuery.processInstanceId(mainProcessInstance.getId()); activityInstanceQuery.activityId("childProcessCall"); HistoricActivityInstance activityInstance = activityInstanceQuery.singleResult(); String calledInstanceId = activityInstance.getCalledProcessInstanceId(); HistoricVariableInstanceQuery variableInstanceQuery = historyService.createHistoricVariableInstanceQuery(); List<HistoricVariableInstance> variableInstances = variableInstanceQuery.processInstanceId(calledInstanceId).list(); assertEquals(4, variableInstances.size()); for (HistoricVariableInstance variable : variableInstances) { assertEquals(variables.get(variable.getVariableName()), variable.getValue()); } }
Example #4
Source File: ActivitiesImpl.java From alfresco-remote-api with GNU Lesser General Public License v3.0 | 5 votes |
@Override public CollectionWithPagingInfo<Activity> getActivities(String processId, Parameters parameters) { Paging paging = parameters.getPaging(); String status = parameters.getParameter("status"); validateIfUserAllowedToWorkWithProcess(processId); HistoricActivityInstanceQuery query = activitiProcessEngine .getHistoryService() .createHistoricActivityInstanceQuery(); if (STATUS_ACTIVE.equals(status)) query.unfinished(); else if (STATUS_COMPLETED.equals(status)) query.finished(); query.processInstanceId(processId); query.orderByExecutionId().asc(); List<HistoricActivityInstance> activities = query.listPage(paging.getSkipCount(), paging.getMaxItems()); List<Activity> page = new ArrayList<Activity>(activities.size()); for (HistoricActivityInstance activityInstance: activities) { Activity activity = new Activity(activityInstance); page.add(activity); } return CollectionWithPagingInfo.asPaged(paging, page, false, page.size()); }
Example #5
Source File: HistoricActivityInstanceEscapeClauseTest.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
public void testQueryByTenantIdLike() { runtimeService.startProcessInstanceByKeyAndTenantId("noopProcess", "One%"); runtimeService.startProcessInstanceByKeyAndTenantId("noopProcess", "Two_"); HistoricActivityInstanceQuery query = historyService.createHistoricActivityInstanceQuery().activityId("noop").activityTenantIdLike("%\\%%"); assertEquals("One%", query.singleResult().getTenantId()); assertEquals(1, query.list().size()); assertEquals(1, query.count()); query = historyService.createHistoricActivityInstanceQuery().activityId("noop").activityTenantIdLike("%\\_%"); assertEquals("Two_", query.singleResult().getTenantId()); assertEquals(1, query.list().size()); assertEquals(1, query.count()); }
Example #6
Source File: CallActivityTest.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
public void testNotInheritVariablesSubprocess() throws Exception { BpmnModel mainBpmnModel = loadBPMNModel(NOT_INHERIT_VARIABLES_MAIN_PROCESS_RESOURCE); BpmnModel childBpmnModel = loadBPMNModel(INHERIT_VARIABLES_CHILD_PROCESS_RESOURCE); processEngine.getRepositoryService() .createDeployment() .name("childProcessDeployment") .addBpmnModel("childProcess.bpmn20.xml", childBpmnModel).deploy(); processEngine.getRepositoryService() .createDeployment() .name("mainProcessDeployment") .addBpmnModel("mainProcess.bpmn20.xml", mainBpmnModel).deploy(); Map<String, Object> variables = new HashMap<String, Object>(); variables.put("var1", "String test value"); variables.put("var2", true); variables.put("var3", 12345); variables.put("var4", 67890); ProcessInstance mainProcessInstance = runtimeService.startProcessInstanceByKey("mainProcess", variables); HistoricActivityInstanceQuery activityInstanceQuery = historyService.createHistoricActivityInstanceQuery(); activityInstanceQuery.processInstanceId(mainProcessInstance.getId()); activityInstanceQuery.activityId("childProcessCall"); HistoricActivityInstance activityInstance = activityInstanceQuery.singleResult(); String calledInstanceId = activityInstance.getCalledProcessInstanceId(); HistoricVariableInstanceQuery variableInstanceQuery = historyService.createHistoricVariableInstanceQuery(); variableInstanceQuery.processInstanceId(calledInstanceId); List<HistoricVariableInstance> variableInstances = variableInstanceQuery.list(); assertEquals(0, variableInstances.size()); }
Example #7
Source File: HistoricActivityInstanceEscapeClauseTest.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
public void testQueryByTenantIdLike() { runtimeService.startProcessInstanceByKeyAndTenantId("noopProcess", "One%"); runtimeService.startProcessInstanceByKeyAndTenantId("noopProcess", "Two_"); HistoricActivityInstanceQuery query = historyService.createHistoricActivityInstanceQuery().activityId("noop").activityTenantIdLike("%\\%%"); assertEquals("One%", query.singleResult().getTenantId()); assertEquals(1, query.list().size()); assertEquals(1, query.count()); query = historyService.createHistoricActivityInstanceQuery().activityId("noop").activityTenantIdLike("%\\_%"); assertEquals("Two_", query.singleResult().getTenantId()); assertEquals(1, query.list().size()); assertEquals(1, query.count()); }
Example #8
Source File: HistoricActivityInstanceTest.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
@Deployment public void testHistoricActivityInstanceUnfinished() { ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("oneTaskProcess"); assertNotNull(processInstance); HistoricActivityInstanceQuery historicActivityInstanceQuery = historyService.createHistoricActivityInstanceQuery(); long finishedActivityInstanceCount = historicActivityInstanceQuery.finished().count(); assertEquals("The Start event is completed", 1, finishedActivityInstanceCount); long unfinishedActivityInstanceCount = historicActivityInstanceQuery.unfinished().count(); assertEquals("One active (unfinished) User Task", 1, unfinishedActivityInstanceCount); }
Example #9
Source File: CompensateEventTest.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
@Deployment(resources = { "org/activiti/engine/test/bpmn/event/compensate/CompensateEventTest.testCompensationStepEndRecorded.bpmn20.xml" }) public void testCompensationStepEndTimeRecorded() { ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("compensationStepEndRecordedProcess"); assertProcessEnded(processInstance.getId()); assertEquals(0, runtimeService.createProcessInstanceQuery().count()); if (processEngineConfiguration.getHistoryLevel().isAtLeast(HistoryLevel.ACTIVITY)) { final HistoricActivityInstanceQuery query = historyService.createHistoricActivityInstanceQuery().activityId("compensationScriptTask"); assertEquals(1, query.count()); final HistoricActivityInstance compensationScriptTask = query.singleResult(); assertNotNull(compensationScriptTask); assertNotNull(compensationScriptTask.getEndTime()); assertNotNull(compensationScriptTask.getDurationInMillis()); } }
Example #10
Source File: CallActivityTest.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
public void testNotInheritVariablesSubprocess() throws Exception { BpmnModel mainBpmnModel = loadBPMNModel(NOT_INHERIT_VARIABLES_MAIN_PROCESS_RESOURCE); BpmnModel childBpmnModel = loadBPMNModel(INHERIT_VARIABLES_CHILD_PROCESS_RESOURCE); processEngine.getRepositoryService() .createDeployment() .name("childProcessDeployment") .addBpmnModel("childProcess.bpmn20.xml", childBpmnModel).deploy(); processEngine.getRepositoryService() .createDeployment() .name("mainProcessDeployment") .addBpmnModel("mainProcess.bpmn20.xml", mainBpmnModel).deploy(); Map<String, Object> variables = new HashMap<String, Object>(); variables.put("var1", "String test value"); variables.put("var2", true); variables.put("var3", 12345); variables.put("var4", 67890); ProcessInstance mainProcessInstance = runtimeService.startProcessInstanceByKey("mainProcess", variables); HistoricActivityInstanceQuery activityInstanceQuery = historyService.createHistoricActivityInstanceQuery(); activityInstanceQuery.processInstanceId(mainProcessInstance.getId()); activityInstanceQuery.activityId("childProcessCall"); HistoricActivityInstance activityInstance = activityInstanceQuery.singleResult(); String calledInstanceId = activityInstance.getCalledProcessInstanceId(); HistoricVariableInstanceQuery variableInstanceQuery = historyService.createHistoricVariableInstanceQuery(); variableInstanceQuery.processInstanceId(calledInstanceId); List<HistoricVariableInstance> variableInstances = variableInstanceQuery.list(); assertEquals(0, variableInstances.size()); }
Example #11
Source File: CallActivityTest.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
public void testInheritVariablesSubprocess() throws Exception { BpmnModel mainBpmnModel = loadBPMNModel(INHERIT_VARIABLES_MAIN_PROCESS_RESOURCE); BpmnModel childBpmnModel = loadBPMNModel(INHERIT_VARIABLES_CHILD_PROCESS_RESOURCE); processEngine.getRepositoryService() .createDeployment() .name("mainProcessDeployment") .addBpmnModel("mainProcess.bpmn20.xml", mainBpmnModel).deploy(); processEngine.getRepositoryService() .createDeployment() .name("childProcessDeployment") .addBpmnModel("childProcess.bpmn20.xml", childBpmnModel).deploy(); Map<String, Object> variables = new HashMap<String, Object>(); variables.put("var1", "String test value"); variables.put("var2", true); variables.put("var3", 12345); variables.put("var4", 67890); ProcessInstance mainProcessInstance = runtimeService.startProcessInstanceByKey("mainProcess", variables); HistoricActivityInstanceQuery activityInstanceQuery = historyService.createHistoricActivityInstanceQuery(); activityInstanceQuery.processInstanceId(mainProcessInstance.getId()); activityInstanceQuery.activityId("childProcessCall"); HistoricActivityInstance activityInstance = activityInstanceQuery.singleResult(); String calledInstanceId = activityInstance.getCalledProcessInstanceId(); HistoricVariableInstanceQuery variableInstanceQuery = historyService.createHistoricVariableInstanceQuery(); List<HistoricVariableInstance> variableInstances = variableInstanceQuery.processInstanceId(calledInstanceId).list(); assertEquals(4, variableInstances.size()); for (HistoricVariableInstance variable : variableInstances) { assertEquals(variables.get(variable.getVariableName()), variable.getValue()); } }
Example #12
Source File: HistoricActivityInstanceBaseResource.java From activiti6-boot2 with Apache License 2.0 | 4 votes |
protected DataResponse getQueryResponse(HistoricActivityInstanceQueryRequest queryRequest, Map<String, String> allRequestParams) { HistoricActivityInstanceQuery query = historyService.createHistoricActivityInstanceQuery(); // Populate query based on request if (queryRequest.getActivityId() != null) { query.activityId(queryRequest.getActivityId()); } if (queryRequest.getActivityInstanceId() != null) { query.activityInstanceId(queryRequest.getActivityInstanceId()); } if (queryRequest.getActivityName() != null) { query.activityName(queryRequest.getActivityName()); } if (queryRequest.getActivityType() != null) { query.activityType(queryRequest.getActivityType()); } if (queryRequest.getExecutionId() != null) { query.executionId(queryRequest.getExecutionId()); } if (queryRequest.getFinished() != null) { Boolean finished = queryRequest.getFinished(); if (finished) { query.finished(); } else { query.unfinished(); } } if (queryRequest.getTaskAssignee() != null) { query.taskAssignee(queryRequest.getTaskAssignee()); } if (queryRequest.getProcessInstanceId() != null) { query.processInstanceId(queryRequest.getProcessInstanceId()); } if (queryRequest.getProcessDefinitionId() != null) { query.processDefinitionId(queryRequest.getProcessDefinitionId()); } if (queryRequest.getTenantId() != null) { query.activityTenantId(queryRequest.getTenantId()); } if (queryRequest.getTenantIdLike() != null) { query.activityTenantIdLike(queryRequest.getTenantIdLike()); } if (Boolean.TRUE.equals(queryRequest.getWithoutTenantId())) { query.activityWithoutTenantId(); } return new HistoricActivityInstancePaginateList(restResponseFactory).paginateList(allRequestParams, queryRequest, query, "startTime", allowedSortProperties); }
Example #13
Source File: HistoricActivityInstanceQueryImpl.java From activiti6-boot2 with Apache License 2.0 | 4 votes |
public HistoricActivityInstanceQuery orderByActivityId() { orderBy(HistoricActivityInstanceQueryProperty.ACTIVITY_ID); return this; }
Example #14
Source File: HistoryService.java From flowable-engine with Apache License 2.0 | 4 votes |
/** Creates a new programmatic query to search for {@link HistoricActivityInstance}s. */ HistoricActivityInstanceQuery createHistoricActivityInstanceQuery();
Example #15
Source File: HistoryServiceImpl.java From flowable-engine with Apache License 2.0 | 4 votes |
@Override public HistoricActivityInstanceQuery createHistoricActivityInstanceQuery() { return new HistoricActivityInstanceQueryImpl(commandExecutor); }
Example #16
Source File: HistoricActivityInstanceQueryImpl.java From flowable-engine with Apache License 2.0 | 4 votes |
@Override public HistoricActivityInstanceQuery orderByActivityId() { orderBy(HistoricActivityInstanceQueryProperty.ACTIVITY_ID); return this; }
Example #17
Source File: HistoryServiceImpl.java From activiti6-boot2 with Apache License 2.0 | 4 votes |
public HistoricActivityInstanceQuery createHistoricActivityInstanceQuery() { return new HistoricActivityInstanceQueryImpl(commandExecutor); }
Example #18
Source File: WorkflowInnerServiceSMOImpl.java From MicroCommunity with Apache License 2.0 | 3 votes |
/** * @param processInstanceId * @return * @CreateUser:xxxx * @ReturnType:List * @CreateDate:2014-6-25下午5:03:13 * @UseFor :在 ACT_HI_ACTINST 表中找到对应流程实例的userTask节点 不包括startEvent * <p> * .finished() */ private List<HistoricActivityInstance> getHisUserTaskActivityInstanceList( String processInstanceId) { List<HistoricActivityInstance> hisActivityInstanceList = ((HistoricActivityInstanceQuery) historyService .createHistoricActivityInstanceQuery() .processInstanceId(processInstanceId).activityType("userTask") .orderByHistoricActivityInstanceStartTime().asc()) .list(); return hisActivityInstanceList; }
Example #19
Source File: HistoryService.java From activiti6-boot2 with Apache License 2.0 | 2 votes |
/** * Creates a new programmatic query to search for {@link HistoricActivityInstance}s. */ HistoricActivityInstanceQuery createHistoricActivityInstanceQuery();