Decision Center 用の値エディターの実装

値エディターを使用して、ビジネス固有の BOM タイプ用のカスタム・グラフィカル・インターフェースを提供します。Decision Center ガイド・エディターまたは Intellirule エディター用の値エディターを実装することができます。

このタスクについて

BOM クラスを値エディター・キーに関連付けると (値エディターと BOM タイプの関連付けを参照)、Decision Center 用の値エディターを実装できます。 次に、Decision Center アーカイブをリパッケージして、その値エディターを統合し、宣言する必要があります。

手順

Decision Center 用の値エディターを実装する手順は、以下のとおりです。

  1. 必要なルール・エディターのタイプに応じて、以下のように値エディターの実装を作成します。
    • 値エディターをガイド・エディター用に定義するには、クラス IlrWValueEditorComponent を拡張します。

    • 値エディターを Intellirule エディター用に定義するには、インターフェース IlrClientScriptFileValueEditorProvider または IlrClientScriptBlockValueEditorProvider を実装します。これらのインターフェースは値エディターのサーバー・サイドを定義し、クライアント・パート用のスクリプトを呼び出します。このスクリプトは、ファイルまたは Java ファイルに直接 JavaScript ブロックとして定義されることがあります。例:

      public class OfferValueEditorProvider implements IlrClientScriptFileValueEditorProvider {
      
      public String getClientScriptModulePath() {
      		return "/js/custom/valueeditors";
      	}
      
      public String getClientScriptModuleName() {
      		return "custom.valueeditors";
      	}
      
      public String getClientScriptClassName() {
      		return "custom.valueeditors.OfferValueEditor";
      	}
      
      }

      Dojo を使用して、値エディターの JavaScript 部分を作成します。 提供される com.ibm.bdsl.web.valueeditors.ValueEditorBase からカスタム・エディターを定義します。 これは、サーバーから表示するデータを取得するためにサーブレットを呼び出すことがあります。 この場合、値を取得する HTML エディターが構築されます。

      例えば、/js/MyValueEditor.js JavaScript ファイルを以下の内容で作成します。

      dojo.declare('custom.valueeditors.OfferValueEditor', com.ibm.bdsl.web.valueeditors.ValueEditorBase, {
         getDomNode: function() {
            var serviceUrl =  config.contextPath + '/servlet/SampleValueEditorServletName';
            var divEditor = document.createElement('div');
            divEditor.className = "popupWindow folderSelector";
            var self = this;
            dojo.xhrPost({
               url: serviceUrl,
               content: addAccessToken({ offer:'true', editorId: this.editor.editorId}),
               // The success handler
               load: function(result) {
               ...
               return divEditor;
               },
               // The error handler
               error: function() {
                  return divEditor;
               }
            });
            return divEditor;
         },
         startEdit: function() {
         }
      });
  2. エディターのキーを実装クラスの完全修飾名にマップする preferences.properties ファイル を作成し、そのファイルを、実装を含む JAR ファイルにインクルードします。
    • ガイド・エディターの場合は、以下の行を追加します。

      webui.editor.<key>=mycompany.MyValueEditorClass

    • Intellirule エディターの場合は、以下の行を追加します。

      "decisioncenter.web.core.intelliruleEditor.<key>" (Business Console の場合)

      "teamserver.web.intelliruleEditor.<key>" (Enterprise Console の場合)

    ここで、<key> は BOM メンバーの値エディター・プロパティーの名前です。

    この設定を Decision Center 構成パラメーターとして指定することもできます (../../com.ibm.odm.dcenter.admin/topics/tpc_rts_ant_changing_params.htmlにある set-config-param Ant タスクを参照)。

    • ガイド・エディターの場合は、以下の構成パラメーターを設定します。

      ant set-config-param -Dkey=webui.editor.<key> -Dvalue=mycompany.MyValueEditorClass

    • Intellirule エディターの場合は、以下の構成パラメーターを設定します。

      ant set-config-param -Dkey=decisioncenter.web.core.intelliruleEditor.<key> -Dvalue=mycompany.MyValueEditorClass (Business Console の場合)

      ant set-config-param -Dkey=teamserver.web.intelliruleEditor.<key> -Dvalue=mycompany.MyValueEditorClass (Enterprise Console の場合)

  3. Decision Center アーカイブを repackage-ear コマンドを使用してリパッケージします。repackage-ear コマンドで、-DadditionalJars 引数を使用して、値エディター・クラスを含む JAR ファイルを指定します。
    注:

    Decision Center アーカイブをリパッケージする方法については、Decision Center アーカイブのリパッケージを参照してください。

  4. Decision Center アーカイブを配布します。

タスクの結果

これで、値エディターが Decision Center で使用可能になります。