for (ProcessDefinition processDefinition : processDefinitions) { completedProcessInstanceCountMap.put(processDefinition.getKey() + " (v" + processDefinition.getVersion() + ")", processEngine.getHistoryService().createHistoricProcessInstanceQuery().finished().processDefinitionId(processDefinition.getId()).count());
count = query.count(); processInstanceList = query.orderByProcessInstanceStartTime().desc().listPage((pageInfo.getPageNum() - 1) * pageInfo.getPageSize(), pageInfo.getPageSize());
@Override public long getHistoricProcessInstancesCountByStatusAndProcessDefinitionKeys(JobStatusEnum jobStatus, Collection<String> processDefinitionKeys, DateTime startTime, DateTime endTime) { return createHistoricProcessInstanceQuery(processDefinitionKeys, jobStatus, startTime, endTime).count(); }
@Override public long getHistoricProcessInstancesCountByStatusAndProcessDefinitionKeys(JobStatusEnum jobStatus, Collection<String> processDefinitionKeys, DateTime startTime, DateTime endTime) { return createHistoricProcessInstanceQuery(processDefinitionKeys, jobStatus, startTime, endTime).count(); }
public int size() { return (int) createQuery().count(); }
@Override public long countWorkflows(WorkflowInstanceQuery workflowInstanceQuery) { // MNT-9074 My Tasks fails to render if tasks quantity is excessive long total = 0; if (Boolean.FALSE.equals(workflowInstanceQuery.getActive()) == false) { // Add active. total += createQuery(workflowInstanceQuery, true).count(); } if (Boolean.TRUE.equals(workflowInstanceQuery.getActive()) == false) { // Add complete total += createQuery(workflowInstanceQuery, false).count(); } return total; }
@Override public long countWorkflows(WorkflowInstanceQuery workflowInstanceQuery) { // MNT-9074 My Tasks fails to render if tasks quantity is excessive long total = 0; if (Boolean.FALSE.equals(workflowInstanceQuery.getActive()) == false) { // Add active. total += createQuery(workflowInstanceQuery, true).count(); } if (Boolean.TRUE.equals(workflowInstanceQuery.getActive()) == false) { // Add complete total += createQuery(workflowInstanceQuery, false).count(); } return total; }
public boolean isCorrectTenantHistoric(String processInstanceId) { return historyService.createHistoricProcessInstanceQuery() .processInstanceId(processInstanceId) .variableValueEquals(ActivitiConstants.VAR_TENANT_DOMAIN, TenantUtil.getCurrentDomain()) .count()>0; }
public boolean isCorrectTenantHistoric(String processInstanceId) { return historyService.createHistoricProcessInstanceQuery() .processInstanceId(processInstanceId) .variableValueEquals(ActivitiConstants.VAR_TENANT_DOMAIN, TenantUtil.getCurrentDomain()) .count()>0; }
public int size() { return (int) historyService.createHistoricProcessInstanceQuery() .startedBy(ExplorerApp.get().getLoggedInUser().getId()) .unfinished() .count(); }
@Test public void getHistoricProcessInstancesCountByStatusAndProcessDefinitionKeys() { JobStatusEnum jobStatus = JobStatusEnum.RUNNING; Collection<String> processDefinitionKeys = new ArrayList<>(); DateTime startTime = new DateTime(); DateTime endTime = new DateTime(); HistoricProcessInstanceQuery historicProcessInstanceQuery = mock(HistoricProcessInstanceQuery.class); when(activitiHistoryService.createHistoricProcessInstanceQuery()).thenReturn(historicProcessInstanceQuery); when(historicProcessInstanceQuery.processDefinitionKeyIn(new ArrayList<>(processDefinitionKeys))).thenReturn(historicProcessInstanceQuery); when(historicProcessInstanceQuery.unfinished()).thenReturn(historicProcessInstanceQuery); when(historicProcessInstanceQuery.startedAfter(startTime.toDate())).thenReturn(historicProcessInstanceQuery); when(historicProcessInstanceQuery.finishedBefore(endTime.toDate())).thenReturn(historicProcessInstanceQuery); long expectedResult = 1234l; when(historicProcessInstanceQuery.count()).thenReturn(expectedResult); long actualResult = activitiService.getHistoricProcessInstancesCountByStatusAndProcessDefinitionKeys(jobStatus, processDefinitionKeys, startTime, endTime); assertEquals(expectedResult, actualResult); InOrder inOrder = inOrder(historicProcessInstanceQuery); inOrder.verify(historicProcessInstanceQuery).processDefinitionKeyIn(new ArrayList<>(processDefinitionKeys)); inOrder.verify(historicProcessInstanceQuery).unfinished(); inOrder.verify(historicProcessInstanceQuery).startedAfter(startTime.toDate()); inOrder.verify(historicProcessInstanceQuery).finishedBefore(endTime.toDate()); inOrder.verify(historicProcessInstanceQuery).count(); inOrder.verifyNoMoreInteractions(); }
for (ProcessDefinition processDefinition : processDefinitions) { completedProcessInstanceCountMap.put(processDefinition.getKey() + " (v" + processDefinition.getVersion() + ")", processEngine.getHistoryService().createHistoricProcessInstanceQuery().finished().processDefinitionId(processDefinition.getId()).count());
protected ProcessDiagramCanvas generateDiagram( String processInstanceId) { if ( historyService.createHistoricProcessInstanceQuery().processInstanceId( processInstanceId).count() == 0) { log.info("Process instanceId["+ processInstanceId +"] does not have any history"); return null;
public List<KickstartWorkflowInfo> convertToWorkflowInfoList(List<ProcessDefinition> processDefinitions, boolean includeCounts) { List<KickstartWorkflowInfo> infoList = new ArrayList<KickstartWorkflowInfo>(); for (ProcessDefinition processDefinition : processDefinitions) { KickstartWorkflowInfo workflowInfo = new KickstartWorkflowInfo(); workflowInfo.setId(processDefinition.getId()); workflowInfo.setKey(processDefinition.getKey()); workflowInfo.setName(processDefinition.getName()); workflowInfo.setVersion(processDefinition.getVersion()); workflowInfo.setDeploymentId(processDefinition.getDeploymentId()); Date deploymentTime = repositoryService.createDeploymentQuery() .deploymentId(processDefinition.getDeploymentId()) .singleResult().getDeploymentTime(); workflowInfo.setCreateTime(deploymentTime); if (includeCounts) { workflowInfo.setNrOfRuntimeInstances(historyService .createHistoricProcessInstanceQuery() .processDefinitionId(processDefinition.getId()) .unfinished().count()); workflowInfo.setNrOfHistoricInstances(historyService .createHistoricProcessInstanceQuery() .processDefinitionId(processDefinition.getId()).finished() .count()); } infoList.add(workflowInfo); } return infoList; }
} else { boolean nameUsed = ProcessEngines.getDefaultProcessEngine().getHistoryService() .createHistoricProcessInstanceQuery().processInstanceBusinessKey(reportName).count() != 0; if (nameUsed) { error = i18nManager.getMessage(Messages.REPORTING_SAVE_POPUP_NAME_EXISTS);