Author: hoang_to
Date: 2010-06-07 20:34:26 -0400 (Mon, 07 Jun 2010)
New Revision: 3239
Modified:
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/data/Mapper.java
Log:
GTNPORTAL-1288: Update Java code in Mapper to fix the ClassCastException
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-07
15:25:49 UTC (rev 3238)
+++
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/data/Mapper.java 2010-06-08
00:34:26 UTC (rev 3239)
@@ -798,18 +798,32 @@
String parentId = hierarchyRelationships.get(dstChildId);
if (parentId != null)
{
+ try{
// Get the new parent
- UIContainer parent = session.findObjectById(ObjectType.CONTAINER,
parentId);
+ UIContainer parent = session.findObjectById(ObjectType.CONTAINER,
parentId);
- // Perform the move
- parent.getComponents().add(dstChild);
+ // Perform the move
+ parent.getComponents().add(dstChild);
- //
- changes.add(new ModelChange.Move(dst.getObjectId(), parentId,
dstChildId));
+ //
+ 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
- // will be processed
+ // julien : we do not need to create an update operation
+ // as later the update operation will be created when the
+ // object
+ // will be processed
+ }
+ catch (ClassCastException ex)
+ {
+ // minhhoang : In case the parentId refers to the page, there
+ // is exception in findObjectId. Hence,
+ // we have a temporary try/catch to handle this exception
+ Page parent = session.findObjectById(ObjectType.PAGE, parentId);
+
+ parent.getRootComponent().getComponents().add(dstChild);
+
+ changes.add(new ModelChange.Move(dst.getObjectId(), parentId,
dstChildId));
+ }
}
}
}