18 September 2014

Important Groovy Expression in ADF

Hi All,

I am sharing some usefull Groovy Expression for ADF application which can simplify your code.

Calling AM method for bind variable using groovy expression

adf.object.applicationModule.methodName()

Calling VOImpl method using groovy expression from bind variable expression.

adf.object.viewObject.methodName()

Assigning sequence next value in Entity Object attribute using groovy.

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

Get Current user from groovy.

adf.context.securityContext.userName or adf.context.securityContext.getUserPrincipal().getName()

Get Current user role from groovy.

adf.context.securityContext.userInRole

Get current date with tuncated time using groovy.

adf.currentDate

Get current date with time stamp value using groovy.

adf.currentDateTime

Raise an error in Entity Validation.

adf.error.raise(“YOUR_MESSAGE”)

Expression to get Old Value and New Value using groovy.

newValue, oldValue

Get the ADF Context object using groovy.

adf.context

Get user session object using groovy.

adf.userSession

Get userData object by groovy

adf.userSession.userData

get value of variable from userData object using groovy

adf.userSession.userData.employeeID

 RowSet Objects with aggregate function

   rowSetAttr.sum(GroovyExpression)
   rowSetAttr.count(GroovyExpression)
   rowSetAttr.avg(GroovyExpression)
   rowSetAttr.min(GroovyExpression)
   rowSetAttr.max(GroovyExpression)
For Example : EmployeesVO.sum(“Salary”)

Happy Coding :)

0 on: "Important Groovy Expression in ADF"