Package org.fireflow.kernel

Examples of org.fireflow.kernel.ITransitionInstance


            token.setStepNumber(token.getStepNumber() + 1);
            targetActivityInstance.fire(token);
        } else {
            //按照定义,activity有且只有一个输出弧,所以此处只进行一次循环。
            for (int i = 0; leavingTransitionInstances != null && i < leavingTransitionInstances.size(); i++) {
                ITransitionInstance transInst = leavingTransitionInstances.get(i);
                transInst.take(token);
            }
        }

        if (token.isAlive()) {
            NodeInstanceEvent event = new NodeInstanceEvent(this);
View Full Code Here


     * @see org.fireflow.kernel.event.IEdgeInstanceEventListener#onEdgeInstanceEventFired(org.fireflow.kernel.event.EdgeInstanceEvent)
     */
    public void onEdgeInstanceEventFired(EdgeInstanceEvent e) throws KernelException {
        if (e.getEventType() == EdgeInstanceEvent.ON_TAKING_THE_TOKEN) {
            IToken token = e.getToken();
            ITransitionInstance transInst = (ITransitionInstance) e.getSource();
            String condition = transInst.getTransition().getCondition();
           
            calculateTheAliveValue(token, condition);

            if (rtCtx.isEnableTrace() && token.isAlive()) {
                Transition transition = transInst.getTransition();
                IWFElement fromNode = transition.getFromNode();
                int minorNumber = 1;
                if (fromNode instanceof Activity){
                    minorNumber=2;
                }else{
                    minorNumber =1;
                }

                ProcessInstanceTrace trace = new ProcessInstanceTrace();
                trace.setProcessInstanceId(e.getToken().getProcessInstanceId());
                trace.setStepNumber(e.getToken().getStepNumber());
                trace.setType(ProcessInstanceTrace.TRANSITION_TYPE);
                trace.setFromNodeId(transInst.getTransition().getFromNode().getId());
                trace.setToNodeId(transInst.getTransition().getToNode().getId());
                trace.setEdgeId(transInst.getTransition().getId());
                trace.setMinorNumber(minorNumber);
                //TODO wmj2003 这里应该是insert。一旦token从当前边上经过,那么就保存流程运行轨迹.
                rtCtx.getPersistenceService().saveOrUpdateProcessInstanceTrace(trace);
            }
        }
View Full Code Here

            }
        }
        if (!doLoop) {//如果没有循环,则执行transitionInstance
                //非顺序流转的需要生成新的token,
                boolean activiateDefaultCondition = true;
                ITransitionInstance defaultTransInst = null;
                for (int i = 0; leavingTransitionInstances != null && i < leavingTransitionInstances.size(); i++) {
                    ITransitionInstance transInst = leavingTransitionInstances.get(i);
                    String condition = transInst.getTransition().getCondition();
                    if (condition != null && condition.equals(ConditionConstant.DEFAULT)) {
                        defaultTransInst = transInst;
                        continue;
                    }

                    Token token = new Token(); // 产生新的token
                    token.setAlive(joinPoint.getAlive());
                    token.setProcessInstance(processInstance);
                    token.setStepNumber(joinPoint.getStepNumber());
                    token.setFromActivityId(joinPoint.getFromActivityId());
                    boolean alive = transInst.take(token);
                    if (alive) {
                        activiateDefaultCondition = false;
                    }

                }
View Full Code Here

        event4.setEventType(NodeInstanceEvent.NODEINSTANCE_LEAVING); //token 离开
        fireNodeEvent(event4);


        boolean activateDefaultCondition = true;//激活默认弧线的标志
        ITransitionInstance defaultTransInst = null;
        //找到所有开始节点的输出弧
        for (int i = 0; leavingTransitionInstances != null && i < leavingTransitionInstances.size(); i++) {
            ITransitionInstance transInst = leavingTransitionInstances.get(i); //开始节点的边的类型只能是transition
            String condition = transInst.getTransition().getCondition();
            //如果弧线的条件!=null 并且 =“default” ,那么弧线实例就是default的弧线了。
            if (condition != null && condition.equals(ConditionConstant.DEFAULT)) {
                defaultTransInst = transInst;//记录default转移线,其他条件都未false,才执行它
                continue;
            }

            Token token = new Token(); // 产生新的token
            token.setAlive(true);
            token.setProcessInstance(processInstance);
            token.setFromActivityId(tk.getFromActivityId());
            token.setStepNumber(tk.getStepNumber()+1); //步骤号+1
           
           
            boolean alive = transInst.take(token);//触发弧线的token
            if (alive) {
                activateDefaultCondition = false;
            }

        }
View Full Code Here

          rtCtx.getPersistenceService()
              .saveOrUpdateProcessInstanceTrace(trace);
        }
      }

      ITransitionInstance theLeavingTransitionInstance = (ITransitionInstance) fromActivityInstance
          .getLeavingTransitionInstances().get(0);
      ISynchronizerInstance synchronizerInstance = (ISynchronizerInstance) theLeavingTransitionInstance
          .getLeavingNodeInstance();
      if (synchronizerInstance.getEnteringTransitionInstances().size() > fromActivityIdList
          .size()) {
        Token supplementToken = new Token();
        ((Token) supplementToken).setAlive(false);
        ((Token) supplementToken).setNodeId(synchronizerInstance
            .getSynchronizer().getId());
        supplementToken.setProcessInstanceId(thisTaskInstance
            .getProcessInstanceId());
        supplementToken
            .setProcessInstance(((TaskInstance) thisTaskInstance)
                .getAliveProcessInstance());
        supplementToken.setFromActivityId("EMPTY(created by reject)");
        supplementToken
            .setStepNumber(thisTaskInstance.getStepNumber() + 1);
        supplementToken.setValue(synchronizerInstance.getVolume()
            - theLeavingTransitionInstance.getWeight()
            * fromActivityIdList.size());
        persistenceService.saveOrUpdateToken(supplementToken);
      }
    } finally {
      session.setWithdrawOrRejectOperationFlag(false);
View Full Code Here

          rtCtx.getPersistenceService()
              .saveOrUpdateProcessInstanceTrace(trace);
        }
      }

      ITransitionInstance thisLeavingTransitionInstance = (ITransitionInstance) thisActivityInstance
          .getLeavingTransitionInstances().get(0);
      ISynchronizerInstance synchronizerInstance = (ISynchronizerInstance) thisLeavingTransitionInstance
          .getLeavingNodeInstance();
      if (synchronizerInstance.getEnteringTransitionInstances().size() > 1) {
        Token supplementToken = new Token();
        ((Token) supplementToken).setAlive(false);
        ((Token) supplementToken).setNodeId(synchronizerInstance
            .getSynchronizer().getId());
        supplementToken.setProcessInstanceId(thisTaskInstance
            .getProcessInstanceId());
        supplementToken
            .setProcessInstance(((TaskInstance) thisTaskInstance)
                .getAliveProcessInstance());
        supplementToken.setFromActivityId("Empty(created by withdraw)");
        supplementToken.setStepNumber(newStepNumber);
        supplementToken.setValue(synchronizerInstance.getVolume()
            - thisLeavingTransitionInstance.getWeight());
        persistenceService.saveOrUpdateToken(supplementToken);
      }

      Token newToken = new Token();
      ((Token) newToken).setAlive(true);
View Full Code Here

TOP

Related Classes of org.fireflow.kernel.ITransitionInstance

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.