⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 decisionimpl.java

📁 一个java工作流引擎
💻 JAVA
字号:
package org.jbpm.model.definition.impl;

import org.jbpm.*;
import org.jbpm.delegation.*;
import org.jbpm.model.definition.*;
import org.jbpm.model.execution.impl.*;

public class DecisionImpl extends NodeImpl implements Decision {

  private transient DelegationImpl decisionDelegation = null;
  
  public DecisionImpl() {}

  public DecisionImpl( String name ) {
    super( name );
  }

  public DelegationImpl getDecisionDelegation() { return this.decisionDelegation; }
  public void setDecisionDelegation(DelegationImpl decisionDelegation) { this.decisionDelegation = decisionDelegation; }

	public void acceptToken(ExecutionContextImpl executionContext) throws ExecutionException {
    // execute the actions on node entrance
    executeActions( EventType.DECISION_ENTER, executionContext );
    
    DecisionHandler decisionHandler = (DecisionHandler) decisionDelegation.instantiate();
    String transitionName = null;

    try {
      transitionName = decisionHandler.decide( executionContext );
    } catch (RuntimeException e) {
      decisionDelegation.handleException(e);
    }
    
    if ( transitionName == null ) {
      throw new IllegalTransitionException( "decision-handler of decision '" + name + "' return null instead of the name of a leaving transition" );
    }
    TransitionImpl transition = getLeavingTransition( transitionName );
    if ( transition == null ) {
      throw new IllegalTransitionException( "'" + transitionName + "' is not a leaving transition of decision '" + name + "'" );
    }

    // execute the actions on node exit
    executeActions( EventType.DECISION_LEAVE, executionContext );
    
    transition.acceptToken( executionContext );
  }
  
  public EventType getDefaultEventType() {
    return EventType.DECISION_ENTER; 
  }
  
  public String toString() {
    return "decision["+name+"]"; 
  }

  public void toXml(org.dom4j.Element element) {
    toXmlNameAndDescription( element );
    decisionDelegation.toXml( element.addElement( "delegation" ));
    toXmlActions( element );
    toXmlTransitions( element );
  }

	public String getTagName() {
		return "decision";
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -