This content has been marked as final. Show 5 replies
Yes you can.
But this not considered best practice.
SugarCRMappModule service = null; service = (SugarCRMappModule)Configuration.createRootApplicationModule("com.sample.model.services.SugarCRMappModule","SugarCRMappModuleLocal"); Configuration.releaseRootApplicationModule(service, false);
you can call findDataControl(String) on the BindingContext and access the application module to invoke a method exposed on the Application Module
read this http://electrotek.wordpress.com/2008/01/23/how-to-get-an-applicationmodule-in-backing-bean/
read this best practice doc while invoking service layer methods from managed beans
Edited by: Abhijit Dutta on Mar 4, 2013 6:18 PM
Both these posts are really good. But both of them require the model jar to be present in the ui.
However I do not want that.
I want to call AMImpl method in bean, but without importing the AMImpl in the bean.
Please tell me if that will be possible.
The way to go is definitely to bind the method to the pagedef and use the operation binding to call the method.
It's not a best practice to get the application module in a bean, do some work on the application module, as the binding layer doesn't know about it and will not reflect the changes.
If you realy want to use the am method directly you have to cast the application module to your impl class as you don't have access to the method otherwise.
If you don't want to create an operation binding in the pagedef and don't want to cast the am then you are bust.
Thanks a lot Timo. Now I know why this is not recommended. This needs model project to be imported to ui project which will violate the separation of Model and UI code.