/**
   * 判断是否为第一个初始节点
   *
   * @return
   */
  public boolean isFirstTask() {
    ActivityImpl rootActivity = execution.getProcessDefinition().getInitial();
    List<PvmTransition> transitions = rootActivity.getOutgoingTransitions();

    for (PvmTransition transition : transitions) {
      TransitionImpl transitionImpl = (TransitionImpl) transition;
      ActivityImpl destinationActivity = transitionImpl.getDestination();
      String firstTaskActivityname = destinationActivity.getId();
      String currentActivityName = execution.getActivity().getId();

      return currentActivityName.equals(firstTaskActivityname);
    }

    return false;
  }
 /**
  * 根据当前节点,查询输出流向是否为并行终点,如果为并行终点,则拼装对应的并行起点ID
  *
  * @param activityImpl 当前节点
  * @return
  */
 private String findParallelGatewayId(ActivityImpl activityImpl) {
   List<PvmTransition> incomingTransitions = activityImpl.getOutgoingTransitions();
   for (PvmTransition pvmTransition : incomingTransitions) {
     TransitionImpl transitionImpl = (TransitionImpl) pvmTransition;
     activityImpl = transitionImpl.getDestination();
     String type = (String) activityImpl.getProperty("type");
     if ("parallelGateway".equals(type)) { // 并行路线
       String gatewayId = activityImpl.getId();
       String gatewayType = gatewayId.substring(gatewayId.lastIndexOf("_") + 0);
       if ("END".equals(gatewayType.toUpperCase())) {
         return gatewayId.substring(0, gatewayId.lastIndexOf("_")) + "_start";
       }
     }
   }
   return null;
 }