亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? token.java

?? jboss jpdl-3.2.2 nolib
?? JAVA
?? 第 1 頁 / 共 2 頁
字號:
/*
 * JBoss, Home of Professional Open Source
 * Copyright 2005, JBoss Inc., and individual contributors as indicated
 * by the @authors tag. See the copyright.txt in the distribution for a
 * full listing of individual contributors.
 *
 * This is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2.1 of
 * the License, or (at your option) any later version.
 *
 * This software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this software; if not, write to the Free
 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
 */
package org.jbpm.graph.exe;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jbpm.JbpmContext;
import org.jbpm.JbpmException;
import org.jbpm.db.JobSession;
import org.jbpm.graph.def.Event;
import org.jbpm.graph.def.Node;
import org.jbpm.graph.def.ProcessDefinition;
import org.jbpm.graph.def.Transition;
import org.jbpm.graph.log.SignalLog;
import org.jbpm.graph.log.TokenCreateLog;
import org.jbpm.graph.log.TokenEndLog;
import org.jbpm.jpdl.el.impl.JbpmExpressionEvaluator;
import org.jbpm.logging.exe.LoggingInstance;
import org.jbpm.logging.log.CompositeLog;
import org.jbpm.logging.log.ProcessLog;
import org.jbpm.svc.Services;
import org.jbpm.taskmgmt.exe.TaskMgmtInstance;
import org.jbpm.util.Clock;
import org.jbpm.util.EqualsUtil;

/**
 * represents one path of execution and maintains a pointer to a node 
 * in the {@link org.jbpm.graph.def.ProcessDefinition}.  Most common 
 * way to get a hold of the token objects is with {@link ProcessInstance#getRootToken()}
 * or {@link org.jbpm.graph.exe.ProcessInstance#findToken(String)}.
 */
public class Token implements Serializable {

  private static final long serialVersionUID = 1L;

  long id = 0;
  int version = 0;
  protected String name = null;
  protected Date start = null;
  protected Date end = null;
  protected Node node = null;
  protected Date nodeEnter = null;
  protected ProcessInstance processInstance = null;
  protected Token parent = null;
  protected Map children = null;
  protected List comments = null;
  protected ProcessInstance subProcessInstance = null;
  protected int nextLogIndex = 0;
  boolean isAbleToReactivateParent = true;
  boolean isTerminationImplicit = false;
  boolean isSuspended = false;
  String lock = null;

  // constructors
  /////////////////////////////////////////////////////////////////////////////
  
  public Token() {
  }

  /**
   * creates a root token.
   */
  public Token(ProcessInstance processInstance) {
    this.start = Clock.getCurrentTime();
    this.processInstance = processInstance;
    this.node = processInstance.getProcessDefinition().getStartState();
    this.isTerminationImplicit = processInstance.getProcessDefinition().isTerminationImplicit();
    
    // optimization:  assigning an id is not necessary since the process instance will be saved shortly.
    // Services.assignId(this);
  }

  /**
   * creates a child token.
   */
  public Token(Token parent, String name) {
    this.start = Clock.getCurrentTime();
    this.processInstance = parent.getProcessInstance();
    this.name = name;
    this.node = parent.getNode();
    this.parent = parent;
    parent.addChild(this);
    this.isTerminationImplicit = parent.isTerminationImplicit();
    parent.addLog(new TokenCreateLog(this));
    
    // assign an id to this token before events get fired
    Services.assignId(this);
  }

  // operations
  /////////////////////////////////////////////////////////////////////////////

  void addChild(Token token) {
    if (children==null) {
      children = new HashMap();
    }
    children.put(token.getName(), token);
  }

  /**
   * provides a signal to the token. this method activates this token and leaves
   * the current state over the default transition.
   */
  public void signal() {
    if (node==null) {
      throw new JbpmException("token '" + this + "' can't be signalled cause it is currently not positioned in a node");
    }
    if (node.getDefaultLeavingTransition() == null) {
      throw new JbpmException("couldn't signal token '" + this + "' : node '" + node + "' doesn't have a default transition");
    }
    signal(node.getDefaultLeavingTransition(), new ExecutionContext(this));
  }

