Adding Error Handling Methods

Add the below methods to EquipWorkOrderDC.java. These methods display error messages to the user at runtime, regardless of whether the application is running in the JDEADFContainer web application or in a test page on the local Integrated WebLogic Server.

private void processErrorException(String msg)
{
    logger.severe(msg);
    displayMessage("Error", msg);
}
 
private void processErrorException(Exception e)
{
    logger.severe(e);
    displayMessage("Error", e.getMessage());
}
 
private void displayMessage(String title, String msg)
{
    if (runningInJDEADFContainer)
    {
        E1AdfUtils.addErrorMessage(msg);
        E1AdfUtils.launchMessagePopup();
    }
    else
    {
        ELContext elCtxt = ADFContext.getCurrent().getELContext();
	        ExpressionFactory expFactory = ADFContext.getCurrent().getExpressionFactory();
        	ValueExpression ve = expFactory.createValueExpression(elCtxt, "#{workOrderListenerBean}", Object.class);
         if (ve.getValue(elCtxt) != null)
	        {
		            MethodExpression me = expFactory.createMethodExpression(elCtxt, "#{workOrderListenerBean.displayLocalMessage}", Void.class, new Class[] {String.class, String.class});
		            me.invoke(elCtxt, new Object[] {title, msg});
         }
    }
}