Author: julien_viet
Date: 2009-11-13 11:03:06 -0500 (Fri, 13 Nov 2009)
New Revision: 595
Modified:
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/data/Mapper.java
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestDataStorage.java
Log:
GTNPORTAL-166 : Portal Page inside Container generates an 'Unknown error'
Modified:
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/data/Mapper.java
===================================================================
---
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/data/Mapper.java 2009-11-13
13:36:53 UTC (rev 594)
+++
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/data/Mapper.java 2009-11-13
16:03:06 UTC (rev 595)
@@ -558,10 +558,13 @@
String childId = child.getStorageId();
if (childId != null)
{
- if (hierarchyRelationships.put(childId, parentId) != null)
+ if (hierarchyRelationships.containsKey(childId))
{
throw new AssertionError("The same object is present two times in the
object hierarchy");
- }
+ }
+
+ // Note that we are aware that parent id may be null
+ hierarchyRelationships.put(childId, parentId);
}
if (child instanceof ContainerData)
{
@@ -637,9 +640,10 @@
//
if (!found)
{
- String srcId = hierarchyRelationships.get(srcChildId);
- if (srcId != null)
+ if (hierarchyRelationships.containsKey(srcChildId))
{
+ String srcId = hierarchyRelationships.get(srcChildId);
+
// It's a move operation, so we move the node first
dst.add(dstChild);
@@ -648,8 +652,8 @@
}
else
{
- throw new IllegalArgumentException("Attempt for updating a ui
component " + session.pathOf(dstChild)
- + "that is not present in the target ui container " +
session.pathOf(dst));
+ throw new IllegalArgumentException("Attempt for updating a ui
component " + session.pathOf(dstChild)
+ + " that is not present in the target ui container " +
session.pathOf(dst));
}
}
Modified:
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestDataStorage.java
===================================================================
---
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestDataStorage.java 2009-11-13
13:36:53 UTC (rev 594)
+++
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestDataStorage.java 2009-11-13
16:03:06 UTC (rev 595)
@@ -228,8 +228,30 @@
assertEquals(a3.getStorageId(), ch6.getObject().getStorageId());
}
- // Need to make window move 2 unit test
+ public void testWindowMove2() throws Exception
+ {
+ Page page = storage_.getPage("portal::test::test3");
+ Container container = new Container();
+ Application application = (Application)page.getChildren().remove(0);
+ container.getChildren().add(application);
+ page.getChildren().add(container);
+
+ //
+ storage_.save(page);
+ //
+ Page page2 = storage_.getPage("portal::test::test3");
+
+ //
+ assertEquals(1, page2.getChildren().size());
+ Container container2 = (Container)page2.getChildren().get(0);
+ assertEquals(1, page2.getChildren().size());
+ Application application2 = (Application)container2.getChildren().get(0);
+ assertEquals(application2.getStorageId(), application.getStorageId());
+ }
+
+ // Need to make window move 3 unit test
+
public void testCreateNavigation() throws Exception
{
PortalConfig portal = new PortalConfig();
Show replies by date