Author: julien_viet
Date: 2010-06-12 09:15:54 -0400 (Sat, 12 Jun 2010)
New Revision: 3305
Modified:
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/data/Mapper.java
Log:
GTNPORTAL-1288 : the layout edition does not work correctly if drag a portlet out of a
container
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 2010-06-12
07:27:18 UTC (rev 3304)
+++
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/data/Mapper.java 2010-06-12
13:15:54 UTC (rev 3305)
@@ -358,9 +358,25 @@
ContainerData srcContainer = src.getPortalLayout();
UIContainer dstContainer = template.getRootComponent();
+ // Workaround to have the real source container used as the model / UI layer lose
this
+ // ID which lead to bugs
+ ContainerData realSrcContainer = new ContainerData(
+ dstContainer.getObjectId(),
+ srcContainer.getId(),
+ srcContainer.getName(),
+ srcContainer.getIcon(),
+ srcContainer.getTemplate(),
+ srcContainer.getFactoryId(),
+ srcContainer.getTitle(),
+ srcContainer.getDescription(),
+ srcContainer.getWidth(),
+ srcContainer.getHeight(),
+ srcContainer.getAccessPermissions(),
+ srcContainer.getChildren());
+
//
- save(srcContainer, dstContainer);
- saveChildren(srcContainer, dstContainer);
+ save(realSrcContainer, dstContainer);
+ saveChildren(realSrcContainer, dstContainer);
//
Templatized templatized = dst.getRootNavigation().getTemplatized();
@@ -568,9 +584,33 @@
//
UIContainer rootContainer = dst.getRootComponent();
- LinkedList<ModelChange> childrenChanges = saveChildren(src, rootContainer);
+ // We are creating a new Page with the root container id as this one is lost
+ // in the model / ui layer. Not doing this cause a class cast exception later
+ // so it's likely the best fix we can do at the moment
+ PageData src2 = new PageData(
+ rootContainer.getObjectId(),
+ src.getId(),
+ src.getName(),
+ src.getIcon(),
+ src.getTemplate(),
+ src.getFactoryId(),
+ src.getTitle(),
+ src.getDescription(),
+ src.getWidth(),
+ src.getHeight(),
+ src.getAccessPermissions(),
+ src.getChildren(),
+ src.getOwnerType(),
+ src.getOwnerId(),
+ src.getEditPermission(),
+ src.isShowMaxWindow()
+ );
+
//
+ LinkedList<ModelChange> childrenChanges = saveChildren(src2, rootContainer);
+
+ //
changes.addAll(childrenChanges);
//
@@ -835,7 +875,8 @@
changes.add(new ModelChange.Move(dst.getObjectId(), parentId,
dstChildId));
// julien : we do not need to create an update operation
- // as later the update operation will be created when the object
+ // as later the update operation will be created when the
+ // object
// will be processed
}
}
Show replies by date