[gatein-commits] gatein SVN: r1438 - portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace.

do-not-reply at jboss.org do-not-reply at jboss.org
Sun Jan 24 22:08:03 EST 2010


Author: truong.le
Date: 2010-01-24 22:08:03 -0500 (Sun, 24 Jan 2010)
New Revision: 1438

Modified:
   portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIPortalApplication.java
Log:
GTNPORTAL-446: Have problem when delete page in Manage pages in special case

Modified: portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIPortalApplication.java
===================================================================
--- portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIPortalApplication.java	2010-01-24 08:51:49 UTC (rev 1437)
+++ portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIPortalApplication.java	2010-01-25 03:08:03 UTC (rev 1438)
@@ -19,10 +19,15 @@
 
 package org.exoplatform.portal.webui.workspace;
 
+import org.exoplatform.container.ExoContainer;
 import org.exoplatform.portal.application.PortalRequestContext;
 import org.exoplatform.portal.config.DataStorage;
+import org.exoplatform.portal.config.NoSuchDataException;
 import org.exoplatform.portal.config.UserPortalConfig;
+import org.exoplatform.portal.config.UserPortalConfigService;
 import org.exoplatform.portal.config.model.Container;
+import org.exoplatform.portal.config.model.Page;
+import org.exoplatform.portal.config.model.PageNode;
 import org.exoplatform.portal.resource.Skin;
 import org.exoplatform.portal.resource.SkinConfig;
 import org.exoplatform.portal.resource.SkinService;
@@ -376,20 +381,21 @@
    }
 
    /**
-    * The processDecode() method is doing 3 actions: 1) if the nodePath is null
-    * (case of the first request) a call to super.processDecode(context) is made
-    * and we end the method here 2) if the nodePath exist but is equals to the
-    * current one then we also call super and stops here 3) if the requested
-    * nodePath is not equals to the current one , then an event of type
-    * PageNodeEvent.CHANGE_PAGE_NODE is sent to the asociated EventListener; a
-    * call to super is then done
+    * The processDecode() method is doing 3 actions: 
+    * 1) if the nodePath is null (case of the first request) a call to 
+    * super.processDecode(context) is made and we end the method here 
+    * 2) if the nodePath exist but is equals to the current one 
+    * then we also call super and stops here 
+    * 3) if the requested nodePath is not equals to the current one or current 
+    * page no longer exists, then an event of type PageNodeEvent.CHANGE_PAGE_NODE 
+    * is sent to the associated EventListener; a call to super is then done
     */
    public void processDecode(WebuiRequestContext context) throws Exception
    {
       PortalRequestContext pcontext = (PortalRequestContext)context;
       String nodePath = pcontext.getNodePath().trim();
-
-      if (!nodePath.equals(nodePath_))
+      
+      if (!nodePath.equals(nodePath_) || !isPageExist())
       {
          nodePath_ = nodePath;
          UIPortal uiPortal = findFirstComponentOfType(UIPortal.class);
@@ -557,5 +563,30 @@
    {
       this.userPortalConfig_ = userPortalConfig;
    }
+   
+   private boolean isPageExist() throws Exception 
+   {
+      WebuiRequestContext context = Util.getPortalRequestContext();
+      ExoContainer appContainer = context.getApplication().getApplicationServiceContainer();
+      UserPortalConfigService userPortalConfigService =
+         (UserPortalConfigService)appContainer.getComponentInstanceOfType(UserPortalConfigService.class);
+      Page page = null;
+      PageNode pageNode = Util.getUIPortal().getSelectedNode();
+      if (pageNode != null)
+      {
+         try
+         {
+            if (pageNode.getPageReference() != null)
+            {
+               page = userPortalConfigService.getPage(pageNode.getPageReference(), context.getRemoteUser());
+            }
+         }
+         catch (NoSuchDataException nsde)
+         {
+            return false;
+         }         
+      }
+      return (page != null);
+   }
 
 }



More information about the gatein-commits mailing list