Friday, June 6, 2014

ADF how to: service methods

All, what do we find regarding "service methods" in ADF BC documentation can be summarized as follows:

"An application module can expose its data model of view objects to clients without requiring any custom Java code. This allows client code to use the ApplicationModule, ViewObject, RowSet, and Row interfaces in the oracle.jbo package to work directly with any view object in the data model. However, just because you can programmatically manipulate view objects any way you want to in client code doesn't mean that doing so is always a best practice.

Whenever the programmatic code that manipulates view objects is a logical aspect of implementing your complete business service functionality, you should encapsulate the details by writing a custom method in your application module's Java class."
 
You can write your own code to configure view object properties to query the correct data to display, you can perform in custom code any kind of multistep procedural logic or finally you can perform aggregate calculations iterating over one or many view objects.

Adding a service method to an application module has many advantages. Some of them are:
  • allowing multiple client pages to easily call the same code if needed
  • code which can be more clear for the clients (client applications and thier developers)
  • option open to improve your implementation without affecting clients
  • simplifying of the regression-testing of your complete business service
  • enabling declarative invocation of logical business functionality in your pages
To write custom service methods you must enable a custom Java class for an application module:
  • In the Application Navigator, double-click the application module.
  • In the overview editor, click the Java navigation tab.
  • On the Java Classes page, click Edit Java Options.
  • In the Select Java Options dialog, select Generate Application Module Class.
  • Click OK.
After implementing custom code you need publish its to the client. You can do this by publishing custom methods to the application module's client interface. This can be done manually or by wizard available on the Java Classes page of the overview editor for the application module. To publish methods click the Edit icon in the Client Interface section of the page to display the Edit Client Interface dialog.

1 comment:

  1. Hi, Great.. Tutorial is just awesome..It is really helpful for a newbie like me.. I am a regular follower of your blog. Really very informative post you shared here. Kindly keep blogging. If anyone wants to become a Java developer learn from Java Training in Chennai. or learn thru Java EE Online Training from India . Nowadays Java has tons of job opportunities on various vertical industry.

    ReplyDelete