[gatein-commits] gatein SVN: r1343 - in portal/trunk/component: portal/src/main/java/org/exoplatform/portal/pom/config and 2 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Mon Jan 18 02:59:26 EST 2010


Author: liem_nguyen
Date: 2010-01-18 02:59:26 -0500 (Mon, 18 Jan 2010)
New Revision: 1343

Added:
   portal/trunk/component/common/src/main/java/org/exoplatform/commons/utils/DataMissingException.java
Modified:
   portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMSession.java
   portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/PageTask.java
   portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/PortalConfigTask.java
   portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/PreferencesTask.java
   portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/data/Mapper.java
Log:
GTNPORTAL-273 Still edit navigation of portal which was deleted

Added: portal/trunk/component/common/src/main/java/org/exoplatform/commons/utils/DataMissingException.java
===================================================================
--- portal/trunk/component/common/src/main/java/org/exoplatform/commons/utils/DataMissingException.java	                        (rev 0)
+++ portal/trunk/component/common/src/main/java/org/exoplatform/commons/utils/DataMissingException.java	2010-01-18 07:59:26 UTC (rev 1343)
@@ -0,0 +1,52 @@
+/******************************************************************************
+  * JBoss, a division of Red Hat                                               *
+  * Copyright 2009, Red Hat Middleware, LLC, and individual                    *
+  * contributors as indicated by the @authors tag. See the                     *
+  * copyright.txt in the distribution for a full listing of                    *
+  * individual contributors.                                                   *
+  *                                                                            *
+  * This is free software; you can redistribute it and/or modify it            *
+  * under the terms of the GNU Lesser General Public License as                *
+  * published by the Free Software Foundation; either version 2.1 of           *
+  * the License, or (at your option) any later version.                        *
+  *                                                                            *
+  * This software is distributed in the hope that it will be useful,           *
+  * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
+  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU           *
+  * Lesser General Public License for more details.                            *
+  *                                                                            *
+  * You should have received a copy of the GNU Lesser General Public           *
+  * License along with this software; if not, write to the Free                *
+  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA         *
+  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.                   *
+  ******************************************************************************/
+
+package org.exoplatform.commons.utils;
+
+public class DataMissingException extends RuntimeException
+{
+
+   public DataMissingException()
+   {
+      // TODO Auto-generated constructor stub
+   }
+
+   public DataMissingException(String message)
+   {
+      super(message);
+      // TODO Auto-generated constructor stub
+   }
+
+   public DataMissingException(Throwable cause)
+   {
+      super(cause);
+      // TODO Auto-generated constructor stub
+   }
+
+   public DataMissingException(String message, Throwable cause)
+   {
+      super(message, cause);
+      // TODO Auto-generated constructor stub
+   }
+
+}

Modified: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMSession.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMSession.java	2010-01-18 04:18:28 UTC (rev 1342)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMSession.java	2010-01-18 07:59:26 UTC (rev 1343)
@@ -24,6 +24,7 @@
 import org.exoplatform.commons.chromattic.SessionContext;
 import org.exoplatform.commons.chromattic.SynchronizationListener;
 import org.exoplatform.commons.chromattic.SynchronizationStatus;
+import org.exoplatform.commons.utils.DataMissingException;
 import org.exoplatform.portal.application.PortletPreferences;
 import org.exoplatform.portal.pom.data.Mapper;
 import org.gatein.mop.api.Model;
@@ -200,7 +201,11 @@
 
    public Customization<?> findCustomizationById(String id)
    {
-      return getModel().findCustomizationById(id);
+      Customization<?> customization = getModel().findCustomizationById(id);
+      if (customization == null) {
+         throw new DataMissingException("Can not find " + id);
+      }
+      return customization;
    }
 
    public void addPortletPreferences(PortletPreferences prefs)

Modified: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/PageTask.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/PageTask.java	2010-01-18 04:18:28 UTC (rev 1342)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/PageTask.java	2010-01-18 07:59:26 UTC (rev 1343)
@@ -19,6 +19,7 @@
 
 package org.exoplatform.portal.pom.config.tasks;
 
+import org.exoplatform.commons.utils.DataMissingException;
 import org.exoplatform.portal.pom.config.POMTask;
 import org.exoplatform.portal.pom.config.cache.DataAccessMode;
 import org.exoplatform.portal.pom.config.cache.CacheableDataTask;
