亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
1区2区3区欧美| 91精品国产综合久久香蕉的特点| 日本大香伊一区二区三区| 欧美三级日韩三级| 欧美电视剧在线看免费| 国产精品免费观看视频| 亚洲成人激情社区| 国产乱码精品一品二品| 91国产丝袜在线播放| 精品国免费一区二区三区| 中文字幕一区二区三区在线播放| 亚洲电影一级黄| 国产高清无密码一区二区三区| 日本高清视频一区二区| 久久久777精品电影网影网| 亚洲女女做受ⅹxx高潮| 久久精品国产久精国产| 91免费在线视频观看| 日韩一区二区三区精品视频| 中文字幕在线不卡| 日韩avvvv在线播放| www.亚洲激情.com| 日韩精品在线看片z| 一区二区三区四区五区视频在线观看 | 一区二区三区精品视频在线| 久久国产综合精品| 欧美三级日韩三级| 国产精品少妇自拍| 日韩福利视频导航| 色综合天天综合色综合av| 日韩美女一区二区三区四区| 亚洲综合无码一区二区| 国产精品一线二线三线精华| 欧美日韩国产美| 综合色中文字幕| 国产精品综合久久| 制服丝袜在线91| 一区二区三区色| 成人免费视频caoporn| 91精品国产综合久久精品性色| 日韩毛片视频在线看| 激情文学综合丁香| 欧美高清激情brazzers| 亚洲人精品午夜| 国产v综合v亚洲欧| 日韩免费高清视频| 午夜欧美2019年伦理| 色综合久久中文综合久久97| 日本一区二区三级电影在线观看| 青草国产精品久久久久久| 欧美午夜精品理论片a级按摩| 国产精品乱人伦中文| 国产精品一卡二卡在线观看| 日韩欧美一区二区三区在线| 午夜亚洲国产au精品一区二区| 91啪亚洲精品| 亚洲蜜臀av乱码久久精品蜜桃| 国产成人久久精品77777最新版本| 精品日韩一区二区| 日本美女一区二区三区| 欧美精品乱人伦久久久久久| 一区二区免费视频| 91麻豆免费看片| 亚洲欧洲一区二区三区| 成人在线综合网| 欧美国产1区2区| 国产ts人妖一区二区| 国产日韩欧美a| 福利91精品一区二区三区| 久久精品人人爽人人爽| 国产精品99久久久久久似苏梦涵| 欧美v日韩v国产v| 精品无人区卡一卡二卡三乱码免费卡| 91精品国产欧美一区二区| 天天做天天摸天天爽国产一区| 欧美色倩网站大全免费| 午夜欧美一区二区三区在线播放| 欧美三级一区二区| 三级在线观看一区二区| 91精品国产乱码| 日韩电影在线一区二区| 日韩精品一区二区三区蜜臀| 久久99精品久久只有精品| 久久亚洲精华国产精华液 | 欧美精选一区二区| 日韩经典中文字幕一区| 日韩一卡二卡三卡四卡| 紧缚奴在线一区二区三区| 久久影院视频免费| 成人午夜视频免费看| 日韩伦理免费电影| 91国偷自产一区二区开放时间 | 欧美探花视频资源| 日韩激情视频网站| 欧美成人精品高清在线播放| 国产另类ts人妖一区二区| 国产日韩欧美一区二区三区乱码| 99久精品国产| 亚洲韩国一区二区三区| 日韩精品最新网址| 成人国产亚洲欧美成人综合网| 综合欧美一区二区三区| 欧美精品九九99久久| 韩国三级在线一区| 综合在线观看色| 51久久夜色精品国产麻豆| 国产尤物一区二区| 亚洲人123区| 日韩免费视频一区| 成人91在线观看| 日韩精品91亚洲二区在线观看| 久久久青草青青国产亚洲免观| eeuss鲁一区二区三区| 亚洲电影激情视频网站| 久久综合久色欧美综合狠狠| 99精品欧美一区二区三区小说| 舔着乳尖日韩一区| 中文字幕av不卡| 欧美午夜精品一区二区蜜桃 | 久久综合中文字幕| av中文字幕一区| 日韩精品电影一区亚洲| 久久久精品tv| 91精品91久久久中77777| 久久国产三级精品| 亚洲视频一二三| 欧美精品一区二区三| 色女孩综合影院| 经典三级视频一区| 亚洲国产欧美日韩另类综合| 国产三级三级三级精品8ⅰ区| 欧美日韩国产高清一区二区三区 | 欧美精品欧美精品系列| 成人午夜视频网站| 男女性色大片免费观看一区二区| 欧美国产日韩在线观看| 欧美一二三四区在线| 91啪在线观看| 国产美女精品在线| 亚洲电影激情视频网站| 日韩一区在线播放| 久久综合色一综合色88| 欧美日韩午夜影院| 成人av网在线| 精品一区二区免费在线观看| 亚洲成年人网站在线观看| 国产精品看片你懂得| 日韩美一区二区三区| 在线精品国精品国产尤物884a| 国产91高潮流白浆在线麻豆| 日韩电影一区二区三区四区| 亚洲伦理在线精品| 中文在线资源观看网站视频免费不卡| 欧美一区二区三区四区五区| 在线观看亚洲a| 97se狠狠狠综合亚洲狠狠| 国产在线精品免费av| 免费欧美日韩国产三级电影| 亚洲一卡二卡三卡四卡无卡久久| 国产精品美女久久久久久久久| 精品99999| 日韩视频不卡中文| 欧美日韩国产经典色站一区二区三区| 91性感美女视频| 成人午夜视频免费看| 国产suv一区二区三区88区| 久久国产婷婷国产香蕉| 青青草国产精品97视觉盛宴| 亚洲国产三级在线| 一区二区三区在线观看网站| 中文字幕一区二区三区视频| 中文成人av在线| 欧美高清一级片在线观看| 国产欧美一区二区在线| 久久综合久色欧美综合狠狠| 精品国产不卡一区二区三区| 欧美一区二区三区四区高清| 88在线观看91蜜桃国自产| 欧美久久一二三四区| 正在播放一区二区| 制服丝袜成人动漫| 欧美一区二区三区喷汁尤物| 欧美一级免费大片| 日韩视频免费观看高清完整版| 日韩美女天天操| 久久久久久久久伊人| 国产日韩欧美综合一区| 国产精品国产三级国产aⅴ原创| 国产精品全国免费观看高清| 国产精品女主播av| 国产精品久久久久一区二区三区| 国产精品久久久久三级| 国产精品久久久久久妇女6080| 亚洲日本在线看| 亚洲一区二区在线播放相泽| 天天亚洲美女在线视频| 青椒成人免费视频| 国产精品小仙女| 91蜜桃视频在线| 欧美三级视频在线|