Monday, April 2, 2018

Accessing AMImpl client interface method in Using expression in ViewObject

In this section, we walk through about accessing an AppModule java method using Groovy expression

Pre-Requisite

JDeveloper 12.1.3

HR Schema

Country Entity & View Object (create Entity/ViewObject and its Java class )

Process

Double click on the AppModuleImpl.java class >> Write a method that return some integer. We are going to call this method from a View Object through Groovy Expression


Expose the method by double Click on the AppModuleImpl.xml >> Click Java >> Click the pencil icon >> Move the method to the selected list >> Click Ok



Now Open a View Object >> Click Attribute >> Click + icon to create new attribute



Input a name and change type to BigInteger as shown below



Select the created field >> Click Details >> Enable expression >> Click the expression icon as shown below






Input the groovy expression as shown below. Click Ok


This expression calls the method in the AppModuleImpl.java and assign it to the column ‘someNumber’

Syntax: ad.object.applicationModule.<MethodName>





Now Click the Source tab of the Country View Object >> Find the View Aattribute name ‘someNumber’ >> Select the element TransientExpression >> After select , a property window appear n the right hand side >> Change the TrustedMode to true in the property window



Click Save All
Test AppModule
Right click the AppModule.xml >> Click Run
Double click on the CountryEOView1 and check the method return value get populated in the column someNumber