protected void setVariable(
      Task task, String name, Object value, RestVariableScope scope, boolean isNew) {
    // Create can only be done on new variables. Existing variables should be updated using PUT
    boolean hasVariable = hasVariableOnScope(task, name, scope);
    if (isNew && hasVariable) {
      throw new ActivitiException(
          "Variable '" + name + "' is already present on task '" + task.getId() + "'.");
    }

    if (!isNew && !hasVariable) {
      throw new ActivitiObjectNotFoundException(
          "Task '" + task.getId() + "' doesn't have a variable with name: '" + name + "'.", null);
    }

    if (scope == RestVariableScope.LOCAL) {
      taskService.setVariableLocal(task.getId(), name, value);
    } else {
      if (task.getExecutionId() != null) {
        // Explicitly set on execution, setting non-local variable on task will override
        // local-variable if exists
        runtimeService.setVariable(task.getExecutionId(), name, value);
      } else {
        // Standalone task, no global variables possible
        throw new ActivitiIllegalArgumentException(
            "Cannot set global variable '"
                + name
                + "' on task '"
                + task.getId()
                + "', task is not part of process.");
      }
    }
  }
  @Override
  @Transactional(readOnly = false)
  public Defect reviewDefect(Long defectId, String assignedTo) {
    Defect existingDefect = defectRepository.getById(defectId);
    String existingAsignee = existingDefect.getAssignedTo();

    existingDefect.setStatus(DefectStatus.ASSIGNED);
    existingDefect.setAssignedTo(assignedTo);
    defectRepository.update(existingDefect);

    for (Task task : taskService.createTaskQuery().taskAssignee(existingAsignee).list()) {
      if (task.getName().equalsIgnoreCase("reviewDefect")) {
        Long taskDefectId = (Long) runtimeService.getVariable(task.getExecutionId(), "defectId");
        if (taskDefectId.equals(defectId)) {
          taskService.complete(task.getId());
          logger.info("Reviewed Defect: " + task.getName() + " Defect Id: " + taskDefectId);
        }
      }
    }
    logger.info(
        "Task assigned to: "
            + existingAsignee
            + " : "
            + taskService.createTaskQuery().taskAssignee(existingAsignee));
    logger.info(
        "Task assigned to: "
            + assignedTo
            + " : "
            + taskService.createTaskQuery().taskAssignee(assignedTo));

    return existingDefect;
  }
예제 #3
0
  @Delete
  public void deleteTask() {
    if (!authenticate()) {
      return;
    }

    Form query = getQuery();
    Boolean cascadeHistory = getQueryParameterAsBoolean("cascadeHistory", query);
    String deleteReason = getQueryParameter("deleteReason", query);

    Task taskToDelete = getTaskFromRequest();
    if (taskToDelete.getExecutionId() != null) {
      // Can't delete a task that is part of a process instance
      throw new ResourceException(
          new Status(
              Status.CLIENT_ERROR_FORBIDDEN.getCode(),
              "Cannot delete a task that is part of a process-instance.",
              null,
              null));
    }

    if (cascadeHistory != null) {
      // Ignore delete-reason since the task-history (where the reason is recorded) will be deleted
      // anyway
      ActivitiUtil.getTaskService().deleteTask(taskToDelete.getId(), cascadeHistory);
    } else {
      // Delete with delete-reason
      ActivitiUtil.getTaskService().deleteTask(taskToDelete.getId(), deleteReason);
    }
    getResponse().setStatus(Status.SUCCESS_NO_CONTENT);
  }
  /**
   * 跳转到任务执行页面
   *
   * @param request
   * @return
   */
  @RequestMapping(value = "/form.do")
  public String from(
      HttpServletRequest request, @RequestParam("taskId") String taskId, Model model) {

    List<Task> taskList = taskService.createTaskQuery().taskId(taskId).list();
    Task task = taskList.get(0);
    // 获取表单数据
    TaskFormData tfd = formService.getTaskFormData(taskId);
    List<FormProperty> fpList = tfd.getFormProperties();

    Map map = runtimeService.getVariables(task.getExecutionId());

    List<ActivityImpl> activityList = new ArrayList<ActivityImpl>();

    try {
      // 查找所有可驳回的节点
      activityList = processExtensionService.findBackActivity(taskId);
      // model.addAttribute("activityList",activityList);
    } catch (Exception e) {
      e.printStackTrace();
    }

    //        model.addAttribute("task",task);
    //        model.addAttribute("fpList",fpList);
    //        model.addAttribute("map",map);
    //        model.addAttribute("taskId",taskId);

    request.setAttribute("task", task);
    request.setAttribute("fpList", fpList);
    request.setAttribute("map", map);
    request.setAttribute("taskId", taskId);
    request.setAttribute("activityList", activityList);

    return "/simple/form";
  }
