Ejemplo n.º 1
0
  /**
   * 代领任务(组任务)
   *
   * @return
   */
  public String listGroupTasks() {
    TaskService taskService = processEngine.getTaskService();
    String username = SpringSecurityUtils.getCurrentUsername();
    tasks = taskService.createTaskQuery().taskCandidateUser(username).list();

    return "listGroupTasks";
  }
Ejemplo n.º 2
0
  /**
   * 待办任务(个人任务)
   *
   * @return
   */
  public String listPersonalTasks() {
    TaskService taskService = processEngine.getTaskService();
    String username = SpringSecurityUtils.getCurrentUsername();
    tasks = taskService.createTaskQuery().taskAssignee(username).list();

    return "listPersonalTasks";
  }
Ejemplo n.º 3
0
  /**
   * 认领任务(对应的是在组任务,即从组任务中领取任务)
   *
   * @return
   */
  public String claimTask() {
    String username = SpringSecurityUtils.getCurrentUsername();

    TaskService taskService = processEngine.getTaskService();
    taskService.claim(taskId, username);

    return RELOAD;
  }
Ejemplo n.º 4
0
  /**
   * 已办任务(历史任务)
   *
   * @return
   */
  public String listHistoryTasks() {
    HistoryService historyService = processEngine.getHistoryService();
    String username = SpringSecurityUtils.getCurrentUsername();
    historicTasks =
        historyService.createHistoricTaskInstanceQuery().taskAssignee(username).finished().list();

    return "listHistoryTasks";
  }
Ejemplo n.º 5
0
  /**
   * 用户参与的流程(包含已经完成和未完成)
   *
   * @return
   */
  public String listInvolvedProcessInstances() {
    HistoryService historyService = processEngine.getHistoryService();

    // TODO: finished(), unfinished()
    String username = SpringSecurityUtils.getCurrentUsername();
    historicProcessInstances =
        historyService.createHistoricProcessInstanceQuery().involvedUser(username).list();

    return "listInvolvedProcessInstances";
  }
Ejemplo n.º 6
0
  /**
   * 代理中的任务(代理人还未完成该任务)
   *
   * @return
   */
  public String listDelegatedTasks() {
    TaskService taskService = processEngine.getTaskService();
    String username = SpringSecurityUtils.getCurrentUsername();
    tasks =
        taskService
            .createTaskQuery()
            .taskOwner(username)
            .taskDelegationState(DelegationState.PENDING)
            .list();

    return "listDelegatedTasks";
  }
Ejemplo n.º 7
0
  /**
   * 发起流程
   *
   * @return
   */
  public String startProcessInstance() {
    IdentityService identityService = processEngine.getIdentityService();
    identityService.setAuthenticatedUserId(SpringSecurityUtils.getCurrentUsername());

    FormService formService = processEngine.getFormService();
    StartFormData startFormData = formService.getStartFormData(processDefinitionId);
    HttpServletRequest request = ServletActionContext.getRequest();
    Map<String, String> map = new HashMap<String, String>();

    for (FormProperty formProperty : startFormData.getFormProperties()) {
      String name = formProperty.getId();
      map.put(name, request.getParameter(name));
    }

    formService.submitStartFormData(processDefinitionId, map);

    return RELOAD;
  }
Ejemplo n.º 8
0
  /**
   * 完成任务
   *
   * @return
   */
  public String completeTask() {
    HttpServletRequest request = ServletActionContext.getRequest();
    IdentityService identityService = processEngine.getIdentityService();
    identityService.setAuthenticatedUserId(SpringSecurityUtils.getCurrentUsername());

    FormService formService = processEngine.getFormService();
    TaskFormData taskFormData = formService.getTaskFormData(taskId);

    Map<String, String> map = new HashMap<String, String>();

    for (FormProperty formProperty : taskFormData.getFormProperties()) {
      if (formProperty.isWritable()) {
        String name = formProperty.getId();
        map.put(name, request.getParameter(name));
      }
    }

    formService.submitTaskFormData(taskId, map);

    return RELOAD;
  }