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

📄 jterrorhandler.java

📁 Java Pattern Oriented Framework (Jt) 是为了实现Java快速开发的面向模式的框架。
💻 JAVA
字号:
package Jt.jbpm;

import Jt.*;
import org.jbpm.graph.exe.ExecutionContext;

/**
 *  Handles error. This class can be readily included in the jBPM process definition.  
 */

public class JtErrorHandler extends JtObject {
  
  private static final long serialVersionUID = 1L;
  private ExecutionContext context = null;
  private String message;



  public JtErrorHandler() {
  }

  /**
   * Returns the message (or part of the message) to be displayed. 
   */
  
  public String getMessage() {
	return message;
  }

  /**
   * Specifies the message or part of the message to be displayed. 
   */
  
  public void setMessage(String message) {
	this.message = message;
  }
  
  //handle exceptions

  public void handleException (Throwable ex) {
      
      JtJBPMAdapter jbpmAdapter = null;
      
      try {           
        if (context != null) {
            jbpmAdapter = (JtJBPMAdapter) context.getContextInstance().getVariable ("JtJBPMAdapter");
        }
        if (jbpmAdapter != null)
            jbpmAdapter.setObjException(ex); // Propagate the exception to the JBPM adapter
            
      } catch (Exception ex1) {
          
      }
      super.handleException(ex);
  }

/*
  public void handleException (Throwable ex) {
      
      JtJBPMAdapter jbpmAdapter = null;
      
      try {           
        if (context != null) {
            jbpmAdapter = (JtJBPMAdapter) context.getContextInstance().getVariable ("JtJBPMAdapter");
        }
        if (jbpmAdapter != null)
            jbpmAdapter.setObjException(ex); // Propagate the exception to the JBPM adapter
            
      } catch (Exception ex1) {
          
      }
      super.handleException(ex);
  }
*/
  
  /**
   * Execute method (JBPM ActionHandler interface). 
   */

  public void execute(ExecutionContext context) throws Exception {
/*      
    this.context = context;
    if (message != null)
        handleError (message);
    else
        handleError ("An error has been detected");
*/
      JtJBPMAdapter jbpmAdapter = null;
      
      try {           
        if (context != null) {
            jbpmAdapter = (JtJBPMAdapter) context.getContextInstance().getVariable ("JtJBPMAdapter");
        }
        if (jbpmAdapter != null)
            this.setValue(jbpmAdapter, "errorMessage", message);
            
      } catch (Exception ex) {
         handleException (ex);    
      }
  }   
}



⌨️ 快捷键说明

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