예제 #5
0
  protected boolean hasVariableOnScope(Task task, String variableName, RestVariableScope scope) {
    boolean variableFound = false;

    if (scope == RestVariableScope.GLOBAL) {
      if (task.getExecutionId() != null
          && ActivitiUtil.getRuntimeService().hasVariable(task.getExecutionId(), variableName)) {
        variableFound = true;
      }

    } else if (scope == RestVariableScope.LOCAL) {
      if (ActivitiUtil.getTaskService().hasVariableLocal(task.getId(), variableName)) {
        variableFound = true;
      }
    }
    return variableFound;
  }
 @Override
 public List<PiecejustifDTO> getPieceJustifFromProcess(Long dossierId, ValidationTask step) {
   Task task =
       taskService
           .createTaskQuery()
           .processInstanceBusinessKey(dossierId.toString())
           .taskDefinitionKey(step.getValue())
           .singleResult();
   return (List<PiecejustifDTO>) runtimeService.getVariable(task.getExecutionId(), "piecejustifs");
 }
 private List<Defect> findDefects(String username, String taskName) {
   List<Task> tasks = taskService.createTaskQuery().taskAssignee(username).list();
   List<Long> defectIds = new ArrayList<Long>();
   for (Task task : tasks) {
     if (task.getName().equalsIgnoreCase(taskName)) {
       Long defectId = (Long) runtimeService.getVariable(task.getExecutionId(), "defectId");
       defectIds.add(defectId);
     }
   }
   return defectRepository.findByIds(defectIds);
 }
