Author: chris.laprun(a)jboss.com
Date: 2010-09-22 11:19:57 -0400 (Wed, 22 Sep 2010)
New Revision: 4311
Modified:
portal/branches/wsrp2-integration/component/wsrp/src/main/java/org/gatein/portal/wsrp/MOPPortalStructureProvider.java
Log:
- GTNWSRP-61: Fixed error where the Portal was not able to find the proper new
customization due to caching.
Modified:
portal/branches/wsrp2-integration/component/wsrp/src/main/java/org/gatein/portal/wsrp/MOPPortalStructureProvider.java
===================================================================
---
portal/branches/wsrp2-integration/component/wsrp/src/main/java/org/gatein/portal/wsrp/MOPPortalStructureProvider.java 2010-09-22
15:06:29 UTC (rev 4310)
+++
portal/branches/wsrp2-integration/component/wsrp/src/main/java/org/gatein/portal/wsrp/MOPPortalStructureProvider.java 2010-09-22
15:19:57 UTC (rev 4311)
@@ -27,6 +27,7 @@
import org.exoplatform.portal.mop.Described;
import org.exoplatform.portal.pom.config.POMSession;
import org.exoplatform.portal.pom.config.POMSessionManager;
+import org.exoplatform.portal.pom.data.PageKey;
import org.exoplatform.portal.pom.spi.wsrp.WSRP;
import org.gatein.common.util.ParameterValidation;
import org.gatein.mop.api.content.Customization;
@@ -147,8 +148,11 @@
String uuid = windowIdToUUIDs.get(windowId);
ParameterValidation.throwIllegalArgExceptionIfNull(uuid, "UUID for " +
windowId);
+ // get the window
POMSession session = pomManager.getSession();
UIWindow window = session.findObjectById(ObjectType.WINDOW, uuid);
+
+ // construct the new customization state
WSRP wsrp = new WSRP();
String portletId = portletContext.getId();
wsrp.setPortletId(portletId);
@@ -165,12 +169,19 @@
}
}
- // destroy existing customization
+ // destroy existing customization as otherwise re-customizing will fail
Customization<?> customization = window.getCustomization();
customization.destroy();
// and re-customize
window.customize(WSRP.CONTENT_TYPE, portletId, wsrp);
+
+ // mark page for cache invalidation otherwise DataCache will use the previous
customization id when trying to set
+ // the portlet state in UIPortlet.setState and will not find it resulting in an
error
+ Page page = window.getPage();
+ session.scheduleForEviction(new PageKey("portal",
page.getSite().getName(), page.getName()));
+
+ // save
session.close(true);
}
Show replies by date