Examples of TokenEntity


Examples of com.founder.fix.fixflow.core.impl.runtime.TokenEntity

   */
  public void enter(ExecutionContext executionContext) {
   
    //事件顺序如下,先判断跳过策略,再判断边界事件,
    //再执行多实例,最后执行节点进入事件
    TokenEntity token = executionContext.getToken();
   
    LOG.debug("进入节点: {}({}),令牌号: {}({}).", this.getName(),this.getId(),token.getName(),token.getId());

    // 把令牌的所在节点设置为当前节点
    token.setFlowNode(this);

    // 这里先不触发事件,在每个多实例进入的时候再触发。
    // fireEvent(BaseElementEvent.EVENTTYPE_NODE_ENTER, executionContext);

    // 设置令牌进入节点的时间
    token.setNodeEnterTime(new Date());

    // 移除临时执行内容对象
    executionContext.clearExecutionContextData();


View Full Code Here

Examples of com.founder.fix.fixflow.core.impl.runtime.TokenEntity

  }
 

  private void forkedTokenEnter(ExecutionContext executionContext) {
    TokenEntity token = executionContext.getToken();

    // 把令牌的所在节点设置为当前节点
    token.setFlowNode(this);

    //这里先不触发事件,在每个多实例进入的时候再触发
    //fireEvent(BaseElementEvent.EVENTTYPE_NODE_ENTER, executionContext);

    // 设置令牌进入节点的时间
    token.setNodeEnterTime(new Date());

    // 移除执行内容对象的线条关联
    executionContext.setSequenceFlow(null);

    executionContext.setSequenceFlowSource(null);
View Full Code Here

Examples of com.founder.fix.fixflow.core.impl.runtime.TokenEntity

      主令牌自己去执行边界事件的执行方法,
      当定时到的时候如果是中断边界,则直接杀掉主令牌所有的儿子,将主令牌推下去
      如果是非中断,则主令牌再生成个儿子给边界事件继续向下走,最后需要并行合并网关将他们收回。
      */
     
      TokenEntity tokenEntity = executionContext.getToken();

     
     
     
      List<BoundaryEvent> boundaryEvents = this.getBoundaryEventRefs();
     
      LOG.debug("节点: {}({}) 含有 {} 个边界事件,令牌号: {}({}).", this.getName(),this.getId(),boundaryEvents.size(),tokenEntity.getName(),tokenEntity.getId());

      String nodeTokenId = this.getId();
      // 创建分支令牌并添加到集合中
      TokenEntity nodeToken = this.createForkedToken(tokenEntity, nodeTokenId).token;
     
      LOG.debug("主令牌创建子令牌,子令牌: {}({}).",tokenEntity.getName(),tokenEntity.getId());
      //创建一个子令牌
      ExecutionContext nodeChildExecutionContext = ProcessObjectFactory.FACTORYINSTANCE.createExecutionContext(nodeToken);

View Full Code Here

Examples of com.founder.fix.fixflow.core.impl.runtime.TokenEntity

  protected void loopExecute(ExecutionContext executionContext) {
   
    Activity activity = (Activity) this;
   
    TokenEntity token=executionContext.getToken();
   
    //获取 Activity 的多实例信息
    LoopCharacteristics loopCharacteristics = activity.getLoopCharacteristics();
   
    //判断事都是并行多实例
    if (loopCharacteristics instanceof MultiInstanceLoopCharacteristics) {
     
      // 并行多实例处理
      LOG.debug("节点: {}({}) 含有并行多实例,将进入多实例'进入'阶段处理,令牌号: {}({}).",activity.getName(),activity.getId(),token.getName(),token.getId());
     
      // 输出数据集
      String loopDataOutputCollectionExpressionValue = getLoopDataOutputCollectionExpression();
     
      // 多实例输入数据集
View Full Code Here

Examples of com.founder.fix.fixflow.core.impl.runtime.TokenEntity

        // 并行多实例处理
       
        //MultiInstanceLoopCharacteristics multiInstanceLoopCharacteristics = (MultiInstanceLoopCharacteristics) loopCharacteristics;

       
        TokenEntity token=executionContext.getToken();
       
        LOG.debug("节点: {}({}) 含有并行多实例,将进入多实例'离开'阶段处理,令牌号: {}({}).",activity.getName(),activity.getId(),token.getName(),token.getId());
       
       
       
        // 输出数据集
        String loopDataOutputCollectionExpressionValue = getLoopDataOutputCollectionExpression();
       
        // 多实例输入数据集
        String loopDataInputCollectionExpressionValue = getLoopDataInputCollectionExpression();
       
        // 多实例输入项
        String inputDataItemExpressionValue = getInputDataItemExpression();
       
        // 多实例输出项
        String outputDataItemExpressionValue = getOutputDataItemExpression();
       
        //完成条件
        String completionConditionExpressionValue=getCompletionConditionExpression();
       
        //打印日志信息
        LOG.debug("\n多实例配置信息: \n 【输入数据集】: \n{}",loopDataInputCollectionExpressionValue);
       
        LOG.debug("\n【输入项编号】: \n{}",inputDataItemExpressionValue);
       
        LOG.debug("\n【输出项编号】: \n{}",outputDataItemExpressionValue)
       
        LOG.debug("\n【输出数据集】: \n{}",outputDataItemExpressionValue)
       
        LOG.debug("\n【完成条件】: \n{}",completionConditionExpressionValue)
       

        if (loopDataOutputCollectionExpressionValue != null && !loopDataOutputCollectionExpressionValue.equals("")) {

          Object valueObj = ExpressionMgmt.execute(loopDataOutputCollectionExpressionValue, executionContext);

          if (valueObj != null) {

            if (valueObj instanceof Collection) {

              String expressionValueTemp = getOutputDataItemExpression();

              @SuppressWarnings("rawtypes")
              Collection collection = (Collection) valueObj;
              collection.add(ExpressionMgmt.execute(expressionValueTemp, executionContext));

            } else {

            }
          } else {

          }
        }

       
       
        if (completionConditionExpressionValue == null || completionConditionExpressionValue.equals("")) {

          LOG.error("节点: "+activity.getName()+"("+activity.getId()+") 多实例完成条件为空.");
         
          throw new FixFlowExpressionException(ExceptionCode.EXPRESSIONEXCEPTION_CONDITIONEXPRESSIONEMPTY,this.getId(),this.getName(),"");
         
        } else {
         
          boolean isCompletion=false;
          try {
           
            isCompletion=StringUtil.getBoolean(ExpressionMgmt.execute(completionConditionExpressionValue, executionContext));
           
          } catch (Exception e) {
           
            LOG.error("节点: "+activity.getName()+"("+activity.getId()+") 多实例完成条件计算出错.",e);
            throw new FixFlowExpressionException(ExceptionCode.EXPRESSIONEXCEPTION_CONDITIONEXPRESSIONERROR,this.getId(),this.getName(),"");
           
          }
         
          if (isCompletion){
           
            LOG.debug("节点: {}({}) 多实例完成条件验证通过,令牌号: {}({}).",activity.getName(),activity.getId(),token.getName(),token.getId());
           
           
            super.leave(executionContext);
           
          }else{
            //不做处理
            LOG.debug("节点: {}({}) 多实例完成条件验证不通过,令牌将继续停留在当前借点,令牌号: {}({}).",activity.getName(),activity.getId(),token.getName(),token.getId());
          }
        }

      } else {
        //这里还没实现。。。。囧
View Full Code Here

Examples of com.founder.fix.fixflow.core.impl.runtime.TokenEntity

  /**
   * 离开节点的时候需要清理的数据. 每个子类需要自己实现.
   */
  public void leaveClearData(ExecutionContext executionContext) {
    TokenEntity tokenEntity = executionContext.getToken();
   
    if (this.getBoundaryEventRefs().size() > 0) {

      String parentTokenId = tokenEntity.getParent().getId();
      try {
        //Scheduler scheduler = Context.getProcessEngineConfiguration().getSchedulerFactory().getScheduler();
        //scheduler.deleteJob(JobKey.jobKey(tokenEntity.getParent().getId(), "FixTimeOutTask_" + parentTokenId));
        if(StringUtil.getBoolean(Context.getProcessEngineConfiguration().getQuartzConfig().getIsEnable())){
          Scheduler scheduler = Context.getProcessEngineConfiguration().getSchedulerFactory().getScheduler();
          Set<JobKey> jobKeys=new HashSet<JobKey>();
          jobKeys = scheduler.getJobKeys(GroupMatcher.jobGroupContains(parentTokenId));
          if(jobKeys.size()>0){
            List<JobKey> jobKeysList=new ArrayList<JobKey>();
            jobKeysList.addAll(jobKeys);
            scheduler.deleteJobs(jobKeysList);
          }
        }
       

      } catch (Exception e) {
       
        LOG.error("节点: "+this.getName()+"("+this.getId()+") 在离开时,清理定时任务数据出错,错误信息: "+e.getMessage(),e);
       
        throw new FixFlowScheduleException(ExceptionCode.QUARZTEXCEPTION_NODELEAVECLEANQUARTZ,this.getId(),this.getName(),e);
       
      }

    }
   
   
    try {
     
      if (StringUtil.getBoolean(Context.getProcessEngineConfiguration().getQuartzConfig().getIsEnable())) {
        Scheduler scheduler = Context.getProcessEngineConfiguration().getSchedulerFactory().getScheduler();
        Set<JobKey> jobKeys = new HashSet<JobKey>();
        jobKeys = scheduler.getJobKeys(GroupMatcher.jobGroupContains(tokenEntity.getId()));
        if (jobKeys.size() > 0) {
          List<JobKey> jobKeysList = new ArrayList<JobKey>();
          jobKeysList.addAll(jobKeys);
          scheduler.deleteJobs(jobKeysList);
        }
View Full Code Here

Examples of com.founder.fix.fixflow.core.impl.runtime.TokenEntity

   * @param executionContext
   * @throws Exception
   */
  public void enter(ExecutionContext executionContext) {
    //获取令牌
    TokenEntity token = executionContext.getToken();
   
    LOG.debug("进入节点: {}({}),令牌号: {}({}).", this.getName(),this.getId(),token.getName(),token.getId());

    // 把令牌的所在节点设置为当前节点
    token.setFlowNode(this);
   
    // 设置令牌进入节点的时间
    token.setNodeEnterTime(new Date());

    // 触发节点进入事件
    fireEvent(BaseElementEvent.EVENTTYPE_NODE_ENTER, executionContext);

    // 移除临时执行内容对象
View Full Code Here

Examples of com.founder.fix.fixflow.core.impl.runtime.TokenEntity

  }

  private void defaultLeave(ExecutionContext executionContext) {
   
    TokenEntity token = executionContext.getToken();
   
   

    // 发生节点离开事件
    fireEvent(BaseElementEvent.EVENTTYPE_NODE_LEAVE, executionContext);
   
   
    //离开时数据清理。
   
    leaveClearData(executionContext);
   
    // kenshin  2013.1.2
    // 用来处理非线条流转令牌,如退回、跳转
 
   
    if(executionContext.getToFlowNode()!=null){
     
      //发现上下文中有直接跳转节点,则流程引擎不走正常处理直接跳转到指定借点。
     
     
      //获取跳转节点
      FlowNode toFlowNode=executionContext.getToFlowNode();
     
      LOG.debug("==执行跳转机制,跳转目标: {}({}),离开节点: {}({}),令牌号: {}({}).",toFlowNode.getName(),toFlowNode.getId(), this.getName(),this.getId(),token.getName(),token.getId());
     
     
      toFlowNode.enter(executionContext);
      return;
    }
   
   
    //定义可通过线条集合
    List<SequenceFlow> sequenceFlowList = new ArrayList<SequenceFlow>();

    //获取正常离开的所有线条
    for (SequenceFlow sequenceFlow : getOutgoing()) {
      //验证线条上的条件
      if (sequenceFlow.isContinue(executionContext)) {
        sequenceFlowList.add(sequenceFlow);
      }

    }

    // 节点后面没有线的处理
    if (sequenceFlowList.size() == 0) {
      if (getOutgoing().size() == 0) {
       
        LOG.error("节点: {}({}) 后面没有配置处理线条!",this.getName(),this.getId());
       
        throw new FixFlowException(ExceptionCode.SEQUENCEFLOWEXCEPTION_NODENOSEQUENCEFLOW,this.getName(),this.getId());
       
      } else {
       
        LOG.error("节点: {}({}) 后面的条件都不满足导致节点后面没有处理线条,请检查后续线条条件!",this.getName(),this.getId());
       
        throw new FixFlowException(ExceptionCode.SEQUENCEFLOWEXCEPTION_NODENOVERIFIEDSEQUENCEFLOW,this.getName(),this.getId());
      }
    }

    // calculationTransitionsExp(executionContext);

    // 节点后面就一条线的处理
    if (sequenceFlowList.size() == 1) {
      leave(executionContext, sequenceFlowList.get(0));
      return;
    }

    // 节点后面大于一条线的处理
    if (sequenceFlowList.size() > 1) {

      // 创建分支令牌集合
      ArrayList<ForkedToken> forkedTokens = new ArrayList<ForkedToken>();

      // 遍历满足条件线条
      for (SequenceFlow sequenceFlow : sequenceFlowList) {
        // 获取线条名称
        String sequenceFlowId = sequenceFlow.getId();
        // 创建分支令牌并添加到集合中
        forkedTokens.add(this.createForkedToken(token, sequenceFlowId));
      }
      // 遍历分支令牌集合
      for (ForkedToken forkedToken : forkedTokens) {
        // 获取令牌
        TokenEntity childToken = forkedToken.token;
        // 获取令牌编号
        String leavingTransitionId = forkedToken.leavingTransitionId;
        // 创建执行内容对象并将里边的令牌赋值为新的分支令牌

        ExecutionContext childExecutionContext = ProcessObjectFactory.FACTORYINSTANCE.createExecutionContext(childToken);
View Full Code Here

Examples of com.founder.fix.fixflow.core.impl.runtime.TokenEntity

   * @throws Exception
   */
  public void leave(ExecutionContext executionContext, SequenceFlow sequenceFlow) {

    // 从执行内容对象中获取令牌
    TokenEntity token = executionContext.getToken();
   
    LOG.debug("离开节点: {}({}),令牌号: {}({}),目标线条: {} .", this.getName(),this.getId(),token.getName(),token.getId(),sequenceFlow.getId());

   
   
    // 将令牌的当前节点设置为当前节点
    token.setFlowNode(this);
    // 将执行内容对象中的线条指定为将要离开的线条
    executionContext.setSequenceFlow(sequenceFlow);

    // 将线条来源对象设置为当前节点
    executionContext.setSequenceFlowSource(this);
View Full Code Here

Examples of com.founder.fix.fixflow.core.impl.runtime.TokenEntity

  // 分支处理///////////////////////////////

  public ForkedToken createForkedToken(TokenEntity parent, String transitionId) {
    // 创建一个令牌实例

    TokenEntity childToken = new TokenEntity(parent, transitionId);

    // 创建分支令牌
    ForkedToken forkedToken = null;
    forkedToken = new ForkedToken(childToken, transitionId);
    return forkedToken;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.