  /**
   * provides a signal to the token. this leave the current state over the given
   * transition name.
   */
  public void signal(String transitionName) {
    if (node==null) {
      throw new JbpmException("token '" + this + "' can't be signalled cause it is currently not positioned in a node");
    }
    if (node.getDefaultLeavingTransition() == null) {
      throw new JbpmException("couldn't signal token '" + this + "' : node '" + node + "' doesn't have a default transition");
    }
    Transition leavingTransition = node.getLeavingTransition(transitionName);
    if (leavingTransition==null) {
      throw new JbpmException("transition '"+transitionName+"' does not exist on "+node);
    }
    signal(leavingTransition, new ExecutionContext(this));
  }
  
  /**
   * provides a signal to the token. this leave the current state over the given
   * transition name.
   */
  public void signal(Transition transition) {
    signal(transition, new ExecutionContext(this));
  }
  

  void signal(ExecutionContext executionContext) {
    signal(node.getDefaultLeavingTransition(), executionContext);
  }

  void signal(Transition transition, ExecutionContext executionContext) {
    if (transition == null) {
      throw new JbpmException("couldn't signal without specifying  a leaving transition : transition is null");
    }
    if (executionContext == null) {
      throw new JbpmException("couldn't signal without an execution context: executionContext is null");
    }
    if (isSuspended) {
      throw new JbpmException("can't signal token '"+name+"' ("+id+"): it is suspended");
    }
    if (isLocked()) {
      throw new JbpmException("this token is locked by "+lock);
    }

    startCompositeLog(new SignalLog(transition));
    try {
      // fire the event before-signal
      Node signalNode = node;
      signalNode.fireEvent(Event.EVENTTYPE_BEFORE_SIGNAL, executionContext);
      
      // start calculating the next state
      node.leave(executionContext, transition);
      
      // if required, check if this token is implicitly terminated
      checkImplicitTermination();
      
      // fire the event after-signal
      signalNode.fireEvent(Event.EVENTTYPE_AFTER_SIGNAL, executionContext);
      
    } finally {
      endCompositeLog();
    }
  }
  
  /**
   * a set of all the leaving transitions on the current node for which the condition expression resolves to true. 
   */
  public Set getAvailableTransitions() {
    Set availableTransitions = new HashSet();
    if (node!=null) {
    	addAvailableTransitionsOfNode(node, availableTransitions);
    }
    return availableTransitions;
  }
  
  /**
   * adds available transitions of that node to the Set
   * and after that calls itself recursivly for the SuperSate of the Node
   * if it has a super state
   */
  private void addAvailableTransitionsOfNode(Node currentNode, Set availableTransitions) {
      List leavingTransitions = currentNode.getLeavingTransitions();
      if (leavingTransitions!=null) {
        Iterator iter = leavingTransitions.iterator();
        while (iter.hasNext()) {
          Transition transition = (Transition) iter.next();
          String conditionExpression = transition.getCondition();
          if (conditionExpression!=null) {
            Object result = JbpmExpressionEvaluator.evaluate(conditionExpression, new ExecutionContext(this));
            if ( (result instanceof Boolean)
                 && (((Boolean)result).booleanValue())
               ) {
              availableTransitions.add(transition);
            }
          } else {
            availableTransitions.add(transition);
          }
        }
      }	  
      if (currentNode.getSuperState() != null) {
    	  addAvailableTransitionsOfNode(currentNode.getSuperState(), availableTransitions);
      }
  }

  /**
   * ends this token and all of its children (if any). this is the last active (=not-ended) child of a parent token, 
   * the parent token will be ended as well and that verification will continue to 
   * propagate.
   */
  public void end() {
    end(true);
  }
  
  /**
   * ends this token with optional parent ending verification.
   * @param verifyParentTermination specifies if the parent token should be checked for termination.
   * if verifyParentTermination is set to true and this is the last non-ended child of a parent token, 
   * the parent token will be ended as well and the verification will continue to propagate.
   */
  public void end(boolean verifyParentTermination) {
    // if not already ended
    if (end==null) {

      // ended tokens cannot reactivate parents
      isAbleToReactivateParent = false;
      
      // set the end date
      // the end date is also the flag that indicates that this token has ended.
      this.end = Clock.getCurrentTime();
      
      // end all this token's children
      if (children != null) {
        Iterator iter = children.values().iterator();
        while (iter.hasNext()) {
          Token child = (Token) iter.next();
          if (!child.hasEnded()) {
            child.end();
          }
        }
      }
      
      if (subProcessInstance!=null) {
        subProcessInstance.end();
      }

      // only log the end of child-tokens.  the process instance logs replace the root token logs.
      if (parent!=null) {
        // add a log
        parent.addLog(new TokenEndLog(this));
      }

      // if there are tasks associated to this token, remove signalling capabilities
      TaskMgmtInstance taskMgmtInstance = (processInstance!=null ? processInstance.getTaskMgmtInstance() : null);
      if (taskMgmtInstance!=null) {
        taskMgmtInstance.removeSignalling(this);
      }

      if (verifyParentTermination) {
        // if this is the last active token of the parent, 
        // the parent needs to be ended as well
        notifyParentOfTokenEnd();
      }
    }
  }
  
