Tuesday, 9 August 2016

POPULAR GROOVY EXPRESSION IN ADF


Some most popular Groovy expression in ADF:

1) To call java method declared in application module from an Entity Object.

 adf.object.getDBTransaction().getRootApplicationModule().yourMethodName()
 Even access a different application module by:

 adf.object.getDBTransaction().getRootApplicationModule().findApplicationModule(“yourAppModule”).yourMethodName()

2) to call java method declared in application module from a View Object.

 adf.object.applicationModule.yourMethodName()

 adf.object.applicationModule.yourMethodName()

3) to call java method declared in ViewObjectimpl class.

 adf.object.viewObject.yourMethodName()

4) to get next DB sequence number using groovy? Just for Entity Level Attribute.

 new  oracle.jbo.server.SequenceImpl(“YOUR_SEQ”,object.getDBTransaction()).getSequenceNumber()

5) to get a ViewAccessor row by key and get an attribute of it.
   
oracle.jbo.Key key = new oracle.jbo.Key(“yourKey”); return yourViewAccessor.findByKey(key,1)[0].getAttribute(“yourAttribute”)

6) to use logger in groovy.

 https://blogs.oracle.com/jdevotnharvest/entry/using_adf_logger_with_groovy

7) to get current logged in userName.

adf.context.securityContext.userName

8) to get current date.

adf.currentDate

9) to get current stamp time.

adf.currentDateTime


10) raise an error in Entity Validation.

adf.error.raise(“RESOURCE_BUNDLE_ERROR”)

11) to get the ADF Context.

adf.context

12) to get user session.

adf.userSession

No comments:

Post a Comment

Fill free to add your comments