예제 #8
0
  public RestVariable getVariableFromRequest(boolean includeBinary) {
    String taskId = getAttribute("taskId");
    if (taskId == null) {
      throw new ActivitiIllegalArgumentException("The taskId cannot be null");
    }

    String variableName = getAttribute("variableName");
    if (variableName == null) {
      throw new ActivitiIllegalArgumentException("The variableName cannot be null");
    }

    boolean variableFound = false;
    Object value = null;
    RestVariableScope variableScope =
        RestVariable.getScopeFromString(getQueryParameter("scope", getQuery()));
    if (variableScope == null) {
      // First, check local variables (which have precedence when no scope is supplied)
      if (ActivitiUtil.getTaskService().hasVariableLocal(taskId, variableName)) {
        value = ActivitiUtil.getTaskService().getVariableLocal(taskId, variableName);
        variableScope = RestVariableScope.LOCAL;
        variableFound = true;
      } else {
        // Revert to execution-variable when not present local on the task
        Task task = ActivitiUtil.getTaskService().createTaskQuery().taskId(taskId).singleResult();
        if (task.getExecutionId() != null
            && ActivitiUtil.getRuntimeService().hasVariable(task.getExecutionId(), variableName)) {
          value = ActivitiUtil.getRuntimeService().getVariable(task.getExecutionId(), variableName);
          variableScope = RestVariableScope.GLOBAL;
          variableFound = true;
        }
      }

    } else if (variableScope == RestVariableScope.GLOBAL) {
      Task task = ActivitiUtil.getTaskService().createTaskQuery().taskId(taskId).singleResult();
      if (task.getExecutionId() != null
          && ActivitiUtil.getRuntimeService().hasVariable(task.getExecutionId(), variableName)) {
        value = ActivitiUtil.getRuntimeService().getVariable(task.getExecutionId(), variableName);
        variableFound = true;
      }

    } else if (variableScope == RestVariableScope.LOCAL) {
      if (ActivitiUtil.getTaskService().hasVariableLocal(taskId, variableName)) {
        value = ActivitiUtil.getTaskService().getVariableLocal(taskId, variableName);
        variableFound = true;
      }
    }

    if (!variableFound) {
      throw new ActivitiObjectNotFoundException(
          "Task '" + taskId + "' doesn't have a variable with name: '" + variableName + "'.",
          VariableInstanceEntity.class);
    } else {
      return getApplication(ActivitiRestServicesApplication.class)
          .getRestResponseFactory()
          .createRestVariable(
              this, variableName, value, variableScope, taskId, null, null, includeBinary);
    }
  }
  public RestVariable getVariableFromRequest(
      String taskId, String variableName, String scope, boolean includeBinary) {

    boolean variableFound = false;
    Object value = null;
    RestVariableScope variableScope = RestVariable.getScopeFromString(scope);
    if (variableScope == null) {
      // First, check local variables (which have precedence when no scope is supplied)
      if (taskService.hasVariableLocal(taskId, variableName)) {
        value = taskService.getVariableLocal(taskId, variableName);
        variableScope = RestVariableScope.LOCAL;
        variableFound = true;
      } else {
        // Revert to execution-variable when not present local on the task
        Task task = taskService.createTaskQuery().taskId(taskId).singleResult();
        if (task.getExecutionId() != null
            && runtimeService.hasVariable(task.getExecutionId(), variableName)) {
          value = runtimeService.getVariable(task.getExecutionId(), variableName);
          variableScope = RestVariableScope.GLOBAL;
          variableFound = true;
        }
      }

    } else if (variableScope == RestVariableScope.GLOBAL) {
      Task task = taskService.createTaskQuery().taskId(taskId).singleResult();
      if (task.getExecutionId() != null
          && runtimeService.hasVariable(task.getExecutionId(), variableName)) {
        value = runtimeService.getVariable(task.getExecutionId(), variableName);
        variableFound = true;
      }

    } else if (variableScope == RestVariableScope.LOCAL) {
      if (taskService.hasVariableLocal(taskId, variableName)) {
        value = taskService.getVariableLocal(taskId, variableName);
        variableFound = true;
      }
    }

    if (!variableFound) {
      throw new ActivitiObjectNotFoundException(
          "Task '" + taskId + "' doesn't have a variable with name: '" + variableName + "'.",
          VariableInstanceEntity.class);
    } else {
      return restResponseFactory.createRestVariable(
          variableName,
          value,
          variableScope,
          taskId,
          RestResponseFactory.VARIABLE_TASK,
          includeBinary);
    }
  }
  @Override
  @Transactional(readOnly = false)
  public Defect markResolved(Long defectId, String assignedTo, String resolution) {
    Defect existingDefect = getDefectById(defectId);
    String existingAssignee = existingDefect.getAssignedTo();
    existingDefect.setResolution(resolution);
    existingDefect.setStatus(DefectStatus.RESOLVED);
    existingDefect.setAssignedTo(assignedTo);
    defectRepository.update(existingDefect);

    for (Task task : taskService.createTaskQuery().taskAssignee(existingAssignee).list()) {
      if (task.getName().equalsIgnoreCase("resolveDefect")) {
        Long taskDefectId = (Long) runtimeService.getVariable(task.getExecutionId(), "defectId");
        if (taskDefectId.equals(defectId)) {
          taskService.complete(task.getId());
          logger.info("Resolved Defect: " + task.getName() + " Defect Id: " + taskDefectId);
        }
      }
    }

    return existingDefect;
  }
