jp.co.fujitsu.reffi.client.nexaweb.action
クラス FlexibleAction

java.lang.Object
  上位を拡張 jp.co.fujitsu.reffi.client.nexaweb.action.AbstractAction
      上位を拡張 jp.co.fujitsu.reffi.client.nexaweb.action.FlexibleAction
すべての実装されたインタフェース:
Action

public class FlexibleAction
extends AbstractAction

[概 要]

アクションの処理フローを実装する、アクション基底クラスです。

[詳 細]

継承クラスはexecute(ParameterMapping)メソッドを実装して処理を実装します。
AbstractActionが提供する基本的な機能+機能モデルをコントローラ経由で呼び出す為のメソッドを持ちます。

[備 考]

使用例)
・xal取得、サーバロジック実行、ClientでのSubscribe開始等を任意のタイミングで実行する
        public class TestAction extends FlexibleAction {

                @Override
                public void execute(ParameterMapping parameterMapping) throws Exception{

                        // xalを同期要求
                        HTTPRequestCore xalRequester = new HTTPRequestCore();
                        xalRequester.setRequestUrl("webcontroller");
                        xalRequester.addUrlParameters("forward.page", "/pages/serverpush.xal");
                        xalRequester.setRenderResponse(true);
                        runModel(xalRequester);

                        // サーバロジック(パブリッシュ開始)を非同期要求
                        HTTPRequestCore publishRequester = new HTTPRequestCore();
                        publishRequester.setRequestUrl("webcontroller");
                        publishRequester.addUrlParameters("model.fqcn", "demo.server.model.ServerPushStartModel");
                        publishRequester.addUrlParameters("publishSpan", "2000");
                        publishRequester.setAsync(true);
                        runModel(publishRequester);
                
                        // サブスクライブ開始を非同期実行
                        SubscribeCore subscriber = new SubscribeCore(); 
                        subscriber.setTopic("serverPushDemo");
                        subscriber.setSubscribe(true);
                        runModelWithProcessListener(subscriber, new ModelProcessListener(){
                                @Override
                                public void modelSuccess(ModelProcessEvent evt) {
                                        ObjectDataSource odc = getObjectDataSourceById("hostDataSource");
                                        odc.setSource(evt.getResult());
                                }
                        
                                @Override
                                public void modelFailure(ModelProcessEvent evt) {
                                        evt.getExeption().printStackTrace();
                                }
                        });
                
                        // 取得したxalを操作 
                        Element serverPushWindow = 
                                getWindowsByCommunicateId(xalRequester.getCommunicateId()).get(0);
                        Element lblStatus = 
                                getElementByNameFromWindow(serverPushWindow, "serverPush.lblStatus");
                        lblStatus.setAttribute("text", "serverでpublish、clientでsubscribeが開始されました。");

                        // イベントソースコンポーネントを無効化
                        Element eventSourceElement = parameterMapping.getEventSourceElement();
                        eventSourceElement.setAttribute("disabled", "true");
                }
        }
 

[環 境] JDK 6.0 Update 11

Copyright (c) 2008-2009 FUJITSU Japan All rights reserved.

作成者:
Project Reffi

コンストラクタの概要
FlexibleAction()
           
 
メソッドの概要
protected  void execute(ParameterMapping parameterMapping)
          [概 要] アクション処理を実装するメソッドです。
 ParameterMapping run(ParameterMapping parameterMapping)
          [概 要] コントローラから呼び出されるアクションの基幹メソッドです。
protected  Object runModel(Model model)
          [概 要] 機能モデルをコントローラ経由で呼び出します。
protected  void runModelWithProcessListener(Model model, ModelProcessListener listener)
          [概 要] 機能モデルをコントローラ経由で呼び出します。
 
クラス jp.co.fujitsu.reffi.client.nexaweb.action.AbstractAction から継承されたメソッド
addPermanent, alertDialog, cascadeWindows, cascadeWindows, closeChildWindows, closeOwnWindow, closeSiblingWindows, createElement, createElementObjectDataSource, getAllWindows, getChildWindows, getClientLogger, getController, getElementById, getElementByNameFromOwnWindow, getElementByNameFromWindow, getElementObjectDataSource, getElementValueByNameFromOwnWindow, getElementValueByNameFromWindow, getObjectDataSourceById, getObjectDataSourceByName, getOwnWindow, getOwnWindowCommunicateId, getParameterMapping, getParentWindow, getPermanent, getPermanent, getSerializedHttpResponseContent, getSiblingWindows, getSubscribingTopicNames, getWindowRect, getWindowsByCommunicateId, isSubscribing, moveToWindowBottomPosition, moveToWindowPosition, moveToWindowPosition, moveToWindowRightPosition, removeElementObjectDataSource, removePermanent, renderResponseToUI, returnElementStatusBeforeError, setController, setParameterMapping, tileWindows, tileWindows, validate, validationFault
 
クラス java.lang.Object から継承されたメソッド
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

コンストラクタの詳細

FlexibleAction

public FlexibleAction()
メソッドの詳細

run

public ParameterMapping run(ParameterMapping parameterMapping)
                     throws Exception

[概 要]

コントローラから呼び出されるアクションの基幹メソッドです。

[詳 細]

アクション処理を実装する為の唯一のメソッドexecute(ParameterMapping) をテンプレートコールします。

FlexibleActionにおけるrunメソッドは必ずnullを返却します。nullを返却されたコントローラは、 以降の処理を行いません。
FlexibleAction継承アクションでは、execute(ParameterMapping) の処理でイベント処理が完結します。

[備 考]

定義:
インタフェース Action 内の run
オーバーライド:
クラス AbstractAction 内の run
パラメータ:
parameterMapping - MVC各レイヤを伝播するパラメータオブジェクト
戻り値:
パラメータマッピング
例外:
Exception - アクション実行例外

execute

protected void execute(ParameterMapping parameterMapping)
                throws Exception

[概 要]

アクション処理を実装するメソッドです。

[詳 細]

FlexibleAction継承アクションは、このメソッドをオーバーライドして、 バリデーション、モデル実行、エレメント編集等の処理を任意に実装します。

[備 考]

パラメータ:
parameterMapping - MVC各レイヤを伝播するパラメータオブジェクト
例外:
Exception

runModel

protected Object runModel(Model model)
                   throws Exception

[概 要]

機能モデルをコントローラ経由で呼び出します。

[詳 細]

コントローラのモデル実行機能に引数modelの実行を委譲します。
このメソッドで戻り値を返却出来るのは、モデル処理が同期的なものである場合です。
非同期的に結果を受けるモデルであった場合、戻り値はnullになります。

[備 考]

非同期モデルを実行する場合はrunModelWithProcessListener(Model, ModelProcessListener) を使用して下さい。

パラメータ:
model - 実行する機能モデルインスタンス
戻り値:
実行された機能モデルインスタンスの汎用戻り値
例外:
Exception

runModelWithProcessListener

protected void runModelWithProcessListener(Model model,
                                           ModelProcessListener listener)
                                    throws Exception

[概 要]

機能モデルをコントローラ経由で呼び出します。

[詳 細]

コントローラのモデル実行機能に引数modelの実行を委譲します。
モデルの処理内容の同期、非同期に関わらず正常、異常結果がリスナに通知されます。

[備 考]

パラメータ:
model - 実行する機能モデルインスタンス
listener - 実行された機能モデルの正常、異常結果を取得する為のリスナインスタンス
例外:
Exception


Copyright(C) Fujitsu All Rights Reserved.