/** * 根据历史任务ID查询历史任务信息 * * @param taskId * @return */ public HistoricTaskInstance getHisTaskById(String hisTaskId) { HistoricTaskInstance hisTask = historyService .createHistoricTaskInstanceQuery().taskId(hisTaskId) .singleResult(); return hisTask; }
protected HistoricTaskInstance getHistoricTaskInstanceFromRequest(String taskId) { HistoricTaskInstance taskInstance = historyService.createHistoricTaskInstanceQuery().taskId(taskId).singleResult(); if (taskInstance == null) { throw new ActivitiObjectNotFoundException("Could not find a task instance with id '" + taskId + "'.", HistoricTaskInstance.class); } return taskInstance; } }
/** * Get valid history task from request. Throws exception if task doen't exist or if task id is not provided. */ protected HistoricTaskInstance getHistoricTaskFromRequest(String taskId) { HistoricTaskInstance task = historyService.createHistoricTaskInstanceQuery().taskId(taskId).singleResult(); if (task == null) { throw new ActivitiObjectNotFoundException("Could not find a task with id '" + taskId + "'.", Task.class); } return task; } }
public Item loadSingleResult(String id) { return new TaskListItem(createQuery().taskId(id).singleResult()); }
/** * 查询历史任务信息 * * @param taskId * @return */ public TaskInfoBean getHistoryTask(String taskId) { TaskInfoBean taskInfoBean = null; try { HistoricTaskInstanceQuery taskQuery = historyService.createHistoricTaskInstanceQuery(); HistoricTaskInstance task = taskQuery.taskId(taskId).singleResult(); if (task == null) { throw new OneBaseException("找不到ID" + taskId + "为的任务"); } taskInfoBean = transToTaskInfoBean(task); } catch (Exception e) { logger.info(e.getMessage(), e); throw new OneBaseException("查询失败" + e.getMessage()); } return taskInfoBean; }
/** * @param localId String * @return HistoricTaskInstance */ public HistoricTaskInstance getHistoricTaskInstance(String localId) { HistoricTaskInstanceQuery taskQuery = historyService.createHistoricTaskInstanceQuery() .taskId(localId); if(!deployWorkflowsInTenant) { taskQuery.processVariableValueEquals(ActivitiConstants.VAR_TENANT_DOMAIN, TenantUtil.getCurrentDomain()); } return taskQuery.singleResult(); }
/** * @param localId String * @return HistoricTaskInstance */ public HistoricTaskInstance getHistoricTaskInstance(String localId) { HistoricTaskInstanceQuery taskQuery = historyService.createHistoricTaskInstanceQuery() .taskId(localId); if(!deployWorkflowsInTenant) { taskQuery.processVariableValueEquals(ActivitiConstants.VAR_TENANT_DOMAIN, TenantUtil.getCurrentDomain()); } return taskQuery.singleResult(); }
@Override protected Component createDetailComponent(String id) { HistoryService historyService = ProcessEngines.getDefaultProcessEngine().getHistoryService(); HistoricTaskInstance historicTaskInstance = historyService.createHistoricTaskInstanceQuery().taskId(id).singleResult(); taskEventPanel.setTaskId(historicTaskInstance.getId()); return new HistoricTaskDetailPanel(historicTaskInstance, this); }
.taskId(taskToComplete.getId()).includeProcessVariables().includeTaskLocalVariables().singleResult(); if (executedTask == null) {
public RestVariable getVariableFromRequest(boolean includeBinary, String taskId, String variableName, String scope, HttpServletRequest request) { RestVariableScope variableScope = RestVariable.getScopeFromString(scope); HistoricTaskInstanceQuery taskQuery = historyService.createHistoricTaskInstanceQuery().taskId(taskId);
protected void initParentTaskLink() { if (historicTask.getParentTaskId() != null) { final HistoricTaskInstance parentTask = historyService.createHistoricTaskInstanceQuery() .taskId(historicTask.getParentTaskId()) .singleResult(); Button showParentTaskButton = new Button(i18nManager.getMessage( Messages.TASK_SUBTASK_OF_PARENT_TASK, parentTask.getName())); showParentTaskButton.addStyleName(Reindeer.BUTTON_LINK); showParentTaskButton.addListener(new ClickListener() { public void buttonClick(ClickEvent event) { viewManager.showTaskPage(parentTask.getId()); } }); centralLayout.addComponent(showParentTaskButton); } }
.taskId(taskId).taskOwner(loggedInUserId).count() == 1; if (isOwner) { showArchivedPage(taskId);
if (task == null) { boolean isOwner = historyService.createHistoricTaskInstanceQuery() .taskId(taskId) .taskOwner(loggedInUserId) .finished()
private WorkflowTask endNormalTask(String taskId, String localTaskId, String transition) { // Retrieve task Task task = taskService.createTaskQuery().taskId(localTaskId).singleResult(); if(task == null) { String msg = messageService.getMessage(ERR_END_UNEXISTING_TASK, taskId); throw new WorkflowException(msg); } // Check if the assignee is equal to the current logged-in user. If not, assign task before ending String currentUserName = AuthenticationUtil.getFullyAuthenticatedUser(); if(task.getAssignee() == null || !task.getAssignee().equals(currentUserName)) { taskService.setAssignee(localTaskId, currentUserName); // Also update pojo used to set the outcome, this will read assignee as wel task.setAssignee(currentUserName); // Re-fetch the task-entity since it's revision has been updated by the setAssignee() call task = taskService.createTaskQuery().taskId(localTaskId).singleResult(); } setOutcome(task, transition); taskService.complete(localTaskId); // The task should have a historicTaskInstance HistoricTaskInstance historicTask = historyService.createHistoricTaskInstanceQuery().taskId(task.getId()).singleResult(); return typeConverter.convert(historicTask); }
private WorkflowTask endNormalTask(String taskId, String localTaskId, String transition) { // Retrieve task Task task = taskService.createTaskQuery().taskId(localTaskId).singleResult(); if(task == null) { String msg = messageService.getMessage(ERR_END_UNEXISTING_TASK, taskId); throw new WorkflowException(msg); } // Check if the assignee is equal to the current logged-in user. If not, assign task before ending String currentUserName = AuthenticationUtil.getFullyAuthenticatedUser(); if(task.getAssignee() == null || !task.getAssignee().equals(currentUserName)) { taskService.setAssignee(localTaskId, currentUserName); // Also update pojo used to set the outcome, this will read assignee as wel task.setAssignee(currentUserName); // Re-fetch the task-entity since it's revision has been updated by the setAssignee() call task = taskService.createTaskQuery().taskId(localTaskId).singleResult(); } setOutcome(task, transition); taskService.complete(localTaskId); // The task should have a historicTaskInstance HistoricTaskInstance historicTask = historyService.createHistoricTaskInstanceQuery().taskId(task.getId()).singleResult(); return typeConverter.convert(historicTask); }
HistoricTaskInstance hti = historyService.createHistoricTaskInstanceQuery().taskId(task.getId()).singleResult(); assertNotNull(hti); assertEquals("admin", hti.getAssignee());
historicQuery.taskId(taskId);
historicQuery.taskId(taskId);
query.taskId(queryRequest.getTaskId());