ADF: Custom Error Handler in Model layer
ADF: Custom Error Handler in Model layer
http://adftutorials.com/adf-custom-error-handler-to-display-custom-message-to-user.html
In Model Project
------------------
Step1 : custom error handler that extends the DCErrorHandlerImpl class
eg:
public final class MyErrorMessageHandler extends DCErrorHandlerImpl {
public String getDisplayMessage(BindingContext ctx, Exception ex) {
String message="";
if (ex instanceof oracle.jbo.ValidationException) {
String msg = ex.getMessage();
int i=msg.indexOf("JBO-25013");//When JBO-25013 Too many object match promary key exception occur.
if(i>0)
{
message= "Duplicate Employee Id Found.";
}
message= getDisplayMessage(ctx,ex);
}
else
{
message=getDisplayMessage(ctx,ex);
}
return message;
}
In View Project
------------------
Step2 : Register MyCustomErrorHandler class into Databinding.cpx file.
<?xml version="1.0" encoding="UTF-8" ?>
<Application xmlns="http://xmlns.oracle.com/adfm/application"
version="11.1.1.60.13" id="DataBindings" SeparateXMLFiles="false"
Package="com.in.adftutorials.view" ClientType="Generic"
ErrorHandlerClass="com.in.adftutorials.view.MyCustomErrorHandler">
No comments:
Post a Comment