From: Chad B. <cwb...@us...> - 2008-05-15 19:30:24
|
User: cwbrandon Date: 08/05/15 12:30:28 Modified: andromda-jsf2/src/main/resources/templates/jsf2/flow ViewPopulator.java.vsl andromda-jsf2/src/main/resources/templates/jsf2/controllers Controller.java.vsl Log: improve exception handling a bit (make sure the form that was set before an exception occured is set back) Revision Changes Path 1.8 +2 -1 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/flow/ViewPopulator.java.vsl Index: ViewPopulator.java.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/flow/ViewPopulator.java.vsl,v retrieving revision 1.7 retrieving revision 1.8 diff -u -w -r1.7 -r1.8 --- ViewPopulator.java.vsl 8 Apr 2008 16:29:06 -0000 1.7 +++ ViewPopulator.java.vsl 15 May 2008 19:30:24 -0000 1.8 @@ -156,6 +156,7 @@ try { #if (!$view.formActions.empty) + final boolean override = (($jsfUtils.requestClassName)facesContext.getExternalContext().getRequest()).getAttribute(${view.useCase.controller.name}.CONTROLLER_EXCEPTION) != null; // - populate the forms if (form != null) { @@ -165,7 +166,7 @@ facesContext, "$action.formBeanName"); // - populate the $action.formBeanName with any parameters from the previous form - ${managedBeansPackage}.${formPopulatorName}.populateForm(form, $action.formBeanName); + ${managedBeansPackage}.${formPopulatorName}.populateForm(form, $action.formBeanName, override); request.setAttribute("$action.formBeanName", $action.formBeanName); #end } 1.13 +4 -0 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/controllers/Controller.java.vsl Index: Controller.java.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/controllers/Controller.java.vsl,v retrieving revision 1.12 retrieving revision 1.13 diff -u -w -r1.12 -r1.13 --- Controller.java.vsl 29 Mar 2008 00:05:32 -0000 1.12 +++ Controller.java.vsl 15 May 2008 19:30:28 -0000 1.13 @@ -8,6 +8,8 @@ public abstract class $controller.name implements java.io.Serializable { + static final String CONTROLLER_EXCEPTION = ${controller.name}.class.getName() + ".exception"; + #foreach ($operation in $controller.operations) /** $operation.getDocumentation(" * ") @@ -75,6 +77,7 @@ } catch (final Throwable throwable) { + this.getRequest().setAttribute(CONTROLLER_EXCEPTION, throwable); this.setForm("$action.formKey", currentForm, false); final String messageKey = ${managedBeansPackage}.${patternMatchingExceptionHandler}.instance().handleException(throwable); if(!org.apache.commons.lang.StringUtils.isEmpty(messageKey)) @@ -83,6 +86,7 @@ } catch (final Throwable throwable) { + this.getRequest().setAttribute(CONTROLLER_EXCEPTION, throwable); this.setForm("$action.formKey", currentForm, false); this.addExceptionMessage(throwable); // - set the forward to null so that we stay on the current view |