예제 #11
0
  /** 查询当前人的个人任务 */
  @Test
  public void findMyProcess() {
    String assignee = "王五";

    List<Task> list =
        processEngine
            .getTaskService() // 与正在执行的任务管理相关的service
            .createTaskQuery() // 创建查询对象
            .taskAssignee(assignee) // 指定个人任务查询,指定办理人
            .list();
    if (list != null && list.size() > 0) {
      for (Task task : list) {
        System.out.println("id" + task.getId());
        System.out.println("任务名称:" + task.getName());
        System.out.println("time:" + task.getCreateTime());
        System.out.println("办理人:" + task.getAssignee());
        System.out.println("流程实例ID" + task.getProcessInstanceId());
        System.out.println("执行对象ID:" + task.getExecutionId());
        System.out.println("流程定义ID" + task.getProcessDefinitionId());
      }
    }
  }
예제 #12
0
  /** Test getting a task variable. GET runtime/tasks/{taskId}/variables/{variableName} */
  @Deployment
  public void testGetTaskVariable() throws Exception {
    try {
      // Test variable behaviour on standalone tasks
      Task task = taskService.newTask();
      taskService.saveTask(task);
      taskService.setVariableLocal(task.getId(), "localTaskVariable", "localValue");

      ClientResource client =
          getAuthenticatedClient(
              RestUrls.createRelativeResourceUrl(
                  RestUrls.URL_TASK_VARIABLE, task.getId(), "localTaskVariable"));
      Representation response = client.get();
      assertEquals(Status.SUCCESS_OK, client.getResponse().getStatus());

      JsonNode responseNode = objectMapper.readTree(response.getStream());
      assertNotNull(responseNode);
      assertEquals("local", responseNode.get("scope").asText());
      assertEquals("localValue", responseNode.get("value").asText());
      assertEquals("localTaskVariable", responseNode.get("name").asText());
      assertEquals("string", responseNode.get("type").asText());

      // Test variable behaviour for a process-task
      ProcessInstance processInstance =
          runtimeService.startProcessInstanceByKey(
              "oneTaskProcess",
              Collections.singletonMap("sharedVariable", (Object) "processValue"));
      Task processTask =
          taskService.createTaskQuery().processInstanceId(processInstance.getId()).singleResult();

      taskService.setVariableLocal(processTask.getId(), "sharedVariable", "taskValue");

      // ANY scope, local should get precedence
      client =
          getAuthenticatedClient(
              RestUrls.createRelativeResourceUrl(
                  RestUrls.URL_TASK_VARIABLE, processTask.getId(), "sharedVariable"));
      response = client.get();
      assertEquals(Status.SUCCESS_OK, client.getResponse().getStatus());

      responseNode = objectMapper.readTree(response.getStream());
      assertNotNull(responseNode);
      assertEquals("local", responseNode.get("scope").asText());
      assertEquals("taskValue", responseNode.get("value").asText());
      assertEquals("sharedVariable", responseNode.get("name").asText());
      assertEquals("string", responseNode.get("type").asText());

      // LOCAL scope
      client =
          getAuthenticatedClient(
              RestUrls.createRelativeResourceUrl(
                      RestUrls.URL_TASK_VARIABLE, processTask.getId(), "sharedVariable")
                  + "?scope=local");
      response = client.get();
      assertEquals(Status.SUCCESS_OK, client.getResponse().getStatus());

      responseNode = objectMapper.readTree(response.getStream());
      assertNotNull(responseNode);
      assertEquals("local", responseNode.get("scope").asText());
      assertEquals("taskValue", responseNode.get("value").asText());
      assertEquals("sharedVariable", responseNode.get("name").asText());
      assertEquals("string", responseNode.get("type").asText());

      // GLOBAL scope
      client =
          getAuthenticatedClient(
              RestUrls.createRelativeResourceUrl(
                      RestUrls.URL_TASK_VARIABLE, processTask.getId(), "sharedVariable")
                  + "?scope=global");
      response = client.get();
      assertEquals(Status.SUCCESS_OK, client.getResponse().getStatus());

      responseNode = objectMapper.readTree(response.getStream());
      assertNotNull(responseNode);
      assertEquals("global", responseNode.get("scope").asText());
      assertEquals("processValue", responseNode.get("value").asText());
      assertEquals("sharedVariable", responseNode.get("name").asText());
      assertEquals("string", responseNode.get("type").asText());

      // Illegal scope
      client =
          getAuthenticatedClient(
              RestUrls.createRelativeResourceUrl(
                      RestUrls.URL_TASK_VARIABLE, processTask.getId(), "sharedVariable")
                  + "?scope=illegal");
      try {
        response = client.get();
        fail("Exception expected");
      } catch (ResourceException expected) {
        assertEquals(Status.CLIENT_ERROR_BAD_REQUEST, expected.getStatus());
        assertEquals("Invalid variable scope: 'illegal'", expected.getStatus().getDescription());
      }

      // Unexisting task
      client =
          getAuthenticatedClient(
              RestUrls.createRelativeResourceUrl(
                  RestUrls.URL_TASK_VARIABLE, "unexisting", "sharedVariable"));
      try {
        response = client.get();
        fail("Exception expected");
      } catch (ResourceException expected) {
        assertEquals(Status.CLIENT_ERROR_NOT_FOUND, expected.getStatus());
        assertEquals("task unexisting doesn't exist", expected.getStatus().getDescription());
      }

      // Unexisting variable
      client =
          getAuthenticatedClient(
              RestUrls.createRelativeResourceUrl(
                  RestUrls.URL_TASK_VARIABLE, processTask.getId(), "unexistingVariable"));
      try {
        response = client.get();
        fail("Exception expected");
      } catch (ResourceException expected) {
        assertEquals(Status.CLIENT_ERROR_NOT_FOUND, expected.getStatus());
        assertEquals(
            "Task '"
                + processTask.getId()
                + "' doesn't have a variable with name: 'unexistingVariable'.",
            expected.getStatus().getDescription());
      }

    } finally {
      // Clean adhoc-tasks even if test fails
      List<Task> tasks = taskService.createTaskQuery().list();
      for (Task task : tasks) {
        if (task.getExecutionId() == null) {
          taskService.deleteTask(task.getId(), true);
        }
      }
    }
  }
