From: Chad B. <cwb...@us...> - 2008-04-08 01:22:14
|
User: cwbrandon Date: 08/04/07 18:20:28 Modified: andromda-jsf2/src/main/resources/templates/jsf2/utils PageableDataModel.java.vsl JsfUtils.java.vsl andromda-jsf2/src/main/resources/templates/jsf2/flow ViewPopulator.java.vsl andromda-jsf2/src/main/resources/templates/jsf2/utils/portlet PageableDataModel.java.vsl Log: enable form serialization for portlets Revision Changes Path 1.2 +1 -0 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/utils/PageableDataModel.java.vsl Index: PageableDataModel.java.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/utils/PageableDataModel.java.vsl,v retrieving revision 1.1 retrieving revision 1.2 diff -u -w -r1.1 -r1.2 --- PageableDataModel.java.vsl 27 Mar 2008 18:34:47 -0000 1.1 +++ PageableDataModel.java.vsl 8 Apr 2008 01:20:28 -0000 1.2 @@ -16,6 +16,7 @@ */ public abstract class $className extends org.apache.myfaces.trinidad.model.CollectionModel + implements java.io.Serializable { private int pageSize; private int rowIndex; 1.3 +23 -19 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/utils/JsfUtils.java.vsl Index: JsfUtils.java.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/utils/JsfUtils.java.vsl,v retrieving revision 1.2 retrieving revision 1.3 diff -u -w -r1.2 -r1.3 --- JsfUtils.java.vsl 25 Feb 2008 14:28:51 -0000 1.2 +++ JsfUtils.java.vsl 8 Apr 2008 01:20:28 -0000 1.3 @@ -4,6 +4,8 @@ #end import org.apache.commons.lang.StringUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; /** * Utilities used within the JSF Cartridge @@ -12,6 +14,8 @@ */ public class $className { + private static Log logger = LogFactory.getLog(JsfUtils.class); + /** * The location of the temporary directoy used the JSF cartridge. */ @@ -44,7 +48,7 @@ * @param session the session from which to create the serialization path. * @param form the form to serialize. */ - public static void serializeForm(final javax.servlet.http.HttpSession session, final Object form) + public static void serializeForm(final $jsfUtils.sessionClassName session, final Object form) { java.io.ObjectOutputStream objectStream = null; try @@ -61,7 +65,7 @@ } catch (final Exception exception) { - // - ignore if we couldn't serialize the form. + logger.warn(exception); } finally { @@ -85,7 +89,7 @@ * @return the serialized form. * @throws Exception */ - public static Object getSerializedForm(final javax.servlet.http.HttpSession session) + public static Object getSerializedForm(final $jsfUtils.sessionClassName session) { Object form = null; java.io.ObjectInputStream objectStream = null; @@ -121,7 +125,7 @@ * * @param session the session for which to remove the serialized form. */ - public static void deleteSerializedForm(final javax.servlet.http.HttpSession session) + public static void deleteSerializedForm(final $jsfUtils.sessionClassName session) { final java.io.File serializationFile = new java.io.File(getFormSerializationPath(session)); @@ -143,7 +147,7 @@ * @param session the session containing the unique id in which to create the path. * @return the path to which serialization occurs. */ - private static String getFormSerializationPath(final javax.servlet.http.HttpSession session) + private static String getFormSerializationPath(final $jsfUtils.sessionClassName session) { return TEMPORARY_DIRECTORY + session.getId() + SERIALIZED_FORM_FILE_NAME; } 1.5 +8 -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.4 retrieving revision 1.5 diff -u -w -r1.4 -r1.5 --- ViewPopulator.java.vsl 21 Mar 2008 16:07:12 -0000 1.4 +++ ViewPopulator.java.vsl 8 Apr 2008 01:20:28 -0000 1.5 @@ -139,6 +139,13 @@ { form = session.getAttribute("$view.formKey"); } +#if ($formSerialization) + // - if the form is still null, see if we can get it from a serialized state + if (form == null) + { + form = ${managedBeansPackage}.JsfUtils.getSerializedForm(session); + } +#end } else { @@ -164,7 +171,7 @@ #end } #end -#if ($standalone && $formSerialization) +#if ($formSerialization) // - serialize the form if (form != null) { 1.8 +1 -0 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/utils/portlet/PageableDataModel.java.vsl Index: PageableDataModel.java.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/utils/portlet/PageableDataModel.java.vsl,v retrieving revision 1.7 retrieving revision 1.8 diff -u -w -r1.7 -r1.8 --- PageableDataModel.java.vsl 3 Apr 2008 19:56:41 -0000 1.7 +++ PageableDataModel.java.vsl 8 Apr 2008 01:20:28 -0000 1.8 @@ -10,6 +10,7 @@ */ public abstract class $className extends javax.faces.model.DataModel + implements java.io.Serializable { private int pageSize; private int rowIndex; |