Java Code Examples for org.activiti.engine.history.HistoricProcessInstanceQuery#processInstanceId()
The following examples show how to use
org.activiti.engine.history.HistoricProcessInstanceQuery#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: PermissionService.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
/** * Check if the given user is allowed to read the process instance. */ public boolean hasReadPermissionOnProcessInstance(User user, HistoricProcessInstance historicProcessInstance, String processInstanceId) { if (historicProcessInstance == null) { throw new NotFoundException("Process instance not found for id " + processInstanceId); } // Start user check if (historicProcessInstance.getStartUserId() != null && historicProcessInstance.getStartUserId().equals(user.getId())) { return true; } // check if the user is involved in the task HistoricProcessInstanceQuery historicProcessInstanceQuery = historyService.createHistoricProcessInstanceQuery(); historicProcessInstanceQuery.processInstanceId(processInstanceId); historicProcessInstanceQuery.involvedUser(user.getId()); if (historicProcessInstanceQuery.count() > 0) { return true; } // Visibility: check if there are any tasks for the current user HistoricTaskInstanceQuery historicTaskInstanceQuery = historyService.createHistoricTaskInstanceQuery(); historicTaskInstanceQuery.processInstanceId(processInstanceId); historicTaskInstanceQuery.taskInvolvedUser(user.getId()); if (historicTaskInstanceQuery.count() > 0) { return true; } List<String> groupIds = getGroupIdsForUser(user); if (!groupIds.isEmpty()) { historicTaskInstanceQuery = historyService.createHistoricTaskInstanceQuery(); historicTaskInstanceQuery.processInstanceId(processInstanceId).taskCandidateGroupIn(groupIds); return historicTaskInstanceQuery.count() > 0; } return false; }
Example 2
Source File: HistoricProcessInstanceBaseResource.java From activiti6-boot2 with Apache License 2.0 | 4 votes |
protected DataResponse getQueryResponse(HistoricProcessInstanceQueryRequest queryRequest, Map<String, String> allRequestParams) { HistoricProcessInstanceQuery query = historyService.createHistoricProcessInstanceQuery(); // Populate query based on request if (queryRequest.getProcessInstanceId() != null) { query.processInstanceId(queryRequest.getProcessInstanceId()); } if (queryRequest.getProcessInstanceIds() != null && !queryRequest.getProcessInstanceIds().isEmpty()) { query.processInstanceIds(new HashSet<String>(queryRequest.getProcessInstanceIds())); } if (queryRequest.getProcessDefinitionKey() != null) { query.processDefinitionKey(queryRequest.getProcessDefinitionKey()); } if (queryRequest.getProcessDefinitionId() != null) { query.processDefinitionId(queryRequest.getProcessDefinitionId()); } if (queryRequest.getProcessBusinessKey() != null) { query.processInstanceBusinessKey(queryRequest.getProcessBusinessKey()); } if (queryRequest.getInvolvedUser() != null) { query.involvedUser(queryRequest.getInvolvedUser()); } if (queryRequest.getSuperProcessInstanceId() != null) { query.superProcessInstanceId(queryRequest.getSuperProcessInstanceId()); } if (queryRequest.getExcludeSubprocesses() != null) { query.excludeSubprocesses(queryRequest.getExcludeSubprocesses()); } if (queryRequest.getFinishedAfter() != null) { query.finishedAfter(queryRequest.getFinishedAfter()); } if (queryRequest.getFinishedBefore() != null) { query.finishedBefore(queryRequest.getFinishedBefore()); } if (queryRequest.getStartedAfter() != null) { query.startedAfter(queryRequest.getStartedAfter()); } if (queryRequest.getStartedBefore() != null) { query.startedBefore(queryRequest.getStartedBefore()); } if (queryRequest.getStartedBy() != null) { query.startedBy(queryRequest.getStartedBy()); } if (queryRequest.getFinished() != null) { if (queryRequest.getFinished()) { query.finished(); } else { query.unfinished(); } } if (queryRequest.getIncludeProcessVariables() != null) { if (queryRequest.getIncludeProcessVariables()) { query.includeProcessVariables(); } } if (queryRequest.getVariables() != null) { addVariables(query, queryRequest.getVariables()); } if (queryRequest.getTenantId() != null) { query.processInstanceTenantId(queryRequest.getTenantId()); } if (queryRequest.getTenantIdLike() != null) { query.processInstanceTenantIdLike(queryRequest.getTenantIdLike()); } if (Boolean.TRUE.equals(queryRequest.getWithoutTenantId())) { query.processInstanceWithoutTenantId(); } return new HistoricProcessInstancePaginateList(restResponseFactory).paginateList(allRequestParams, queryRequest, query, "processInstanceId", allowedSortProperties); }