Beispiel #1
0
  public boolean checkCouldRollback(Node node) {
    // TODO: 如果是catchEvent,也应该可以退回,到时候再说
    for (Edge edge : node.getOutgoingEdges()) {
      Node dest = edge.getDest();
      String type = dest.getType();

      if ("userTask".equals(type)) {
        if (!dest.isActive()) {
          boolean isSkip = isSkipActivity(dest.getId());

          if (isSkip) {
            return checkCouldRollback(dest);
          } else {
            // logger.info("cannot rollback, " + type + "("
            // + dest.getName() + ") is complete.");
            // return false;
            return true;
          }
        }
      } else if (type.endsWith("Gateway")) {
        return checkCouldRollback(dest);
      } else {
        logger.info("cannot rollback, " + type + "(" + dest.getName() + ") is complete.");

        return false;
      }
    }

    return true;
  }
Beispiel #2
0
  public void collectNodes(Node node, List<String> historyNodeIds) {
    logger.info("node : {}, {}, {}", node.getId(), node.getType(), node.getName());

    for (Edge edge : node.getOutgoingEdges()) {
      logger.info("edge : {}", edge.getName());

      Node dest = edge.getDest();
      historyNodeIds.add(dest.getId());
      collectNodes(dest, historyNodeIds);
    }
  }
Beispiel #3
0
  public String findIncomingNode(Graph graph, Node node) {
    for (Edge edge : graph.getEdges()) {
      Node src = edge.getSrc();
      Node dest = edge.getDest();
      String srcType = src.getType();

      if (!dest.getId().equals(node.getId())) {
        continue;
      }

      if ("userTask".equals(srcType)) {
        boolean isSkip = isSkipActivity(src.getId());

        if (isSkip) {
          return this.findIncomingNode(graph, src);
        } else {
          return src.getId();
        }
      } else if (srcType.endsWith("Gateway")) {
        return this.findIncomingNode(graph, src);
      } else {
        logger.info(
            "cannot rollback, previous node is not userTask : "
                + src.getId()
                + " "
                + srcType
                + "("
                + src.getName()
                + ")");

        return null;
      }
    }

    logger.info(
        "cannot rollback, this : "
            + node.getId()
            + " "
            + node.getType()
            + "("
            + node.getName()
            + ")");

    return null;
  }