Thursday, May 12, 2011

Get the Application Module instance in backing bean from Data Control in Oracle ADF?

Sometimes we might need the view object instance or the application module instance in the manged bean in the view controller project. The following code snippet is a sample to do the same

import oracle.adf.model.BindingContext;
import oracle.adf.model.binding.DCDataControl;
import oracle.jbo.ApplicationModule;

public static ApplicationModule getAMOfDataControl(String name){
    BindingContext bindingContext = BindingContext.getCurrent();
    ApplicationModule appModule = null;
    if (bindingContext != null) {
        DCDataControl dc = bindingContext.findDataControl(name);
        if (dc != null) {
            appModule = (ApplicationModule)dc.getDataProvider();
        }
    }
    return appModule;
}

Once we get the application module, we can get the required View Object instance.

No comments:

Post a Comment