예제 #13
0
  /**
   * Test updating a single task variable in all scopes, including "not found" check.
   *
   * <p>PUT runtime/tasks/{taskId}/variables/{variableName}
   */
  @Deployment
  public void testUpdateTaskVariable() throws Exception {
    ProcessInstance processInstance =
        runtimeService.startProcessInstanceByKey(
            "oneTaskProcess",
            Collections.singletonMap("overlappingVariable", (Object) "processValue"));
    Task task =
        taskService.createTaskQuery().processInstanceId(processInstance.getId()).singleResult();
    taskService.setVariableLocal(task.getId(), "overlappingVariable", "taskValue");

    // Update variable without scope, local should be presumed -> local updated and global should be
    // retained
    ObjectNode requestNode = objectMapper.createObjectNode();
    requestNode.put("name", "overlappingVariable");
    requestNode.put("value", "updatedLocalValue");
    requestNode.put("type", "string");

    ClientResource client =
        getAuthenticatedClient(
            RestUrls.createRelativeResourceUrl(
                RestUrls.URL_TASK_VARIABLE, task.getId(), "overlappingVariable"));
    Representation response = client.put(requestNode);
    assertEquals(Status.SUCCESS_OK, client.getResponse().getStatus());

    JsonNode responseNode = objectMapper.readTree(response.getStream());
    assertNotNull(responseNode);
    assertEquals("updatedLocalValue", responseNode.get("value").asText());
    assertEquals("local", responseNode.get("scope").asText());
    // Check local value is changed in engine and global one remains unchanged
    assertEquals(
        "updatedLocalValue", taskService.getVariableLocal(task.getId(), "overlappingVariable"));
    assertEquals(
        "processValue", runtimeService.getVariable(task.getExecutionId(), "overlappingVariable"));

    // Update variable in local scope
    response.release();
    requestNode = objectMapper.createObjectNode();
    requestNode.put("name", "overlappingVariable");
    requestNode.put("value", "updatedLocalValueOnceAgain");
    requestNode.put("type", "string");
    requestNode.put("scope", "local");
    response = client.put(requestNode);
    assertEquals(Status.SUCCESS_OK, client.getResponse().getStatus());

    responseNode = objectMapper.readTree(response.getStream());
    assertNotNull(responseNode);
    assertEquals("updatedLocalValueOnceAgain", responseNode.get("value").asText());
    assertEquals("local", responseNode.get("scope").asText());
    // Check local value is changed in engine and global one remains unchanged
    assertEquals(
        "updatedLocalValueOnceAgain",
        taskService.getVariableLocal(task.getId(), "overlappingVariable"));
    assertEquals(
        "processValue", runtimeService.getVariable(task.getExecutionId(), "overlappingVariable"));

    // Update variable in global scope
    response.release();
    requestNode = objectMapper.createObjectNode();
    requestNode.put("name", "overlappingVariable");
    requestNode.put("value", "updatedInGlobalScope");
    requestNode.put("type", "string");
    requestNode.put("scope", "global");
    response = client.put(requestNode);
    assertEquals(Status.SUCCESS_OK, client.getResponse().getStatus());

    responseNode = objectMapper.readTree(response.getStream());
    assertNotNull(responseNode);
    assertEquals("updatedInGlobalScope", responseNode.get("value").asText());
    assertEquals("global", responseNode.get("scope").asText());
    // Check global value is changed in engine and local one remains unchanged
    assertEquals(
        "updatedLocalValueOnceAgain",
        taskService.getVariableLocal(task.getId(), "overlappingVariable"));
    assertEquals(
        "updatedInGlobalScope",
        runtimeService.getVariable(task.getExecutionId(), "overlappingVariable"));

    // Try updating with mismatch between URL and body variableName unexisting property
    try {
      requestNode.put("name", "unexistingVariable");
      client.put(requestNode);
      fail("Exception expected");
    } catch (ResourceException expected) {
      assertEquals(Status.CLIENT_ERROR_BAD_REQUEST, expected.getStatus());
      assertEquals(
          "Variable name in the body should be equal to the name used in the requested URL.",
          expected.getStatus().getDescription());
    }

    // Try updating unexisting property
    try {
      client =
          getAuthenticatedClient(
              RestUrls.createRelativeResourceUrl(
                  RestUrls.URL_TASK_VARIABLE, task.getId(), "unexistingVariable"));
      requestNode.put("name", "unexistingVariable");
      client.put(requestNode);
      fail("Exception expected");
    } catch (ResourceException expected) {
      assertEquals(Status.CLIENT_ERROR_NOT_FOUND, expected.getStatus());
      assertEquals(
          "Task '" + task.getId() + "' doesn't have a variable with name: 'unexistingVariable'.",
          expected.getStatus().getDescription());
    }
  }
