Thursday, October 10, 2013

That's Groovy!

I think a little known feature of ADF is the ability to use Groovy expressions in the ADF Business Components layer. You can use Groovy expressions for the following:
• Values for view and entity objects attributes
• Validation rules on entity object attributes
• Expressions for error messages
• Values for view object bind variables
• View object transient attribute validation

If you haven't already I highly recommend reading the Introduction to Groovy Support in JDeveloper
and Oracle ADF 11g whitepaper at the following link: http://www.oracle.com/technetwork/developer-tools/jdev/introduction-to-groovy-128837.pdf

Since the Groovy expressions are run inside of the JVM you can make use of any Java libraries and classes that exist there. Groovy expressions can be simple or complex and there are also a variety of expressions built into ADF such as adf.currentDate and adf.context.securityContext.userName. These would allow you to set the date and user on attributes at the VO level when not using history columns.

Useful JDeveloper Keyboard Shortcuts

Just a few useful JDeveloper 11g keyboard shortcuts


FUNCTION SHORTCUT
Go To File Ctrl + Alt + Minus
Select File In Navigator Alt + Home
Code Template Ctrl + Enter
Go To Declaration Ctrl + Mouse Click
Go To Java Class Ctrl + Minus
Application navigator start typing to search
Quick Class Outline Ctrl + Shift + `
Open Recent Files Ctrl + Plus
Reformat Code Ctrl + Alt + L
Go To Line Number In Source Ctrl + G
Go To Last Edit Location Ctrl + Shift + Backspace
Go To Open Editors Ctrl + Tab

oracle.jbo.expr.JIEvalException: JBO-25077: Name MyLOVType not found in the given object - Error When Trying To Implement LOV Attribute

If you have ever received the oracle.jbo.expr.JIEvalException: JBO-25077: Name MyLOVType not found in the given object error when trying to implement a LOV for an attribute you mots likely spent more time than you should have trying to figure out what the issue was. According to the error message everything is configured as it should be and it is even telling you that it can't find the MyLOVType in the given object which is the LOV type that you are looking for. Upon closer examination of the view accessor used to generate the LOV you will find that you didn't enclose the string value in quotes for the bind parameter value. MyLOVType should be "MyLOVType" just as the value for p_active is "Y".