public int size() { return (int) createQuery().count(); }
/** * 查询已办工作流列表 * * @param queryCondition * @return */ public PageInfo<TaskInfoBean> queryTaskHistoryList(TaskQueryCondition queryCondition) { PageInfo<TaskInfoBean> page = queryCondition.getPageInfo(); List<TaskInfoBean> list = new ArrayList<>(); try { HistoricTaskInstanceQuery taskQuery = queryCondition.createHistoricTaskInstanceQuery(historyService.createHistoricTaskInstanceQuery()); List<HistoricTaskInstance> taskList = taskQuery.orderByTaskCreateTime().desc().listPage((page.getPageNo() - 1) * page.getPageSize(), page.getPageSize()); page.setCount(taskQuery.count()); for (HistoricTaskInstance task : taskList) { list.add(transToTaskInfoBean(task)); } page.setList(list); } catch (Exception e) { logger.error(e.getMessage(), e); throw new OneBaseException("查询失败:" + e.getMessage()); } return page; }
@Override public long countTasks(WorkflowTaskQuery query) { long totalCount = 0; WorkflowTaskState taskState = query.getTaskState(); if(WorkflowTaskState.COMPLETED.equals(taskState) == false) { totalCount += createRuntimeTaskQuery(query).count(); } // Depending on the state, history should be included/excluded as well if(WorkflowTaskState.IN_PROGRESS.equals(taskState) == false) { totalCount += createHistoricTaskQuery(query).count(); } return totalCount; }
@Override public long countTasks(WorkflowTaskQuery query) { long totalCount = 0; WorkflowTaskState taskState = query.getTaskState(); if(WorkflowTaskState.COMPLETED.equals(taskState) == false) { totalCount += createRuntimeTaskQuery(query).count(); } // Depending on the state, history should be included/excluded as well if(WorkflowTaskState.IN_PROGRESS.equals(taskState) == false) { totalCount += createHistoricTaskQuery(query).count(); } return totalCount; }
@Override public void evaluate(SimulationRunEntity simulationRun) { if (simulationRun != null) { for (ProcessDefinition processDefinition : SimulationRunContext.getRepositoryService().createProcessDefinitionQuery().active().list() ) { ProcessDefinitionEntity pde = (ProcessDefinitionEntity) ((RepositoryServiceImpl)SimulationRunContext.getRepositoryService()) .getDeployedProcessDefinition( processDefinition.getId()); for (ActivityImpl activity : pde.getActivities()) { if ( activity.getProperty("type") != null && activity.getProperty("type") == "userTask" ) { long count = SimulationRunContext.getHistoryService().createHistoricTaskInstanceQuery() .processDefinitionKey( processDefinition.getKey()) .taskDefinitionKey( activity.getId()) .unfinished() .count(); if ( count> 0) { RuntimeService runtimeService = SimulationContext.getSimulationEngineConfiguration().getRuntimeService(); Map<String, Object> resultVariables = new HashMap<String, Object>(); resultVariables.put("processDefinitionKey", processDefinition.getKey()); resultVariables.put("taskDefinitionKey", activity.getId()); resultVariables.put( "description", Long.toString( count)); runtimeService.saveResult(type, resultVariables); } } } } } }
.taskId(taskId).taskOwner(loggedInUserId).count() == 1; if (isOwner) { showArchivedPage(taskId);
.taskOwner(loggedInUserId) .finished() .count() == 1;