예제 #14
0
  /**
   * 打开任务 传入的request必须有以下参数 taskId:task的Id taskPage:处理task的页面路径 model:业务表类名 formId:业务表id
   * formProperties:控制表单的名称
   *
   * @return
   * @throws Exception
   */
  public String open_task() throws Exception {
    log.debug("open_task()");
    List<String> nextTaskList = new ArrayList<String>();
    String taskId = getpara("taskId");
    String taskPage = getpara("taskPage");
    String modelStr = getpara("model");
    // add by hb for only query user task
    String readonly = getpara("readonly");
    // end
    String formId = (String) infActiviti.getVariableByTaskId(taskId, "formId");
    if (formId == null || formId.equals("") || modelStr == null || "".equals(modelStr)) {
      rhs.put("model", null);
    } else {
      BaseModel model = (BaseModel) baseDao.loadById(modelStr, Long.parseLong(formId));
      rhs.put("model", model);
    }

    /* add by chenzhijian 20130419 -s */
    // 获取 formProperties 配置文件
    String formProperties = getpara("formProperties");
    HashMap<String, String> formPro = new HashMap<String, String>();
    Properties p = new Properties();
    try {
      // String filepath = System.getProperty("webroot", "./src/main/webapp/");
      String filepath = getWebroot();
      // eg: app/manager/wo/wo.properties
      filepath +=
          "/app/manager/" + modelStr.toLowerCase() + "/" + modelStr.toLowerCase() + ".properties";
      FileInputStream in = new FileInputStream(filepath);
      p.load(in);
      in.close();
      Set<String> set = p.stringPropertyNames();
      for (String s : set) {
        if (s.startsWith("default")) {
          formPro.put(s.replace("default.", ""), p.getProperty(s));
        }
      }
      for (String s : set) {
        if (s.startsWith(formProperties)) {
          formPro.put(s.replace(formProperties + ".", ""), p.getProperty(s));
        }
      }
    } catch (Exception e) {
      e.printStackTrace();
    }
    rhs.put("formPro", formPro);
    /* add by chenzhijian 20130419 -e */

    Task task = infActiviti.getTaskById(taskId);
    /*add by hb for get next task 20140128 start*/
    String nextTask = "";
    String initiator = (String) infActiviti.getVariableByTaskId(task.getId(), "initiator");
    // 当前任务获取当前流程的流程定义,然后根据流程定义获得所有的节点
    ProcessDefinitionEntity def =
        (ProcessDefinitionEntity)
            ((RepositoryServiceImpl) repositoryService)
                .getDeployedProcessDefinition(task.getProcessDefinitionId());
    List<ActivityImpl> activitiList = def.getActivities();
    // 根据任务获取当前流程执行ID,执行实例以及当前流程节点的ID
    String excId = task.getExecutionId();
    ExecutionEntity execution =
        (ExecutionEntity) runtimeService.createExecutionQuery().executionId(excId).singleResult();
    String activitiId = execution.getActivityId();
    // 循环activitiList 并判断出当前流程所处节点,然后得到当前节点实例,
    // 根据节点实例获取所有从当前节点出发的路径,然后根据路径获得下一个节点实例
    for (ActivityImpl activityImpl : activitiList) {
      String id = activityImpl.getId();
      if (activitiId.equals(id)) {
        log.debug("当前任务:" + activityImpl.getProperty("name"));
        List<PvmTransition> outTransitions =
            activityImpl.getOutgoingTransitions(); // 获取从某个节点出来的所有线路
        for (PvmTransition tr : outTransitions) {
          PvmActivity ac = tr.getDestination(); // 获取线路的终点节点,在这里应该还要加个判断,如果是并行或者相容关口,则需要继续往下找下一个任务。
          if (ac.getProperty("type").equals("parallelGateway")
              || ac.getProperty("type")
                  .equals(
                      "inclusiveGateway")) { // 不能包括互斥关口
                                             // ac.getProperty("type").equals("exclusiveGateway")
            List<PvmTransition> outTransitions2 = ac.getOutgoingTransitions(); // 因为是关口,所以继续往下找任务
            for (PvmTransition pvmTransition : outTransitions2) {
              PvmActivity ac2 = pvmTransition.getDestination();
              nextTask = (String) ac2.getId();
              log.debug("下一个任务----->:" + nextTask);
              nextTaskList.add(nextTask);
            }
          } else {
            nextTask = (String) ac.getId();
            log.debug("下一个任务++++>:" + nextTask);
            nextTaskList.add(nextTask);
          }
        }
        break;
      }
    }

    /*end*/
    rhs.put("task", task);
    rhs.put("initiator", initiator);
    rhs.put("nextTaskList", nextTaskList);
    rhs.put("taskPage", taskPage);
    rhs.put("readonly", readonly);
    getAllUserAndGroupInfo();

    return "success";
  }