Author: thomas.heute(a)jboss.com
Date: 2010-10-27 06:36:41 -0400 (Wed, 27 Oct 2010)
New Revision: 4855
Added:
epp/portal/branches/EPP_5_1_Branch/component/portal/src/main/java/org/exoplatform/portal/config/serialize/JibxStringSerialize.java
Modified:
epp/portal/branches/EPP_5_1_Branch/component/portal/src/main/resources/binding.xml
epp/portal/branches/EPP_5_1_Branch/component/portal/src/test/java/org/exoplatform/portal/config/TestJIBXXmlMapping.java
epp/portal/branches/EPP_5_1_Branch/component/portal/src/test/resources/portal/portal/classic/navigation.xml
Log:
JBEPP-583: Content of page-reference element in navigation.xml should be trimmed when read
in
Copied:
epp/portal/branches/EPP_5_1_Branch/component/portal/src/main/java/org/exoplatform/portal/config/serialize/JibxStringSerialize.java
(from rev 4429,
portal/branches/branch-GTNPORTAL-1493/component/portal/src/main/java/org/exoplatform/portal/config/serialize/JibxStringSerialize.java)
===================================================================
---
epp/portal/branches/EPP_5_1_Branch/component/portal/src/main/java/org/exoplatform/portal/config/serialize/JibxStringSerialize.java
(rev 0)
+++
epp/portal/branches/EPP_5_1_Branch/component/portal/src/main/java/org/exoplatform/portal/config/serialize/JibxStringSerialize.java 2010-10-27
10:36:41 UTC (rev 4855)
@@ -0,0 +1,35 @@
+/*
+ * 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;
+
+/**
+ * Created by The eXo Platform SAS
+ * Author : Vu Viet Phuong
+ * phuong_vu(a)exoplatform.com
+ * Sep 29, 2010
+ */
+public class JibxStringSerialize
+{
+ public static String deserializeString(String untrimmed)
+ {
+ if (untrimmed == null)
+ {
+ return null;
+ }
+ return untrimmed.trim();
+ }
+}
Modified:
epp/portal/branches/EPP_5_1_Branch/component/portal/src/main/resources/binding.xml
===================================================================
---
epp/portal/branches/EPP_5_1_Branch/component/portal/src/main/resources/binding.xml 2010-10-27
10:24:33 UTC (rev 4854)
+++
epp/portal/branches/EPP_5_1_Branch/component/portal/src/main/resources/binding.xml 2010-10-27
10:36:41 UTC (rev 4855)
@@ -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>
@@ -146,6 +147,5 @@
<collection field="preferences"
item-type="org.exoplatform.portal.application.Preference"/>
<structure name="preferences-validator" usage="optional"/>
- </mapping>
-
+ </mapping>
</binding>
Modified:
epp/portal/branches/EPP_5_1_Branch/component/portal/src/test/java/org/exoplatform/portal/config/TestJIBXXmlMapping.java
===================================================================
---
epp/portal/branches/EPP_5_1_Branch/component/portal/src/test/java/org/exoplatform/portal/config/TestJIBXXmlMapping.java 2010-10-27
10:24:33 UTC (rev 4854)
+++
epp/portal/branches/EPP_5_1_Branch/component/portal/src/test/java/org/exoplatform/portal/config/TestJIBXXmlMapping.java 2010-10-27
10:36:41 UTC (rev 4855)
@@ -82,6 +82,9 @@
Object obj =
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);
Modified:
epp/portal/branches/EPP_5_1_Branch/component/portal/src/test/resources/portal/portal/classic/navigation.xml
===================================================================
---
epp/portal/branches/EPP_5_1_Branch/component/portal/src/test/resources/portal/portal/classic/navigation.xml 2010-10-27
10:24:33 UTC (rev 4854)
+++
epp/portal/branches/EPP_5_1_Branch/component/portal/src/test/resources/portal/portal/classic/navigation.xml 2010-10-27
10:36:41 UTC (rev 4855)
@@ -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>