Java Code Examples for org.activiti.engine.history.HistoricActivityInstanceQuery#processInstanceId()
The following examples show how to use
org.activiti.engine.history.HistoricActivityInstanceQuery#processInstanceId() .
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: 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 2
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 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: 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 5
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 6
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); }