Using ADF SDO Find Criteria

The less talked about and the most confusing subject when it comes to service based model is Find Criteria. You may not need to add explicit view criteria to filter records, if you use the SDOs (Service Data Objects). Here, I will show how you can use a simple Find Criteria.

Creating Proxy from the Deployed FASDOAppModuleService:
Say, you have deployed an application module service interface called FASDOAppModuleService and the URL is http://soabpm-vm:7001/FASDOModel/FASDOAppModuleService?wsdl. First, let’s create a proxy project using this info.
FASDOModel wsdl

In JDeveloper, create a generic project called FASDOModelProxy. Follow the steps with figures below to create the proxy project now.
Create New Project
Choose Generic Project

Once the project is created, let’s generate the Web Service Proxy. In JDeveloper, click File –> New –> navigate to Business Tier –> select Web Service Proxy –> click OK. Then just follow the Web Service Proxy Creation Wizard as shown below.
Create Proxy From WSDL
Screenshot-CreateWebServiceProxy-Step1of7
Screenshot-CreateWebServiceProxy-Step2of7
Screenshot-CreateWebServiceProxy-Step3of7
Screenshot-CreateWebServiceProxy-Step4of7
Screenshot-CreateWebServiceProxy-Step5of8
Screenshot-CreateWebServiceProxy-Step6of8
Screenshot-CreateWebServiceProxy-Step7of9
Screenshot-CreateWebServiceProxy-Step8of9
Screenshot-CreateWebServiceProxy-Step9of9

You will see something like below once the wizard is completed.
FASDOModelProxy

Using Find Criteria
Now, let’s use the Find Criteria to filter the records as per our need. Say, you are interested in retrieving records of all active employees (ACTIVE=’Y’) and potentially apply more filters to it. If you simply invoke the operation findEmpView() from FASDOAppModuleService without criteria, it will retrieve all the records from the EMP table which is not the result we want. Therefore, let’s create a simple method that takes an attribute (Column name) and its value to construct the Find Criteria. Something to keep in mind, make sure all the object types used here are from the Web Services Proxy project, like the one created above, e.g. fasdomodel.types.ObjectFactory under FASDOModelProxy project.

Testing above utility is simple, use the following test client code:

But, there will be instances where multiple filters might be needed to get the right result set. We can further refine the utility that will take any numbers of filters and apply that to the Find Criteria to bring back the desired result set. As part of employing multiple filters, let’s retrieve the records of active employees who also get commissions using the refined Find Criteria utility and the test client below.

Now test it with a client and see the result yourself.

Testing FASDOAppModuleService service from web
You can also test the deployed FASDOAppModuleService directly from web, if you would like:

Result from the deployed FASDOAppModuleService using findEmpView() operation.

Sanjib

Director at Fusion Applied
Sanjib is an Oracle Middleware Architectwith over 15 years' experience developing software and managing projects in challenging, fast-paced consulting environments. An experienced OO developer with expertise in J2EE and Oracle Fusion Middleware technologies. His current focus is on helping customers build solutions using the Oracle Fusion Middleware stack including Oracle SOA Suite 11g, BPM, ADF & WebCenter Suite.
Sanjib

Leave a Reply

avatar
  Subscribe  
Notify of