  // comments /////////////////////////////////////////////////////////////////

  public void addComment(String message) {
    addComment(new Comment(message));
  }

  public void addComment(Comment comment) {
    if (comments==null) comments = new ArrayList();
    comments.add(comment);
    comment.setToken(this);
  }
  
  public List getComments() {
    return comments;
  }
 
  // operations helper methods ////////////////////////////////////////////////

  /**
   * notifies a parent that one of its nodeMap has ended.
   */
  void notifyParentOfTokenEnd() {
    if (isRoot()) {
      processInstance.end();
    } else {
      
      if (!parent.hasActiveChildren()) {
        parent.end();
      }
    }
  }

  /**
   * tells if this token has child tokens that have not yet ended.
   */
  public boolean hasActiveChildren() {
    boolean foundActiveChildToken = false;
    // try and find at least one child token that is
    // still active (= not ended)
    if (children!=null) {
      Iterator iter = children.values().iterator();
      while ((iter.hasNext()) && (!foundActiveChildToken)) {
        Token child = (Token) iter.next();
        if (!child.hasEnded()) {
          foundActiveChildToken = true;
        }
      }
    }
    return foundActiveChildToken;
  }

  // log convenience methods //////////////////////////////////////////////////

  /**
   * convenience method for adding a process log.
   */
  public void addLog(ProcessLog processLog) {
    LoggingInstance li = (LoggingInstance) processInstance.getInstance(LoggingInstance.class);
    if (li != null) {
      processLog.setToken(this);

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
中文字幕乱码一区二区免费| 亚洲一二三四区不卡| 一区二区三区四区亚洲| 老司机午夜精品99久久| 欧美在线播放高清精品| 亚洲国产精品ⅴa在线观看| 天天影视涩香欲综合网| 91免费视频观看| 国产精品欧美一级免费| 国产在线日韩欧美| 欧美一区二区人人喊爽| 亚洲影院理伦片| 99久久精品免费| 久久精品男人的天堂| 精品一二线国产| 欧美精品 日韩| 亚洲图片欧美一区| 欧日韩精品视频| 亚洲最大的成人av| 91猫先生在线| 亚洲桃色在线一区| 99国产精品视频免费观看| 欧美激情一区二区三区蜜桃视频| 免费在线观看视频一区| 欧美一区二区三区四区久久 | 秋霞午夜av一区二区三区| 日本精品一区二区三区高清| 国产精品久久久久一区| 国产在线不卡一区| 精品久久99ma| 国产乱人伦精品一区二区在线观看 | 欧美日韩一区二区在线观看视频| 亚洲欧美日韩成人高清在线一区| 97国产精品videossex| 亚洲视频香蕉人妖| 欧洲国产伦久久久久久久| 樱桃视频在线观看一区| 欧美图片一区二区三区| 亚洲v日本v欧美v久久精品| 欧美高清视频一二三区| 免费精品视频在线| 亚洲精品一区二区三区在线观看 | 精品国产sm最大网站| 麻豆精品新av中文字幕| wwwwxxxxx欧美| 床上的激情91.| 亚洲女女做受ⅹxx高潮| 欧美日韩亚州综合| 久久超级碰视频| 欧美国产精品一区二区| 色综合久久久久久久| 亚洲国产裸拍裸体视频在线观看乱了| 欧美日本在线观看| 国产原创一区二区| 亚洲欧美日本韩国| 日韩一级黄色片| 成人网男人的天堂| 亚洲黄色尤物视频| 日韩欧美久久一区| aaa欧美色吧激情视频| 香蕉成人伊视频在线观看| 久久影视一区二区| 色综合一区二区| 老司机精品视频导航| 综合精品久久久| 欧美一区二区三级| 91在线你懂得| 久久99精品国产.久久久久| 亚洲色图欧美偷拍| 精品欧美乱码久久久久久1区2区| 成人午夜av影视| 日本色综合中文字幕| 国产女主播视频一区二区| 欧美日韩一区二区三区视频| 国产精品一品二品| 亚洲6080在线| ●精品国产综合乱码久久久久| 欧美久久久久久久久久| 成人高清免费观看| 久热成人在线视频| 亚洲成人免费av| 综合激情网...| 欧美经典一区二区| 日韩一级欧美一级| 欧美日韩在线播放| 99久久伊人网影院| 久久 天天综合| 视频一区二区中文字幕| 亚洲美女免费视频| 国产精品国产三级国产| 久久午夜羞羞影院免费观看| 欧美猛男超大videosgay| 99视频精品全部免费在线| 国产老妇另类xxxxx| 日本在线不卡一区| 日韩高清一级片| 亚洲影院理伦片| 亚洲人成网站精品片在线观看| 国产三级精品三级| 国产色产综合产在线视频| 欧美变态口味重另类| 欧美一级片免费看| 欧美夫妻性生活| 欧美日韩国产一级| 欧美日韩国产区一| 欧美日韩情趣电影| 欧美日韩激情一区| 欧美日韩国产成人在线91| 日本丰满少妇一区二区三区| 99精品久久99久久久久| 成人午夜激情视频| 成人av免费在线观看| 丁香婷婷深情五月亚洲| 国产福利一区二区三区在线视频| 精品一区二区三区在线观看| 麻豆精品视频在线观看免费 | 午夜精品久久久久久久久久久| 一区二区在线观看视频| 亚洲图片有声小说| 午夜天堂影视香蕉久久| 午夜精品福利久久久| 日韩高清不卡一区| 美美哒免费高清在线观看视频一区二区| 天堂蜜桃一区二区三区| 轻轻草成人在线| 国产麻豆视频精品| 91最新地址在线播放| 欧洲一区二区三区免费视频| 欧美日韩综合在线| 日韩免费观看高清完整版| 久久久久久毛片| 自拍av一区二区三区| 亚洲午夜精品一区二区三区他趣| 日一区二区三区| 狠狠色丁香婷婷综合久久片| 成人av在线资源| 91国偷自产一区二区开放时间| 欧美视频中文一区二区三区在线观看| 欧美日本精品一区二区三区| 欧美精品一区二区三区蜜桃视频| 国产婷婷精品av在线| 亚洲欧美日韩电影| 秋霞电影网一区二区| 成人理论电影网| 欧美日韩在线不卡| 久久精品夜色噜噜亚洲a∨| 亚洲美女免费在线| 狠狠色综合日日| 一本色道久久加勒比精品| 日韩午夜激情免费电影| 中文字幕中文字幕一区| 热久久久久久久| 不卡av在线免费观看| 91精品国产综合久久婷婷香蕉| 国产视频一区二区三区在线观看| 亚洲综合色噜噜狠狠| 国产精品一区久久久久| 欧美日韩免费视频| 国产欧美综合色| 日本怡春院一区二区| 91丨九色丨黑人外教| 欧美成人福利视频| 亚洲一二三四区| 粉嫩久久99精品久久久久久夜| 欧美性猛片xxxx免费看久爱| 中文字幕二三区不卡| 麻豆精品国产传媒mv男同| 日本福利一区二区| 国产精品私人影院| 久久激五月天综合精品| 欧美日韩综合色| 亚洲视频中文字幕| 大桥未久av一区二区三区中文| 日韩一区二区三区观看| 亚洲精品国产品国语在线app| 国产精品一区在线| 日韩一区二区三区免费观看| 亚洲一二三区视频在线观看| av在线不卡免费看| 亚洲国产精品ⅴa在线观看| 久久99精品久久久久久久久久久久| 欧美亚洲国产一区在线观看网站| 国产精品国产三级国产a| 国产精品乡下勾搭老头1| 欧美va亚洲va香蕉在线| 丝袜诱惑亚洲看片| 欧美日韩亚洲综合在线 欧美亚洲特黄一级| 国产欧美日韩不卡| 国产高清不卡一区| 欧美激情一区二区三区| 国产69精品久久久久777| 久久欧美一区二区| 国产一区二区三区日韩| 日韩欧美一区电影| 蜜桃精品视频在线| 日韩三级视频中文字幕| 老司机精品视频线观看86 | 青青草91视频| 91精品国产乱| 久久99精品久久久久久国产越南|