ビジネスイベントのキャプチャ
この機能を使用すると、ビジネスイベントをキャプチャすることができます。言い換えると、この機能を使用して、BusinessEventHandler を設定することができます。ビジネスイベントを有効化するには、2 つの方法があります。以下のビジネスハンドラへの参照のどちらかを使用することができます。
● IsaBaseAction
通常は、IsaBaseAction 内のイベントを使用する必要があります。コーディングは以下のような構文になります。

public class ZEventAction extends ISACoreBaseAction {
public ActionForward isaPerform(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response,
UserSessionData userSessionData,
RequestParser requestParser,
BusinessObjectManager bom,
IsaLocation log,
IsaCoreInitAction.StartupParameter startupParameter,
BusinessEventHandler eventHandler)
throws CommunicationException {
ZObject zObject = bom.getZObject();
if (zObject != null) {
ZEvent event = new ZEvent (zObject);
eventHandler.fireBusinessEvent(event);
}
return mapping.findForward("success");
}
● BusinessObjectBase を拡張したすべてのビジネスオブジェクト
トリガがアクションで発生しない場合、またはイベントがアクション内の複数箇所で発生する場合は、BusinessObjectBase だけを使用します。コーディングは以下のような構文になります。

public class ZBusinessObect extends BusinessObjectBase {
public void zMethod() {
if (businessEventHandler != null) {
ZEvent event = new ZEvent (this);
eventHandler.fireBusinessEvent(event);
}
...
}
}
この例の新規イベントはアクションをベースにしているため、ISACoreBaseAction への参照を使用する必要があります。コーディングは以下のような構文になります。

public class CaptureRequestHelpAction extends IsaCoreBaseAction {
public ActionForward isaPerform(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response,
UserSessionData userSessionData,
RequestParser requestParser,
BusinessObjectManager bom,
IsaLocation log,
IsaCoreInitAction.StartupParameter startupParameter,
BusinessEventHandler eventHandler)
throws CommunicationException {
String helpType;
String helpAction = requestParser.getParameter("action").getValue().getString();
helpType = helpAction.toUpperCase();
RequestHelpEvent event = new RequestHelpEvent(bom.getUser(), bom.getShop(), helpType);
eventHandler.fireBusinessEvent(event);
if (helpAction.equals("email")) {
return mapping.findForward("email");
}
return mapping.findForward("success");
}
}
参照: