You can use any of the below methods to get the application module programmatically.
>> private EmployeeAMImpl getAm() {
FacesContext fctx = FacesContext.getCurrentInstance();
DCBindingContainer dc =
(DCBindingContainer)fctx.getApplication().getExpressionFactory().createValueExpression(fctx.getELContext(),
DCBindingContainer.class).getValue(fctx.getELContext());
return (WorkbenchAMImpl)dc.findDataControl("EmployeeAMDataControl").getApplicationModule();
}
>> private EmployeeAMImpl getAm() {
FacesContext fc = FacesContext.getCurrentInstance();
Application app = fc.getApplication();
ExpressionFactory elFactory = app.getExpressionFactory();
ELContext elContext = fc.getELContext();
ValueExpression valueExp =
elFactory.createValueExpression(elContext, "#{data.EmployeeAMDataControl.dataProvider}",
Object.class);
return (WorkbenchAMImpl)valueExp.getValue(elContext);
}