Day: April 2, 2010
You can make a JDeveloper model View Object (VO) use a data query that has a custom variable accessor in Java. This is useful for cases where you want your where clause to select based on the current user name from the ADF Security context.
Go to the “Query” tab of your view object:
Add a new Bind Variable and make sure to specify “Expression” and give the value the Groovy expression “adf.object.viewObject.yourPropertyName”. The “adf.object.viewObject” portion is essentially like saying “this object” and then it will call getYourPropertyName() to fetch the value:
Select the “Java” tab of your view object and then click the pencil icon to edit the settings:
Finally, open that Java file and change the implementation of your get accessor as you wish. In my case, I am simply returning the user name property from the ADF security context. I also changed my set accessor to do nothing: