エクスポートされたビュー・オブジェクト・メソッドのコール

クライアント・プログラムに、ビュー・オブジェクトおよび汎用アプリケーション・モジュールのJavaインタフェースが含まれたパッケージをインポートする必要があります。次に例を示します。

import package4.common.*
// includes package4.common.EmpView

import oracle.jbo.*
// includes generic application module oracle.jbo.ApplicationModule

エクスポートされたメソッドを使用するには、次のようにします。

  1. 汎用アプリケーション・モジュールのインスタンスを取得します。

  2. ビュー・オブジェクトへの参照を取得し、エクスポートされたメソッドが含まれているカスタム・プロキシ・ビュー・オブジェクトへキャストします。

  3. エクスポートされたメソッドを使用します。

次に例を示します。

// Call create() to get the application module instance;
// cast it to the custom application module
ApplicationModule am = home.create();
// Get a handle to the view object - Cast it to the custom  
// view object interface containing the exported method
EmpView empView = (EmpView) am.findViewObject("EmpView");
// Call the exported method
empView.promote();

エクスポートされたビュー・オブジェクト・メソッドのみを使用する場合には、アプリケーション・モジュールを、エクスポート後のインタフェースにキャストする必要はありません。