@@ -111,7 +112,7 @@
          Site srcSite = workspace.getSite(siteType, ownerId);
          if (srcSite == null)
          {
-            throw new IllegalArgumentException("Could not clone  page " + name + "from non existing site of type "
+            throw new DataMissingException("Could not clone  page " + name + "from non existing site of type "
                + ownerType + " with id " + ownerId);
          }
          else
@@ -124,7 +125,7 @@
          //
          if (srcPage == null)
          {
-            throw new IllegalArgumentException("Could not clone non existing page " + name + " from site of type "
+            throw new DataMissingException("Could not clone non existing page " + name + " from site of type "
                + ownerType + " with id " + ownerId);
          }
 
@@ -266,7 +267,7 @@
          Site site = workspace.getSite(siteType, ownerId);
          if (site == null)
          {
-            throw new IllegalArgumentException("Could not remove page " + name + "of non existing site of type "
+            throw new DataMissingException("Could not remove page " + name + "of non existing site of type "
                + ownerType + " with id " + ownerId);
          }
          else
@@ -276,7 +277,7 @@
             org.gatein.mop.api.workspace.Page page = pages.getChild(name);
             if (page == null)
             {
-               throw new IllegalArgumentException("Could not remove non existing page " + name + " of site of type "
+               throw new DataMissingException("Could not remove non existing page " + name + " of site of type "
                   + ownerType + " with id " + ownerId);
             }
             page.destroy();

Modified: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/PortalConfigTask.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/PortalConfigTask.java	2010-01-18 04:18:28 UTC (rev 1342)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/PortalConfigTask.java	2010-01-18 07:59:26 UTC (rev 1343)
@@ -19,6 +19,7 @@
 
 package org.exoplatform.portal.pom.config.tasks;
 
+import org.exoplatform.commons.utils.DataMissingException;
 import org.exoplatform.portal.application.PortletPreferences;
 import org.exoplatform.portal.pom.config.cache.DataAccessMode;
 import org.exoplatform.portal.pom.config.cache.CacheableDataTask;
@@ -79,7 +80,7 @@
          Site site = workspace.getSite(type, key.getId());
          if (site == null)
          {
-            throw new NullPointerException("Could not remove non existing portal " + key.getId());
+            throw new DataMissingException("Could not remove non existing portal " + key.getId());
          }
          else
          {

Modified: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/PreferencesTask.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/PreferencesTask.java	2010-01-18 04:18:28 UTC (rev 1342)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/PreferencesTask.java	2010-01-18 07:59:26 UTC (rev 1343)
@@ -19,6 +19,7 @@
 
 package org.exoplatform.portal.pom.config.tasks;
 
+import org.exoplatform.commons.utils.DataMissingException;
 import org.exoplatform.portal.pom.config.POMSession;
 import org.exoplatform.portal.pom.config.POMTask;
 import org.exoplatform.portal.pom.config.cache.CacheableDataTask;
@@ -48,6 +49,9 @@
       public String run(POMSession session) throws Exception
       {
          Customization<S> customization = (Customization<S>)session.findCustomizationById(storageId);
+         if (customization == null) {
+            throw new DataMissingException("Can not find " + storageId);
+         }
          return customization.getContentId();
       }
    }
@@ -131,7 +135,9 @@
       {
 
          Customization<S> customization = (Customization<S>)session.findCustomizationById(storageId);
-
+         if (customization == null) {
+            throw new DataMissingException("Can not find " + storageId);
+         }
          if (prefs != null)
          {
             customization.setState(prefs);

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-01-18 04:18:28 UTC (rev 1342)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/data/Mapper.java	2010-01-18 07:59:26 UTC (rev 1343)
@@ -19,6 +19,7 @@
 
 package org.exoplatform.portal.pom.data;
 
+import org.exoplatform.commons.utils.DataMissingException;
 import org.exoplatform.portal.config.UserACL;
 import org.exoplatform.portal.config.model.ApplicationState;
 import org.exoplatform.portal.config.model.ApplicationType;
@@ -397,6 +398,7 @@
 
    private List<ComponentData> loadChildren(UIContainer src)
    {
+      if (src == null) throw new DataMissingException("Can not load children");
       ArrayList<ComponentData> children = new ArrayList<ComponentData>(src.size());
       for (UIComponent component : src)
       {



More information about the gatein-commits mailing list