Calling Exported View Object Methods

The client program must import the package containing the Java interface for the View Object and the generic Application Module. For example:

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

import oracle.jbo.*
// includes generic Application Module oracle.jbo.ApplicationModule

To use the exported method:

  1. Get an instance of the generic Application Module.

  2. Get a reference to the View Object and cast it to the custom proxy View Object containing the exported method.

  3. Work with the exported method.

For example:

// 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();

Notice that if you are working with only the exported View Object method, you do not have to cast the Application Module to its exported interface.