Author: trong.tran
Date: 2010-01-18 23:49:07 -0500 (Mon, 18 Jan 2010)
New Revision: 1358
Added:
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/NoSuchDataException.java
Removed:
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/NoSuchDateException.java
Modified:
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/StorageException.java
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
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestDataStorage.java
portal/trunk/webui/core/pom.xml
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/bean/UIDataFeed.java
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/UIRepeater.java
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/UIVirtualList.java
Log:
GTNPORTAL-273 Improve the code and add unit test for Data Storage services
Copied:
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/NoSuchDataException.java
(from rev 1352,
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/NoSuchDateException.java)
===================================================================
---
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/NoSuchDataException.java
(rev 0)
+++
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/NoSuchDataException.java 2010-01-19
04:49:07 UTC (rev 1358)
@@ -0,0 +1,48 @@
+/******************************************************************************
+ * 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.portal.config;
+
+
+public class NoSuchDataException extends StorageException
+{
+ public NoSuchDataException()
+ {
+ }
+
+ public NoSuchDataException(String message)
+ {
+ super(message);
+ }
+
+ public NoSuchDataException(Throwable cause) {
+ super(cause);
+ }
+
+ public NoSuchDataException(String message, Throwable cause)
+ {
+ super(message, cause);
+ }
+
+}
Deleted:
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/NoSuchDateException.java
===================================================================
---
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/NoSuchDateException.java 2010-01-19
04:29:07 UTC (rev 1357)
+++
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/NoSuchDateException.java 2010-01-19
04:49:07 UTC (rev 1358)
@@ -1,43 +0,0 @@
-/******************************************************************************
- * 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.portal.config;
-
-
-public class NoSuchDateException extends StorageException
-{
- public NoSuchDateException()
- {
- }
-
- public NoSuchDateException(String message)
- {
- super(message);
- }
-
- public NoSuchDateException(String message, Throwable cause)
- {
- super(message, cause);
- }
-
-}
Modified:
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/StorageException.java
===================================================================
---
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/StorageException.java 2010-01-19
04:29:07 UTC (rev 1357)
+++
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/StorageException.java 2010-01-19
04:49:07 UTC (rev 1358)
@@ -15,8 +15,14 @@
super(message);
}
+ public StorageException(Throwable cause)
+ {
+ super(cause);
+ }
+
public StorageException(String message, Throwable cause)
{
super(message, cause);
}
+
}
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-19
04:29:07 UTC (rev 1357)
+++
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMSession.java 2010-01-19
04:49:07 UTC (rev 1358)
@@ -25,7 +25,7 @@
import org.exoplatform.commons.chromattic.SynchronizationListener;
import org.exoplatform.commons.chromattic.SynchronizationStatus;
import org.exoplatform.portal.application.PortletPreferences;
-import org.exoplatform.portal.config.NoSuchDateException;
+import org.exoplatform.portal.config.NoSuchDataException;
import org.exoplatform.portal.pom.data.Mapper;
import org.gatein.mop.api.Model;
import org.gatein.mop.api.content.Customization;
@@ -203,7 +203,7 @@
{
Customization<?> customization = getModel().findCustomizationById(id);
if (customization == null) {
- throw new NoSuchDateException("Can not find " + id);
+ throw new NoSuchDataException("Can not find " + id);
}
return customization;
}
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-19
04:29:07 UTC (rev 1357)
+++
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/PageTask.java 2010-01-19
04:49:07 UTC (rev 1358)
@@ -19,7 +19,7 @@
package org.exoplatform.portal.pom.config.tasks;
-import org.exoplatform.portal.config.NoSuchDateException;
+import org.exoplatform.portal.config.NoSuchDataException;
import org.exoplatform.portal.pom.config.POMTask;
import org.exoplatform.portal.pom.config.cache.DataAccessMode;
import org.exoplatform.portal.pom.config.cache.CacheableDataTask;
@@ -112,7 +112,7 @@
Site srcSite = workspace.getSite(siteType, ownerId);
if (srcSite == null)
{
- throw new NoSuchDateException("Could not clone page " + name +
"from non existing site of type "
+ throw new NoSuchDataException("Could not clone page " + name +
"from non existing site of type "
+ ownerType + " with id " + ownerId);
}
else
@@ -125,7 +125,7 @@
//
if (srcPage == null)
{
- throw new NoSuchDateException("Could not clone non existing page "
+ name + " from site of type "
+ throw new NoSuchDataException("Could not clone non existing page "
+ name + " from site of type "
+ ownerType + " with id " + ownerId);
}
@@ -267,7 +267,7 @@
Site site = workspace.getSite(siteType, ownerId);
if (site == null)
{
- throw new NoSuchDateException("Could not remove page " + name +
"of non existing site of type "
+ throw new NoSuchDataException("Could not remove page " + name +
"of non existing site of type "
+ ownerType + " with id " + ownerId);
}
else
@@ -277,7 +277,7 @@
org.gatein.mop.api.workspace.Page page = pages.getChild(name);
if (page == null)
{
- throw new NoSuchDateException("Could not remove non existing page
" + name + " of site of type "
+ throw new NoSuchDataException("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-19
04:29:07 UTC (rev 1357)
+++
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/PortalConfigTask.java 2010-01-19
04:49:07 UTC (rev 1358)
@@ -20,7 +20,7 @@
package org.exoplatform.portal.pom.config.tasks;
import org.exoplatform.portal.application.PortletPreferences;
-import org.exoplatform.portal.config.NoSuchDateException;
+import org.exoplatform.portal.config.NoSuchDataException;
import org.exoplatform.portal.pom.config.cache.DataAccessMode;
import org.exoplatform.portal.pom.config.cache.CacheableDataTask;
import org.exoplatform.portal.pom.data.Mapper;
@@ -80,7 +80,7 @@
Site site = workspace.getSite(type, key.getId());
if (site == null)
{
- throw new NoSuchDateException("Could not remove non existing portal
" + key.getId());
+ throw new NoSuchDataException("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-19
04:29:07 UTC (rev 1357)
+++
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/PreferencesTask.java 2010-01-19
04:49:07 UTC (rev 1358)
@@ -19,7 +19,7 @@
package org.exoplatform.portal.pom.config.tasks;
-import org.exoplatform.portal.config.NoSuchDateException;
+import org.exoplatform.portal.config.NoSuchDataException;
import org.exoplatform.portal.pom.config.POMSession;
import org.exoplatform.portal.pom.config.POMTask;
import org.exoplatform.portal.pom.config.cache.CacheableDataTask;
@@ -50,7 +50,7 @@
{
Customization<S> customization =
(Customization<S>)session.findCustomizationById(storageId);
if (customization == null) {
- throw new NoSuchDateException("Can not find " + storageId);
+ throw new NoSuchDataException("Can not find " + storageId);
}
return customization.getContentId();
}
@@ -136,7 +136,7 @@
Customization<S> customization =
(Customization<S>)session.findCustomizationById(storageId);
if (customization == null) {
- throw new NoSuchDateException("Can not find " + storageId);
+ throw new NoSuchDataException("Can not find " + storageId);
}
if (prefs != null)
{
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-19
04:29:07 UTC (rev 1357)
+++
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/data/Mapper.java 2010-01-19
04:49:07 UTC (rev 1358)
@@ -19,7 +19,7 @@
package org.exoplatform.portal.pom.data;
-import org.exoplatform.portal.config.NoSuchDateException;
+import org.exoplatform.portal.config.NoSuchDataException;
import org.exoplatform.portal.config.UserACL;
import org.exoplatform.portal.config.model.ApplicationState;
import org.exoplatform.portal.config.model.ApplicationType;
@@ -398,7 +398,7 @@
private List<ComponentData> loadChildren(UIContainer src)
{
- if (src == null) throw new NoSuchDateException("Can not load children");
+ if (src == null) throw new NoSuchDataException("Can not load children");
ArrayList<ComponentData> children = new
ArrayList<ComponentData>(src.size());
for (UIComponent component : src)
{
Modified:
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestDataStorage.java
===================================================================
---
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestDataStorage.java 2010-01-19
04:29:07 UTC (rev 1357)
+++
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestDataStorage.java 2010-01-19
04:49:07 UTC (rev 1358)
@@ -134,7 +134,7 @@
storage_.remove(portal);
fail("was expecting a NoSuchDataException");
}
- catch (NoSuchDateException e)
+ catch (NoSuchDataException e)
{
}
Modified: portal/trunk/webui/core/pom.xml
===================================================================
--- portal/trunk/webui/core/pom.xml 2010-01-19 04:29:07 UTC (rev 1357)
+++ portal/trunk/webui/core/pom.xml 2010-01-19 04:49:07 UTC (rev 1358)
@@ -38,6 +38,11 @@
<version>3.0.0-CR01-SNAPSHOT</version>
</dependency>
<dependency>
+ <groupId>org.exoplatform.portal</groupId>
+ <artifactId>exo.portal.component.portal</artifactId>
+ <version>3.0.0-CR01-SNAPSHOT</version>
+ </dependency>
+ <dependency>
<groupId>org.gatein.common</groupId>
<artifactId>common-common</artifactId>
</dependency>
Modified:
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/bean/UIDataFeed.java
===================================================================
---
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/bean/UIDataFeed.java 2010-01-19
04:29:07 UTC (rev 1357)
+++
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/bean/UIDataFeed.java 2010-01-19
04:49:07 UTC (rev 1358)
@@ -20,7 +20,7 @@
package org.exoplatform.webui.bean;
import org.exoplatform.commons.utils.PageList;
-import org.exoplatform.portal.config.NoSuchDateException;
+import org.exoplatform.portal.config.NoSuchDataException;
/**
* Created by The eXo Platform SAS Author : liem.nguyen ncliam(a)gmail.com Jun 26,
@@ -33,10 +33,10 @@
/***
* Load data of next page. Throws DataMissingException when page's data is cannot
load
- * @throws NoSuchDateException
+ * @throws NoSuchDataException
* @throws Exception
*/
- public void feedNext() throws NoSuchDateException, Exception;
+ public void feedNext() throws NoSuchDataException, Exception;
public boolean hasNext();
}
Modified:
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/UIRepeater.java
===================================================================
---
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/UIRepeater.java 2010-01-19
04:29:07 UTC (rev 1357)
+++
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/UIRepeater.java 2010-01-19
04:49:07 UTC (rev 1358)
@@ -20,7 +20,7 @@
package org.exoplatform.webui.core;
import org.exoplatform.commons.utils.PageList;
-import org.exoplatform.portal.config.NoSuchDateException;
+import org.exoplatform.portal.config.NoSuchDataException;
import org.exoplatform.util.ReflectionUtil;
import org.exoplatform.webui.bean.UIDataFeed;
import org.exoplatform.webui.config.annotation.ComponentConfig;
@@ -106,7 +106,7 @@
return method.invoke(bean, ReflectionUtil.EMPTY_ARGS);
}
- public void feedNext() throws NoSuchDateException, Exception
+ public void feedNext() throws NoSuchDataException, Exception
{
int page = datasource.getCurrentPage();
page++;
@@ -123,10 +123,10 @@
if (obj == null) throw new Exception("Data Row is Null");
}
}
- catch (Throwable e)
+ catch (Exception e)
{
datasource.getPage(page--);
- throw new NoSuchDateException(e);
+ throw new NoSuchDataException(e);
}
}
Modified:
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/UIVirtualList.java
===================================================================
---
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/UIVirtualList.java 2010-01-19
04:29:07 UTC (rev 1357)
+++
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/UIVirtualList.java 2010-01-19
04:49:07 UTC (rev 1358)
@@ -20,7 +20,7 @@
package org.exoplatform.webui.core;
import org.exoplatform.commons.utils.PageList;
-import org.exoplatform.portal.config.NoSuchDateException;
+import org.exoplatform.portal.config.NoSuchDataException;
import org.exoplatform.webui.application.WebuiRequestContext;
import org.exoplatform.webui.bean.UIDataFeed;
import org.exoplatform.webui.config.annotation.ComponentConfig;
@@ -80,7 +80,7 @@
{
dataFeed.feedNext();
}
- catch (NoSuchDateException e)
+ catch (NoSuchDataException e)
{
// Update parent of virtual list to refresh
event.getRequestContext().addUIComponentToUpdateByAjax(virtualList.getParent());