I am using 22.214.171.124.0
In our page, we have enterable form which is based on a EO based VO. User can create/update/delete records on this form and click submit button to commit the changes.
In our EOImpl, we are not using standard ADF BC for data manipulation. We overide doDML to call backend plsql API which will do some validations and data manipulation(insert, update,delete).
The 2 cases that we have implemented without issues are:
1. When backend API return status "-1", we will throw JboException with the error message returned by the backend API, so that EO row will not be saved and error message will be return back to the UI automatically and displayed as a error popup.
throw new JboException(msg);
2. When backend API return status "0" that no exception being raised in doDML , ADF will commit all the data manipulation and all changes are saved
However, there are 3rd case when status is "1" that how to implement in doDML :
3.Backend API will return status "1" for warning message. For this case, want to show the warning message to the UI as a popup and confirm button. Commit should happen only after user confirm on Warning popup.
Can anybody help me is there a way in EO doDML that we can pass message back to UI for displaying and wait for user confirmation before commiting the transaction ?
in this case you also throw an oracle.jbo.JboException and have the UI showing the error. However. instead of throwing native JboException I would create my own extension and call it ApplicationWarning
1. public class ApplicationWarning extends JboExcpetion
2. You then can throw your own error message as you are used to do in PLSQL as well
3. Provide a language package for the user interface to pick the message text (optional if you need translation)
4. In the DataBiningds.cpx file you create your own ADF error Handler: see http://docs.oracle.com/cd/E23943_01/web.1111/b31974/web_adv.htm#CIHHBEEJ
In the custom error handler you check if the exception is an instance of "ApplicationWarning" and if it is show a custom message dialog on the page (requires you to have a consittent view infrastructure that contains a custom popup that can be raised and that can be configured with the message. When the user clicks OK you can then - in a managed bean - do whatever needs t be done.
In case that error 1 means the commit wasn't successful, you would keep a variable entry in the EntityImpl class that you fill with a flag for what the last operation was. If this flag then is identical with the next commit (entity state) then you pass this along to the Store Procedure to suppress the warning
Above implementation guidance makes sense to me. But i have a question further :
"+In the custom error handler you check if the exception is an instance of "ApplicationWarning" and if it is show a custom message dialog on the page (requires you to have a consittent view infrastructure that contains a custom popup that can be raised and that can be configured with the message. When the user clicks OK you can then - in a managed bean - do whatever needs t be done.+"
Where should I created that view infrastructure ? How should I tell CustomErrorHandler to invoke that customViewinfrastructure. I have done a lot of google and read the Dev guide also , but could not find a reference in this regard.
What i did till now ... I created customErrorHandler and wrote code to skip customException raised so that ADF doesn't show it's own error popup. But how to make sure that ADF shows my custom exception in a different pop ( defined by me ).
Edited by: Rajdeep on Feb 7, 2013 11:39 AM