📄 genericejbeventlistenerlocal.java
字号:
/*
* GenericEJBEventListnerLocal.java
*/
package jp.co.intra_mart.framework.base.event;
import javax.ejb.EJBException;
import jp.co.intra_mart.framework.base.event.EJBEventListener;
import jp.co.intra_mart.framework.base.event.Event;
import jp.co.intra_mart.framework.base.event.EventResult;
import jp.co.intra_mart.framework.system.exception.ApplicationException;
import jp.co.intra_mart.framework.system.exception.SystemException;
/**
* 儘乕僇儖EJB傪棙梡偡傞斈梡揑側僀儀儞僩儕僗僫偱偡丅
*
* @version 1.0
* @since 5.0
*/
public class GenericEJBEventListenerLocal extends EJBEventListener {
/**
* 儂乕儉僀儞僞僼僃乕僗GenericEJBEventListenerAgentHome
*/
private GenericEJBEventListenerAgentLocalHome home;
/**
* 張棟傪峴偆StandardEventLinstener偺僋儔僗柤
*/
private String listenerName;
/**
* GenericEJBEventListnerLocal傪怴婯偵惗惉偟傑偡丅
*
* @param home 儂乕儉僀儞僞僼僃乕僗
* @param listenerName 幚嵺偵張棟傪峴偆StandardEventListener偺僋儔僗柤
*/
public GenericEJBEventListenerLocal(
GenericEJBEventListenerAgentLocalHome home,
String listenerName) {
super();
this.home = home;
this.listenerName = listenerName;
}
/**
* 張棟傪幚峴偟傑偡丅
* 僀儀儞僩傪尦偵張棟傪幚峴偟傑偡丅
* 偙偺僀儞僞僼僃乕僗傪幚憰偡傞偡傋偰偺僋儔僗偼丄
* 偡傋偰偺僀儀儞僩僩儕僈傪幚峴偟偨屻偵張棟傪
* 幚峴偡傞傛偆偵愝寁偝傟偰偄傞昁梫偑偁傝傑偡丅
*
* @param event 僀儀儞僩
* @return 僀儀儞僩張棟寢壥
* @throws ApplicationException 僀儀儞僩張棟帪偵傾僾儕働乕僔儑儞椺奜偑敪惗
* @throws SystemException 僔僗僥儉張棟帪偵傾僾儕働乕僔儑儞椺奜偑敪惗
*/
public EventResult execute(Event event)
throws SystemException, ApplicationException {
GenericEJBEventListenerAgentLocal agent = null;
EventResult result = null;
// 儘乕僇儖僀儞僞僼僃乕僗偺庢摼
try {
agent = this.home.create();
} catch (Exception e) {
throw new SystemException(e.getMessage(), e);
}
// 張棟偺幚峴
try {
result = agent.execute(event, this.listenerName);
} catch (ApplicationException e) {
throw e;
} catch (SystemException e) {
throw e;
} catch (EJBException e) {
Exception ex = e.getCausedByException();
if (ex == null) {
throw new SystemException(e.getMessage(), e);
} else if (ex instanceof SystemException) {
throw (SystemException)ex;
} else if (ex instanceof ApplicationException) {
throw (ApplicationException)ex;
} else {
throw new SystemException(ex.getMessage(), ex);
}
}
return result;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -