Oracle ADF Application Module Client – Expose custom methods with Data Transfer Objects


Scenario:

You have a requirement to implement a back-end service that accepts/returns a user-defined Data Transfer Object.  The business logic of this service is implemented using an Application Module  – i.e. there is a method in the AM with a signature that uses the DTOs.

 

For example:

 

Imagine “RateUpdate” is a complex class with a “list” of RateUpdateDetails and each update detail has information about, say, a Customer and a Rate that we have a contract with them etc.  I quickly hashed out the following structure using some example from my earlier experiences, this by no means is the definitive structure – rather a simple example:

 

…with the implementation looking something like this, DTOs are simple java beans with accessors and mutators and an empty public constructor.

 

We then implement the Status class and implement the updateRate method in the Application Module:

 

Finally we expose this to the client using the wizard ….

1) Click on the Model to open the wizard

2) Click on the Java menu item and then click on the “pen” that is on the bottom-Right-hand-side for the “Client Interface”

3) The “Edit Client Interface” is used to “shuttle” methods in the Application Module from “Available” to “Selected” … the ones in the Selected box are exposed to the calling client.  However, in this case – we do not see the method we just created!

 

Solution:

So the problem is that despite the AM and the DTO bean implementation compiling, you still do not “See” the new method in the Edit Client Wizard to expose to clients. This is because the DTO classes (Rating, Status, Customer etc) have to be  Serializable… i.e they must “implement Java.io.Serializable”

 

We do this for all the user defined classes that are referenced by the method in the AM. And then try again … and Viola!

AM Method-Visible-After-Implements-Serializable

 

 

1 Comment

  1. shrikant says:

    Can you share the source code of this sample.

    Like

Leave a Comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s