Java Code Examples for org.activiti.engine.history.HistoricProcessInstanceQuery#finishedBefore()
The following examples show how to use
org.activiti.engine.history.HistoricProcessInstanceQuery#finishedBefore() .
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: ActivitiServiceImpl.java From herd with Apache License 2.0 | 5 votes |
/** * Creates a HistoricProcessInstanceQuery in the given process definitions, optionally filtering by the given job status, start and end times. * * @param processDefinitionKeys Collection of process definition keys * @param jobStatus The job status. Optional. * @param startTime The start time. Optional. * @param endTime The end time. Optional. * * @return A HistoricProcessInstanceQuery */ private HistoricProcessInstanceQuery createHistoricProcessInstanceQuery(Collection<String> processDefinitionKeys, JobStatusEnum jobStatus, DateTime startTime, DateTime endTime) { HistoricProcessInstanceQuery query = activitiHistoryService.createHistoricProcessInstanceQuery().processDefinitionKeyIn(new ArrayList<>(processDefinitionKeys)); if (JobStatusEnum.RUNNING.equals(jobStatus) || JobStatusEnum.SUSPENDED.equals(jobStatus)) { // If the filter is for "running" or "suspended", use the "unfinished" query filter. query.unfinished(); } else if (JobStatusEnum.COMPLETED.equals(jobStatus)) { // If the filter is for "completed" processes, use the "finished" query filter. query.finished(); } if (startTime != null) { query.startedAfter(startTime.toDate()); } if (endTime != null) { query.finishedBefore(endTime.toDate()); } return query; }
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); }