ADF, ADF Exceptions

ADF How to access bind variable from view object row?

Problem

I just faced a requirement to pass bind variable value to one of view object attributes LOV. It looks straight forward while we can provide view criteria and bind variable values to LOV’s view object via view accessor:

I thought that it should be no problem just to write a groovy expression into parameters value field:

adf.object.viewObject.myBindVariable

But  I’ve got an compile error:

[Static type checking] – [ADF security error] Accessing the viewObject property on class oracle.jbo.server.ViewRowImpl is not permitted.

Looks that there are some security limitations in accessing view object bind variables from view row scope. To be honest I don’t understand what security dangers lie behind, but it is as it is.

Solution

I came up with kind of workaround by altering view object row implementation class. Here are steps to implement it:

    1. Create a transient attribute (i.e. BindValue) in view object which needs to use some LOV with parameters
    2. Generate class MyObjectViewRowImpl.java and change getter for this attribute to return bind variable:
       
      /** 
      * Gets the attribute value for the calculated attribute BindVal. 
      * @return the BindValue 
      */ 
      public String getBindValue() { 
      //return (String) getAttributeInternal(BINDVALUE); 
      return (String)this.getViewObject().getVariableManager().getVariableValue("MyBindVariable"); 
      } 
      
    3. Provide recently created attribute to LOV view object via view accessor:

Thats it. LOV view object should receive bind variable value with no errors.

JDeveloper/ADF Version 12.2.1.0.0

About Danas Tarnauskas

2 thoughts on “ADF How to access bind variable from view object row?

  1. Thanks Danas..You are a savior . We had a similar requirement and couldn’t find the solution anywhere. Finally your blog helped. Thanks again.

Comments are closed.