Package org.fireflow.model.net

Examples of org.fireflow.model.net.Node


        Iterator<Element> iter = elements.iterator();
        while (iter.hasNext()) {
            Element transitionElement =  iter.next();
            Transition transition = createTransition(wp, transitionElement);
            transitions.add(transition);
            Node fromNode = transition.getFromNode();
            Node toNode = transition.getToNode();
            if (fromNode != null && (fromNode instanceof Activity)) {
                ((Activity) fromNode).setLeavingTransition(transition);
            } else if (fromNode != null && (fromNode instanceof Synchronizer)) {
                ((Synchronizer) fromNode).getLeavingTransitions().add(
                        transition);
View Full Code Here


     */
    protected Transition createTransition(WorkflowProcess wp, Element element)
            throws FPDLParserException {
        String fromNodeId = element.attributeValue(FROM);
        String toNodeId = element.attributeValue(TO);
        Node fromNode = (Node) wp.findWFElementById(fromNodeId);
        Node toNode = (Node) wp.findWFElementById(toNodeId);

        Transition transition = new Transition(wp,
                element.attributeValue(NAME), fromNode,
                toNode);
        transition.setSn(UUID.randomUUID().toString());
View Full Code Here

      return true;
    }
    List<Node> reachableList = this.getReachableNodes(fromNodeId);

    for (int j = 0; reachableList != null && j < reachableList.size(); j++) {
      Node node =  reachableList.get(j);
      if (node.getId().equals(toNodeId)) {
        return true;
      }
    }

    return false;
View Full Code Here

   * @param activityId1
   * @param activityId2
   * @return true表示在同一个执行线上,false表示不在同一个执行线上
   */
  public boolean isInSameLine(String activityId1, String activityId2) {
    Node node1 = (Node) this.findWFElementById(activityId1);
    Node node2 = (Node) this.findWFElementById(activityId2);
    if (node1 == null || node2 == null)
      return false;
    List<Node> connectableNodes4Activity1 = new ArrayList<Node>();
    connectableNodes4Activity1.add(node1);
    connectableNodes4Activity1.addAll(getReachableNodes(activityId1));
    connectableNodes4Activity1.addAll(getEnterableNodes(activityId1));

    List<Node> connectableNodes4Activity2 = new ArrayList<Node>();
    connectableNodes4Activity2.add(node2);
    connectableNodes4Activity2.addAll(getReachableNodes(activityId2));
    connectableNodes4Activity2.addAll(getEnterableNodes(activityId2));
    /*
     * System.out.println("===Inside WorkflowProcess.isInSameLine()::connectableNodes4Activity1.size()="
     * +connectableNodes4Activity1.size());System.out.println(
     * "===Inside WorkflowProcess.isInSameLine()::connectableNodes4Activity2.size()="
     * +connectableNodes4Activity2.size());
     * System.out.println("-----------------------activity1--------------");
     * for (int i=0;i<connectableNodes4Activity1.size();i++){ Node node =
     * (Node)connectableNodes4Activity1.get(i);
     * System.out.println("node.id of act1 is "+node.getId()); }
     *
     *
     * System.out.println("---------------------activity2--------------------"
     * ); for (int i=0;i<connectableNodes4Activity2.size();i++){ Node node =
     * (Node)connectableNodes4Activity2.get(i);
     * System.out.println("node.id of act2 is "+node.getId()); }
     */

    if (connectableNodes4Activity1.size() != connectableNodes4Activity2.size()) {
      return false;
    }

    for (int i = 0; i < connectableNodes4Activity1.size(); i++) {
      Node node =  connectableNodes4Activity1.get(i);
      boolean find = false;
      for (int j = 0; j < connectableNodes4Activity2.size(); j++) {
        Node tmpNode = connectableNodes4Activity2.get(j);
        if (node.getId().equals(tmpNode.getId())) {
          find = true;
          break;
        }
      }
      if (!find)
View Full Code Here

     * @param nodeId
     * @return
     */
  public List<Node> getReachableNodes(String nodeId) {
    List<Node> reachableNodesList = new ArrayList<Node>();
    Node node = (Node) this.findWFElementById(nodeId);
    if (node instanceof Activity) {
      Activity activity = (Activity) node;
      Transition leavingTransition = activity.getLeavingTransition();
      if (leavingTransition != null) {
        Node toNode = leavingTransition.getToNode();
        if (toNode != null) {
          reachableNodesList.add(toNode);
          reachableNodesList.addAll(getReachableNodes(toNode.getId()));
        }
      }
    } else if (node instanceof Synchronizer) {
      Synchronizer synchronizer = (Synchronizer) node;
      List<Transition> leavingTransitions = synchronizer.getLeavingTransitions();
      for (int i = 0; leavingTransitions != null
          && i < leavingTransitions.size(); i++) {
        Transition leavingTransition =  leavingTransitions.get(i);
        if (leavingTransition != null) {
          Node toNode = (Node) leavingTransition.getToNode();
          if (toNode != null) {
            reachableNodesList.add(toNode);
            reachableNodesList.addAll(getReachableNodes(toNode.getId()));
          }

        }
      }
    }
        //剔除重复节点
        List<Node> tmp = new ArrayList<Node>();
    boolean alreadyInTheList = false;
    for (int i = 0; i < reachableNodesList.size(); i++) {
      Node nodeTmp = reachableNodesList.get(i);
      alreadyInTheList = false;
      for (int j = 0; j < tmp.size(); j++) {
        Node nodeTmp2 = tmp.get(j);
        if (nodeTmp2.getId().equals(nodeTmp.getId())) {
          alreadyInTheList = true;
          break;
        }
      }
      if (!alreadyInTheList) {
View Full Code Here

     * @param nodeId
     * @return
     */
  public List<Node> getEnterableNodes(String nodeId) {
    List<Node> enterableNodesList = new ArrayList<Node>();
    Node node = (Node) this.findWFElementById(nodeId);
    if (node instanceof Activity) {
      Activity activity = (Activity) node;
      Transition enteringTransition = activity.getEnteringTransition();
      if (enteringTransition != null) {
        Node fromNode = enteringTransition.getFromNode();
        if (fromNode != null) {
          enterableNodesList.add(fromNode);
          enterableNodesList.addAll(getEnterableNodes(fromNode.getId()));
        }
      }
    } else if (node instanceof Synchronizer) {
      Synchronizer synchronizer = (Synchronizer) node;
      List<Transition> enteringTransitions = synchronizer.getEnteringTransitions();
      for (int i = 0; enteringTransitions != null
          && i < enteringTransitions.size(); i++) {
        Transition enteringTransition =  enteringTransitions.get(i);
        if (enteringTransition != null) {
          Node fromNode = enteringTransition.getFromNode();
          if (fromNode != null) {
            enterableNodesList.add(fromNode);
            enterableNodesList.addAll(getEnterableNodes(fromNode.getId()));
          }

        }
      }
    }

      //剔除重复节点
    //TODO mingjie.mj 20091018 改为使用集合是否更好?
        List<Node> tmp = new ArrayList<Node>();
    boolean alreadyInTheList = false;
    for (int i = 0; i < enterableNodesList.size(); i++) {
      Node nodeTmp = enterableNodesList.get(i);
      alreadyInTheList = false;
      for (int j = 0; j < tmp.size(); j++) {
        Node nodeTmp2 =  tmp.get(j);
        if (nodeTmp2.getId().equals(nodeTmp.getId())) {
          alreadyInTheList = true;
          break;
        }
      }
      if (!alreadyInTheList) {
View Full Code Here

        Iterator<Element> iter = elements.iterator();
        while (iter.hasNext()) {
            Element transitionElement = iter.next();
            Transition transition = createTransition(wp, transitionElement, nodeMap);
            transitions.add(transition);
            Node fromNode = transition.getFromNode();
            Node toNode = transition.getToNode();
            if (fromNode != null && (fromNode instanceof Activity)) {
                ((Activity) fromNode).setLeavingTransition(transition);
            } else if (fromNode != null && (fromNode instanceof Synchronizer)) {
                ((Synchronizer) fromNode).getLeavingTransitions().add(
                        transition);
View Full Code Here

     */
    protected Transition createTransition(WorkflowProcess wp, Element element, Map<String,Node> nodeMap)
            throws FPDLParserException {
        String fromNodeId = element.getAttribute(FROM);
        String toNodeId = element.getAttribute(TO);
        Node fromNode = nodeMap.get(fromNodeId);
        Node toNode = nodeMap.get(toNodeId);

        Transition transition = new Transition(wp,
                element.getAttribute(NAME), fromNode,
                toNode);
        transition.setSn(UUID.randomUUID().toString());
View Full Code Here

          if (workflowProcess.isReachable(aliveActivityId, synchronizer.getId())){         
            Transition trans = null;
            reachable = true;
            for (int j=0;j<enteringTrans.size();j++){
              trans = enteringTrans.get(j);
              Node fromNode = (Node)trans.getFromNode();
              if (workflowProcess.isReachable(aliveActivityId, fromNode.getId())){
                if (!incomingTransitionIds.contains(trans.getId())){
                  incomingTransitionIds.add(trans.getId());
                }
              }
            }     
View Full Code Here

        if (thisProcess.isReachable(aliveActivityId, synchronizer.getId())){         
          Transition trans = null;
          reachable = true;
          for (int j=0;j<enteringTrans.size();j++){
            trans = enteringTrans.get(j);
            Node fromNode = trans.getFromNode();
            if (thisProcess.isReachable(aliveActivityId, fromNode.getId())){
              if (!incomingTransitionIds.contains(trans.getId())){
                incomingTransitionIds.add(trans.getId());
              }
            }
          }     
View Full Code Here

TOP

Related Classes of org.fireflow.model.net.Node

Copyright © 2018 www.massapicom. 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.