Wed. Jan 26th, 2022

Requirement: There will be many requirement where we want to get the object of the ApplicationModule in the Managed Bean in Oracle ADF. Thus, in this post I will show you few approaches by which we can get an object of the ApplicationModule

Approach 1: We can get the object of applicationModuleImpl by writing the below line of Java code:

 BindingContext bindingContext = BindingContext.getCurrent();
 DCDataControl dc = bindingContext.findDataControl("AppModuleDataControl");// Name of application module in datacontrolBinding.cpx
 AppModuleImpl appModule = (AppModuleImpl) dc.getDataProvider();

Approach 2: We can also get the object of applicationModuleImpl by writing the below line of Java code:

AppModuleImpl am = (AppModuleImpl)resolvElDC("AppModuleDataControl");

The Java code for the resolvElDC method is shown below:

public Object resolvElDC(String data) {
        FacesContext fc = FacesContext.getCurrentInstance();
        Application app = fc.getApplication();
        ExpressionFactory elFactory = app.getExpressionFactory();
        ELContext elContext = fc.getELContext();
        ValueExpression valueExp =
            elFactory.createValueExpression(elContext, "#{data." + data + ".dataProvider}", Object.class);
        return valueExp.getValue(elContext);

Hence, the solution to our requirement.

If you like the post please comment, share, and do join me on Facebook. Please subscribe to my YouTube Channel for video tutorials.

Thanks & Regards,
Susanto Paul

 484 total views,  1 views today

By Susanto Paul

Susanto is an Oracle ACE, a qualified MCA, MBA, and a highly-skilled Senior Oracle Specialist. He is an enthusiastic Blogger and YouTuber who helps learners to solve their complex problems more efficiently. He has 9+ years of experience in multiple technologies like AWS, Oracle ADF, Oracle APEX, Oracle JET, Oracle VBCS, Oracle IDCS, Oracle PL/SQL, Oracle Integration Cloud, Java, JDBC, Servlets, JSP, Spring, Hibernate, HTML5, CSS3, JavaScript, TypeScript, NodesJS, Angular, MySQL, Oracle WebLogic Server, JUnit, JMeter, Selenium Web Driver, etc. He is a certified: Oracle Certified Professional Java SE 6 Programmer, Oracle ADF 11g Certified Implementation Specialist, Oracle Cloud Platform Application Integration 2020 Certified Specialist, Oracle Cloud Infrastructure Foundations 2020 Certified Associate, and Oracle Cloud Infrastructure Developer 2020 Certified Associate

Leave a Reply

Your email address will not be published. Required fields are marked *