Examples of HistoricTaskInstance


Examples of org.activiti.engine.history.HistoricTaskInstance

  public String showTask(@PathVariable("id") String id,
      @RequestParam(value = TASK_HISTORY_PARAM, required = true) Boolean historyParam,
      @RequestParam(value = PROC_ID, required = true) String procId, Model model,
      HttpServletRequest request) throws TaskHandlerException {
        Task currentTask = null;
        HistoricTaskInstance historyTask = null;
        IProcessEntity linkedObject = getLinkedObject(procId);
        if (Boolean.FALSE.equals(historyParam)) {
          request.setAttribute(TASK_HISTORY_PARAM, false);
            currentTask = getCurrentTask(id);
            // living task instance requested, but already completed by other actor
            if (currentTask == null) {
              historyTask = getHistoryTask(id);
              if (historyTask != null) {
                // force historic view with additional info, who and when already completed task
                request.setAttribute(TASK_HISTORY_PARAM, true);
                Object[] arguments = new Object[2];
                arguments[0] = historyTask.getAssignee();
                arguments[1] = new SimpleDateFormat(InfrastructureConstants.ISO_DATE_TIME_FORMAT)
                  .format(historyTask.getEndTime());
                model.addAttribute(MODEL_ATTR_TASK_COMPLETED,
                  messageSource.getMessage(InfrastructureConstants.TASK_ALREADY_COMPLETED,
              arguments, InfrastructureConstants.UNDEFINED_MESSAGE, request.getLocale()));
              } else {
                // there is not living, nor historic instance, task is non existing / was deleted
                request.getSession()
                  .setAttribute(InfrastructureConstants.SESSION_ATTR_FROM_NON_EXISTING_TASK, true);
                return "redirect:/" + getLinkedObjectViewPath() +
                    WebUtil.encodeUrlPathSegment(linkedObject.getId().toString(),
                    request);
              }
          }
        } else {
          request.setAttribute(TASK_HISTORY_PARAM, true);
          historyTask = getHistoryTask(id);
        }
    String taskName = currentTask != null ? currentTask.getName() : historyTask.getName();
    // taskId is the same for active or history process task
    String taskId = currentTask != null ? currentTask.getId() : historyTask.getId();
    if (Boolean.FALSE.equals(historyParam)) {
      request.getSession().setAttribute(SESSION_ATTR_TASK_ID, taskId);
      request.getSession().setAttribute(SESSION_ATTR_PROC_ID, procId);
    }
    String path = UNDEFINED_TASK; // unknown task type
View Full Code Here

Examples of org.activiti.engine.history.HistoricTaskInstance

      .orderByTaskId().desc()
      .listPage(0,1);
   
    if( historyTaskList == null || historyTaskList.isEmpty() )
      return null;
    HistoricTaskInstance historyTask = historyTaskList.get(0);
   
    HistoricDetailQuery query = historyService.createHistoricDetailQuery().formProperties();
    query.taskId( historyTask.getId() );
   
    return query.list();
  }
View Full Code Here

Examples of org.activiti.engine.history.HistoricTaskInstance

   * 表单数据
   * @param id 流程类型ID 或  任务ID
   * @return FormData
   */
  public FormData getFormData(String id ){
    HistoricTaskInstance task = historyService
      .createHistoricTaskInstanceQuery().taskId(id).singleResult();
    if( task != null )
      return getTaskFormData(id);
    return getStartFormData(id);
  }
View Full Code Here

Examples of org.activiti.engine.history.HistoricTaskInstance

   
    List<HistoricTaskInstance> histTaskList = historyService
        .createHistoricTaskInstanceQuery().finished()
        .orderByHistoricTaskInstanceEndTime().desc()
        .listPage(0, 1);
    HistoricTaskInstance histTask = (histTaskList==null
        ||histTaskList.isEmpty())?null:histTaskList.get(0);
   
    if( histTask == null )
      throw new ApplicationException("历史任务不存在,无法回退!");
   
    if( histTask.getAssignee() == null || !histTask.getAssignee().equals(user) )
      throw new ApplicationException("其它操作用户已完成了新任务,无法回退!");
   
    //流程转向
    turnTransition(ExecutionType.FALLBACK,user,task,histTask,null);
  }
View Full Code Here

Examples of org.activiti.engine.history.HistoricTaskInstance

  }
 
  @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);
  }
View Full Code Here

Examples of org.activiti.engine.history.HistoricTaskInstance

    centralLayout.addComponent(descriptionLayout);
  }

  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);
    }
View Full Code Here

Examples of org.activiti.engine.history.HistoricTaskInstance

    final HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery().
      finished().
      singleResult();
    assertNotNull(historicProcessInstance);
    assertEquals("oneTaskProcessBusinessKey", historicProcessInstance.getBusinessKey());
    HistoricTaskInstance historicTaskInstance = historyService.createHistoricTaskInstanceQuery().taskDefinitionKey("userTask").singleResult();
    assertEquals("user1", historicTaskInstance.getAssignee());
  }
View Full Code Here

Examples of org.activiti.engine.history.HistoricTaskInstance

    final HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery().
      finished().
      singleResult();
    assertNotNull(historicProcessInstance);
    assertEquals("oneTaskProcessBusinessKey", historicProcessInstance.getBusinessKey());
    HistoricTaskInstance historicTaskInstance = historyService.createHistoricTaskInstanceQuery().taskDefinitionKey("userTask").singleResult();
    assertEquals("user1", historicTaskInstance.getAssignee());
  }
View Full Code Here

Examples of org.activiti.engine.history.HistoricTaskInstance

   
    // test that the delete reason of the process instance shows up as delete reason of the task in history
    // ACT-848
    if(processEngineConfiguration.getHistoryLevel().isAtLeast(HistoryLevel.ACTIVITY)) {
     
      HistoricTaskInstance historicTaskInstance = historyService
              .createHistoricTaskInstanceQuery()
              .processInstanceId(processInstance.getId())
              .singleResult();
     
      assertEquals(deleteReason, historicTaskInstance.getDeleteReason());
     
      HistoricProcessInstance historicInstance = historyService.createHistoricProcessInstanceQuery()
          .processInstanceId(processInstance.getId())
          .singleResult();
     
View Full Code Here

Examples of org.activiti.engine.history.HistoricTaskInstance

    assertEquals("updatedowner", task.getOwner());
    assertEquals(dueDate, task.getDueDate());
    assertEquals(1, task.getPriority());
   
    if (processEngineConfiguration.getHistoryLevel().isAtLeast(HistoryLevel.AUDIT)) {
      HistoricTaskInstance historicTaskInstance = historyService
        .createHistoricTaskInstanceQuery()
        .taskId(task.getId())
        .singleResult();
      assertEquals("updatedtaskname", historicTaskInstance.getName());
      assertEquals("updateddescription", historicTaskInstance.getDescription());
      assertEquals("updatedassignee", historicTaskInstance.getAssignee());
      assertEquals("updatedowner", historicTaskInstance.getOwner());
      assertEquals(dueDate, historicTaskInstance.getDueDate());
      assertEquals(1, historicTaskInstance.getPriority());
    }
   
    // Finally, delete task
    taskService.deleteTask(task.getId(), true);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.