[gatein-commits] gatein SVN: r5131 - in exo/portal/branches/3.1.x/component/portal/src: main/resources and 2 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Wed Nov 17 03:14:57 EST 2010


Author: phuong_vu
Date: 2010-11-17 03:14:56 -0500 (Wed, 17 Nov 2010)
New Revision: 5131

Added:
   exo/portal/branches/3.1.x/component/portal/src/main/java/org/exoplatform/portal/config/serialize/JibxStringSerialize.java
Modified:
   exo/portal/branches/3.1.x/component/portal/src/main/resources/binding.xml
   exo/portal/branches/3.1.x/component/portal/src/test/java/org/exoplatform/portal/config/TestJIBXXmlMapping.java
   exo/portal/branches/3.1.x/component/portal/src/test/resources/portal/portal/classic/navigation.xml
Log:
EXOGTN-137 [PLF] content of page-reference element in navigation.xml should be trimmed when read in

Copied: exo/portal/branches/3.1.x/component/portal/src/main/java/org/exoplatform/portal/config/serialize/JibxStringSerialize.java (from rev 5114, portal/branches/branch-GTNPORTAL-1643/component/portal/src/main/java/org/exoplatform/portal/config/serialize/JibxStringSerialize.java)
===================================================================
--- exo/portal/branches/3.1.x/component/portal/src/main/java/org/exoplatform/portal/config/serialize/JibxStringSerialize.java	                        (rev 0)
+++ exo/portal/branches/3.1.x/component/portal/src/main/java/org/exoplatform/portal/config/serialize/JibxStringSerialize.java	2010-11-17 08:14:56 UTC (rev 5131)
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2003-2010 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.portal.config.serialize;
+
+public class JibxStringSerialize
+{
+   public static String deserializeString(String untrimmed) 
+   { 
+      if (untrimmed == null) 
+      {
+         return null;         
+      }
+      return untrimmed.trim(); 
+   } 
+}

Modified: exo/portal/branches/3.1.x/component/portal/src/main/resources/binding.xml
===================================================================
--- exo/portal/branches/3.1.x/component/portal/src/main/resources/binding.xml	2010-11-17 07:52:05 UTC (rev 5130)
+++ exo/portal/branches/3.1.x/component/portal/src/main/resources/binding.xml	2010-11-17 08:14:56 UTC (rev 5131)
@@ -97,7 +97,8 @@
     <value name="start-publication-date" field="startPublicationDate" usage="optional"/>
     <value name="end-publication-date" field="endPublicationDate" usage="optional"/>
     <value name="visibility" field="visibility" usage="optional" default="DISPLAYED"/>
-    <value name="page-reference" field="pageReference" usage="optional"/>
+    <value name="page-reference" field="pageReference" usage="optional"
+       deserializer="org.exoplatform.portal.config.serialize.JibxStringSerialize.deserializeString"/>
     <collection field="children" usage="optional" item-type="org.exoplatform.portal.config.model.PageNode"/>
   </mapping>
   

Modified: exo/portal/branches/3.1.x/component/portal/src/test/java/org/exoplatform/portal/config/TestJIBXXmlMapping.java
===================================================================
--- exo/portal/branches/3.1.x/component/portal/src/test/java/org/exoplatform/portal/config/TestJIBXXmlMapping.java	2010-11-17 07:52:05 UTC (rev 5130)
+++ exo/portal/branches/3.1.x/component/portal/src/test/java/org/exoplatform/portal/config/TestJIBXXmlMapping.java	2010-11-17 08:14:56 UTC (rev 5131)
@@ -83,6 +83,9 @@
          uctx.unmarshalDocument(new FileInputStream("src/test/resources/portal/portal/classic/navigation.xml"), null);
       assertEquals(PageNavigation.class, obj.getClass());
 
+      PageNavigation pageNavigation = (PageNavigation)obj;
+      assertEquals("portal::classic::homepage", pageNavigation.getNode("home").getPageReference());
+
       IMarshallingContext mctx = bfact.createMarshallingContext();
       mctx.setIndent(2);
       mctx.marshalDocument(obj, "UTF-8", null, new FileOutputStream("target/navigation.xml"));

Modified: exo/portal/branches/3.1.x/component/portal/src/test/resources/portal/portal/classic/navigation.xml
===================================================================
--- exo/portal/branches/3.1.x/component/portal/src/test/resources/portal/portal/classic/navigation.xml	2010-11-17 07:52:05 UTC (rev 5130)
+++ exo/portal/branches/3.1.x/component/portal/src/test/resources/portal/portal/classic/navigation.xml	2010-11-17 08:14:56 UTC (rev 5131)
@@ -30,7 +30,9 @@
 	    <uri>home</uri>
 	    <name>home</name>
 	    <label>#{portal.classic.home}</label>
-	    <page-reference>portal::classic::homepage</page-reference>	    
+      <page-reference>
+         portal::classic::homepage
+      </page-reference>
 	  </node>    
 	  <node>
 	    <uri>webexplorer</uri>



More information about the gatein-commits mailing list