gatein SVN: r416 - in portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal: pom/config and 3 other directories.
by do-not-reply@jboss.org
Author: julien_viet
Date: 2009-10-24 06:48:25 -0400 (Sat, 24 Oct 2009)
New Revision: 416
Added:
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/ExecutorDispatcher.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/TaskExecutor.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/cache/
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/cache/CacheableDataTask.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/cache/DataAccessMode.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/cache/DataCache.java
Modified:
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/DataStorageImpl.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMDataStorage.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/PageNavigationTask.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/PageTask.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/PortalConfigTask.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/ModelDataStorage.java
Log:
first bits of proper caching
Modified: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/DataStorageImpl.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/DataStorageImpl.java 2009-10-24 08:35:40 UTC (rev 415)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/DataStorageImpl.java 2009-10-24 10:48:25 UTC (rev 416)
@@ -37,7 +37,6 @@
import org.exoplatform.portal.pom.data.PageKey;
import org.exoplatform.portal.pom.data.PortalData;
import org.exoplatform.portal.pom.data.PortalKey;
-import org.exoplatform.portal.pom.config.tasks.DashboardTask;
import java.lang.reflect.Array;
import java.util.Comparator;
@@ -261,13 +260,13 @@
public Dashboard loadDashboard(String dashboardId) throws Exception
{
- DashboardData data = delegate.execute(new DashboardTask.Load(dashboardId)).getDashboard();
+ DashboardData data = delegate.loadDashboard(dashboardId);
return data != null ? new Dashboard(data) : null;
}
public void saveDashboard(Dashboard dashboard) throws Exception
{
- delegate.execute(new DashboardTask.Save(dashboard.build()));
+ delegate.saveDashboard(dashboard.build());
}
public void begin()
Added: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/ExecutorDispatcher.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/ExecutorDispatcher.java (rev 0)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/ExecutorDispatcher.java 2009-10-24 10:48:25 UTC (rev 416)
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2003-2007 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.portal.pom.config;
+
+import org.exoplatform.portal.pom.config.TaskExecutor;
+import org.exoplatform.services.log.ExoLogger;
+import org.exoplatform.services.log.Log;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class ExecutorDispatcher implements TaskExecutor
+{
+
+ /** . */
+ private final POMSessionManager pomMgr;
+
+ /** . */
+ private final Log log = ExoLogger.getLogger(getClass());
+
+ /** . */
+ private static final String[] padding = {" ", " ", " ", " "};
+
+ public ExecutorDispatcher(POMSessionManager pomMgr)
+ {
+ this.pomMgr = pomMgr;
+ }
+
+ public <T extends POMTask> T execute(T task) throws Exception
+ {
+ String s = task.toString();
+ long t0 = System.currentTimeMillis();
+ pomMgr.execute(task);
+ long t1 = System.currentTimeMillis();
+ String t = "" + (t1 - t0);
+ if (t.length() < 4)
+ {
+ t = padding[t.length()] + t;
+ log.info("Executed [" + t + "] " + s + "");
+ }
+ else
+ {
+ log.info("Executed in " + t + " " + s + "");
+ }
+ return task;
+ }
+}
Modified: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMDataStorage.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMDataStorage.java 2009-10-24 08:35:40 UTC (rev 415)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMDataStorage.java 2009-10-24 10:48:25 UTC (rev 416)
@@ -29,6 +29,10 @@
import org.exoplatform.portal.config.model.Container;
import org.exoplatform.portal.config.model.ModelChange;
import org.exoplatform.portal.config.model.ModelObject;
+import org.exoplatform.portal.pom.config.cache.DataCache;
+import org.exoplatform.portal.pom.config.TaskExecutor;
+import org.exoplatform.portal.pom.config.tasks.DashboardTask;
+import org.exoplatform.portal.pom.data.DashboardData;
import org.exoplatform.portal.pom.data.ModelDataStorage;
import org.exoplatform.portal.pom.data.NavigationData;
import org.exoplatform.portal.pom.data.NavigationKey;
@@ -44,6 +48,7 @@
import org.exoplatform.portal.pom.config.tasks.PortletPreferencesTask;
import org.exoplatform.portal.pom.config.tasks.PreferencesTask;
import org.exoplatform.portal.pom.config.tasks.SearchTask;
+import org.exoplatform.services.cache.CacheService;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
import org.jibx.runtime.BindingDirectory;
@@ -70,34 +75,17 @@
/** . */
private final Log log = ExoLogger.getLogger(getClass());
+
+ /** . */
+ private final TaskExecutor executor;
- public POMDataStorage(POMSessionManager pomMgr, ConfigurationManager confManager)
+ public POMDataStorage(CacheService cacheService, POMSessionManager pomMgr, ConfigurationManager confManager)
{
this.pomMgr = pomMgr;
- confManager_ = confManager;
+ this.confManager_ = confManager;
+ this.executor = new DataCache(cacheService, new ExecutorDispatcher(pomMgr));
}
- private static final String[] padding = {" ", " ", " ", " "};
-
- public <T extends POMTask> T execute(T task) throws Exception
- {
- String s = task.toString();
- long t0 = System.currentTimeMillis();
- pomMgr.execute(task);
- long t1 = System.currentTimeMillis();
- String t = "" + (t1 - t0);
- if (t.length() < 4)
- {
- t = padding[t.length()] + t;
- log.info("Executed [" + t + "] " + s + "");
- }
- else
- {
- log.info("Executed in " + t + " " + s + "");
- }
- return task;
- }
-
public POMSessionManager getPOMSessionManager()
{
return pomMgr;
@@ -105,73 +93,73 @@
public PortalData getPortalConfig(PortalKey key) throws Exception
{
- return execute(new PortalConfigTask.Load(key)).getConfig();
+ return executor.execute(new PortalConfigTask.Load(key)).getConfig();
}
public void create(PortalData config) throws Exception
{
- execute(new PortalConfigTask.Save(config, true));
+ executor.execute(new PortalConfigTask.Save(config, true));
}
public void save(PortalData config) throws Exception
{
- execute(new PortalConfigTask.Save(config, true));
+ executor.execute(new PortalConfigTask.Save(config, true));
}
public void remove(PortalData config) throws Exception
{
- execute(new PortalConfigTask.Remove(config.getKey()));
+ executor.execute(new PortalConfigTask.Remove(config.getKey()));
}
public PageData getPage(PageKey key) throws Exception
{
- return execute(new PageTask.Load(key)).getPage();
+ return executor.execute(new PageTask.Load(key)).getPage();
}
public PageData clonePage(PageKey key, PageKey cloneKey)
throws Exception
{
- return execute(new PageTask.Clone(key, cloneKey, true)).getPage();
+ return executor.execute(new PageTask.Clone(key, cloneKey, true)).getPage();
}
public void remove(PageData page) throws Exception
{
- execute(new PageTask.Remove(page));
+ executor.execute(new PageTask.Remove(page));
}
public void create(PageData page) throws Exception
{
- execute(new PageTask.Save(page));
+ executor.execute(new PageTask.Save(page));
}
public List<ModelChange> save(PageData page) throws Exception
{
- return execute(new PageTask.Save(page)).getChanges();
+ return executor.execute(new PageTask.Save(page)).getChanges();
}
public NavigationData getPageNavigation(NavigationKey key) throws Exception
{
- return execute(new PageNavigationTask.Load(key)).getPageNavigation();
+ return executor.execute(new PageNavigationTask.Load(key)).getPageNavigation();
}
public void save(NavigationData navigation) throws Exception
{
- execute(new PageNavigationTask.Save(navigation, true));
+ executor.execute(new PageNavigationTask.Save(navigation, true));
}
public void create(NavigationData navigation) throws Exception
{
- execute(new PageNavigationTask.Save(navigation, false));
+ executor.execute(new PageNavigationTask.Save(navigation, false));
}
public void remove(NavigationData navigation) throws Exception
{
- execute(new PageNavigationTask.Remove(navigation));
+ executor.execute(new PageNavigationTask.Remove(navigation));
}
public void save(PortletPreferences portletPreferences) throws Exception
{
- execute(new PortletPreferencesTask.Save(portletPreferences));
+ executor.execute(new PortletPreferencesTask.Save(portletPreferences));
}
public <S> S load(ApplicationState<S> state) throws Exception
@@ -185,7 +173,7 @@
else
{
PreferencesTask.Load<S> load = new PreferencesTask.Load<S>((PersistentApplicationState<S>)state);
- execute(load);
+ executor.execute(load);
return load.getState();
}
}
@@ -199,14 +187,14 @@
else
{
PreferencesTask.Save<S> save = new PreferencesTask.Save<S>((PersistentApplicationState<S>)state, preferences);
- execute(save);
+ executor.execute(save);
return state;
}
}
public PortletPreferences getPortletPreferences(String windowID) throws Exception
{
- return execute(new PortletPreferencesTask.Load(windowID)).getPreferences();
+ return executor.execute(new PortletPreferencesTask.Load(windowID)).getPreferences();
}
public <T> LazyPageList<T> find(Query<T> q) throws Exception
@@ -219,23 +207,23 @@
Class<T> type = q.getClassType();
if (PageData.class.equals(type))
{
- return (LazyPageList<T>)execute(new SearchTask.FindPage((Query<PageData>)q)).getResult();
+ return (LazyPageList<T>)executor.execute(new SearchTask.FindPage((Query<PageData>)q)).getResult();
}
else if (NavigationData.class.equals(type))
{
- return (LazyPageList<T>)execute(new SearchTask.FindNavigation((Query<NavigationData>)q)).getResult();
+ return (LazyPageList<T>)executor.execute(new SearchTask.FindNavigation((Query<NavigationData>)q)).getResult();
}
else if (PortletPreferences.class.equals(type))
{
- return (LazyPageList<T>)execute(new SearchTask.FindPortletPreferences((Query<PortletPreferences>)q)).getResult();
+ return (LazyPageList<T>)executor.execute(new SearchTask.FindPortletPreferences((Query<PortletPreferences>)q)).getResult();
}
else if (PortalData.class.equals(type) && "portal".equals(q.getOwnerType()))
{
- return (LazyPageList<T>)execute(new SearchTask.FindSite((Query<PortalData>)q)).getResult();
+ return (LazyPageList<T>)executor.execute(new SearchTask.FindSite((Query<PortalData>)q)).getResult();
}
else if (PortalKey.class.equals(type) && "portal".equals(q.getOwnerType()))
{
- return (LazyPageList<T>)execute(new SearchTask.FindSiteKey((Query<PortalKey>)q)).getResult();
+ return (LazyPageList<T>)executor.execute(new SearchTask.FindSiteKey((Query<PortalKey>)q)).getResult();
}
else
{
@@ -262,6 +250,16 @@
}
}
+ public DashboardData loadDashboard(String dashboardId) throws Exception
+ {
+ return executor.execute(new DashboardTask.Load(dashboardId)).getDashboard();
+ }
+
+ public void saveDashboard(DashboardData dashboard) throws Exception
+ {
+ executor.execute(new DashboardTask.Save(dashboard));
+ }
+
public Container getSharedLayout() throws Exception
{
String path = "war:/conf/portal/portal/sharedlayout.xml";
Added: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/TaskExecutor.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/TaskExecutor.java (rev 0)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/TaskExecutor.java 2009-10-24 10:48:25 UTC (rev 416)
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2003-2007 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.portal.pom.config;
+
+import org.exoplatform.portal.pom.config.POMTask;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public interface TaskExecutor
+{
+
+ <T extends POMTask> T execute(T task) throws Exception;
+
+}
Added: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/cache/CacheableDataTask.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/cache/CacheableDataTask.java (rev 0)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/cache/CacheableDataTask.java 2009-10-24 10:48:25 UTC (rev 416)
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2003-2007 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.portal.pom.config.cache;
+
+import org.exoplatform.portal.pom.config.POMTask;
+
+import java.io.Serializable;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public interface CacheableDataTask<K extends Serializable, V> extends POMTask
+{
+
+ DataAccessMode getAccessMode();
+
+ K getKey();
+
+ V getValue();
+
+ void setValue(V value);
+
+ Class<V> getValueType();
+
+}
Added: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/cache/DataAccessMode.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/cache/DataAccessMode.java (rev 0)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/cache/DataAccessMode.java 2009-10-24 10:48:25 UTC (rev 416)
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2003-2007 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.portal.pom.config.cache;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public enum DataAccessMode
+{
+
+ CREATE, READ, WRITE, DESTROY
+
+}
Added: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/cache/DataCache.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/cache/DataCache.java (rev 0)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/cache/DataCache.java 2009-10-24 10:48:25 UTC (rev 416)
@@ -0,0 +1,126 @@
+/*
+ * Copyright (C) 2003-2007 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.portal.pom.config.cache;
+
+import org.exoplatform.portal.pom.config.POMTask;
+import org.exoplatform.portal.pom.config.TaskExecutor;
+import org.exoplatform.services.cache.CacheService;
+import org.exoplatform.services.cache.ExoCache;
+
+import java.io.Serializable;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class DataCache implements TaskExecutor
+{
+
+ /** . */
+ private TaskExecutor next;
+
+ /** . */
+ private ExoCache<Serializable, Object> cache;
+
+ public DataCache(CacheService cacheService, TaskExecutor next)
+ {
+ this.next = next;
+ this.cache = cacheService.getCacheInstance(DataCache.class.getSimpleName());
+ }
+
+ public <T extends POMTask> T execute(T task) throws Exception
+ {
+ if (task instanceof CacheableDataTask)
+ {
+ CacheableDataTask<?, ?> loadTask = (CacheableDataTask<?,?>)task;
+ switch (loadTask.getAccessMode())
+ {
+ case READ:
+ return (T)read(loadTask);
+ case CREATE:
+ return (T)create(loadTask);
+ case WRITE:
+ return (T)write(loadTask);
+ case DESTROY:
+ return (T)remove(loadTask);
+ default:
+ throw new UnsupportedOperationException();
+
+ }
+ }
+ else
+ {
+ return next.execute(task);
+ }
+ }
+
+ private <K extends Serializable, V, T extends CacheableDataTask<K, V>> T remove(T task) throws Exception
+ {
+ K key = task.getKey();
+ cache.remove(key);
+ return next.execute(task);
+ }
+
+ private <K extends Serializable, V, T extends CacheableDataTask<K, V>> T write(T task) throws Exception
+ {
+ K key = task.getKey();
+ cache.remove(key);
+ return next.execute(task);
+ }
+
+ private <K extends Serializable, V, T extends CacheableDataTask<K, V>> T create(T task) throws Exception
+ {
+ // Nothing to do for now
+ return next.execute(task);
+ }
+
+ private <K extends Serializable, V, T extends CacheableDataTask<K, V>> T read(T task) throws Exception
+ {
+ K key = task.getKey();
+ Object o = cache.get(key);
+ V v = null;
+ if (o != null)
+ {
+ Class<V> type = task.getValueType();
+ if (type.isInstance(o))
+ {
+ v = type.cast(o);
+ }
+ }
+
+ //
+ if (v != null)
+ {
+ task.setValue(v);
+ }
+ else
+ {
+ //
+ next.execute(task);
+
+ //
+ v = task.getValue();
+ if (v != null)
+ {
+ cache.put(key, v);
+ }
+ }
+
+ //
+ return task;
+ }
+}
Modified: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/PageNavigationTask.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/PageNavigationTask.java 2009-10-24 08:35:40 UTC (rev 415)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/PageNavigationTask.java 2009-10-24 10:48:25 UTC (rev 416)
@@ -19,6 +19,8 @@
package org.exoplatform.portal.pom.config.tasks;
+import org.exoplatform.portal.pom.config.cache.DataAccessMode;
+import org.exoplatform.portal.pom.config.cache.CacheableDataTask;
import org.exoplatform.portal.pom.data.Mapper;
import org.exoplatform.portal.pom.config.AbstractPOMTask;
@@ -38,22 +40,18 @@
{
/** . */
- protected final String ownerType;
+ protected final ObjectType<? extends Site> siteType;
/** . */
- protected final String ownerId;
+ protected final NavigationKey key;
- /** . */
- protected final ObjectType<? extends Site> siteType;
-
protected PageNavigationTask(NavigationKey key)
{
- this.ownerType = key.getOwnerType();
- this.ownerId = key.getOwnerId();
- this.siteType = Mapper.parseSiteType(ownerType);
+ this.key = key;
+ this.siteType = Mapper.parseSiteType(key.getOwnerType());
}
- public static class Load extends PageNavigationTask
+ public static class Load extends PageNavigationTask implements CacheableDataTask<NavigationKey, NavigationData>
{
/** . */
@@ -69,10 +67,35 @@
return pageNav;
}
+ public DataAccessMode getAccessMode()
+ {
+ return DataAccessMode.READ;
+ }
+
+ public NavigationKey getKey()
+ {
+ return key;
+ }
+
+ public NavigationData getValue()
+ {
+ return pageNav;
+ }
+
+ public void setValue(NavigationData value)
+ {
+ this.pageNav = value;
+ }
+
+ public Class<NavigationData> getValueType()
+ {
+ return NavigationData.class;
+ }
+
public void run(POMSession session) throws Exception
{
Workspace workspace = session.getWorkspace();
- Site site = workspace.getSite(siteType, ownerId);
+ Site site = workspace.getSite(siteType, key.getOwnerId());
if (site != null)
{
Navigation nav = site.getRootNavigation();
@@ -84,7 +107,7 @@
}
else
{
- System.out.println("Cannot load page navigation as the corresponding portal " + ownerId
+ System.out.println("Cannot load page navigation as the corresponding portal " + key.getOwnerId()
+ " with type " + siteType + " does not exist");
}
}
@@ -92,11 +115,11 @@
@Override
public String toString()
{
- return "PageNavigation.Load[ownerType=" + ownerType + ",ownerId=" + ownerId + "]";
+ return "PageNavigation.Load[ownerType=" + key.getOwnerType() + ",ownerId=" + key.getOwnerId() + "]";
}
}
- public static class Save extends PageNavigationTask
+ public static class Save extends PageNavigationTask implements CacheableDataTask<NavigationKey, NavigationData>
{
/** . */
@@ -114,14 +137,39 @@
this.overwrite = overwrite;
}
+ public DataAccessMode getAccessMode()
+ {
+ return pageNav.getStorageId() != null ? DataAccessMode.WRITE : DataAccessMode.CREATE;
+ }
+
+ public void setValue(NavigationData value)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public Class<NavigationData> getValueType()
+ {
+ return NavigationData.class;
+ }
+
+ public NavigationData getValue()
+ {
+ return pageNav;
+ }
+
+ public NavigationKey getKey()
+ {
+ return key;
+ }
+
public void run(POMSession session) throws Exception
{
Workspace workspace = session.getWorkspace();
- Site site = workspace.getSite(siteType, ownerId);
+ Site site = workspace.getSite(siteType, key.getOwnerId());
if (site == null)
{
throw new IllegalArgumentException("Cannot insert page navigation "
- + " as the corresponding portal " + ownerId + " with type " + siteType + " does not exist");
+ + " as the corresponding portal " + key.getOwnerId() + " with type " + siteType + " does not exist");
}
// Delete node descendants first
@@ -141,11 +189,11 @@
@Override
public String toString()
{
- return "PageNavigation.Save[ownerType=" + ownerType + ",ownerId=" + ownerId + "]";
+ return "PageNavigation.Save[ownerType=" + key.getOwnerType() + ",ownerId=" + key.getOwnerId() + "]";
}
}
- public static class Remove extends PageNavigationTask
+ public static class Remove extends PageNavigationTask implements CacheableDataTask<NavigationKey, NavigationData>
{
public Remove(NavigationData pageNav)
@@ -153,14 +201,39 @@
super(pageNav.getKey());
}
+ public DataAccessMode getAccessMode()
+ {
+ return DataAccessMode.DESTROY;
+ }
+
+ public void setValue(NavigationData value)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public Class<NavigationData> getValueType()
+ {
+ return NavigationData.class;
+ }
+
+ public NavigationData getValue()
+ {
+ return null;
+ }
+
+ public NavigationKey getKey()
+ {
+ return key;
+ }
+
public void run(POMSession session) throws Exception
{
Workspace workspace = session.getWorkspace();
- Site site = workspace.getSite(siteType, ownerId);
+ Site site = workspace.getSite(siteType, key.getOwnerId());
if (site == null)
{
throw new IllegalArgumentException("Cannot insert page navigation "
- + " as the corresponding portal " + ownerId + " with type " + siteType + " does not exist");
+ + " as the corresponding portal " + key.getOwnerId() + " with type " + siteType + " does not exist");
}
// Delete descendants
@@ -177,7 +250,7 @@
@Override
public String toString()
{
- return "PageNavigation.Remove[ownerType=" + ownerType + ",ownerId=" + ownerId + "]";
+ return "PageNavigation.Remove[ownerType=" + key.getOwnerType() + ",ownerId=" + key.getOwnerId() + "]";
}
}
}
\ No newline at end of file
Modified: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/PageTask.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/PageTask.java 2009-10-24 08:35:40 UTC (rev 415)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/PageTask.java 2009-10-24 10:48:25 UTC (rev 416)
@@ -19,6 +19,8 @@
package org.exoplatform.portal.pom.config.tasks;
+import org.exoplatform.portal.pom.config.cache.DataAccessMode;
+import org.exoplatform.portal.pom.config.cache.CacheableDataTask;
import org.exoplatform.portal.pom.data.Mapper;
import org.exoplatform.portal.pom.data.PageData;
@@ -56,10 +58,14 @@
protected final String name;
/** . */
+ protected final PageKey key;
+
+ /** . */
protected final ObjectType<? extends Site> siteType;
protected PageTask(PageKey key)
{
+ this.key = key;
this.ownerType = key.getOwnerType();
this.ownerId = key.getOwnerId();
this.name = key.getName();
@@ -230,7 +236,7 @@
}
}
- public static class Remove extends PageTask
+ public static class Remove extends PageTask implements CacheableDataTask<PageKey, PageData>
{
public Remove(PageData page)
@@ -238,6 +244,31 @@
super(page.getKey());
}
+ public DataAccessMode getAccessMode()
+ {
+ return DataAccessMode.DESTROY;
+ }
+
+ public void setValue(PageData value)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public Class<PageData> getValueType()
+ {
+ return PageData.class;
+ }
+
+ public PageData getValue()
+ {
+ return null;
+ }
+
+ public PageKey getKey()
+ {
+ return key;
+ }
+
public void run(POMSession session)
{
Workspace workspace = session.getWorkspace();
@@ -268,7 +299,7 @@
}
}
- public static class Save extends PageTask
+ public static class Save extends PageTask implements CacheableDataTask<PageKey, PageData>
{
/** . */
@@ -285,6 +316,31 @@
this.page = page;
}
+ public DataAccessMode getAccessMode()
+ {
+ return page.getStorageId() != null ? DataAccessMode.WRITE : DataAccessMode.CREATE;
+ }
+
+ public void setValue(PageData value)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public Class<PageData> getValueType()
+ {
+ return PageData.class;
+ }
+
+ public PageData getValue()
+ {
+ return page;
+ }
+
+ public PageKey getKey()
+ {
+ return key;
+ }
+
public void run(POMSession session) throws Exception
{
Workspace workspace = session.getWorkspace();
@@ -312,7 +368,7 @@
}
}
- public static class Load extends PageTask
+ public static class Load extends PageTask implements CacheableDataTask<PageKey, PageData>
{
/** . */
@@ -328,6 +384,31 @@
return page;
}
+ public DataAccessMode getAccessMode()
+ {
+ return DataAccessMode.READ;
+ }
+
+ public PageKey getKey()
+ {
+ return key;
+ }
+
+ public Class<PageData> getValueType()
+ {
+ return PageData.class;
+ }
+
+ public void setValue(PageData value)
+ {
+ page = value;
+ }
+
+ public PageData getValue()
+ {
+ return page;
+ }
+
public void run(POMSession session)
{
Workspace workspace = session.getWorkspace();
Modified: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/PortalConfigTask.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/PortalConfigTask.java 2009-10-24 08:35:40 UTC (rev 415)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/PortalConfigTask.java 2009-10-24 10:48:25 UTC (rev 416)
@@ -20,6 +20,8 @@
package org.exoplatform.portal.pom.config.tasks;
import org.exoplatform.portal.application.PortletPreferences;
+import org.exoplatform.portal.pom.config.cache.DataAccessMode;
+import org.exoplatform.portal.pom.config.cache.CacheableDataTask;
import org.exoplatform.portal.pom.data.Mapper;
import org.exoplatform.portal.pom.data.PortalData;
import org.exoplatform.portal.pom.config.AbstractPOMTask;
@@ -38,22 +40,18 @@
{
/** . */
- protected final String name;
+ protected final PortalKey key;
/** . */
protected final ObjectType<? extends Site> type;
- /** . */
- protected final String ownerType;
-
protected PortalConfigTask(PortalKey key)
{
- this.name = key.getOwnerId();
- this.ownerType = key.getOwnerType();
+ this.key = key;
this.type = Mapper.parseSiteType(key.getOwnerType());
}
- public static class Remove extends PortalConfigTask
+ public static class Remove extends PortalConfigTask implements CacheableDataTask<PortalKey, PortalData>
{
public Remove(PortalKey key)
@@ -61,13 +59,38 @@
super(key);
}
+ public DataAccessMode getAccessMode()
+ {
+ return DataAccessMode.DESTROY;
+ }
+
+ public Class<PortalData> getValueType()
+ {
+ return PortalData.class;
+ }
+
+ public PortalKey getKey()
+ {
+ return key;
+ }
+
+ public void setValue(PortalData value)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public PortalData getValue()
+ {
+ return null;
+ }
+
public void run(POMSession session)
{
Workspace workspace = session.getWorkspace();
- Site site = workspace.getSite(type, name);
+ Site site = workspace.getSite(type, key.getOwnerId());
if (site == null)
{
- throw new NullPointerException("Could not remove non existing portal " + name);
+ throw new NullPointerException("Could not remove non existing portal " + key.getOwnerId());
}
else
{
@@ -78,11 +101,11 @@
@Override
public String toString()
{
- return "PortalConfig.Remove[ownerType=" + ownerType + ",ownerId=" + name + "]";
+ return "PortalConfig.Remove[ownerType=" + key.getOwnerType() + ",ownerId=" + key.getOwnerId() + "]";
}
}
- public static class Save extends PortalConfigTask
+ public static class Save extends PortalConfigTask implements CacheableDataTask<PortalKey, PortalData>
{
/** . */
@@ -100,10 +123,35 @@
this.overwrite = overwrite;
}
+ public DataAccessMode getAccessMode()
+ {
+ return config.getStorageId() != null ? DataAccessMode.WRITE : DataAccessMode.CREATE;
+ }
+
+ public void setValue(PortalData value)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public Class<PortalData> getValueType()
+ {
+ return PortalData.class;
+ }
+
+ public PortalData getValue()
+ {
+ return config;
+ }
+
+ public PortalKey getKey()
+ {
+ return key;
+ }
+
public void run(POMSession session) throws Exception
{
Workspace workspace = session.getWorkspace();
- Site site = workspace.getSite(type, name);
+ Site site = workspace.getSite(type, key.getOwnerId());
if (site != null)
{
if (!overwrite)
@@ -130,11 +178,11 @@
@Override
public String toString()
{
- return "PortalConfig.Save[ownerType=" + ownerType + ",ownerId=" + name + "]";
+ return "PortalConfig.Save[ownerType=" + key.getOwnerType() + ",ownerId=" + key.getOwnerId() + "]";
}
}
- public static class Load extends PortalConfigTask
+ public static class Load extends PortalConfigTask implements CacheableDataTask<PortalKey, PortalData>
{
/** . */
@@ -145,6 +193,31 @@
super(key);
}
+ public DataAccessMode getAccessMode()
+ {
+ return DataAccessMode.READ;
+ }
+
+ public PortalKey getKey()
+ {
+ return key;
+ }
+
+ public void setValue(PortalData value)
+ {
+ config = value;
+ }
+
+ public Class<PortalData> getValueType()
+ {
+ return PortalData.class;
+ }
+
+ public PortalData getValue()
+ {
+ return config;
+ }
+
public PortalData getConfig()
{
return config;
@@ -153,7 +226,7 @@
public void run(POMSession session)
{
Workspace workspace = session.getWorkspace();
- Site site = workspace.getSite(type, name);
+ Site site = workspace.getSite(type, key.getOwnerId());
if (site != null)
{
this.config = new Mapper(session).load(site);
@@ -163,7 +236,7 @@
@Override
public String toString()
{
- return "PortalConfig.Load[ownerType=" + ownerType + ",ownerId=" + name + "]";
+ return "PortalConfig.Load[ownerType=" + key.getOwnerType() + ",ownerId=" + key.getOwnerId() + "]";
}
}
}
Modified: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/ModelDataStorage.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/ModelDataStorage.java 2009-10-24 08:35:40 UTC (rev 415)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/ModelDataStorage.java 2009-10-24 10:48:25 UTC (rev 416)
@@ -24,6 +24,7 @@
import org.exoplatform.portal.config.Query;
import org.exoplatform.portal.config.model.ApplicationState;
import org.exoplatform.portal.config.model.Container;
+import org.exoplatform.portal.config.model.Dashboard;
import org.exoplatform.portal.config.model.ModelChange;
import org.exoplatform.portal.pom.data.PageData;
import org.exoplatform.portal.pom.data.PortalData;
@@ -42,8 +43,6 @@
public interface ModelDataStorage
{
- public <T extends POMTask> T execute(T task) throws Exception;
-
public void create(PortalData config) throws Exception;
public void save(PortalData config) throws Exception;
@@ -103,4 +102,8 @@
public <T> LazyPageList<T> find(Query<T> q, Comparator<T> sortComparator) throws Exception;
public Container getSharedLayout() throws Exception;
+
+ public DashboardData loadDashboard(String dashboardId) throws Exception;
+
+ public void saveDashboard(DashboardData dashboard) throws Exception;
}
\ No newline at end of file
15 years, 11 months
gatein SVN: r415 - portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config.
by do-not-reply@jboss.org
Author: julien_viet
Date: 2009-10-24 04:35:40 -0400 (Sat, 24 Oct 2009)
New Revision: 415
Added:
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/DataStorageImpl.java
Log:
forgot to add this important class in previous commits
Added: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/DataStorageImpl.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/DataStorageImpl.java (rev 0)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/DataStorageImpl.java 2009-10-24 08:35:40 UTC (rev 415)
@@ -0,0 +1,288 @@
+/*
+ * Copyright (C) 2003-2007 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.portal.config;
+
+import org.exoplatform.commons.utils.LazyPageList;
+import org.exoplatform.commons.utils.ListAccess;
+import org.exoplatform.portal.application.PortletPreferences;
+import org.exoplatform.portal.config.model.ApplicationState;
+import org.exoplatform.portal.config.model.Container;
+import org.exoplatform.portal.config.model.Dashboard;
+import org.exoplatform.portal.config.model.ModelChange;
+import org.exoplatform.portal.config.model.ModelObject;
+import org.exoplatform.portal.config.model.Page;
+import org.exoplatform.portal.config.model.PageNavigation;
+import org.exoplatform.portal.config.model.PortalConfig;
+import org.exoplatform.portal.pom.config.ModelDemarcation;
+import org.exoplatform.portal.pom.data.DashboardData;
+import org.exoplatform.portal.pom.data.ModelData;
+import org.exoplatform.portal.pom.data.ModelDataStorage;
+import org.exoplatform.portal.pom.data.NavigationData;
+import org.exoplatform.portal.pom.data.NavigationKey;
+import org.exoplatform.portal.pom.data.PageData;
+import org.exoplatform.portal.pom.data.PageKey;
+import org.exoplatform.portal.pom.data.PortalData;
+import org.exoplatform.portal.pom.data.PortalKey;
+import org.exoplatform.portal.pom.config.tasks.DashboardTask;
+
+import java.lang.reflect.Array;
+import java.util.Comparator;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class DataStorageImpl implements DataStorage, ModelDemarcation
+{
+
+ /** . */
+ private ModelDataStorage delegate;
+
+ public DataStorageImpl(ModelDataStorage delegate)
+ {
+ this.delegate = delegate;
+ }
+
+ public Page clonePage(String pageId, String clonedOwnerType, String clonedOwnerId, String clonedName) throws Exception
+ {
+ PageKey key = PageKey.create(pageId);
+ PageKey cloneKey = new PageKey(clonedOwnerType, clonedOwnerId, clonedName);
+ return new Page(delegate.clonePage(key, cloneKey));
+ }
+
+ public PageNavigation getPageNavigation(String ownerType, String id) throws Exception
+ {
+ NavigationData data = delegate.getPageNavigation(new NavigationKey(ownerType, id));
+ return data != null ? new PageNavigation(data) : null;
+ }
+
+ public void remove(Page page) throws Exception
+ {
+ delegate.remove(page.build());
+ }
+
+ public <S> S load(ApplicationState<S> state) throws Exception
+ {
+ return delegate.load(state);
+ }
+
+ public void create(Page page) throws Exception
+ {
+ delegate.create(page.build());
+ }
+
+ public PortletPreferences getPortletPreferences(String windowID) throws Exception
+ {
+ return delegate.getPortletPreferences(windowID);
+ }
+
+ public <S> ApplicationState<S> save(ApplicationState<S> state, S preferences) throws Exception
+ {
+ return delegate.save(state, preferences);
+ }
+
+ public Container getSharedLayout() throws Exception
+ {
+ return delegate.getSharedLayout();
+ }
+
+ public void save(PortalConfig config) throws Exception
+ {
+ delegate.save(config.build());
+ }
+
+ public void create(PortalConfig config) throws Exception
+ {
+ delegate.create(config.build());
+ }
+
+ public PortalConfig getPortalConfig(String portalName) throws Exception
+ {
+ return getPortalConfig(PortalConfig.PORTAL_TYPE, portalName);
+ }
+
+ public void save(PageNavigation navigation) throws Exception
+ {
+ delegate.save(navigation.build());
+ }
+
+ public void remove(PortalConfig config) throws Exception
+ {
+ delegate.remove(config.build());
+ }
+
+ public PageNavigation getPageNavigation(String fullId) throws Exception
+ {
+ NavigationKey key = NavigationKey.create(fullId);
+ NavigationData data = delegate.getPageNavigation(key);
+ return data != null ? new PageNavigation(data) : null;
+ }
+
+ public Page getPage(String pageId) throws Exception
+ {
+ PageKey key = PageKey.create(pageId);
+ PageData data = delegate.getPage(key);
+ return data != null ? new Page(data) : null;
+ }
+
+ public List<ModelChange> save(Page page) throws Exception
+ {
+ return delegate.save(page.build());
+ }
+
+ public void create(PageNavigation navigation) throws Exception
+ {
+ delegate.save(navigation.build());
+ }
+
+ private abstract class Bilto<O extends ModelObject, D extends ModelData>
+ {
+
+ final Query<O> q;
+
+ final Class<D> dataType;
+
+ Bilto(Query<O> q, Class<D> dataType)
+ {
+ this.q = q;
+ this.dataType = dataType;
+ }
+
+ protected abstract O create(D d);
+
+ LazyPageList<O> execute() throws Exception
+ {
+ Query<D> delegateQ = new Query<D>(q, dataType);
+ LazyPageList<D> r = delegate.find(delegateQ, null);
+ final List<D> list = r.getAll();
+ ListAccess<O> access = new ListAccess<O>()
+ {
+ public int getSize() throws Exception
+ {
+ return list.size();
+ }
+ public O[] load(int index, int length) throws Exception, IllegalArgumentException
+ {
+ O[] pages = (O[])Array.newInstance(q.getClassType(), length);
+ int i = 0;
+ for (D data : list.subList(index, index + length))
+ {
+ pages[i++] = create(data);
+ }
+ return pages;
+ }
+ };
+ return new LazyPageList<O>(access, r.getPageSize());
+ }
+
+ }
+
+ public <T> LazyPageList<T> find(Query<T> q, Comparator<T> sortComparator) throws Exception
+ {
+ Class<T> type = q.getClassType();
+ if (type == Page.class)
+ {
+ Bilto<Page, PageData> bilto = new Bilto<Page, PageData>((Query<Page>)q, PageData.class)
+ {
+ @Override
+ protected Page create(PageData pageData)
+ {
+ return new Page(pageData);
+ }
+ };
+ return (LazyPageList<T>)bilto.execute();
+ }
+ else if (type == PageNavigation.class)
+ {
+ Bilto<PageNavigation, NavigationData> bilto = new Bilto<PageNavigation, NavigationData>((Query<PageNavigation>)q, NavigationData.class)
+ {
+ @Override
+ protected PageNavigation create(NavigationData page)
+ {
+ return new PageNavigation(page);
+ }
+ };
+ return (LazyPageList<T>)bilto.execute();
+ }
+ else if (type == PortalConfig.class)
+ {
+ Bilto<PortalConfig, PortalData> bilto = new Bilto<PortalConfig, PortalData>((Query<PortalConfig>)q, PortalData.class)
+ {
+ @Override
+ protected PortalConfig create(PortalData portalData)
+ {
+ return new PortalConfig(portalData);
+ }
+ };
+ return (LazyPageList<T>)bilto.execute();
+ }
+ else
+ {
+ throw new UnsupportedOperationException("Cannot query type " + type);
+ }
+ }
+
+ public <T> LazyPageList<T> find(Query<T> q) throws Exception
+ {
+ return find(q, null);
+ }
+
+ public void save(PortletPreferences portletPreferences) throws Exception
+ {
+ delegate.save(portletPreferences);
+ }
+
+ public PortalConfig getPortalConfig(String ownerType, String portalName) throws Exception
+ {
+ PortalKey key = new PortalKey(ownerType, portalName);
+ PortalData data = delegate.getPortalConfig(key);
+ return data != null ? new PortalConfig(data) : null;
+ }
+
+ public void remove(PageNavigation navigation) throws Exception
+ {
+ delegate.remove(navigation.build());
+ }
+
+ public Dashboard loadDashboard(String dashboardId) throws Exception
+ {
+ DashboardData data = delegate.execute(new DashboardTask.Load(dashboardId)).getDashboard();
+ return data != null ? new Dashboard(data) : null;
+ }
+
+ public void saveDashboard(Dashboard dashboard) throws Exception
+ {
+ delegate.execute(new DashboardTask.Save(dashboard.build()));
+ }
+
+ public void begin()
+ {
+ if (delegate instanceof ModelDemarcation)
+ {
+ ((ModelDemarcation)delegate).begin();
+ }
+ }
+
+ public void end(boolean save)
+ {
+ if (delegate instanceof ModelDemarcation)
+ {
+ ((ModelDemarcation)delegate).end(save);
+ }
+ }
+}
15 years, 11 months
gatein SVN: r414 - in portal/branches/performance: component/portal/src/main/java/org/exoplatform/portal/config/model and 11 other directories.
by do-not-reply@jboss.org
Author: julien_viet
Date: 2009-10-24 04:32:00 -0400 (Sat, 24 Oct 2009)
New Revision: 414
Added:
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/ApplicationData.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/BodyData.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/BodyType.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/ComponentData.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/ContainerData.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/DashboardData.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/MappedAttributes.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/Mapper.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/ModelData.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/ModelDataStorage.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/NavigationData.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/NavigationKey.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/NavigationNodeContainerData.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/NavigationNodeData.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/OwnerKey.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/PageData.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/PageKey.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/PortalData.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/PortalKey.java
Removed:
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/ApplicationData.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/BodyData.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/BodyType.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/ComponentData.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/ContainerData.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/DashboardData.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/MappedAttributes.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/Mapper.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/ModelData.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/ModelDataStorage.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/NavigationContainer.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/NavigationKey.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/OwnerKey.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/PageData.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/PageKey.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/PortalData.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/PortalKey.java
Modified:
portal/branches/performance/component/portal/src/main/java/conf/portal/configuration.xml
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/Application.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/Container.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/Dashboard.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/ModelChange.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/ModelObject.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/Page.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PageBody.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PageNavigation.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PageNode.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PageNodeContainer.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PortalConfig.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/SiteBody.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/gadget/GadgetApplication.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/portlet/PortletApplication.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/wsrp/WSRPApplication.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMDataStorage.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMSession.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/DashboardTask.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/PageNavigationTask.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/PageTask.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/PortalConfigTask.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/PortletPreferencesTask.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/SearchTask.java
portal/branches/performance/component/portal/src/test/java/conf/portal/test-configuration.xml
portal/branches/performance/web/portal/src/main/webapp/WEB-INF/conf/portal/portal-configuration.xml
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageActionListener.java
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalForm.java
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalSelector.java
Log:
move mop data to a better location
Modified: portal/branches/performance/component/portal/src/main/java/conf/portal/configuration.xml
===================================================================
--- portal/branches/performance/component/portal/src/main/java/conf/portal/configuration.xml 2009-10-24 08:22:11 UTC (rev 413)
+++ portal/branches/performance/component/portal/src/main/java/conf/portal/configuration.xml 2009-10-24 08:32:00 UTC (rev 414)
@@ -36,7 +36,7 @@
</component>
<component>
- <key>org.exoplatform.portal.pom.config.data.ModelDataStorage</key>
+ <key>org.exoplatform.portal.pom.data.ModelDataStorage</key>
<type>org.exoplatform.portal.pom.config.POMDataStorage</type>
</component>
Modified: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/Application.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/Application.java 2009-10-24 08:22:11 UTC (rev 413)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/Application.java 2009-10-24 08:32:00 UTC (rev 414)
@@ -20,8 +20,8 @@
package org.exoplatform.portal.config.model;
import org.exoplatform.portal.pom.config.Utils;
-import org.exoplatform.portal.pom.config.data.ApplicationData;
-import org.exoplatform.portal.pom.config.data.ModelData;
+import org.exoplatform.portal.pom.data.ApplicationData;
+import org.exoplatform.portal.pom.data.ModelData;
/**
* May 13, 2004
Modified: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/Container.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/Container.java 2009-10-24 08:22:11 UTC (rev 413)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/Container.java 2009-10-24 08:32:00 UTC (rev 414)
@@ -20,9 +20,9 @@
package org.exoplatform.portal.config.model;
import org.exoplatform.portal.pom.config.Utils;
-import org.exoplatform.portal.pom.config.data.ComponentData;
-import org.exoplatform.portal.pom.config.data.ContainerData;
-import org.exoplatform.portal.pom.config.data.ModelData;
+import org.exoplatform.portal.pom.data.ComponentData;
+import org.exoplatform.portal.pom.data.ContainerData;
+import org.exoplatform.portal.pom.data.ModelData;
import java.util.ArrayList;
import java.util.Collections;
Modified: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/Dashboard.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/Dashboard.java 2009-10-24 08:22:11 UTC (rev 413)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/Dashboard.java 2009-10-24 08:32:00 UTC (rev 414)
@@ -20,8 +20,8 @@
package org.exoplatform.portal.config.model;
import org.exoplatform.portal.pom.config.Utils;
-import org.exoplatform.portal.pom.config.data.ComponentData;
-import org.exoplatform.portal.pom.config.data.DashboardData;
+import org.exoplatform.portal.pom.data.ComponentData;
+import org.exoplatform.portal.pom.data.DashboardData;
import java.util.List;
Modified: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/ModelChange.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/ModelChange.java 2009-10-24 08:22:11 UTC (rev 413)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/ModelChange.java 2009-10-24 08:32:00 UTC (rev 414)
@@ -19,7 +19,7 @@
package org.exoplatform.portal.config.model;
-import org.exoplatform.portal.pom.config.data.ModelData;
+import org.exoplatform.portal.pom.data.ModelData;
/**
* @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
Modified: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/ModelObject.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/ModelObject.java 2009-10-24 08:22:11 UTC (rev 413)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/ModelObject.java 2009-10-24 08:32:00 UTC (rev 414)
@@ -25,11 +25,11 @@
import org.exoplatform.portal.config.model.portlet.PortletId;
import org.exoplatform.portal.config.model.wsrp.WSRPApplication;
import org.exoplatform.portal.config.model.wsrp.WSRPId;
-import org.exoplatform.portal.pom.config.data.ApplicationData;
-import org.exoplatform.portal.pom.config.data.BodyData;
-import org.exoplatform.portal.pom.config.data.ContainerData;
-import org.exoplatform.portal.pom.config.data.ModelData;
-import org.exoplatform.portal.pom.config.data.PageData;
+import org.exoplatform.portal.pom.data.ApplicationData;
+import org.exoplatform.portal.pom.data.BodyData;
+import org.exoplatform.portal.pom.data.ContainerData;
+import org.exoplatform.portal.pom.data.ModelData;
+import org.exoplatform.portal.pom.data.PageData;
import org.exoplatform.portal.pom.spi.gadget.Gadget;
import org.exoplatform.portal.pom.spi.portlet.Preferences;
import org.exoplatform.portal.pom.spi.wsrp.WSRPState;
Modified: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/Page.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/Page.java 2009-10-24 08:22:11 UTC (rev 413)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/Page.java 2009-10-24 08:32:00 UTC (rev 414)
@@ -20,8 +20,8 @@
package org.exoplatform.portal.config.model;
import org.exoplatform.portal.pom.config.Utils;
-import org.exoplatform.portal.pom.config.data.ComponentData;
-import org.exoplatform.portal.pom.config.data.PageData;
+import org.exoplatform.portal.pom.data.ComponentData;
+import org.exoplatform.portal.pom.data.PageData;
import java.util.ArrayList;
import java.util.List;
Modified: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PageBody.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PageBody.java 2009-10-24 08:22:11 UTC (rev 413)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PageBody.java 2009-10-24 08:32:00 UTC (rev 414)
@@ -19,9 +19,9 @@
package org.exoplatform.portal.config.model;
-import org.exoplatform.portal.pom.config.data.BodyData;
-import org.exoplatform.portal.pom.config.data.BodyType;
-import org.exoplatform.portal.pom.config.data.ModelData;
+import org.exoplatform.portal.pom.data.BodyData;
+import org.exoplatform.portal.pom.data.BodyType;
+import org.exoplatform.portal.pom.data.ModelData;
/**
* Created by The eXo Platform SAS
Modified: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PageNavigation.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PageNavigation.java 2009-10-24 08:22:11 UTC (rev 413)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PageNavigation.java 2009-10-24 08:32:00 UTC (rev 414)
@@ -19,8 +19,8 @@
package org.exoplatform.portal.config.model;
-import org.exoplatform.portal.pom.config.data.NavigationData;
-import org.exoplatform.portal.pom.config.data.NavigationNodeData;
+import org.exoplatform.portal.pom.data.NavigationData;
+import org.exoplatform.portal.pom.data.NavigationNodeData;
import java.util.ArrayList;
import java.util.LinkedHashMap;
Modified: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PageNode.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PageNode.java 2009-10-24 08:22:11 UTC (rev 413)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PageNode.java 2009-10-24 08:32:00 UTC (rev 414)
@@ -20,7 +20,7 @@
package org.exoplatform.portal.config.model;
import org.exoplatform.commons.utils.ExpressionUtil;
-import org.exoplatform.portal.pom.config.data.NavigationNodeData;
+import org.exoplatform.portal.pom.data.NavigationNodeData;
import java.util.ArrayList;
import java.util.Date;
Modified: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PageNodeContainer.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PageNodeContainer.java 2009-10-24 08:22:11 UTC (rev 413)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PageNodeContainer.java 2009-10-24 08:32:00 UTC (rev 414)
@@ -20,8 +20,8 @@
package org.exoplatform.portal.config.model;
import org.exoplatform.portal.config.model.ModelObject;
-import org.exoplatform.portal.pom.config.data.NavigationNodeContainerData;
-import org.exoplatform.portal.pom.config.data.NavigationNodeData;
+import org.exoplatform.portal.pom.data.NavigationNodeContainerData;
+import org.exoplatform.portal.pom.data.NavigationNodeData;
import java.util.ArrayList;
import java.util.Collections;
Modified: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PortalConfig.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PortalConfig.java 2009-10-24 08:22:11 UTC (rev 413)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PortalConfig.java 2009-10-24 08:32:00 UTC (rev 414)
@@ -20,7 +20,7 @@
package org.exoplatform.portal.config.model;
import org.exoplatform.portal.pom.config.Utils;
-import org.exoplatform.portal.pom.config.data.PortalData;
+import org.exoplatform.portal.pom.data.PortalData;
import java.util.ArrayList;
import java.util.List;
Modified: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/SiteBody.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/SiteBody.java 2009-10-24 08:22:11 UTC (rev 413)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/SiteBody.java 2009-10-24 08:32:00 UTC (rev 414)
@@ -19,9 +19,9 @@
package org.exoplatform.portal.config.model;
-import org.exoplatform.portal.pom.config.data.BodyData;
-import org.exoplatform.portal.pom.config.data.BodyType;
-import org.exoplatform.portal.pom.config.data.ModelData;
+import org.exoplatform.portal.pom.data.BodyData;
+import org.exoplatform.portal.pom.data.BodyType;
+import org.exoplatform.portal.pom.data.ModelData;
public class SiteBody extends ModelObject
{
Modified: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/gadget/GadgetApplication.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/gadget/GadgetApplication.java 2009-10-24 08:22:11 UTC (rev 413)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/gadget/GadgetApplication.java 2009-10-24 08:32:00 UTC (rev 414)
@@ -20,7 +20,7 @@
package org.exoplatform.portal.config.model.gadget;
import org.exoplatform.portal.config.model.Application;
-import org.exoplatform.portal.pom.config.data.ApplicationData;
+import org.exoplatform.portal.pom.data.ApplicationData;
import org.exoplatform.portal.config.model.ApplicationType;
import org.exoplatform.portal.pom.spi.gadget.Gadget;
Modified: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/portlet/PortletApplication.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/portlet/PortletApplication.java 2009-10-24 08:22:11 UTC (rev 413)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/portlet/PortletApplication.java 2009-10-24 08:32:00 UTC (rev 414)
@@ -20,7 +20,7 @@
package org.exoplatform.portal.config.model.portlet;
import org.exoplatform.portal.config.model.Application;
-import org.exoplatform.portal.pom.config.data.ApplicationData;
+import org.exoplatform.portal.pom.data.ApplicationData;
import org.exoplatform.portal.config.model.ApplicationType;
import org.exoplatform.portal.pom.spi.portlet.Preferences;
Modified: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/wsrp/WSRPApplication.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/wsrp/WSRPApplication.java 2009-10-24 08:22:11 UTC (rev 413)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/wsrp/WSRPApplication.java 2009-10-24 08:32:00 UTC (rev 414)
@@ -20,7 +20,7 @@
package org.exoplatform.portal.config.model.wsrp;
import org.exoplatform.portal.config.model.Application;
-import org.exoplatform.portal.pom.config.data.ApplicationData;
+import org.exoplatform.portal.pom.data.ApplicationData;
import org.exoplatform.portal.config.model.ApplicationType;
import org.exoplatform.portal.pom.spi.wsrp.WSRPState;
Modified: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMDataStorage.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMDataStorage.java 2009-10-24 08:22:11 UTC (rev 413)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMDataStorage.java 2009-10-24 08:32:00 UTC (rev 414)
@@ -29,14 +29,14 @@
import org.exoplatform.portal.config.model.Container;
import org.exoplatform.portal.config.model.ModelChange;
import org.exoplatform.portal.config.model.ModelObject;
-import org.exoplatform.portal.pom.config.data.ModelDataStorage;
-import org.exoplatform.portal.pom.config.data.NavigationData;
-import org.exoplatform.portal.pom.config.data.NavigationKey;
-import org.exoplatform.portal.pom.config.data.PageData;
+import org.exoplatform.portal.pom.data.ModelDataStorage;
+import org.exoplatform.portal.pom.data.NavigationData;
+import org.exoplatform.portal.pom.data.NavigationKey;
+import org.exoplatform.portal.pom.data.PageData;
import org.exoplatform.portal.config.model.PersistentApplicationState;
-import org.exoplatform.portal.pom.config.data.PageKey;
-import org.exoplatform.portal.pom.config.data.PortalData;
-import org.exoplatform.portal.pom.config.data.PortalKey;
+import org.exoplatform.portal.pom.data.PageKey;
+import org.exoplatform.portal.pom.data.PortalData;
+import org.exoplatform.portal.pom.data.PortalKey;
import org.exoplatform.portal.config.model.TransientApplicationState;
import org.exoplatform.portal.pom.config.tasks.PageNavigationTask;
import org.exoplatform.portal.pom.config.tasks.PageTask;
Modified: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMSession.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMSession.java 2009-10-24 08:22:11 UTC (rev 413)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMSession.java 2009-10-24 08:32:00 UTC (rev 414)
@@ -21,7 +21,7 @@
import org.chromattic.api.ChromatticSession;
import org.exoplatform.portal.application.PortletPreferences;
-import org.exoplatform.portal.pom.config.data.Mapper;
+import org.exoplatform.portal.pom.data.Mapper;
import org.gatein.mop.api.Model;
import org.gatein.mop.api.content.Customization;
import org.gatein.mop.api.workspace.ObjectType;
Modified: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/DashboardTask.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/DashboardTask.java 2009-10-24 08:22:11 UTC (rev 413)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/DashboardTask.java 2009-10-24 08:32:00 UTC (rev 414)
@@ -19,8 +19,8 @@
package org.exoplatform.portal.pom.config.tasks;
-import org.exoplatform.portal.pom.config.data.DashboardData;
-import org.exoplatform.portal.pom.config.data.Mapper;
+import org.exoplatform.portal.pom.data.DashboardData;
+import org.exoplatform.portal.pom.data.Mapper;
import org.exoplatform.portal.pom.config.AbstractPOMTask;
import org.exoplatform.portal.pom.config.POMSession;
import org.gatein.mop.api.workspace.ObjectType;
Modified: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/PageNavigationTask.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/PageNavigationTask.java 2009-10-24 08:22:11 UTC (rev 413)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/PageNavigationTask.java 2009-10-24 08:32:00 UTC (rev 414)
@@ -19,12 +19,12 @@
package org.exoplatform.portal.pom.config.tasks;
-import org.exoplatform.portal.pom.config.data.Mapper;
+import org.exoplatform.portal.pom.data.Mapper;
import org.exoplatform.portal.pom.config.AbstractPOMTask;
import org.exoplatform.portal.pom.config.POMSession;
-import org.exoplatform.portal.pom.config.data.NavigationData;
-import org.exoplatform.portal.pom.config.data.NavigationKey;
+import org.exoplatform.portal.pom.data.NavigationData;
+import org.exoplatform.portal.pom.data.NavigationKey;
import org.gatein.mop.api.workspace.Navigation;
import org.gatein.mop.api.workspace.ObjectType;
import org.gatein.mop.api.workspace.Site;
Modified: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/PageTask.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/PageTask.java 2009-10-24 08:22:11 UTC (rev 413)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/PageTask.java 2009-10-24 08:32:00 UTC (rev 414)
@@ -19,13 +19,13 @@
package org.exoplatform.portal.pom.config.tasks;
-import org.exoplatform.portal.pom.config.data.Mapper;
-import org.exoplatform.portal.pom.config.data.PageData;
+import org.exoplatform.portal.pom.data.Mapper;
+import org.exoplatform.portal.pom.data.PageData;
import org.exoplatform.portal.config.model.ModelChange;
import org.exoplatform.portal.pom.config.AbstractPOMTask;
import org.exoplatform.portal.pom.config.POMSession;
-import org.exoplatform.portal.pom.config.data.PageKey;
+import org.exoplatform.portal.pom.data.PageKey;
import org.gatein.mop.api.Attributes;
import org.gatein.mop.api.content.ContentType;
import org.gatein.mop.api.content.Customization;
Modified: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/PortalConfigTask.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/PortalConfigTask.java 2009-10-24 08:22:11 UTC (rev 413)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/PortalConfigTask.java 2009-10-24 08:32:00 UTC (rev 414)
@@ -20,11 +20,11 @@
package org.exoplatform.portal.pom.config.tasks;
import org.exoplatform.portal.application.PortletPreferences;
-import org.exoplatform.portal.pom.config.data.Mapper;
-import org.exoplatform.portal.pom.config.data.PortalData;
+import org.exoplatform.portal.pom.data.Mapper;
+import org.exoplatform.portal.pom.data.PortalData;
import org.exoplatform.portal.pom.config.AbstractPOMTask;
import org.exoplatform.portal.pom.config.POMSession;
-import org.exoplatform.portal.pom.config.data.PortalKey;
+import org.exoplatform.portal.pom.data.PortalKey;
import org.gatein.mop.api.workspace.ObjectType;
import org.gatein.mop.api.workspace.Page;
import org.gatein.mop.api.workspace.Site;
Modified: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/PortletPreferencesTask.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/PortletPreferencesTask.java 2009-10-24 08:22:11 UTC (rev 413)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/PortletPreferencesTask.java 2009-10-24 08:32:00 UTC (rev 414)
@@ -21,7 +21,7 @@
import org.exoplatform.portal.application.PortletPreferences;
import org.exoplatform.portal.application.Preference;
-import org.exoplatform.portal.pom.config.data.Mapper;
+import org.exoplatform.portal.pom.data.Mapper;
import org.exoplatform.portal.pom.config.AbstractPOMTask;
import org.exoplatform.portal.pom.config.POMSession;
import org.exoplatform.portal.pom.spi.portlet.Preferences;
Modified: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/SearchTask.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/SearchTask.java 2009-10-24 08:22:11 UTC (rev 413)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/SearchTask.java 2009-10-24 08:32:00 UTC (rev 414)
@@ -23,11 +23,11 @@
import org.exoplatform.commons.utils.ListAccess;
import org.exoplatform.portal.application.PortletPreferences;
import org.exoplatform.portal.config.Query;
-import org.exoplatform.portal.pom.config.data.Mapper;
-import org.exoplatform.portal.pom.config.data.NavigationData;
-import org.exoplatform.portal.pom.config.data.PageData;
-import org.exoplatform.portal.pom.config.data.PortalData;
-import org.exoplatform.portal.pom.config.data.PortalKey;
+import org.exoplatform.portal.pom.data.Mapper;
+import org.exoplatform.portal.pom.data.NavigationData;
+import org.exoplatform.portal.pom.data.PageData;
+import org.exoplatform.portal.pom.data.PortalData;
+import org.exoplatform.portal.pom.data.PortalKey;
import org.exoplatform.portal.pom.config.AbstractPOMTask;
import org.exoplatform.portal.pom.config.POMSession;
import org.gatein.mop.api.workspace.Navigation;
Copied: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data (from rev 412, portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data)
Deleted: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/ApplicationData.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/ApplicationData.java 2009-10-24 07:50:41 UTC (rev 412)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/ApplicationData.java 2009-10-24 08:32:00 UTC (rev 414)
@@ -1,189 +0,0 @@
-/*
- * Copyright (C) 2003-2007 eXo Platform SAS.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
- *
- * This program 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
- */
-package org.exoplatform.portal.pom.config.data;
-
-import org.exoplatform.portal.config.model.ApplicationState;
-import org.exoplatform.portal.config.model.ApplicationType;
-
-import java.util.List;
-import java.util.Map;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public class ApplicationData<S, I> extends ComponentData
-{
-
- /** . */
- private final ApplicationType<S, I> type;
-
- /** . */
- private final ApplicationState<S> state;
-
- /** . */
- private final I ref;
-
- /** . */
- private final String id;
-
- /** . */
- private final String title;
-
- /** . */
- private final String icon;
-
- /** . */
- private final String description;
-
- /** . */
- private final boolean showInfoBar;
-
- /** . */
- private final boolean showApplicationState;
-
- /** . */
- private final boolean showApplicationMode;
-
- /** . */
- private final String theme;
-
- /** . */
- private final String width;
-
- /** . */
- private final String height;
-
- /** . */
- private final Map<String, String> properties;
-
- /** . */
- private final List<String> accessPermissions;
-
- public ApplicationData(
- String storageId,
- String storageName,
- ApplicationType<S, I> type,
- ApplicationState<S> state,
- I ref,
- String id,
- String title,
- String icon,
- String description,
- boolean showInfoBar,
- boolean showApplicationState,
- boolean showApplicationMode,
- String theme, String width,
- String height,
- Map<String, String> properties,
- List<String> accessPermissions)
- {
- super(storageId, storageName);
-
- //
- this.type = type;
- this.state = state;
- this.ref = ref;
- this.id = id;
- this.title = title;
- this.icon = icon;
- this.description = description;
- this.showInfoBar = showInfoBar;
- this.showApplicationState = showApplicationState;
- this.showApplicationMode = showApplicationMode;
- this.theme = theme;
- this.width = width;
- this.height = height;
- this.properties = properties;
- this.accessPermissions = accessPermissions;
- }
-
- public ApplicationType<S, I> getType()
- {
- return type;
- }
-
- public ApplicationState<S> getState()
- {
- return state;
- }
-
- public I getRef()
- {
- return ref;
- }
-
- public String getId()
- {
- return id;
- }
-
- public String getTitle()
- {
- return title;
- }
-
- public String getIcon()
- {
- return icon;
- }
-
- public String getDescription()
- {
- return description;
- }
-
- public boolean isShowInfoBar()
- {
- return showInfoBar;
- }
-
- public boolean isShowApplicationState()
- {
- return showApplicationState;
- }
-
- public boolean isShowApplicationMode()
- {
- return showApplicationMode;
- }
-
- public String getTheme()
- {
- return theme;
- }
-
- public String getWidth()
- {
- return width;
- }
-
- public String getHeight()
- {
- return height;
- }
-
- public Map<String, String> getProperties()
- {
- return properties;
- }
-
- public List<String> getAccessPermissions()
- {
- return accessPermissions;
- }
-}
Copied: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/ApplicationData.java (from rev 413, portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/ApplicationData.java)
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/ApplicationData.java (rev 0)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/ApplicationData.java 2009-10-24 08:32:00 UTC (rev 414)
@@ -0,0 +1,189 @@
+/*
+ * Copyright (C) 2003-2007 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.portal.pom.data;
+
+import org.exoplatform.portal.config.model.ApplicationState;
+import org.exoplatform.portal.config.model.ApplicationType;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class ApplicationData<S, I> extends ComponentData
+{
+
+ /** . */
+ private final ApplicationType<S, I> type;
+
+ /** . */
+ private final ApplicationState<S> state;
+
+ /** . */
+ private final I ref;
+
+ /** . */
+ private final String id;
+
+ /** . */
+ private final String title;
+
+ /** . */
+ private final String icon;
+
+ /** . */
+ private final String description;
+
+ /** . */
+ private final boolean showInfoBar;
+
+ /** . */
+ private final boolean showApplicationState;
+
+ /** . */
+ private final boolean showApplicationMode;
+
+ /** . */
+ private final String theme;
+
+ /** . */
+ private final String width;
+
+ /** . */
+ private final String height;
+
+ /** . */
+ private final Map<String, String> properties;
+
+ /** . */
+ private final List<String> accessPermissions;
+
+ public ApplicationData(
+ String storageId,
+ String storageName,
+ ApplicationType<S, I> type,
+ ApplicationState<S> state,
+ I ref,
+ String id,
+ String title,
+ String icon,
+ String description,
+ boolean showInfoBar,
+ boolean showApplicationState,
+ boolean showApplicationMode,
+ String theme, String width,
+ String height,
+ Map<String, String> properties,
+ List<String> accessPermissions)
+ {
+ super(storageId, storageName);
+
+ //
+ this.type = type;
+ this.state = state;
+ this.ref = ref;
+ this.id = id;
+ this.title = title;
+ this.icon = icon;
+ this.description = description;
+ this.showInfoBar = showInfoBar;
+ this.showApplicationState = showApplicationState;
+ this.showApplicationMode = showApplicationMode;
+ this.theme = theme;
+ this.width = width;
+ this.height = height;
+ this.properties = properties;
+ this.accessPermissions = accessPermissions;
+ }
+
+ public ApplicationType<S, I> getType()
+ {
+ return type;
+ }
+
+ public ApplicationState<S> getState()
+ {
+ return state;
+ }
+
+ public I getRef()
+ {
+ return ref;
+ }
+
+ public String getId()
+ {
+ return id;
+ }
+
+ public String getTitle()
+ {
+ return title;
+ }
+
+ public String getIcon()
+ {
+ return icon;
+ }
+
+ public String getDescription()
+ {
+ return description;
+ }
+
+ public boolean isShowInfoBar()
+ {
+ return showInfoBar;
+ }
+
+ public boolean isShowApplicationState()
+ {
+ return showApplicationState;
+ }
+
+ public boolean isShowApplicationMode()
+ {
+ return showApplicationMode;
+ }
+
+ public String getTheme()
+ {
+ return theme;
+ }
+
+ public String getWidth()
+ {
+ return width;
+ }
+
+ public String getHeight()
+ {
+ return height;
+ }
+
+ public Map<String, String> getProperties()
+ {
+ return properties;
+ }
+
+ public List<String> getAccessPermissions()
+ {
+ return accessPermissions;
+ }
+}
Deleted: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/BodyData.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/BodyData.java 2009-10-24 07:50:41 UTC (rev 412)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/BodyData.java 2009-10-24 08:32:00 UTC (rev 414)
@@ -1,43 +0,0 @@
-/*
- * Copyright (C) 2003-2007 eXo Platform SAS.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
- *
- * This program 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
- */
-package org.exoplatform.portal.pom.config.data;
-
-import org.exoplatform.portal.pom.config.data.BodyType;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public class BodyData extends ComponentData
-{
-
- /** . */
- private final BodyType type;
-
- public BodyData(String storageId, BodyType type)
- {
- super(storageId, null);
-
- //
- this.type = type;
- }
-
- public BodyType getType()
- {
- return type;
- }
-}
Copied: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/BodyData.java (from rev 413, portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/BodyData.java)
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/BodyData.java (rev 0)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/BodyData.java 2009-10-24 08:32:00 UTC (rev 414)
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2003-2007 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.portal.pom.data;
+
+import org.exoplatform.portal.pom.data.BodyType;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class BodyData extends ComponentData
+{
+
+ /** . */
+ private final BodyType type;
+
+ public BodyData(String storageId, BodyType type)
+ {
+ super(storageId, null);
+
+ //
+ this.type = type;
+ }
+
+ public BodyType getType()
+ {
+ return type;
+ }
+}
Deleted: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/BodyType.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/BodyType.java 2009-10-24 07:50:41 UTC (rev 412)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/BodyType.java 2009-10-24 08:32:00 UTC (rev 414)
@@ -1,28 +0,0 @@
-/*
- * Copyright (C) 2003-2007 eXo Platform SAS.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
- *
- * This program 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
- */
-package org.exoplatform.portal.pom.config.data;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public enum BodyType
-{
-
- SITE, PAGE
-
-}
Copied: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/BodyType.java (from rev 413, portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/BodyType.java)
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/BodyType.java (rev 0)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/BodyType.java 2009-10-24 08:32:00 UTC (rev 414)
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2003-2007 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.portal.pom.data;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public enum BodyType
+{
+
+ SITE, PAGE
+
+}
Deleted: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/ComponentData.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/ComponentData.java 2009-10-24 07:50:41 UTC (rev 412)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/ComponentData.java 2009-10-24 08:32:00 UTC (rev 414)
@@ -1,30 +0,0 @@
-/*
- * Copyright (C) 2003-2007 eXo Platform SAS.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
- *
- * This program 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
- */
-package org.exoplatform.portal.pom.config.data;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public class ComponentData extends ModelData
-{
-
- public ComponentData(String storageId, String storageName)
- {
- super(storageId, storageName);
- }
-}
Copied: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/ComponentData.java (from rev 413, portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/ComponentData.java)
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/ComponentData.java (rev 0)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/ComponentData.java 2009-10-24 08:32:00 UTC (rev 414)
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2003-2007 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.portal.pom.data;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class ComponentData extends ModelData
+{
+
+ public ComponentData(String storageId, String storageName)
+ {
+ super(storageId, storageName);
+ }
+}
Deleted: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/ContainerData.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/ContainerData.java 2009-10-24 07:50:41 UTC (rev 412)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/ContainerData.java 2009-10-24 08:32:00 UTC (rev 414)
@@ -1,155 +0,0 @@
-/*
- * Copyright (C) 2003-2007 eXo Platform SAS.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
- *
- * This program 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
- */
-package org.exoplatform.portal.pom.config.data;
-
-import java.util.List;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public class ContainerData extends ComponentData
-{
-
- /** . */
- private final String id;
-
- /** . */
- private final String name;
-
- /** . */
- private final String icon;
-
- /** . */
- private final String decorator;
-
- /** . */
- private final String template;
-
- /** . */
- private final String factoryId;
-
- /** . */
- private final String title;
-
- /** . */
- private final String description;
-
- /** . */
- private final String width;
-
- /** . */
- private final String height;
-
- /** . */
- private final List<String> accessPermissions;
-
- /** . */
- private final List<ComponentData> children;
-
- public ContainerData(
- String storageId,
- String id,
- String name,
- String icon,
- String decorator,
- String template,
- String factoryId,
- String title,
- String description,
- String width,
- String height,
- List<String> accessPermissions,
- List<ComponentData> children)
- {
- super(storageId, null);
-
- //
- this.id = id;
- this.name = name;
- this.icon = icon;
- this.decorator = decorator;
- this.template = template;
- this.factoryId = factoryId;
- this.title = title;
- this.description = description;
- this.width = width;
- this.height = height;
- this.accessPermissions = accessPermissions;
- this.children = children;
- }
-
- public String getId()
- {
- return id;
- }
-
- public String getName()
- {
- return name;
- }
-
- public String getIcon()
- {
- return icon;
- }
-
- public String getDecorator()
- {
- return decorator;
- }
-
- public String getTemplate()
- {
- return template;
- }
-
- public String getFactoryId()
- {
- return factoryId;
- }
-
- public String getTitle()
- {
- return title;
- }
-
- public String getDescription()
- {
- return description;
- }
-
- public String getWidth()
- {
- return width;
- }
-
- public String getHeight()
- {
- return height;
- }
-
- public List<String> getAccessPermissions()
- {
- return accessPermissions;
- }
-
- public List<ComponentData> getChildren()
- {
- return children;
- }
-}
Copied: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/ContainerData.java (from rev 413, portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/ContainerData.java)
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/ContainerData.java (rev 0)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/ContainerData.java 2009-10-24 08:32:00 UTC (rev 414)
@@ -0,0 +1,155 @@
+/*
+ * Copyright (C) 2003-2007 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.portal.pom.data;
+
+import java.util.List;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class ContainerData extends ComponentData
+{
+
+ /** . */
+ private final String id;
+
+ /** . */
+ private final String name;
+
+ /** . */
+ private final String icon;
+
+ /** . */
+ private final String decorator;
+
+ /** . */
+ private final String template;
+
+ /** . */
+ private final String factoryId;
+
+ /** . */
+ private final String title;
+
+ /** . */
+ private final String description;
+
+ /** . */
+ private final String width;
+
+ /** . */
+ private final String height;
+
+ /** . */
+ private final List<String> accessPermissions;
+
+ /** . */
+ private final List<ComponentData> children;
+
+ public ContainerData(
+ String storageId,
+ String id,
+ String name,
+ String icon,
+ String decorator,
+ String template,
+ String factoryId,
+ String title,
+ String description,
+ String width,
+ String height,
+ List<String> accessPermissions,
+ List<ComponentData> children)
+ {
+ super(storageId, null);
+
+ //
+ this.id = id;
+ this.name = name;
+ this.icon = icon;
+ this.decorator = decorator;
+ this.template = template;
+ this.factoryId = factoryId;
+ this.title = title;
+ this.description = description;
+ this.width = width;
+ this.height = height;
+ this.accessPermissions = accessPermissions;
+ this.children = children;
+ }
+
+ public String getId()
+ {
+ return id;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public String getIcon()
+ {
+ return icon;
+ }
+
+ public String getDecorator()
+ {
+ return decorator;
+ }
+
+ public String getTemplate()
+ {
+ return template;
+ }
+
+ public String getFactoryId()
+ {
+ return factoryId;
+ }
+
+ public String getTitle()
+ {
+ return title;
+ }
+
+ public String getDescription()
+ {
+ return description;
+ }
+
+ public String getWidth()
+ {
+ return width;
+ }
+
+ public String getHeight()
+ {
+ return height;
+ }
+
+ public List<String> getAccessPermissions()
+ {
+ return accessPermissions;
+ }
+
+ public List<ComponentData> getChildren()
+ {
+ return children;
+ }
+}
Deleted: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/DashboardData.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/DashboardData.java 2009-10-24 07:50:41 UTC (rev 412)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/DashboardData.java 2009-10-24 08:32:00 UTC (rev 414)
@@ -1,103 +0,0 @@
-/*
- * Copyright (C) 2003-2007 eXo Platform SAS.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
- *
- * This program 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
- */
-package org.exoplatform.portal.pom.config.data;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public class DashboardData extends ContainerData
-{
-
- public DashboardData(
- String storageId,
- String id,
- String name,
- String icon,
- String decorator,
- String template,
- String factoryId,
- String title,
- String description,
- String width,
- String height,
- List<String> accessPermissions,
- List<ComponentData> children)
- {
- super(
- storageId,
- id,
- name,
- icon,
- decorator,
- template,
- factoryId,
- title,
- description,
- width,
- height,
- accessPermissions,
- children);
- }
-
- /** . */
- static final DashboardData INITIAL_DASHBOARD;
-
- static
- {
- List<ComponentData> children = new ArrayList<ComponentData>();
- for (int i = 0; i < 3; i++)
- {
- ContainerData row = new ContainerData(
- null,
- null,
- null,
- null,
- null,
- "classpath:groovy/dashboard/webui/component/UIContainer.gtmpl",
- null,
- null,
- null,
- null,
- null,
- Collections.<String>emptyList(),
- Collections.<ComponentData>emptyList());
- children.add(row);
- }
-
- INITIAL_DASHBOARD = new DashboardData(
- null,
- null,
- null,
- null,
- null,
- "classpath:groovy/dashboard/webui/component/UIColumnContainer.gtmpl",
- null,
- null,
- null,
- null,
- null,
- Collections.<String>emptyList(),
- Collections.unmodifiableList(children)
- );
- }
-
-}
Copied: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/DashboardData.java (from rev 413, portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/DashboardData.java)
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/DashboardData.java (rev 0)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/DashboardData.java 2009-10-24 08:32:00 UTC (rev 414)
@@ -0,0 +1,103 @@
+/*
+ * Copyright (C) 2003-2007 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.portal.pom.data;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class DashboardData extends ContainerData
+{
+
+ public DashboardData(
+ String storageId,
+ String id,
+ String name,
+ String icon,
+ String decorator,
+ String template,
+ String factoryId,
+ String title,
+ String description,
+ String width,
+ String height,
+ List<String> accessPermissions,
+ List<ComponentData> children)
+ {
+ super(
+ storageId,
+ id,
+ name,
+ icon,
+ decorator,
+ template,
+ factoryId,
+ title,
+ description,
+ width,
+ height,
+ accessPermissions,
+ children);
+ }
+
+ /** . */
+ static final DashboardData INITIAL_DASHBOARD;
+
+ static
+ {
+ List<ComponentData> children = new ArrayList<ComponentData>();
+ for (int i = 0; i < 3; i++)
+ {
+ ContainerData row = new ContainerData(
+ null,
+ null,
+ null,
+ null,
+ null,
+ "classpath:groovy/dashboard/webui/component/UIContainer.gtmpl",
+ null,
+ null,
+ null,
+ null,
+ null,
+ Collections.<String>emptyList(),
+ Collections.<ComponentData>emptyList());
+ children.add(row);
+ }
+
+ INITIAL_DASHBOARD = new DashboardData(
+ null,
+ null,
+ null,
+ null,
+ null,
+ "classpath:groovy/dashboard/webui/component/UIColumnContainer.gtmpl",
+ null,
+ null,
+ null,
+ null,
+ null,
+ Collections.<String>emptyList(),
+ Collections.unmodifiableList(children)
+ );
+ }
+
+}
Deleted: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/MappedAttributes.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/MappedAttributes.java 2009-10-24 07:50:41 UTC (rev 412)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/MappedAttributes.java 2009-10-24 08:32:00 UTC (rev 414)
@@ -1,126 +0,0 @@
-/**
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * 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.pom.config.data;
-
-import org.gatein.mop.api.Key;
-import org.gatein.mop.api.ValueType;
-
-import java.util.Date;
-
-/**
- * A class to hold the various attributes mapped between the model and the mop layer.
- *
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-class MappedAttributes
-{
-
- private MappedAttributes()
- {
- }
-
- /** . */
- public static final Key<String> ID = Key.create("id", ValueType.STRING);
-
- /** . */
- public static final Key<String> NAME = Key.create("name", ValueType.STRING);
-
- /** . */
- public static final Key<Boolean> SHOW_MAX_WINDOW = Key.create("show-max-window", ValueType.BOOLEAN);
-
- /** . */
- public static final Key<String> TITLE = Key.create("title", ValueType.STRING);
-
- /** . */
- public static final Key<String> FACTORY_ID = Key.create("factory-id", ValueType.STRING);
-
- /** . */
- public static final Key<String> ACCESS_PERMISSIONS = Key.create("access-permissions", ValueType.STRING);
-
- /** . */
- public static final Key<String> EDIT_PERMISSION = Key.create("edit-permission", ValueType.STRING);
-
- /** . */
- public static final Key<String> CREATOR = Key.create("creator", ValueType.STRING);
-
- /** . */
- public static final Key<String> MODIFIER = Key.create("modifier", ValueType.STRING);
-
- /** . */
- public static final Key<String> DESCRIPTION = Key.create("description", ValueType.STRING);
-
- /** . */
- public static final Key<String> DECORATOR = Key.create("decorator", ValueType.STRING);
-
- /** . */
- public static final Key<Integer> PRIORITY = Key.create("priority", ValueType.INTEGER);
-
- /** . */
- public static final Key<String> LABEL = Key.create("label", ValueType.STRING);
-
- /** . */
- public static final Key<String> ICON = Key.create("icon", ValueType.STRING);
-
- /** . */
- public static final Key<String> URI = Key.create("uri", ValueType.STRING);
-
- /** . */
- public static final Key<Date> START_PUBLICATION_DATE = Key.create("start-publication-date", ValueType.DATE);
-
- /** . */
- public static final Key<Date> END_PUBLICATION_DATE = Key.create("end-publication-date", ValueType.DATE);
-
- /** . */
- public static final Key<Boolean> VISIBLE = Key.create("visible", ValueType.BOOLEAN);
-
- /** . */
- public static final Key<String> TEMPLATE = Key.create("template", ValueType.STRING);
-
- /** . */
- public static final Key<Boolean> SHOW_PUBLICATION_DATE = Key.create("show-publication-date", ValueType.BOOLEAN);
-
- /** . */
- public static final Key<Boolean> SHOW_INFO_BAR = Key.create("show-info-bar", ValueType.BOOLEAN);
-
- /** . */
- public static final Key<Boolean> SHOW_STATE = Key.create("show-state", ValueType.BOOLEAN);
-
- /** . */
- public static final Key<Boolean> SHOW_MODE = Key.create("show-mode", ValueType.BOOLEAN);
-
- /** . */
- public static final Key<String> LOCALE = Key.create("locale", ValueType.STRING);
-
- /** . */
- public static final Key<String> SKIN = Key.create("skin", ValueType.STRING);
-
- /** . */
- public static final Key<String> WIDTH = Key.create("width", ValueType.STRING);
-
- /** . */
- public static final Key<String> HEIGHT = Key.create("height", ValueType.STRING);
-
- /** . */
- public static final Key<String> TYPE = Key.create("type", ValueType.STRING);
-
- /** . */
- public static final Key<String> THEME = Key.create("theme", ValueType.STRING);
-}
Copied: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/MappedAttributes.java (from rev 413, portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/MappedAttributes.java)
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/MappedAttributes.java (rev 0)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/MappedAttributes.java 2009-10-24 08:32:00 UTC (rev 414)
@@ -0,0 +1,126 @@
+/**
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * 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.pom.data;
+
+import org.gatein.mop.api.Key;
+import org.gatein.mop.api.ValueType;
+
+import java.util.Date;
+
+/**
+ * A class to hold the various attributes mapped between the model and the mop layer.
+ *
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+class MappedAttributes
+{
+
+ private MappedAttributes()
+ {
+ }
+
+ /** . */
+ public static final Key<String> ID = Key.create("id", ValueType.STRING);
+
+ /** . */
+ public static final Key<String> NAME = Key.create("name", ValueType.STRING);
+
+ /** . */
+ public static final Key<Boolean> SHOW_MAX_WINDOW = Key.create("show-max-window", ValueType.BOOLEAN);
+
+ /** . */
+ public static final Key<String> TITLE = Key.create("title", ValueType.STRING);
+
+ /** . */
+ public static final Key<String> FACTORY_ID = Key.create("factory-id", ValueType.STRING);
+
+ /** . */
+ public static final Key<String> ACCESS_PERMISSIONS = Key.create("access-permissions", ValueType.STRING);
+
+ /** . */
+ public static final Key<String> EDIT_PERMISSION = Key.create("edit-permission", ValueType.STRING);
+
+ /** . */
+ public static final Key<String> CREATOR = Key.create("creator", ValueType.STRING);
+
+ /** . */
+ public static final Key<String> MODIFIER = Key.create("modifier", ValueType.STRING);
+
+ /** . */
+ public static final Key<String> DESCRIPTION = Key.create("description", ValueType.STRING);
+
+ /** . */
+ public static final Key<String> DECORATOR = Key.create("decorator", ValueType.STRING);
+
+ /** . */
+ public static final Key<Integer> PRIORITY = Key.create("priority", ValueType.INTEGER);
+
+ /** . */
+ public static final Key<String> LABEL = Key.create("label", ValueType.STRING);
+
+ /** . */
+ public static final Key<String> ICON = Key.create("icon", ValueType.STRING);
+
+ /** . */
+ public static final Key<String> URI = Key.create("uri", ValueType.STRING);
+
+ /** . */
+ public static final Key<Date> START_PUBLICATION_DATE = Key.create("start-publication-date", ValueType.DATE);
+
+ /** . */
+ public static final Key<Date> END_PUBLICATION_DATE = Key.create("end-publication-date", ValueType.DATE);
+
+ /** . */
+ public static final Key<Boolean> VISIBLE = Key.create("visible", ValueType.BOOLEAN);
+
+ /** . */
+ public static final Key<String> TEMPLATE = Key.create("template", ValueType.STRING);
+
+ /** . */
+ public static final Key<Boolean> SHOW_PUBLICATION_DATE = Key.create("show-publication-date", ValueType.BOOLEAN);
+
+ /** . */
+ public static final Key<Boolean> SHOW_INFO_BAR = Key.create("show-info-bar", ValueType.BOOLEAN);
+
+ /** . */
+ public static final Key<Boolean> SHOW_STATE = Key.create("show-state", ValueType.BOOLEAN);
+
+ /** . */
+ public static final Key<Boolean> SHOW_MODE = Key.create("show-mode", ValueType.BOOLEAN);
+
+ /** . */
+ public static final Key<String> LOCALE = Key.create("locale", ValueType.STRING);
+
+ /** . */
+ public static final Key<String> SKIN = Key.create("skin", ValueType.STRING);
+
+ /** . */
+ public static final Key<String> WIDTH = Key.create("width", ValueType.STRING);
+
+ /** . */
+ public static final Key<String> HEIGHT = Key.create("height", ValueType.STRING);
+
+ /** . */
+ public static final Key<String> TYPE = Key.create("type", ValueType.STRING);
+
+ /** . */
+ public static final Key<String> THEME = Key.create("theme", ValueType.STRING);
+}
Deleted: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/Mapper.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/Mapper.java 2009-10-24 07:50:41 UTC (rev 412)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/Mapper.java 2009-10-24 08:32:00 UTC (rev 414)
@@ -1,1085 +0,0 @@
-/**
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * 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.pom.config.data;
-
-import org.exoplatform.portal.config.model.ApplicationState;
-import org.exoplatform.portal.config.model.ApplicationType;
-import org.exoplatform.portal.pom.config.data.BodyType;
-import org.exoplatform.portal.config.model.Dashboard;
-import org.exoplatform.portal.config.model.ModelChange;
-import org.exoplatform.portal.config.model.PersistentApplicationState;
-import org.exoplatform.portal.config.model.PortalConfig;
-import org.exoplatform.portal.config.model.TransientApplicationState;
-import org.exoplatform.portal.config.model.gadget.GadgetId;
-import org.exoplatform.portal.pom.config.Utils;
-import static org.exoplatform.portal.pom.config.Utils.join;
-import static org.exoplatform.portal.pom.config.Utils.split;
-
-import org.exoplatform.portal.config.model.portlet.PortletId;
-import org.exoplatform.portal.config.model.wsrp.WSRPId;
-import org.exoplatform.portal.pom.config.POMSession;
-import org.exoplatform.portal.pom.config.data.ApplicationData;
-import org.exoplatform.portal.pom.config.data.BodyData;
-import org.exoplatform.portal.pom.config.data.ComponentData;
-import org.exoplatform.portal.pom.config.data.ContainerData;
-import org.exoplatform.portal.pom.config.data.DashboardData;
-import org.exoplatform.portal.pom.config.data.ModelData;
-import org.exoplatform.portal.pom.config.data.NavigationContainer;
-import org.exoplatform.portal.pom.config.data.PageData;
-import org.exoplatform.portal.pom.config.data.PortalData;
-import org.exoplatform.portal.pom.spi.gadget.Gadget;
-import org.exoplatform.portal.pom.spi.portlet.Preferences;
-import org.exoplatform.portal.pom.spi.wsrp.WSRPState;
-import org.gatein.mop.api.Attributes;
-import org.gatein.mop.api.content.ContentType;
-import org.gatein.mop.api.content.Customization;
-import org.gatein.mop.api.workspace.Navigation;
-import org.gatein.mop.api.workspace.ObjectType;
-import org.gatein.mop.api.workspace.Site;
-import org.gatein.mop.api.workspace.Workspace;
-import org.gatein.mop.api.workspace.WorkspaceObject;
-import org.gatein.mop.api.workspace.link.Link;
-import org.gatein.mop.api.workspace.link.PageLink;
-import org.gatein.mop.api.workspace.ui.UIBody;
-import org.gatein.mop.api.workspace.ui.UIComponent;
-import org.gatein.mop.api.workspace.ui.UIContainer;
-import org.gatein.mop.api.workspace.ui.UIWindow;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.UUID;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public class Mapper
-{
-
- /** . */
- private static final Set<String> portalPropertiesBlackList =
- new HashSet<String>(Arrays.asList("jcr:uuid", "jcr:primaryType", MappedAttributes.LOCALE.getName(),
- MappedAttributes.ACCESS_PERMISSIONS.getName(), MappedAttributes.EDIT_PERMISSION.getName(),
- MappedAttributes.SKIN.getName(), MappedAttributes.TITLE.getName(), MappedAttributes.CREATOR.getName(),
- MappedAttributes.MODIFIER.getName()));
-
- /** . */
- private static final Set<String> windowPropertiesBlackList =
- new HashSet<String>(Arrays.asList("jcr:uuid", "jcr:primaryType", MappedAttributes.TYPE.getName(),
- MappedAttributes.THEME.getName(), MappedAttributes.TITLE.getName(), MappedAttributes.ACCESS_PERMISSIONS
- .getName(), MappedAttributes.SHOW_INFO_BAR.getName(), MappedAttributes.SHOW_STATE.getName(),
- MappedAttributes.SHOW_MODE.getName(), MappedAttributes.DESCRIPTION.getName(), MappedAttributes.ICON.getName(),
- MappedAttributes.WIDTH.getName(), MappedAttributes.HEIGHT.getName()));
-
- /** . */
- private final POMSession session;
-
- public Mapper(POMSession session)
- {
- this.session = session;
- }
-
- public NavigationContainer.Page load(Navigation src)
- {
- return load(src, NavigationContainer.Page.class);
- }
-
- private <T extends NavigationContainer> T load(Navigation src, Class<T> type)
- {
-
- //
- ArrayList<NavigationContainer.Node> children = new ArrayList<NavigationContainer.Node>(src.getChildren().size());
- for (Navigation srcChild : src.getChildren())
- {
- NavigationContainer.Node dstChild = load(srcChild, NavigationContainer.Node.class);
- children.add(dstChild);
- }
-
- //
- T dst;
- if (type == NavigationContainer.Page.class)
- {
- Site site = src.getSite();
- String ownerType = getOwnerType(site.getObjectType());
- String ownerId = site.getName();
- Attributes attrs = src.getAttributes();
- NavigationContainer.Page dstNav = new NavigationContainer.Page(
- src.getObjectId(),
- ownerType,
- ownerId,
- attrs.getValue(MappedAttributes.DESCRIPTION),
- attrs.getValue(MappedAttributes.CREATOR),
- attrs.getValue(MappedAttributes.MODIFIER),
- attrs.getValue(MappedAttributes.PRIORITY, 1),
- children);
- dst = (T)dstNav;
- }
- else if (type == NavigationContainer.Node.class)
- {
- Attributes attrs = src.getAttributes();
- String pageReference = null;
- Link link = src.getLink();
- if (link instanceof PageLink)
- {
- PageLink pageLink = (PageLink)link;
- org.gatein.mop.api.workspace.Page target = pageLink.getPage();
- if (target != null)
- {
- Site site = target.getSite();
- ObjectType<? extends Site> siteType = site.getObjectType();
- pageReference = getOwnerType(siteType) + "::" + site.getName() + "::" + target.getName();
- }
- }
- NavigationContainer.Node dstNode = new NavigationContainer.Node(
- src.getObjectId(),
- attrs.getValue(MappedAttributes.URI),
- attrs.getValue(MappedAttributes.LABEL),
- attrs.getValue(MappedAttributes.ICON),
- src.getName(),
- attrs.getValue(MappedAttributes.START_PUBLICATION_DATE),
- attrs.getValue(MappedAttributes.END_PUBLICATION_DATE),
- attrs.getValue(MappedAttributes.SHOW_PUBLICATION_DATE, false),
- attrs.getValue(MappedAttributes.VISIBLE, true),
- pageReference,
- children
- );
-
- dst = (T)dstNode;
- }
- else
- {
- throw new AssertionError();
- }
-
- //
- return dst;
- }
-
- public void save(NavigationContainer.Page src, Navigation dst)
- {
- save((NavigationContainer)src, dst);
- }
-
- private void save(NavigationContainer src, Navigation dst)
- {
- if (src instanceof NavigationContainer.Node)
- {
- NavigationContainer.Node node = (NavigationContainer.Node)src;
- Workspace workspace = dst.getSite().getWorkspace();
- String reference = node.getPageReference();
- if (reference != null)
- {
- String[] pageChunks = split("::", reference);
- ObjectType<? extends Site> siteType = parseSiteType(pageChunks[0]);
- Site site = workspace.getSite(siteType, pageChunks[1]);
- org.gatein.mop.api.workspace.Page target = site.getRootPage().getChild("pages").getChild(pageChunks[2]);
- PageLink link = dst.linkTo(ObjectType.PAGE_LINK);
- link.setPage(target);
- }
-
- //
- Attributes attrs = dst.getAttributes();
- attrs.setValue(MappedAttributes.URI, node.getURI());
- attrs.setValue(MappedAttributes.LABEL, node.getLabel());
- attrs.setValue(MappedAttributes.ICON, node.getIcon());
- attrs.setValue(MappedAttributes.START_PUBLICATION_DATE, node.getStartPublicationDate());
- attrs.setValue(MappedAttributes.END_PUBLICATION_DATE, node.getEndPublicationDate());
- attrs.setValue(MappedAttributes.SHOW_PUBLICATION_DATE, node.getShowPublicationDate());
- attrs.setValue(MappedAttributes.VISIBLE, node.isVisible());
- }
- else if (src instanceof NavigationContainer.Page)
- {
- NavigationContainer.Page pageNav = (NavigationContainer.Page)src;
-
- //
- Attributes attrs = dst.getAttributes();
- attrs.setValue(MappedAttributes.PRIORITY, pageNav.getPriority());
- attrs.setValue(MappedAttributes.CREATOR, pageNav.getCreator());
- attrs.setValue(MappedAttributes.MODIFIER, pageNav.getModifier());
- attrs.setValue(MappedAttributes.DESCRIPTION, pageNav.getDescription());
- }
- else
- {
- throw new AssertionError();
- }
-
- //
- Set<String> savedSet = new HashSet<String>();
- for (NavigationContainer.Node node : src.getChildren())
- {
- String srcId = node.getStorageId();
- Navigation dstChild;
- if (srcId != null)
- {
- dstChild = session.findObjectById(ObjectType.NAVIGATION, srcId);
- }
- else
- {
- dstChild = dst.getChild(node.getName());
- if (dstChild == null)
- {
- dstChild = dst.addChild(node.getName());
- }
- srcId = dstChild.getObjectId();
- }
- save(node, dstChild);
- savedSet.add(srcId);
- }
- for (Iterator<? extends Navigation> i = dst.getChildren().iterator(); i.hasNext();)
- {
- Navigation dstChild = i.next();
- if (!savedSet.contains(dstChild.getObjectId()))
- {
- i.remove();
- }
- }
- }
-
- public PortalData load(Site src)
- {
- String type = Mapper.getOwnerType(src.getObjectType());
- Attributes attrs = src.getAttributes();
-
- //
- org.gatein.mop.api.workspace.Page template = src.getRootNavigation().getTemplate();
- UIContainer srcLayout = template.getRootComponent();
-
- //
- Map<String, String> properties = new HashMap<String, String>();
- load(attrs, properties, portalPropertiesBlackList);
-
- //
- List<ComponentData> layoutChildren = loadChildren(srcLayout);
- ContainerData layout = load(srcLayout, layoutChildren);
-
- //
- return new PortalData(
- src.getObjectId(),
- src.getName(),
- type,
- attrs.getValue(MappedAttributes.LOCALE),
- Collections.unmodifiableList(Arrays.asList(split("|", attrs.getValue(MappedAttributes.ACCESS_PERMISSIONS, "")))),
- attrs.getValue(MappedAttributes.EDIT_PERMISSION),
- Collections.unmodifiableMap(properties),
- attrs.getValue(MappedAttributes.SKIN),
- attrs.getValue(MappedAttributes.TITLE),
- layout,
- attrs.getValue(MappedAttributes.CREATOR),
- attrs.getValue(MappedAttributes.MODIFIER));
- }
-
- public void save(PortalData src, Site dst)
- {
- if (src.getStorageId() != null && !src.getStorageId().equals(dst.getObjectId()))
- {
- String msg =
- "Attempt to save a site " + src.getType() + "/" + src.getName() + " on the wrong target site "
- + dst.getObjectType() + "/" + dst.getName();
- throw new IllegalArgumentException(msg);
- }
-
- //
- Attributes attrs = dst.getAttributes();
- attrs.setValue(MappedAttributes.LOCALE, src.getLocale());
- attrs.setValue(MappedAttributes.ACCESS_PERMISSIONS, join("|", src.getAccessPermissions()));
- attrs.setValue(MappedAttributes.EDIT_PERMISSION, src.getEditPermission());
- attrs.setValue(MappedAttributes.SKIN, src.getSkin());
- attrs.setValue(MappedAttributes.TITLE, src.getTitle());
- attrs.setValue(MappedAttributes.CREATOR, src.getCreator());
- attrs.setValue(MappedAttributes.MODIFIER, src.getModifier());
- if (src.getProperties() != null)
- {
- save(src.getProperties(), attrs);
- }
-
- //
- org.gatein.mop.api.workspace.Page templates = dst.getRootPage().getChild("templates");
- org.gatein.mop.api.workspace.Page template = templates.getChild("default");
- if (template == null)
- {
- template = templates.addChild("default");
- }
-
- //
- ContainerData srcContainer = src.getPortalLayout();
- UIContainer dstContainer = template.getRootComponent();
-
- //
- save(srcContainer, dstContainer);
- saveChildren(srcContainer, dstContainer);
-
- //
- dst.getRootNavigation().setTemplate(template);
- }
-
- public PageData load(org.gatein.mop.api.workspace.Page src)
- {
- Site site = src.getSite();
- String ownerType = getOwnerType(site.getObjectType());
- String ownerId = site.getName();
- String name = src.getName();
- List<ComponentData> children = loadChildren(src.getRootComponent());
- Attributes attrs = src.getAttributes();
-
- //
- return new PageData(
- src.getObjectId(),
- null,
- name,
- null,
- null,
- null,
- attrs.getValue(MappedAttributes.FACTORY_ID),
- attrs.getValue(MappedAttributes.TITLE),
- null,
- null,
- null,
- Utils.safeImmutableList(split("|", attrs.getValue(MappedAttributes.ACCESS_PERMISSIONS))),
- children,
- ownerType,
- ownerId,
- attrs.getValue(MappedAttributes.EDIT_PERMISSION),
- attrs.getValue(MappedAttributes.SHOW_MAX_WINDOW, false),
- attrs.getValue(MappedAttributes.CREATOR),
- attrs.getValue(MappedAttributes.MODIFIER)
- );
- }
-
- public List<ModelChange> save(PageData src, Site site, String name)
- {
- org.gatein.mop.api.workspace.Page root = site.getRootPage();
- org.gatein.mop.api.workspace.Page pages = root.getChild("pages");
- org.gatein.mop.api.workspace.Page dst = pages.getChild(name);
-
- //
- LinkedList<ModelChange> changes = new LinkedList<ModelChange>();
-
- //
- if (dst == null)
- {
- dst = pages.addChild(name);
- changes.add(new ModelChange.Create(src));
- }
- else
- {
- changes.add(new ModelChange.Update(src));
- }
-
- //
- Attributes attrs = dst.getAttributes();
- attrs.setValue(MappedAttributes.TITLE, src.getTitle());
- attrs.setValue(MappedAttributes.FACTORY_ID, src.getFactoryId());
- attrs.setValue(MappedAttributes.ACCESS_PERMISSIONS, join("|", src.getAccessPermissions()));
- attrs.setValue(MappedAttributes.EDIT_PERMISSION, src.getEditPermission());
- attrs.setValue(MappedAttributes.SHOW_MAX_WINDOW, src.isShowMaxWindow());
- attrs.setValue(MappedAttributes.CREATOR, src.getCreator());
- attrs.setValue(MappedAttributes.MODIFIER, src.getModifier());
-
- //
- changes.addAll(saveChildren(src, dst.getRootComponent()));
-
- //
- return changes;
- }
-
- private ContainerData load(UIContainer src, List<ComponentData> children)
- {
- Attributes attrs = src.getAttributes();
- return new ContainerData(
- src.getObjectId(),
- attrs.getValue(MappedAttributes.ID),
- attrs.getValue(MappedAttributes.NAME),
- attrs.getValue(MappedAttributes.ICON),
- attrs.getValue(MappedAttributes.DECORATOR),
- attrs.getValue(MappedAttributes.TEMPLATE),
- attrs.getValue(MappedAttributes.FACTORY_ID),
- attrs.getValue(MappedAttributes.TITLE),
- attrs.getValue(MappedAttributes.DESCRIPTION),
- attrs.getValue(MappedAttributes.WIDTH),
- attrs.getValue(MappedAttributes.HEIGHT),
- Utils.safeImmutableList(split("|", attrs.getValue(MappedAttributes.ACCESS_PERMISSIONS))),
- children
- );
- }
-
- private List<ComponentData> loadChildren(UIContainer src)
- {
- ArrayList<ComponentData> children = new ArrayList<ComponentData>(src.size());
- for (UIComponent component : src)
- {
-
- // Obtain a model object from the ui component
- ComponentData mo;
- if (component instanceof UIContainer)
- {
- UIContainer srcContainer = (UIContainer)component;
- Attributes attrs = srcContainer.getAttributes();
- String type = attrs.getValue(MappedAttributes.TYPE);
- if ("dashboard".equals(type))
- {
- TransientApplicationState<Preferences> state = new TransientApplicationState<Preferences>();
- Site owner = src.getPage().getSite();
- state.setOwnerType(getOwnerType(owner.getObjectType()));
- state.setOwnerId(owner.getName());
- mo = new ApplicationData<Preferences, PortletId>(
- srcContainer.getObjectId(),
- component.getName(),
- ApplicationType.PORTLET,
- state,
- new PortletId("dashboard", "DashboardPortlet"),
- null,
- null,
- null,
- null,
- false,
- false,
- false,
- null,
- null,
- null,
- Collections.<String, String>emptyMap(),
- Collections.<String>emptyList());
- }
- else
- {
- List<ComponentData> dstChildren = loadChildren(srcContainer);
- mo = load(srcContainer, dstChildren);
- }
- }
- else if (component instanceof UIWindow)
- {
- UIWindow window = (UIWindow)component;
- ApplicationData application = load(window);
- mo = application;
- }
- else if (component instanceof UIBody)
- {
- mo = new BodyData(component.getObjectId(), BodyType.PAGE);
- }
- else
- {
- throw new AssertionError();
- }
-
- // Add among children
- children.add(mo);
- }
- return children;
- }
-
- private void save(ContainerData src, UIContainer dst)
- {
- Attributes dstAttrs = dst.getAttributes();
- dstAttrs.setValue(MappedAttributes.ID, src.getId());
- dstAttrs.setValue(MappedAttributes.TYPE, src instanceof DashboardData ? "dashboard" : null);
- dstAttrs.setValue(MappedAttributes.TITLE, src.getTitle());
- dstAttrs.setValue(MappedAttributes.ICON, src.getIcon());
- dstAttrs.setValue(MappedAttributes.TEMPLATE, src.getTemplate());
- dstAttrs.setValue(MappedAttributes.ACCESS_PERMISSIONS, join("|", src.getAccessPermissions()));
- dstAttrs.setValue(MappedAttributes.FACTORY_ID, src.getFactoryId());
- dstAttrs.setValue(MappedAttributes.DECORATOR, src.getDecorator());
- dstAttrs.setValue(MappedAttributes.DESCRIPTION, src.getDescription());
- dstAttrs.setValue(MappedAttributes.WIDTH, src.getWidth());
- dstAttrs.setValue(MappedAttributes.HEIGHT, src.getHeight());
- dstAttrs.setValue(MappedAttributes.NAME, src.getName());
- }
-
- private void save(ModelData src, WorkspaceObject dst, LinkedList<ModelChange> changes,
- Map<String, String> hierarchyRelationships)
- {
- if (src instanceof ContainerData)
- {
- save((ContainerData)src, (UIContainer)dst);
- saveChildren((ContainerData)src, (UIContainer)dst, changes, hierarchyRelationships);
- }
- else if (src instanceof ApplicationData)
- {
- save((ApplicationData<?, ?>)src, (UIWindow)dst);
- }
- else if (src instanceof BodyData)
- {
- // Stateless
- }
- else
- {
- throw new AssertionError("Was not expecting child " + src);
- }
- }
-
- /** . */
- private static final PortletId DASHBOARD_ID = new PortletId("dashboard", "DashboardPortlet");
-
- private LinkedList<ModelChange> saveChildren(final ContainerData src, UIContainer dst)
- {
-
- //
- LinkedList<ModelChange> changes = new LinkedList<ModelChange>();
-
- //
- Map<String, String> hierarchyRelationships = new HashMap<String, String>();
-
- //
- build(src, hierarchyRelationships);
-
- //
- saveChildren(src, dst, changes, Collections.unmodifiableMap(hierarchyRelationships));
-
- //
- return changes;
- }
-
- private void build(ContainerData parent, Map<String, String> hierarchyRelationships)
- {
- String parentId = parent.getStorageId();
- if (parentId != null)
- {
- for (ModelData child : parent.getChildren())
- {
- String childId = child.getStorageId();
- if (childId != null)
- {
- if (hierarchyRelationships.put(childId, parentId) != null)
- {
- throw new AssertionError("The same object is present two times in the object hierarchy");
- }
- if (child instanceof ContainerData)
- {
- build((ContainerData)child, hierarchyRelationships);
- }
- }
- }
- }
- }
-
- private void saveChildren(final ContainerData src, UIContainer dst, LinkedList<ModelChange> changes,
- Map<String, String> hierarchyRelationships)
- {
- final List<String> orders = new ArrayList<String>();
- final Map<String, ModelData> modelObjectMap = new HashMap<String, ModelData>();
-
- //
- for (ModelData srcChild : src.getChildren())
- {
- String srcId = srcChild.getStorageId();
-
- // Replace dashboard application by container if needed
- if (srcChild instanceof ApplicationData)
- {
- ApplicationData app = (ApplicationData)srcChild;
- if (app.getType() == ApplicationType.PORTLET)
- {
- PortletId ref = (PortletId)app.getRef();
- if (DASHBOARD_ID.equals(ref))
- {
- if (app.getStorageId() != null)
- {
- UIContainer dstDashboard = session.findObjectById(ObjectType.CONTAINER, app.getStorageId());
- srcChild = loadDashboard(dstDashboard);
- }
- else
- {
- srcChild = DashboardData.INITIAL_DASHBOARD;
- }
- }
- }
- }
-
- //
- UIComponent dstChild;
- if (srcId != null)
- {
- dstChild = session.findObjectById(ObjectType.COMPONENT, srcId);
- if (dstChild == null)
- {
- throw new AssertionError("Could not find supposed present child with id " + srcId);
- }
- // julien : this can fail due to a bug in chromattic not implementing equals method properly
- // and is replaced with the foreach below
- /*
- if (!dst.contains(dstChild)) {
- throw new IllegalArgumentException("Attempt for updating a ui component " + session.pathOf(dstChild) +
- "that is not present in the target ui container " + session.pathOf(dst));
- }
- */
- boolean found = false;
- for (UIComponent child : dst)
- {
- if (child.getObjectId().equals(srcId))
- {
- found = true;
- break;
- }
- }
- if (!found)
- {
- if (hierarchyRelationships.containsKey(srcId))
- {
- // It's a move operation, so we move the node first
- dst.add(dstChild);
- }
- else
- {
- throw new IllegalArgumentException("Attempt for updating a ui component " + session.pathOf(dstChild)
- + "that is not present in the target ui container " + session.pathOf(dst));
- }
- }
-
- //
- changes.add(new ModelChange.Update(srcChild));
- }
- else
- {
- String name = srcChild.getStorageName();
- if (name == null)
- {
- // We manufacture one name
- name = UUID.randomUUID().toString();
- }
- if (srcChild instanceof ContainerData)
- {
- dstChild = dst.add(ObjectType.CONTAINER, name);
- }
- else if (srcChild instanceof ApplicationData)
- {
- dstChild = dst.add(ObjectType.WINDOW, name);
- }
- else if (srcChild instanceof BodyData)
- {
- dstChild = dst.add(ObjectType.BODY, name);
- }
- else
- {
- throw new AssertionError("Was not expecting child " + srcChild);
- }
- changes.add(new ModelChange.Create(srcChild));
- }
-
- //
- save(srcChild, dstChild, changes, hierarchyRelationships);
-
- //
- String dstId = dstChild.getObjectId();
- modelObjectMap.put(dstId, srcChild);
- orders.add(dstId);
- }
-
- // Take care of move operation that could be seen as a remove
- for (UIComponent dstChild : dst)
- {
- String dstId = dstChild.getObjectId();
- if (!modelObjectMap.containsKey(dstId) && hierarchyRelationships.containsKey(dstId))
- {
- String parentId = hierarchyRelationships.get(dstId);
-
- // Get the new parent
- UIContainer parent = session.findObjectById(ObjectType.CONTAINER, parentId);
-
- // Perform the move
- parent.add(dstChild);
-
- //
- changes.add(new ModelChange.Destroy(dstId));
- }
- }
-
- // Delete removed children
- for (Iterator<UIComponent> i = dst.iterator(); i.hasNext();)
- {
- UIComponent dstChild = i.next();
- String dstId = dstChild.getObjectId();
- if (!modelObjectMap.containsKey(dstId))
- {
- i.remove();
- changes.add(new ModelChange.Destroy(dstId));
- }
- }
-
- // Now sort children according to the order provided by the container
- // need to replace that with Collections.sort once the set(int index, E element) is implemented in Chromattic lists
- UIComponent[] a = dst.toArray(new UIComponent[dst.size()]);
- Arrays.sort(a, new Comparator<UIComponent>()
- {
- public int compare(UIComponent o1, UIComponent o2)
- {
- int i1 = orders.indexOf(o1.getObjectId());
- int i2 = orders.indexOf(o2.getObjectId());
- return i1 - i2;
- }
- });
- for (int j = 0; j < a.length; j++)
- {
- dst.add(j, a[j]);
- }
- }
-
- private <S, I> ApplicationData<S, I> load(UIWindow src)
- {
- Attributes attrs = src.getAttributes();
-
- //
- Customization<?> customization = src.getCustomization();
-
- //
- ContentType<?> contentType = customization.getType();
-
- //
- String customizationid = customization.getId();
-
- //
- String contentId = customization.getContentId();
-
- //
- I ref;
- ApplicationType<S, I> type;
- if (contentType == null || contentType == Preferences.CONTENT_TYPE)
- {
- int pos = contentId.indexOf('/');
- String applicationName = contentId.substring(0, pos);
- String portletName = contentId.substring(pos + 1);
- ref = (I)new PortletId(applicationName, portletName);
- type = (ApplicationType<S,I>)ApplicationType.PORTLET;
- }
- else if (contentType == Gadget.CONTENT_TYPE)
- {
- ref = (I)new GadgetId(contentId);
- type = (ApplicationType<S,I>)ApplicationType.GADGET;
- }
- else if (contentType == WSRPState.CONTENT_TYPE)
- {
- ref = (I)new WSRPId(contentId);
- type = (ApplicationType<S,I>)ApplicationType.WSRP_PORTLET;
- }
- else
- {
- throw new AssertionError("Unknown type: " + contentType);
- }
-
- //
- PersistentApplicationState<S> instanceState = new PersistentApplicationState<S>(customizationid);
-
- //
- HashMap<String, String> properties = new HashMap<String, String>();
- load(attrs, properties, windowPropertiesBlackList);
-
- //
- return new ApplicationData<S,I>(
- src.getObjectId(),
- src.getName(),
- type,
- instanceState,
- ref,
- null,
- attrs.getValue(MappedAttributes.TITLE),
- attrs.getValue(MappedAttributes.ICON),
- attrs.getValue(MappedAttributes.DESCRIPTION),
- attrs.getValue(MappedAttributes.SHOW_INFO_BAR),
- attrs.getValue(MappedAttributes.SHOW_STATE),
- attrs.getValue(MappedAttributes.SHOW_MODE),
- attrs.getValue(MappedAttributes.THEME),
- attrs.getValue(MappedAttributes.WIDTH),
- attrs.getValue(MappedAttributes.HEIGHT),
- Utils.safeImmutableMap(properties),
- Utils.safeImmutableList(split("|", attrs.getValue(MappedAttributes.ACCESS_PERMISSIONS)))
- );
- }
-
- public <S, I> void save(ApplicationData<S, I> src, UIWindow dst)
- {
- Attributes attrs = dst.getAttributes();
- attrs.setValue(MappedAttributes.THEME, src.getTheme());
- attrs.setValue(MappedAttributes.TITLE, src.getTitle());
- attrs.setValue(MappedAttributes.ACCESS_PERMISSIONS, join("|", src.getAccessPermissions()));
- attrs.setValue(MappedAttributes.SHOW_INFO_BAR, src.isShowInfoBar());
- attrs.setValue(MappedAttributes.SHOW_STATE, src.isShowApplicationState());
- attrs.setValue(MappedAttributes.SHOW_MODE, src.isShowApplicationMode());
- attrs.setValue(MappedAttributes.DESCRIPTION, src.getDescription());
- attrs.setValue(MappedAttributes.ICON, src.getIcon());
- attrs.setValue(MappedAttributes.WIDTH, src.getWidth());
- attrs.setValue(MappedAttributes.HEIGHT, src.getHeight());
- save(src.getProperties(), attrs);
-
- //
- ApplicationState<S> instanceState = src.getState();
-
- // We modify only transient portlet state
- // and we ignore any persistent portlet state
- if (instanceState instanceof TransientApplicationState)
- {
-
- //
- TransientApplicationState<S> transientState = (TransientApplicationState<S>)instanceState;
-
- // Attempt to get a site from the instance state
- Site site = null;
- if (transientState.getOwnerType() != null && transientState.getOwnerId() != null)
- {
- ObjectType<Site> siteType = parseSiteType(transientState.getOwnerType());
- site = session.getWorkspace().getSite(siteType, transientState.getOwnerId());
- }
-
- // The current site
- Site currentSite = dst.getPage().getSite();
-
- // If it is the same site than the current page
- // set null
- if (site == dst.getPage().getSite())
- {
- site = null;
- }
-
- // The content id
- String contentId;
- ContentType<S> contentType = src.getType().getContentType();
- if (contentType == Preferences.CONTENT_TYPE)
- {
- PortletId id = (PortletId)src.getRef();
- contentId = id.getApplicationName() + "/" + id.getPortletName();
- }
- else if (contentType == Gadget.CONTENT_TYPE)
- {
- GadgetId id = (GadgetId)src.getRef();
- contentId = id.getGadgetName();
- }
- else if (contentType == WSRPState.CONTENT_TYPE)
- {
- WSRPId id = (WSRPId)src.getRef();
- contentId = id.getUri();
- }
- else
- {
- throw new UnsupportedOperationException("Unsupported content type");
- }
-
- // The customization that we will inherit from if not null
- Customization<?> customization = null;
-
- // Now inspect the unique id
- String uniqueId = transientState.getUniqueId();
- if (uniqueId != null)
- {
-
- // This is a customized window
- if (uniqueId.startsWith("@"))
- {
- String id = uniqueId.substring(1);
-
- // It's another window, we get its customization
- if (!dst.getObjectId().equals(id))
- {
- UIWindow window = session.findObjectById(ObjectType.WINDOW, id);
- Customization<?> windowCustomization = window.getCustomization();
- if (windowCustomization.getType().equals(contentType))
- {
- customization = windowCustomization;
- }
- }
- }
- else
- {
- int pos = uniqueId.indexOf('#');
- if (pos == -1)
- {
-
- // If it's a different site than the page one (it has to be at this point)
- // then we get its customization
- if (site != null)
- {
- customization = site.getCustomization(uniqueId);
- }
- else
- {
- customization = currentSite.getCustomization(uniqueId);
-
- // If it does not exist we create it
- if (customization == null)
- {
- customization = currentSite.customize(uniqueId, contentType, contentId, null);
- }
- }
- }
- else
- {
-
- // Otherwise we get the page customization
- String a = uniqueId.substring(0, pos);
- String b = uniqueId.substring(pos + 1);
- org.gatein.mop.api.workspace.Page page = site.getRootPage().getChild("pages").getChild(b);
- customization = page.getCustomization(a);
- }
- }
- }
-
- // Destroy existing window previous customization
- if (dst.getCustomization() != null)
- {
- dst.getCustomization().destroy();
- }
-
- // If the existing customization is not null and matches the content id
- Customization<S> dstCustomization;
- if (customization != null && customization.getType().equals(contentType)
- && customization.getContentId().equals(contentId))
- {
-
- // Cast is ok as content type matches
- @SuppressWarnings("unchecked")
- Customization<S> bilto = (Customization<S>)customization;
-
- // If it's a customization of the current site we extend it
- if (bilto.getContext() == currentSite)
- {
- dstCustomization = dst.customize(bilto);
- }
- else
- {
- // Otherwise we clone it propertly
- S state = bilto.getVirtualState();
- dstCustomization = dst.customize(contentType, contentId, state);
- }
- }
- else
- {
- // Otherwise we create an empty customization
- dstCustomization = dst.customize(contentType, contentId, null);
- }
-
- // At this point we have customized the window
- // now if we have any additional state payload we must merge it
- // with the current state
- S state = ((TransientApplicationState<S>)instanceState).getContentState();
- if (state != null)
- {
- dstCustomization.setState(state);
- }
- }
- }
-
- public DashboardData loadDashboard(UIContainer container)
- {
- Attributes attrs = container.getAttributes();
- List<ComponentData> children = loadChildren(container);
- return new DashboardData(
- container.getObjectId(),
- attrs.getValue(MappedAttributes.ID),
- attrs.getValue(MappedAttributes.NAME),
- attrs.getValue(MappedAttributes.ICON),
- attrs.getValue(MappedAttributes.DECORATOR),
- attrs.getValue(MappedAttributes.TEMPLATE),
- attrs.getValue(MappedAttributes.FACTORY_ID),
- attrs.getValue(MappedAttributes.TITLE),
- attrs.getValue(MappedAttributes.DESCRIPTION),
- attrs.getValue(MappedAttributes.WIDTH),
- attrs.getValue(MappedAttributes.HEIGHT),
- Utils.safeImmutableList(split("|", attrs.getValue(MappedAttributes.ACCESS_PERMISSIONS))),
- children
- );
- }
-
- public void saveDashboard(DashboardData dashboard, UIContainer dst)
- {
- save(dashboard, dst);
- saveChildren(dashboard, dst);
- }
-
- public static String[] parseWindowId(String windowId)
- {
- int i0 = windowId.indexOf("#");
- int i1 = windowId.indexOf(":/", i0 + 1);
- String ownerType = windowId.substring(0, i0);
- String ownerId = windowId.substring(i0 + 1, i1);
- String persistenceid = windowId.substring(i1 + 2);
- String[] chunks = split("/", 2, persistenceid);
- chunks[0] = ownerType;
- chunks[1] = ownerId;
- return chunks;
- }
-
- private static void load(Attributes src, Map<String, String> dst, Set<String> blackList)
- {
- for (String name : src.getKeys())
- {
- if (!blackList.contains(name))
- {
- Object value = src.getObject(name);
- if (value instanceof String)
- {
- dst.put(name, (String)value);
- }
- }
- }
- }
-
- public static void save(Map<String, String> src, Attributes dst)
- {
- for (Map.Entry<String, String> property : src.entrySet())
- {
- dst.setString(property.getKey(), property.getValue());
- }
- }
-
- public static String getOwnerType(ObjectType<? extends Site> siteType)
- {
- if (siteType == ObjectType.PORTAL_SITE)
- {
- return PortalConfig.PORTAL_TYPE;
- }
- else if (siteType == ObjectType.GROUP_SITE)
- {
- return PortalConfig.GROUP_TYPE;
- }
- else if (siteType == ObjectType.USER_SITE)
- {
- return PortalConfig.USER_TYPE;
- }
- else
- {
- throw new IllegalArgumentException("Invalid site type " + siteType);
- }
- }
-
- public static ObjectType<Site> parseSiteType(String ownerType)
- {
- if (ownerType.equals(PortalConfig.PORTAL_TYPE))
- {
- return ObjectType.PORTAL_SITE;
- }
- else if (ownerType.equals(PortalConfig.GROUP_TYPE))
- {
- return ObjectType.GROUP_SITE;
- }
- else if (ownerType.equals(PortalConfig.USER_TYPE))
- {
- return ObjectType.USER_SITE;
- }
- else
- {
- throw new IllegalArgumentException("Invalid owner type " + ownerType);
- }
- }
-}
Copied: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/Mapper.java (from rev 413, portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/Mapper.java)
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/Mapper.java (rev 0)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/Mapper.java 2009-10-24 08:32:00 UTC (rev 414)
@@ -0,0 +1,1084 @@
+/**
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * 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.pom.data;
+
+import org.exoplatform.portal.config.model.ApplicationState;
+import org.exoplatform.portal.config.model.ApplicationType;
+import org.exoplatform.portal.pom.data.BodyType;
+import org.exoplatform.portal.config.model.ModelChange;
+import org.exoplatform.portal.config.model.PersistentApplicationState;
+import org.exoplatform.portal.config.model.PortalConfig;
+import org.exoplatform.portal.config.model.TransientApplicationState;
+import org.exoplatform.portal.config.model.gadget.GadgetId;
+import org.exoplatform.portal.pom.config.Utils;
+import static org.exoplatform.portal.pom.config.Utils.join;
+import static org.exoplatform.portal.pom.config.Utils.split;
+
+import org.exoplatform.portal.config.model.portlet.PortletId;
+import org.exoplatform.portal.config.model.wsrp.WSRPId;
+import org.exoplatform.portal.pom.config.POMSession;
+import org.exoplatform.portal.pom.data.ApplicationData;
+import org.exoplatform.portal.pom.data.BodyData;
+import org.exoplatform.portal.pom.data.ComponentData;
+import org.exoplatform.portal.pom.data.ContainerData;
+import org.exoplatform.portal.pom.data.DashboardData;
+import org.exoplatform.portal.pom.data.ModelData;
+import org.exoplatform.portal.pom.data.NavigationNodeContainerData;
+import org.exoplatform.portal.pom.data.PageData;
+import org.exoplatform.portal.pom.data.PortalData;
+import org.exoplatform.portal.pom.spi.gadget.Gadget;
+import org.exoplatform.portal.pom.spi.portlet.Preferences;
+import org.exoplatform.portal.pom.spi.wsrp.WSRPState;
+import org.gatein.mop.api.Attributes;
+import org.gatein.mop.api.content.ContentType;
+import org.gatein.mop.api.content.Customization;
+import org.gatein.mop.api.workspace.Navigation;
+import org.gatein.mop.api.workspace.ObjectType;
+import org.gatein.mop.api.workspace.Site;
+import org.gatein.mop.api.workspace.Workspace;
+import org.gatein.mop.api.workspace.WorkspaceObject;
+import org.gatein.mop.api.workspace.link.Link;
+import org.gatein.mop.api.workspace.link.PageLink;
+import org.gatein.mop.api.workspace.ui.UIBody;
+import org.gatein.mop.api.workspace.ui.UIComponent;
+import org.gatein.mop.api.workspace.ui.UIContainer;
+import org.gatein.mop.api.workspace.ui.UIWindow;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.UUID;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class Mapper
+{
+
+ /** . */
+ private static final Set<String> portalPropertiesBlackList =
+ new HashSet<String>(Arrays.asList("jcr:uuid", "jcr:primaryType", MappedAttributes.LOCALE.getName(),
+ MappedAttributes.ACCESS_PERMISSIONS.getName(), MappedAttributes.EDIT_PERMISSION.getName(),
+ MappedAttributes.SKIN.getName(), MappedAttributes.TITLE.getName(), MappedAttributes.CREATOR.getName(),
+ MappedAttributes.MODIFIER.getName()));
+
+ /** . */
+ private static final Set<String> windowPropertiesBlackList =
+ new HashSet<String>(Arrays.asList("jcr:uuid", "jcr:primaryType", MappedAttributes.TYPE.getName(),
+ MappedAttributes.THEME.getName(), MappedAttributes.TITLE.getName(), MappedAttributes.ACCESS_PERMISSIONS
+ .getName(), MappedAttributes.SHOW_INFO_BAR.getName(), MappedAttributes.SHOW_STATE.getName(),
+ MappedAttributes.SHOW_MODE.getName(), MappedAttributes.DESCRIPTION.getName(), MappedAttributes.ICON.getName(),
+ MappedAttributes.WIDTH.getName(), MappedAttributes.HEIGHT.getName()));
+
+ /** . */
+ private final POMSession session;
+
+ public Mapper(POMSession session)
+ {
+ this.session = session;
+ }
+
+ public NavigationData load(Navigation src)
+ {
+ return load(src, NavigationData.class);
+ }
+
+ private <T extends NavigationNodeContainerData> T load(Navigation src, Class<T> type)
+ {
+
+ //
+ ArrayList<NavigationNodeData> children = new ArrayList<NavigationNodeData>(src.getChildren().size());
+ for (Navigation srcChild : src.getChildren())
+ {
+ NavigationNodeData dstChild = load(srcChild, NavigationNodeData.class);
+ children.add(dstChild);
+ }
+
+ //
+ T dst;
+ if (type == NavigationData.class)
+ {
+ Site site = src.getSite();
+ String ownerType = getOwnerType(site.getObjectType());
+ String ownerId = site.getName();
+ Attributes attrs = src.getAttributes();
+ NavigationData dstNav = new NavigationData(
+ src.getObjectId(),
+ ownerType,
+ ownerId,
+ attrs.getValue(MappedAttributes.DESCRIPTION),
+ attrs.getValue(MappedAttributes.CREATOR),
+ attrs.getValue(MappedAttributes.MODIFIER),
+ attrs.getValue(MappedAttributes.PRIORITY, 1),
+ children);
+ dst = (T)dstNav;
+ }
+ else if (type == NavigationNodeData.class)
+ {
+ Attributes attrs = src.getAttributes();
+ String pageReference = null;
+ Link link = src.getLink();
+ if (link instanceof PageLink)
+ {
+ PageLink pageLink = (PageLink)link;
+ org.gatein.mop.api.workspace.Page target = pageLink.getPage();
+ if (target != null)
+ {
+ Site site = target.getSite();
+ ObjectType<? extends Site> siteType = site.getObjectType();
+ pageReference = getOwnerType(siteType) + "::" + site.getName() + "::" + target.getName();
+ }
+ }
+ NavigationNodeData dstNode = new NavigationNodeData(
+ src.getObjectId(),
+ attrs.getValue(MappedAttributes.URI),
+ attrs.getValue(MappedAttributes.LABEL),
+ attrs.getValue(MappedAttributes.ICON),
+ src.getName(),
+ attrs.getValue(MappedAttributes.START_PUBLICATION_DATE),
+ attrs.getValue(MappedAttributes.END_PUBLICATION_DATE),
+ attrs.getValue(MappedAttributes.SHOW_PUBLICATION_DATE, false),
+ attrs.getValue(MappedAttributes.VISIBLE, true),
+ pageReference,
+ children
+ );
+
+ dst = (T)dstNode;
+ }
+ else
+ {
+ throw new AssertionError();
+ }
+
+ //
+ return dst;
+ }
+
+ public void save(NavigationData src, Navigation dst)
+ {
+ save((NavigationNodeContainerData)src, dst);
+ }
+
+ private void save(NavigationNodeContainerData src, Navigation dst)
+ {
+ if (src instanceof NavigationNodeData)
+ {
+ NavigationNodeData node = (NavigationNodeData)src;
+ Workspace workspace = dst.getSite().getWorkspace();
+ String reference = node.getPageReference();
+ if (reference != null)
+ {
+ String[] pageChunks = split("::", reference);
+ ObjectType<? extends Site> siteType = parseSiteType(pageChunks[0]);
+ Site site = workspace.getSite(siteType, pageChunks[1]);
+ org.gatein.mop.api.workspace.Page target = site.getRootPage().getChild("pages").getChild(pageChunks[2]);
+ PageLink link = dst.linkTo(ObjectType.PAGE_LINK);
+ link.setPage(target);
+ }
+
+ //
+ Attributes attrs = dst.getAttributes();
+ attrs.setValue(MappedAttributes.URI, node.getURI());
+ attrs.setValue(MappedAttributes.LABEL, node.getLabel());
+ attrs.setValue(MappedAttributes.ICON, node.getIcon());
+ attrs.setValue(MappedAttributes.START_PUBLICATION_DATE, node.getStartPublicationDate());
+ attrs.setValue(MappedAttributes.END_PUBLICATION_DATE, node.getEndPublicationDate());
+ attrs.setValue(MappedAttributes.SHOW_PUBLICATION_DATE, node.getShowPublicationDate());
+ attrs.setValue(MappedAttributes.VISIBLE, node.isVisible());
+ }
+ else if (src instanceof NavigationData)
+ {
+ NavigationData pageNav = (NavigationData)src;
+
+ //
+ Attributes attrs = dst.getAttributes();
+ attrs.setValue(MappedAttributes.PRIORITY, pageNav.getPriority());
+ attrs.setValue(MappedAttributes.CREATOR, pageNav.getCreator());
+ attrs.setValue(MappedAttributes.MODIFIER, pageNav.getModifier());
+ attrs.setValue(MappedAttributes.DESCRIPTION, pageNav.getDescription());
+ }
+ else
+ {
+ throw new AssertionError();
+ }
+
+ //
+ Set<String> savedSet = new HashSet<String>();
+ for (NavigationNodeData node : src.getNodes())
+ {
+ String srcId = node.getStorageId();
+ Navigation dstChild;
+ if (srcId != null)
+ {
+ dstChild = session.findObjectById(ObjectType.NAVIGATION, srcId);
+ }
+ else
+ {
+ dstChild = dst.getChild(node.getName());
+ if (dstChild == null)
+ {
+ dstChild = dst.addChild(node.getName());
+ }
+ srcId = dstChild.getObjectId();
+ }
+ save(node, dstChild);
+ savedSet.add(srcId);
+ }
+ for (Iterator<? extends Navigation> i = dst.getChildren().iterator(); i.hasNext();)
+ {
+ Navigation dstChild = i.next();
+ if (!savedSet.contains(dstChild.getObjectId()))
+ {
+ i.remove();
+ }
+ }
+ }
+
+ public PortalData load(Site src)
+ {
+ String type = Mapper.getOwnerType(src.getObjectType());
+ Attributes attrs = src.getAttributes();
+
+ //
+ org.gatein.mop.api.workspace.Page template = src.getRootNavigation().getTemplate();
+ UIContainer srcLayout = template.getRootComponent();
+
+ //
+ Map<String, String> properties = new HashMap<String, String>();
+ load(attrs, properties, portalPropertiesBlackList);
+
+ //
+ List<ComponentData> layoutChildren = loadChildren(srcLayout);
+ ContainerData layout = load(srcLayout, layoutChildren);
+
+ //
+ return new PortalData(
+ src.getObjectId(),
+ src.getName(),
+ type,
+ attrs.getValue(MappedAttributes.LOCALE),
+ Collections.unmodifiableList(Arrays.asList(split("|", attrs.getValue(MappedAttributes.ACCESS_PERMISSIONS, "")))),
+ attrs.getValue(MappedAttributes.EDIT_PERMISSION),
+ Collections.unmodifiableMap(properties),
+ attrs.getValue(MappedAttributes.SKIN),
+ attrs.getValue(MappedAttributes.TITLE),
+ layout,
+ attrs.getValue(MappedAttributes.CREATOR),
+ attrs.getValue(MappedAttributes.MODIFIER));
+ }
+
+ public void save(PortalData src, Site dst)
+ {
+ if (src.getStorageId() != null && !src.getStorageId().equals(dst.getObjectId()))
+ {
+ String msg =
+ "Attempt to save a site " + src.getType() + "/" + src.getName() + " on the wrong target site "
+ + dst.getObjectType() + "/" + dst.getName();
+ throw new IllegalArgumentException(msg);
+ }
+
+ //
+ Attributes attrs = dst.getAttributes();
+ attrs.setValue(MappedAttributes.LOCALE, src.getLocale());
+ attrs.setValue(MappedAttributes.ACCESS_PERMISSIONS, join("|", src.getAccessPermissions()));
+ attrs.setValue(MappedAttributes.EDIT_PERMISSION, src.getEditPermission());
+ attrs.setValue(MappedAttributes.SKIN, src.getSkin());
+ attrs.setValue(MappedAttributes.TITLE, src.getTitle());
+ attrs.setValue(MappedAttributes.CREATOR, src.getCreator());
+ attrs.setValue(MappedAttributes.MODIFIER, src.getModifier());
+ if (src.getProperties() != null)
+ {
+ save(src.getProperties(), attrs);
+ }
+
+ //
+ org.gatein.mop.api.workspace.Page templates = dst.getRootPage().getChild("templates");
+ org.gatein.mop.api.workspace.Page template = templates.getChild("default");
+ if (template == null)
+ {
+ template = templates.addChild("default");
+ }
+
+ //
+ ContainerData srcContainer = src.getPortalLayout();
+ UIContainer dstContainer = template.getRootComponent();
+
+ //
+ save(srcContainer, dstContainer);
+ saveChildren(srcContainer, dstContainer);
+
+ //
+ dst.getRootNavigation().setTemplate(template);
+ }
+
+ public PageData load(org.gatein.mop.api.workspace.Page src)
+ {
+ Site site = src.getSite();
+ String ownerType = getOwnerType(site.getObjectType());
+ String ownerId = site.getName();
+ String name = src.getName();
+ List<ComponentData> children = loadChildren(src.getRootComponent());
+ Attributes attrs = src.getAttributes();
+
+ //
+ return new PageData(
+ src.getObjectId(),
+ null,
+ name,
+ null,
+ null,
+ null,
+ attrs.getValue(MappedAttributes.FACTORY_ID),
+ attrs.getValue(MappedAttributes.TITLE),
+ null,
+ null,
+ null,
+ Utils.safeImmutableList(split("|", attrs.getValue(MappedAttributes.ACCESS_PERMISSIONS))),
+ children,
+ ownerType,
+ ownerId,
+ attrs.getValue(MappedAttributes.EDIT_PERMISSION),
+ attrs.getValue(MappedAttributes.SHOW_MAX_WINDOW, false),
+ attrs.getValue(MappedAttributes.CREATOR),
+ attrs.getValue(MappedAttributes.MODIFIER)
+ );
+ }
+
+ public List<ModelChange> save(PageData src, Site site, String name)
+ {
+ org.gatein.mop.api.workspace.Page root = site.getRootPage();
+ org.gatein.mop.api.workspace.Page pages = root.getChild("pages");
+ org.gatein.mop.api.workspace.Page dst = pages.getChild(name);
+
+ //
+ LinkedList<ModelChange> changes = new LinkedList<ModelChange>();
+
+ //
+ if (dst == null)
+ {
+ dst = pages.addChild(name);
+ changes.add(new ModelChange.Create(src));
+ }
+ else
+ {
+ changes.add(new ModelChange.Update(src));
+ }
+
+ //
+ Attributes attrs = dst.getAttributes();
+ attrs.setValue(MappedAttributes.TITLE, src.getTitle());
+ attrs.setValue(MappedAttributes.FACTORY_ID, src.getFactoryId());
+ attrs.setValue(MappedAttributes.ACCESS_PERMISSIONS, join("|", src.getAccessPermissions()));
+ attrs.setValue(MappedAttributes.EDIT_PERMISSION, src.getEditPermission());
+ attrs.setValue(MappedAttributes.SHOW_MAX_WINDOW, src.isShowMaxWindow());
+ attrs.setValue(MappedAttributes.CREATOR, src.getCreator());
+ attrs.setValue(MappedAttributes.MODIFIER, src.getModifier());
+
+ //
+ changes.addAll(saveChildren(src, dst.getRootComponent()));
+
+ //
+ return changes;
+ }
+
+ private ContainerData load(UIContainer src, List<ComponentData> children)
+ {
+ Attributes attrs = src.getAttributes();
+ return new ContainerData(
+ src.getObjectId(),
+ attrs.getValue(MappedAttributes.ID),
+ attrs.getValue(MappedAttributes.NAME),
+ attrs.getValue(MappedAttributes.ICON),
+ attrs.getValue(MappedAttributes.DECORATOR),
+ attrs.getValue(MappedAttributes.TEMPLATE),
+ attrs.getValue(MappedAttributes.FACTORY_ID),
+ attrs.getValue(MappedAttributes.TITLE),
+ attrs.getValue(MappedAttributes.DESCRIPTION),
+ attrs.getValue(MappedAttributes.WIDTH),
+ attrs.getValue(MappedAttributes.HEIGHT),
+ Utils.safeImmutableList(split("|", attrs.getValue(MappedAttributes.ACCESS_PERMISSIONS))),
+ children
+ );
+ }
+
+ private List<ComponentData> loadChildren(UIContainer src)
+ {
+ ArrayList<ComponentData> children = new ArrayList<ComponentData>(src.size());
+ for (UIComponent component : src)
+ {
+
+ // Obtain a model object from the ui component
+ ComponentData mo;
+ if (component instanceof UIContainer)
+ {
+ UIContainer srcContainer = (UIContainer)component;
+ Attributes attrs = srcContainer.getAttributes();
+ String type = attrs.getValue(MappedAttributes.TYPE);
+ if ("dashboard".equals(type))
+ {
+ TransientApplicationState<Preferences> state = new TransientApplicationState<Preferences>();
+ Site owner = src.getPage().getSite();
+ state.setOwnerType(getOwnerType(owner.getObjectType()));
+ state.setOwnerId(owner.getName());
+ mo = new ApplicationData<Preferences, PortletId>(
+ srcContainer.getObjectId(),
+ component.getName(),
+ ApplicationType.PORTLET,
+ state,
+ new PortletId("dashboard", "DashboardPortlet"),
+ null,
+ null,
+ null,
+ null,
+ false,
+ false,
+ false,
+ null,
+ null,
+ null,
+ Collections.<String, String>emptyMap(),
+ Collections.<String>emptyList());
+ }
+ else
+ {
+ List<ComponentData> dstChildren = loadChildren(srcContainer);
+ mo = load(srcContainer, dstChildren);
+ }
+ }
+ else if (component instanceof UIWindow)
+ {
+ UIWindow window = (UIWindow)component;
+ ApplicationData application = load(window);
+ mo = application;
+ }
+ else if (component instanceof UIBody)
+ {
+ mo = new BodyData(component.getObjectId(), BodyType.PAGE);
+ }
+ else
+ {
+ throw new AssertionError();
+ }
+
+ // Add among children
+ children.add(mo);
+ }
+ return children;
+ }
+
+ private void save(ContainerData src, UIContainer dst)
+ {
+ Attributes dstAttrs = dst.getAttributes();
+ dstAttrs.setValue(MappedAttributes.ID, src.getId());
+ dstAttrs.setValue(MappedAttributes.TYPE, src instanceof DashboardData ? "dashboard" : null);
+ dstAttrs.setValue(MappedAttributes.TITLE, src.getTitle());
+ dstAttrs.setValue(MappedAttributes.ICON, src.getIcon());
+ dstAttrs.setValue(MappedAttributes.TEMPLATE, src.getTemplate());
+ dstAttrs.setValue(MappedAttributes.ACCESS_PERMISSIONS, join("|", src.getAccessPermissions()));
+ dstAttrs.setValue(MappedAttributes.FACTORY_ID, src.getFactoryId());
+ dstAttrs.setValue(MappedAttributes.DECORATOR, src.getDecorator());
+ dstAttrs.setValue(MappedAttributes.DESCRIPTION, src.getDescription());
+ dstAttrs.setValue(MappedAttributes.WIDTH, src.getWidth());
+ dstAttrs.setValue(MappedAttributes.HEIGHT, src.getHeight());
+ dstAttrs.setValue(MappedAttributes.NAME, src.getName());
+ }
+
+ private void save(ModelData src, WorkspaceObject dst, LinkedList<ModelChange> changes,
+ Map<String, String> hierarchyRelationships)
+ {
+ if (src instanceof ContainerData)
+ {
+ save((ContainerData)src, (UIContainer)dst);
+ saveChildren((ContainerData)src, (UIContainer)dst, changes, hierarchyRelationships);
+ }
+ else if (src instanceof ApplicationData)
+ {
+ save((ApplicationData<?, ?>)src, (UIWindow)dst);
+ }
+ else if (src instanceof BodyData)
+ {
+ // Stateless
+ }
+ else
+ {
+ throw new AssertionError("Was not expecting child " + src);
+ }
+ }
+
+ /** . */
+ private static final PortletId DASHBOARD_ID = new PortletId("dashboard", "DashboardPortlet");
+
+ private LinkedList<ModelChange> saveChildren(final ContainerData src, UIContainer dst)
+ {
+
+ //
+ LinkedList<ModelChange> changes = new LinkedList<ModelChange>();
+
+ //
+ Map<String, String> hierarchyRelationships = new HashMap<String, String>();
+
+ //
+ build(src, hierarchyRelationships);
+
+ //
+ saveChildren(src, dst, changes, Collections.unmodifiableMap(hierarchyRelationships));
+
+ //
+ return changes;
+ }
+
+ private void build(ContainerData parent, Map<String, String> hierarchyRelationships)
+ {
+ String parentId = parent.getStorageId();
+ if (parentId != null)
+ {
+ for (ModelData child : parent.getChildren())
+ {
+ String childId = child.getStorageId();
+ if (childId != null)
+ {
+ if (hierarchyRelationships.put(childId, parentId) != null)
+ {
+ throw new AssertionError("The same object is present two times in the object hierarchy");
+ }
+ if (child instanceof ContainerData)
+ {
+ build((ContainerData)child, hierarchyRelationships);
+ }
+ }
+ }
+ }
+ }
+
+ private void saveChildren(final ContainerData src, UIContainer dst, LinkedList<ModelChange> changes,
+ Map<String, String> hierarchyRelationships)
+ {
+ final List<String> orders = new ArrayList<String>();
+ final Map<String, ModelData> modelObjectMap = new HashMap<String, ModelData>();
+
+ //
+ for (ModelData srcChild : src.getChildren())
+ {
+ String srcId = srcChild.getStorageId();
+
+ // Replace dashboard application by container if needed
+ if (srcChild instanceof ApplicationData)
+ {
+ ApplicationData app = (ApplicationData)srcChild;
+ if (app.getType() == ApplicationType.PORTLET)
+ {
+ PortletId ref = (PortletId)app.getRef();
+ if (DASHBOARD_ID.equals(ref))
+ {
+ if (app.getStorageId() != null)
+ {
+ UIContainer dstDashboard = session.findObjectById(ObjectType.CONTAINER, app.getStorageId());
+ srcChild = loadDashboard(dstDashboard);
+ }
+ else
+ {
+ srcChild = DashboardData.INITIAL_DASHBOARD;
+ }
+ }
+ }
+ }
+
+ //
+ UIComponent dstChild;
+ if (srcId != null)
+ {
+ dstChild = session.findObjectById(ObjectType.COMPONENT, srcId);
+ if (dstChild == null)
+ {
+ throw new AssertionError("Could not find supposed present child with id " + srcId);
+ }
+ // julien : this can fail due to a bug in chromattic not implementing equals method properly
+ // and is replaced with the foreach below
+ /*
+ if (!dst.contains(dstChild)) {
+ throw new IllegalArgumentException("Attempt for updating a ui component " + session.pathOf(dstChild) +
+ "that is not present in the target ui container " + session.pathOf(dst));
+ }
+ */
+ boolean found = false;
+ for (UIComponent child : dst)
+ {
+ if (child.getObjectId().equals(srcId))
+ {
+ found = true;
+ break;
+ }
+ }
+ if (!found)
+ {
+ if (hierarchyRelationships.containsKey(srcId))
+ {
+ // It's a move operation, so we move the node first
+ dst.add(dstChild);
+ }
+ else
+ {
+ throw new IllegalArgumentException("Attempt for updating a ui component " + session.pathOf(dstChild)
+ + "that is not present in the target ui container " + session.pathOf(dst));
+ }
+ }
+
+ //
+ changes.add(new ModelChange.Update(srcChild));
+ }
+ else
+ {
+ String name = srcChild.getStorageName();
+ if (name == null)
+ {
+ // We manufacture one name
+ name = UUID.randomUUID().toString();
+ }
+ if (srcChild instanceof ContainerData)
+ {
+ dstChild = dst.add(ObjectType.CONTAINER, name);
+ }
+ else if (srcChild instanceof ApplicationData)
+ {
+ dstChild = dst.add(ObjectType.WINDOW, name);
+ }
+ else if (srcChild instanceof BodyData)
+ {
+ dstChild = dst.add(ObjectType.BODY, name);
+ }
+ else
+ {
+ throw new AssertionError("Was not expecting child " + srcChild);
+ }
+ changes.add(new ModelChange.Create(srcChild));
+ }
+
+ //
+ save(srcChild, dstChild, changes, hierarchyRelationships);
+
+ //
+ String dstId = dstChild.getObjectId();
+ modelObjectMap.put(dstId, srcChild);
+ orders.add(dstId);
+ }
+
+ // Take care of move operation that could be seen as a remove
+ for (UIComponent dstChild : dst)
+ {
+ String dstId = dstChild.getObjectId();
+ if (!modelObjectMap.containsKey(dstId) && hierarchyRelationships.containsKey(dstId))
+ {
+ String parentId = hierarchyRelationships.get(dstId);
+
+ // Get the new parent
+ UIContainer parent = session.findObjectById(ObjectType.CONTAINER, parentId);
+
+ // Perform the move
+ parent.add(dstChild);
+
+ //
+ changes.add(new ModelChange.Destroy(dstId));
+ }
+ }
+
+ // Delete removed children
+ for (Iterator<UIComponent> i = dst.iterator(); i.hasNext();)
+ {
+ UIComponent dstChild = i.next();
+ String dstId = dstChild.getObjectId();
+ if (!modelObjectMap.containsKey(dstId))
+ {
+ i.remove();
+ changes.add(new ModelChange.Destroy(dstId));
+ }
+ }
+
+ // Now sort children according to the order provided by the container
+ // need to replace that with Collections.sort once the set(int index, E element) is implemented in Chromattic lists
+ UIComponent[] a = dst.toArray(new UIComponent[dst.size()]);
+ Arrays.sort(a, new Comparator<UIComponent>()
+ {
+ public int compare(UIComponent o1, UIComponent o2)
+ {
+ int i1 = orders.indexOf(o1.getObjectId());
+ int i2 = orders.indexOf(o2.getObjectId());
+ return i1 - i2;
+ }
+ });
+ for (int j = 0; j < a.length; j++)
+ {
+ dst.add(j, a[j]);
+ }
+ }
+
+ private <S, I> ApplicationData<S, I> load(UIWindow src)
+ {
+ Attributes attrs = src.getAttributes();
+
+ //
+ Customization<?> customization = src.getCustomization();
+
+ //
+ ContentType<?> contentType = customization.getType();
+
+ //
+ String customizationid = customization.getId();
+
+ //
+ String contentId = customization.getContentId();
+
+ //
+ I ref;
+ ApplicationType<S, I> type;
+ if (contentType == null || contentType == Preferences.CONTENT_TYPE)
+ {
+ int pos = contentId.indexOf('/');
+ String applicationName = contentId.substring(0, pos);
+ String portletName = contentId.substring(pos + 1);
+ ref = (I)new PortletId(applicationName, portletName);
+ type = (ApplicationType<S,I>)ApplicationType.PORTLET;
+ }
+ else if (contentType == Gadget.CONTENT_TYPE)
+ {
+ ref = (I)new GadgetId(contentId);
+ type = (ApplicationType<S,I>)ApplicationType.GADGET;
+ }
+ else if (contentType == WSRPState.CONTENT_TYPE)
+ {
+ ref = (I)new WSRPId(contentId);
+ type = (ApplicationType<S,I>)ApplicationType.WSRP_PORTLET;
+ }
+ else
+ {
+ throw new AssertionError("Unknown type: " + contentType);
+ }
+
+ //
+ PersistentApplicationState<S> instanceState = new PersistentApplicationState<S>(customizationid);
+
+ //
+ HashMap<String, String> properties = new HashMap<String, String>();
+ load(attrs, properties, windowPropertiesBlackList);
+
+ //
+ return new ApplicationData<S,I>(
+ src.getObjectId(),
+ src.getName(),
+ type,
+ instanceState,
+ ref,
+ null,
+ attrs.getValue(MappedAttributes.TITLE),
+ attrs.getValue(MappedAttributes.ICON),
+ attrs.getValue(MappedAttributes.DESCRIPTION),
+ attrs.getValue(MappedAttributes.SHOW_INFO_BAR),
+ attrs.getValue(MappedAttributes.SHOW_STATE),
+ attrs.getValue(MappedAttributes.SHOW_MODE),
+ attrs.getValue(MappedAttributes.THEME),
+ attrs.getValue(MappedAttributes.WIDTH),
+ attrs.getValue(MappedAttributes.HEIGHT),
+ Utils.safeImmutableMap(properties),
+ Utils.safeImmutableList(split("|", attrs.getValue(MappedAttributes.ACCESS_PERMISSIONS)))
+ );
+ }
+
+ public <S, I> void save(ApplicationData<S, I> src, UIWindow dst)
+ {
+ Attributes attrs = dst.getAttributes();
+ attrs.setValue(MappedAttributes.THEME, src.getTheme());
+ attrs.setValue(MappedAttributes.TITLE, src.getTitle());
+ attrs.setValue(MappedAttributes.ACCESS_PERMISSIONS, join("|", src.getAccessPermissions()));
+ attrs.setValue(MappedAttributes.SHOW_INFO_BAR, src.isShowInfoBar());
+ attrs.setValue(MappedAttributes.SHOW_STATE, src.isShowApplicationState());
+ attrs.setValue(MappedAttributes.SHOW_MODE, src.isShowApplicationMode());
+ attrs.setValue(MappedAttributes.DESCRIPTION, src.getDescription());
+ attrs.setValue(MappedAttributes.ICON, src.getIcon());
+ attrs.setValue(MappedAttributes.WIDTH, src.getWidth());
+ attrs.setValue(MappedAttributes.HEIGHT, src.getHeight());
+ save(src.getProperties(), attrs);
+
+ //
+ ApplicationState<S> instanceState = src.getState();
+
+ // We modify only transient portlet state
+ // and we ignore any persistent portlet state
+ if (instanceState instanceof TransientApplicationState)
+ {
+
+ //
+ TransientApplicationState<S> transientState = (TransientApplicationState<S>)instanceState;
+
+ // Attempt to get a site from the instance state
+ Site site = null;
+ if (transientState.getOwnerType() != null && transientState.getOwnerId() != null)
+ {
+ ObjectType<Site> siteType = parseSiteType(transientState.getOwnerType());
+ site = session.getWorkspace().getSite(siteType, transientState.getOwnerId());
+ }
+
+ // The current site
+ Site currentSite = dst.getPage().getSite();
+
+ // If it is the same site than the current page
+ // set null
+ if (site == dst.getPage().getSite())
+ {
+ site = null;
+ }
+
+ // The content id
+ String contentId;
+ ContentType<S> contentType = src.getType().getContentType();
+ if (contentType == Preferences.CONTENT_TYPE)
+ {
+ PortletId id = (PortletId)src.getRef();
+ contentId = id.getApplicationName() + "/" + id.getPortletName();
+ }
+ else if (contentType == Gadget.CONTENT_TYPE)
+ {
+ GadgetId id = (GadgetId)src.getRef();
+ contentId = id.getGadgetName();
+ }
+ else if (contentType == WSRPState.CONTENT_TYPE)
+ {
+ WSRPId id = (WSRPId)src.getRef();
+ contentId = id.getUri();
+ }
+ else
+ {
+ throw new UnsupportedOperationException("Unsupported content type");
+ }
+
+ // The customization that we will inherit from if not null
+ Customization<?> customization = null;
+
+ // Now inspect the unique id
+ String uniqueId = transientState.getUniqueId();
+ if (uniqueId != null)
+ {
+
+ // This is a customized window
+ if (uniqueId.startsWith("@"))
+ {
+ String id = uniqueId.substring(1);
+
+ // It's another window, we get its customization
+ if (!dst.getObjectId().equals(id))
+ {
+ UIWindow window = session.findObjectById(ObjectType.WINDOW, id);
+ Customization<?> windowCustomization = window.getCustomization();
+ if (windowCustomization.getType().equals(contentType))
+ {
+ customization = windowCustomization;
+ }
+ }
+ }
+ else
+ {
+ int pos = uniqueId.indexOf('#');
+ if (pos == -1)
+ {
+
+ // If it's a different site than the page one (it has to be at this point)
+ // then we get its customization
+ if (site != null)
+ {
+ customization = site.getCustomization(uniqueId);
+ }
+ else
+ {
+ customization = currentSite.getCustomization(uniqueId);
+
+ // If it does not exist we create it
+ if (customization == null)
+ {
+ customization = currentSite.customize(uniqueId, contentType, contentId, null);
+ }
+ }
+ }
+ else
+ {
+
+ // Otherwise we get the page customization
+ String a = uniqueId.substring(0, pos);
+ String b = uniqueId.substring(pos + 1);
+ org.gatein.mop.api.workspace.Page page = site.getRootPage().getChild("pages").getChild(b);
+ customization = page.getCustomization(a);
+ }
+ }
+ }
+
+ // Destroy existing window previous customization
+ if (dst.getCustomization() != null)
+ {
+ dst.getCustomization().destroy();
+ }
+
+ // If the existing customization is not null and matches the content id
+ Customization<S> dstCustomization;
+ if (customization != null && customization.getType().equals(contentType)
+ && customization.getContentId().equals(contentId))
+ {
+
+ // Cast is ok as content type matches
+ @SuppressWarnings("unchecked")
+ Customization<S> bilto = (Customization<S>)customization;
+
+ // If it's a customization of the current site we extend it
+ if (bilto.getContext() == currentSite)
+ {
+ dstCustomization = dst.customize(bilto);
+ }
+ else
+ {
+ // Otherwise we clone it propertly
+ S state = bilto.getVirtualState();
+ dstCustomization = dst.customize(contentType, contentId, state);
+ }
+ }
+ else
+ {
+ // Otherwise we create an empty customization
+ dstCustomization = dst.customize(contentType, contentId, null);
+ }
+
+ // At this point we have customized the window
+ // now if we have any additional state payload we must merge it
+ // with the current state
+ S state = ((TransientApplicationState<S>)instanceState).getContentState();
+ if (state != null)
+ {
+ dstCustomization.setState(state);
+ }
+ }
+ }
+
+ public DashboardData loadDashboard(UIContainer container)
+ {
+ Attributes attrs = container.getAttributes();
+ List<ComponentData> children = loadChildren(container);
+ return new DashboardData(
+ container.getObjectId(),
+ attrs.getValue(MappedAttributes.ID),
+ attrs.getValue(MappedAttributes.NAME),
+ attrs.getValue(MappedAttributes.ICON),
+ attrs.getValue(MappedAttributes.DECORATOR),
+ attrs.getValue(MappedAttributes.TEMPLATE),
+ attrs.getValue(MappedAttributes.FACTORY_ID),
+ attrs.getValue(MappedAttributes.TITLE),
+ attrs.getValue(MappedAttributes.DESCRIPTION),
+ attrs.getValue(MappedAttributes.WIDTH),
+ attrs.getValue(MappedAttributes.HEIGHT),
+ Utils.safeImmutableList(split("|", attrs.getValue(MappedAttributes.ACCESS_PERMISSIONS))),
+ children
+ );
+ }
+
+ public void saveDashboard(DashboardData dashboard, UIContainer dst)
+ {
+ save(dashboard, dst);
+ saveChildren(dashboard, dst);
+ }
+
+ public static String[] parseWindowId(String windowId)
+ {
+ int i0 = windowId.indexOf("#");
+ int i1 = windowId.indexOf(":/", i0 + 1);
+ String ownerType = windowId.substring(0, i0);
+ String ownerId = windowId.substring(i0 + 1, i1);
+ String persistenceid = windowId.substring(i1 + 2);
+ String[] chunks = split("/", 2, persistenceid);
+ chunks[0] = ownerType;
+ chunks[1] = ownerId;
+ return chunks;
+ }
+
+ private static void load(Attributes src, Map<String, String> dst, Set<String> blackList)
+ {
+ for (String name : src.getKeys())
+ {
+ if (!blackList.contains(name))
+ {
+ Object value = src.getObject(name);
+ if (value instanceof String)
+ {
+ dst.put(name, (String)value);
+ }
+ }
+ }
+ }
+
+ public static void save(Map<String, String> src, Attributes dst)
+ {
+ for (Map.Entry<String, String> property : src.entrySet())
+ {
+ dst.setString(property.getKey(), property.getValue());
+ }
+ }
+
+ public static String getOwnerType(ObjectType<? extends Site> siteType)
+ {
+ if (siteType == ObjectType.PORTAL_SITE)
+ {
+ return PortalConfig.PORTAL_TYPE;
+ }
+ else if (siteType == ObjectType.GROUP_SITE)
+ {
+ return PortalConfig.GROUP_TYPE;
+ }
+ else if (siteType == ObjectType.USER_SITE)
+ {
+ return PortalConfig.USER_TYPE;
+ }
+ else
+ {
+ throw new IllegalArgumentException("Invalid site type " + siteType);
+ }
+ }
+
+ public static ObjectType<Site> parseSiteType(String ownerType)
+ {
+ if (ownerType.equals(PortalConfig.PORTAL_TYPE))
+ {
+ return ObjectType.PORTAL_SITE;
+ }
+ else if (ownerType.equals(PortalConfig.GROUP_TYPE))
+ {
+ return ObjectType.GROUP_SITE;
+ }
+ else if (ownerType.equals(PortalConfig.USER_TYPE))
+ {
+ return ObjectType.USER_SITE;
+ }
+ else
+ {
+ throw new IllegalArgumentException("Invalid owner type " + ownerType);
+ }
+ }
+}
Deleted: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/ModelData.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/ModelData.java 2009-10-24 07:50:41 UTC (rev 412)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/ModelData.java 2009-10-24 08:32:00 UTC (rev 414)
@@ -1,50 +0,0 @@
-/**
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * 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.pom.config.data;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public abstract class ModelData
-{
-
- /** Storage id. */
- private final String storageId;
-
- /** The storage name that is unique among a container context. */
- private final String storageName;
-
- protected ModelData(String storageId, String storageName)
- {
- this.storageId = storageId;
- this.storageName = storageName;
- }
-
- public String getStorageId()
- {
- return storageId;
- }
-
- public String getStorageName()
- {
- return storageName;
- }
-}
\ No newline at end of file
Copied: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/ModelData.java (from rev 413, portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/ModelData.java)
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/ModelData.java (rev 0)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/ModelData.java 2009-10-24 08:32:00 UTC (rev 414)
@@ -0,0 +1,50 @@
+/**
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * 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.pom.data;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public abstract class ModelData
+{
+
+ /** Storage id. */
+ private final String storageId;
+
+ /** The storage name that is unique among a container context. */
+ private final String storageName;
+
+ protected ModelData(String storageId, String storageName)
+ {
+ this.storageId = storageId;
+ this.storageName = storageName;
+ }
+
+ public String getStorageId()
+ {
+ return storageId;
+ }
+
+ public String getStorageName()
+ {
+ return storageName;
+ }
+}
\ No newline at end of file
Deleted: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/ModelDataStorage.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/ModelDataStorage.java 2009-10-24 07:50:41 UTC (rev 412)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/ModelDataStorage.java 2009-10-24 08:32:00 UTC (rev 414)
@@ -1,107 +0,0 @@
-/**
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * 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.pom.config.data;
-
-import org.exoplatform.commons.utils.LazyPageList;
-import org.exoplatform.portal.application.PortletPreferences;
-import org.exoplatform.portal.config.Query;
-import org.exoplatform.portal.config.model.ApplicationState;
-import org.exoplatform.portal.config.model.Container;
-import org.exoplatform.portal.config.model.ModelChange;
-import org.exoplatform.portal.pom.config.data.NavigationContainer;
-import org.exoplatform.portal.pom.config.data.PageData;
-import org.exoplatform.portal.pom.config.data.PortalData;
-import org.exoplatform.portal.pom.config.POMTask;
-
-import java.util.Comparator;
-import java.util.List;
-
-/**
- * Created by The eXo Platform SAS
- * Apr 19, 2007
- *
- * This interface is used to load the PortalConfig, Page config and Navigation config from the
- * database
- */
-public interface ModelDataStorage
-{
-
- public <T extends POMTask> T execute(T task) throws Exception;
-
- public void create(PortalData config) throws Exception;
-
- public void save(PortalData config) throws Exception;
-
- public PortalData getPortalConfig(PortalKey key) throws Exception;
-
- public void remove(PortalData config) throws Exception;
-
- public PageData getPage(PageKey key) throws Exception;
-
- /**
- * Clones a page.
- *
- * @param key the key of the page to clone
- * @param cloneKey the key of the clone
- * @return the cloned page
- * @throws Exception any exception
- */
- public PageData clonePage(PageKey key, PageKey cloneKey)
- throws Exception;
-
- public void remove(PageData page) throws Exception;
-
- public void create(PageData page) throws Exception;
-
- /**
- * Saves a page. If a page with the same id already exists then a merge operation will occur, otherwise
- * a new page will be created from the provided argument.
- *
- * The operation returns a list of the change object that describes the changes that occured during the
- * save operation.
- *
- * @param page the page to save
- * @return the list of model changes that occured during the save operation
- * @throws Exception any exception
- */
- public List<ModelChange> save(PageData page) throws Exception;
-
- public NavigationContainer.Page getPageNavigation(NavigationKey key) throws Exception;
-
- public void save(NavigationContainer.Page navigation) throws Exception;
-
- public void create(NavigationContainer.Page navigation) throws Exception;
-
- public void remove(NavigationContainer.Page navigation) throws Exception;
-
- public void save(PortletPreferences portletPreferences) throws Exception;
-
- public <S> S load(ApplicationState<S> state) throws Exception;
-
- public <S> ApplicationState<S> save(ApplicationState<S> state, S preferences) throws Exception;
-
- public PortletPreferences getPortletPreferences(String windowID) throws Exception;
-
- public <T> LazyPageList<T> find(Query<T> q) throws Exception;
-
- public <T> LazyPageList<T> find(Query<T> q, Comparator<T> sortComparator) throws Exception;
-
- public Container getSharedLayout() throws Exception;
-}
\ No newline at end of file
Copied: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/ModelDataStorage.java (from rev 413, portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/ModelDataStorage.java)
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/ModelDataStorage.java (rev 0)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/ModelDataStorage.java 2009-10-24 08:32:00 UTC (rev 414)
@@ -0,0 +1,106 @@
+/**
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * 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.pom.data;
+
+import org.exoplatform.commons.utils.LazyPageList;
+import org.exoplatform.portal.application.PortletPreferences;
+import org.exoplatform.portal.config.Query;
+import org.exoplatform.portal.config.model.ApplicationState;
+import org.exoplatform.portal.config.model.Container;
+import org.exoplatform.portal.config.model.ModelChange;
+import org.exoplatform.portal.pom.data.PageData;
+import org.exoplatform.portal.pom.data.PortalData;
+import org.exoplatform.portal.pom.config.POMTask;
+
+import java.util.Comparator;
+import java.util.List;
+
+/**
+ * Created by The eXo Platform SAS
+ * Apr 19, 2007
+ *
+ * This interface is used to load the PortalConfig, Page config and Navigation config from the
+ * database
+ */
+public interface ModelDataStorage
+{
+
+ public <T extends POMTask> T execute(T task) throws Exception;
+
+ public void create(PortalData config) throws Exception;
+
+ public void save(PortalData config) throws Exception;
+
+ public PortalData getPortalConfig(PortalKey key) throws Exception;
+
+ public void remove(PortalData config) throws Exception;
+
+ public PageData getPage(PageKey key) throws Exception;
+
+ /**
+ * Clones a page.
+ *
+ * @param key the key of the page to clone
+ * @param cloneKey the key of the clone
+ * @return the cloned page
+ * @throws Exception any exception
+ */
+ public PageData clonePage(PageKey key, PageKey cloneKey)
+ throws Exception;
+
+ public void remove(PageData page) throws Exception;
+
+ public void create(PageData page) throws Exception;
+
+ /**
+ * Saves a page. If a page with the same id already exists then a merge operation will occur, otherwise
+ * a new page will be created from the provided argument.
+ *
+ * The operation returns a list of the change object that describes the changes that occured during the
+ * save operation.
+ *
+ * @param page the page to save
+ * @return the list of model changes that occured during the save operation
+ * @throws Exception any exception
+ */
+ public List<ModelChange> save(PageData page) throws Exception;
+
+ public NavigationData getPageNavigation(NavigationKey key) throws Exception;
+
+ public void save(NavigationData navigation) throws Exception;
+
+ public void create(NavigationData navigation) throws Exception;
+
+ public void remove(NavigationData navigation) throws Exception;
+
+ public void save(PortletPreferences portletPreferences) throws Exception;
+
+ public <S> S load(ApplicationState<S> state) throws Exception;
+
+ public <S> ApplicationState<S> save(ApplicationState<S> state, S preferences) throws Exception;
+
+ public PortletPreferences getPortletPreferences(String windowID) throws Exception;
+
+ public <T> LazyPageList<T> find(Query<T> q) throws Exception;
+
+ public <T> LazyPageList<T> find(Query<T> q, Comparator<T> sortComparator) throws Exception;
+
+ public Container getSharedLayout() throws Exception;
+}
\ No newline at end of file
Deleted: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/NavigationContainer.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/NavigationContainer.java 2009-10-24 07:50:41 UTC (rev 412)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/NavigationContainer.java 2009-10-24 08:32:00 UTC (rev 414)
@@ -1,261 +0,0 @@
-/*
- * Copyright (C) 2003-2007 eXo Platform SAS.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
- *
- * This program 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
- */
-package org.exoplatform.portal.pom.config.data;
-
-import org.exoplatform.portal.pom.config.data.ModelData;
-
-import java.util.Date;
-import java.util.List;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public class NavigationContainer extends ModelData
-{
-
- /** . */
- private final List<NavigationContainer.Node> children;
-
- public NavigationContainer(String storageId, List<NavigationContainer.Node> children)
- {
- super(storageId, null);
-
- //
- this.children = children;
- }
-
- public List<NavigationContainer.Node> getChildren()
- {
- return children;
- }
-
- public static class Node extends NavigationContainer
- {
-
- /** . */
- private final String uri;
-
- /** . */
- private final String label;
-
- /** . */
- private final String icon;
-
- /** . */
- private final String name;
-
- /** . */
- private final Date startPublicationDate;
-
- /** . */
- private final Date endPublicationDate;
-
- /** . */
- private final boolean showPublicationDate;
-
- /** . */
- private final boolean visible;
-
- /** . */
- private final String pageReference;
-
- public Node(
- String uri,
- String label,
- String icon,
- String name,
- Date startPublicationDate,
- Date endPublicationDate,
- Boolean showPublicationDate,
- Boolean visible,
- String pageReference,
- List<NavigationContainer.Node> children)
- {
- this(null, uri, label, icon, name, startPublicationDate, endPublicationDate, showPublicationDate, visible, pageReference, children);
- }
-
- public Node(
- String storageId,
- String uri,
- String label,
- String icon,
- String name,
- Date startPublicationDate,
- Date endPublicationDate,
- Boolean showPublicationDate,
- Boolean visible,
- String pageReference,
- List<NavigationContainer.Node> children)
- {
- super(storageId, children);
-
- //
- this.uri = uri;
- this.label = label;
- this.icon = icon;
- this.name = name;
- this.startPublicationDate = startPublicationDate;
- this.endPublicationDate = endPublicationDate;
- this.showPublicationDate = showPublicationDate != null ? showPublicationDate : false;
- this.visible = visible != null ? visible : true;
- this.pageReference = pageReference;
- }
- public String getURI()
- {
- return uri;
- }
-
- public String getLabel()
- {
- return label;
- }
-
- public String getIcon()
- {
- return icon;
- }
-
- public String getName()
- {
- return name;
- }
-
- public Date getStartPublicationDate()
- {
- return startPublicationDate;
- }
-
- public Date getEndPublicationDate()
- {
- return endPublicationDate;
- }
-
- public boolean getShowPublicationDate()
- {
- return showPublicationDate;
- }
-
- public boolean isVisible()
- {
- return visible;
- }
-
- public String getPageReference()
- {
- return pageReference;
- }
- }
-
- public static class Page extends NavigationContainer
- {
-
- /** . */
- private final NavigationKey key;
-
- /** . */
- private final String description;
-
- /** . */
- private final String creator;
-
- /** . */
- private final String modifier;
-
- /** . */
- private final int priority;
-
- public Page(
- String ownerType,
- String ownerId,
- String description,
- String creator,
- String modifier,
- Integer priority,
- List<NavigationContainer.Node> children)
- {
- this(null, ownerType, ownerId, description, creator, modifier, priority, children);
- }
-
- public Page(
- String storageId,
- String ownerType,
- String ownerId,
- String description,
- String creator,
- String modifier,
- Integer priority,
- List<NavigationContainer.Node> children)
- {
- super(storageId, children);
-
- //
- if (ownerType == null)
- {
- throw new NullPointerException("No null owner type");
- }
- if (ownerId == null)
- {
- throw new NullPointerException("No null owner id");
- }
-
- //
- this.key = new NavigationKey(ownerType, ownerId);
- this.description = description;
- this.creator = creator;
- this.modifier = modifier;
- this.priority = priority != null ? priority : 1;
- }
-
- public NavigationKey getKey()
- {
- return key;
- }
-
- public String getOwnerType()
- {
- return key.getOwnerType();
- }
-
- public String getOwnerId()
- {
- return key.getOwnerId();
- }
-
- public String getDescription()
- {
- return description;
- }
-
- public String getCreator()
- {
- return creator;
- }
-
- public String getModifier()
- {
- return modifier;
- }
-
- public int getPriority()
- {
- return priority;
- }
- }
-
-
-}
Copied: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/NavigationData.java (from rev 413, portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/NavigationData.java)
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/NavigationData.java (rev 0)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/NavigationData.java 2009-10-24 08:32:00 UTC (rev 414)
@@ -0,0 +1,119 @@
+/*
+ * Copyright (C) 2003-2007 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.portal.pom.data;
+
+import java.util.List;
+
+/**
+* @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+* @version $Revision$
+*/
+public class NavigationData extends NavigationNodeContainerData
+{
+
+ /** . */
+ private final NavigationKey key;
+
+ /** . */
+ private final String description;
+
+ /** . */
+ private final String creator;
+
+ /** . */
+ private final String modifier;
+
+ /** . */
+ private final int priority;
+
+ public NavigationData(
+ String ownerType,
+ String ownerId,
+ String description,
+ String creator,
+ String modifier,
+ Integer priority,
+ List<NavigationNodeData> children)
+ {
+ this(null, ownerType, ownerId, description, creator, modifier, priority, children);
+ }
+
+ public NavigationData(
+ String storageId,
+ String ownerType,
+ String ownerId,
+ String description,
+ String creator,
+ String modifier,
+ Integer priority,
+ List<NavigationNodeData> children)
+ {
+ super(storageId, children);
+
+ //
+ if (ownerType == null)
+ {
+ throw new NullPointerException("No null owner type");
+ }
+ if (ownerId == null)
+ {
+ throw new NullPointerException("No null owner id");
+ }
+
+ //
+ this.key = new NavigationKey(ownerType, ownerId);
+ this.description = description;
+ this.creator = creator;
+ this.modifier = modifier;
+ this.priority = priority != null ? priority : 1;
+ }
+
+ public NavigationKey getKey()
+ {
+ return key;
+ }
+
+ public String getOwnerType()
+ {
+ return key.getOwnerType();
+ }
+
+ public String getOwnerId()
+ {
+ return key.getOwnerId();
+ }
+
+ public String getDescription()
+ {
+ return description;
+ }
+
+ public String getCreator()
+ {
+ return creator;
+ }
+
+ public String getModifier()
+ {
+ return modifier;
+ }
+
+ public int getPriority()
+ {
+ return priority;
+ }
+}
Deleted: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/NavigationKey.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/NavigationKey.java 2009-10-24 07:50:41 UTC (rev 412)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/NavigationKey.java 2009-10-24 08:32:00 UTC (rev 414)
@@ -1,46 +0,0 @@
-/*
- * Copyright (C) 2003-2007 eXo Platform SAS.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
- *
- * This program 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
- */
-package org.exoplatform.portal.pom.config.data;
-
-import org.exoplatform.portal.pom.config.Utils;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public class NavigationKey extends OwnerKey
-{
-
- public NavigationKey(String ownerType, String ownerId)
- {
- super(ownerType, ownerId);
- }
-
- public static NavigationKey create(String compositeId)
- {
- if (compositeId == null)
- {
- throw new NullPointerException();
- }
- String[] components = Utils.split("::", compositeId);
- if (components.length != 2)
- {
- throw new IllegalArgumentException("Wrong navigation id key format " + compositeId);
- }
- return new NavigationKey(components[0], components[1]);
- }
-}
Copied: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/NavigationKey.java (from rev 413, portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/NavigationKey.java)
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/NavigationKey.java (rev 0)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/NavigationKey.java 2009-10-24 08:32:00 UTC (rev 414)
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2003-2007 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.portal.pom.data;
+
+import org.exoplatform.portal.pom.config.Utils;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class NavigationKey extends OwnerKey
+{
+
+ public NavigationKey(String ownerType, String ownerId)
+ {
+ super(ownerType, ownerId);
+ }
+
+ public static NavigationKey create(String compositeId)
+ {
+ if (compositeId == null)
+ {
+ throw new NullPointerException();
+ }
+ String[] components = Utils.split("::", compositeId);
+ if (components.length != 2)
+ {
+ throw new IllegalArgumentException("Wrong navigation id key format " + compositeId);
+ }
+ return new NavigationKey(components[0], components[1]);
+ }
+}
Copied: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/NavigationNodeContainerData.java (from rev 413, portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/NavigationNodeContainerData.java)
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/NavigationNodeContainerData.java (rev 0)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/NavigationNodeContainerData.java 2009-10-24 08:32:00 UTC (rev 414)
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2003-2007 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.portal.pom.data;
+
+import org.exoplatform.portal.pom.data.ModelData;
+
+import java.util.List;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class NavigationNodeContainerData extends ModelData
+{
+
+ /** . */
+ private final List<NavigationNodeData> nodes;
+
+ public NavigationNodeContainerData(String storageId, List<NavigationNodeData> nodes)
+ {
+ super(storageId, null);
+
+ //
+ this.nodes = nodes;
+ }
+
+ public List<NavigationNodeData> getNodes()
+ {
+ return nodes;
+ }
+}
Copied: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/NavigationNodeData.java (from rev 413, portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/NavigationNodeData.java)
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/NavigationNodeData.java (rev 0)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/NavigationNodeData.java 2009-10-24 08:32:00 UTC (rev 414)
@@ -0,0 +1,141 @@
+/*
+ * Copyright (C) 2003-2007 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.portal.pom.data;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+* @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+* @version $Revision$
+*/
+public class NavigationNodeData extends NavigationNodeContainerData
+{
+
+ /** . */
+ private final String uri;
+
+ /** . */
+ private final String label;
+
+ /** . */
+ private final String icon;
+
+ /** . */
+ private final String name;
+
+ /** . */
+ private final Date startPublicationDate;
+
+ /** . */
+ private final Date endPublicationDate;
+
+ /** . */
+ private final boolean showPublicationDate;
+
+ /** . */
+ private final boolean visible;
+
+ /** . */
+ private final String pageReference;
+
+ public NavigationNodeData(
+ String uri,
+ String label,
+ String icon,
+ String name,
+ Date startPublicationDate,
+ Date endPublicationDate,
+ Boolean showPublicationDate,
+ Boolean visible,
+ String pageReference,
+ List<NavigationNodeData> children)
+ {
+ this(null, uri, label, icon, name, startPublicationDate, endPublicationDate, showPublicationDate, visible, pageReference, children);
+ }
+
+ public NavigationNodeData(
+ String storageId,
+ String uri,
+ String label,
+ String icon,
+ String name,
+ Date startPublicationDate,
+ Date endPublicationDate,
+ Boolean showPublicationDate,
+ Boolean visible,
+ String pageReference,
+ List<NavigationNodeData> children)
+ {
+ super(storageId, children);
+
+ //
+ this.uri = uri;
+ this.label = label;
+ this.icon = icon;
+ this.name = name;
+ this.startPublicationDate = startPublicationDate;
+ this.endPublicationDate = endPublicationDate;
+ this.showPublicationDate = showPublicationDate != null ? showPublicationDate : false;
+ this.visible = visible != null ? visible : true;
+ this.pageReference = pageReference;
+ }
+ public String getURI()
+ {
+ return uri;
+ }
+
+ public String getLabel()
+ {
+ return label;
+ }
+
+ public String getIcon()
+ {
+ return icon;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public Date getStartPublicationDate()
+ {
+ return startPublicationDate;
+ }
+
+ public Date getEndPublicationDate()
+ {
+ return endPublicationDate;
+ }
+
+ public boolean getShowPublicationDate()
+ {
+ return showPublicationDate;
+ }
+
+ public boolean isVisible()
+ {
+ return visible;
+ }
+
+ public String getPageReference()
+ {
+ return pageReference;
+ }
+}
Deleted: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/OwnerKey.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/OwnerKey.java 2009-10-24 07:50:41 UTC (rev 412)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/OwnerKey.java 2009-10-24 08:32:00 UTC (rev 414)
@@ -1,74 +0,0 @@
-/*
- * Copyright (C) 2003-2007 eXo Platform SAS.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
- *
- * This program 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
- */
-package org.exoplatform.portal.pom.config.data;
-
-import java.io.Serializable;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public class OwnerKey implements Serializable
-{
-
- /** . */
- private final String ownerType;
-
- /** . */
- private final String ownerId;
-
- public OwnerKey(String ownerType, String ownerId)
- {
- if (ownerType == null)
- {
- throw new NullPointerException();
- }
- if (ownerId == null)
- {
- throw new NullPointerException();
- }
- this.ownerType = ownerType;
- this.ownerId = ownerId;
- }
-
- public String getOwnerType()
- {
- return ownerType;
- }
-
- public String getOwnerId()
- {
- return ownerId;
- }
-
- @Override
- public int hashCode()
- {
- return ownerId.hashCode() ^ ownerType.hashCode();
- }
-
- @Override
- public boolean equals(Object obj)
- {
- if (obj instanceof OwnerKey)
- {
- OwnerKey that = (OwnerKey)obj;
- return ownerType.equals(that.ownerType) && ownerId.equals(that.ownerId);
- }
- return false;
- }
-}
Copied: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/OwnerKey.java (from rev 413, portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/OwnerKey.java)
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/OwnerKey.java (rev 0)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/OwnerKey.java 2009-10-24 08:32:00 UTC (rev 414)
@@ -0,0 +1,74 @@
+/*
+ * Copyright (C) 2003-2007 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.portal.pom.data;
+
+import java.io.Serializable;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class OwnerKey implements Serializable
+{
+
+ /** . */
+ private final String ownerType;
+
+ /** . */
+ private final String ownerId;
+
+ public OwnerKey(String ownerType, String ownerId)
+ {
+ if (ownerType == null)
+ {
+ throw new NullPointerException();
+ }
+ if (ownerId == null)
+ {
+ throw new NullPointerException();
+ }
+ this.ownerType = ownerType;
+ this.ownerId = ownerId;
+ }
+
+ public String getOwnerType()
+ {
+ return ownerType;
+ }
+
+ public String getOwnerId()
+ {
+ return ownerId;
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return ownerId.hashCode() ^ ownerType.hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (obj instanceof OwnerKey)
+ {
+ OwnerKey that = (OwnerKey)obj;
+ return ownerType.equals(that.ownerType) && ownerId.equals(that.ownerId);
+ }
+ return false;
+ }
+}
Deleted: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/PageData.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/PageData.java 2009-10-24 07:50:41 UTC (rev 412)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/PageData.java 2009-10-24 08:32:00 UTC (rev 414)
@@ -1,108 +0,0 @@
-/*
- * Copyright (C) 2003-2007 eXo Platform SAS.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
- *
- * This program 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
- */
-package org.exoplatform.portal.pom.config.data;
-
-import java.util.List;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public class PageData extends ContainerData
-{
-
- /** . */
- private final PageKey key;
-
- /** . */
- private final String editPermission;
-
- /** . */
- private final boolean showMaxWindow;
-
- /** . */
- private final String creator;
-
- /** . */
- private final String modifier;
-
- public PageData(
- String storageId,
- String id,
- String name,
- String icon,
- String decorator,
- String template,
- String factoryId,
- String title,
- String description,
- String width,
- String height,
- List<String> accessPermissions,
- List<ComponentData> children,
- String ownerType,
- String ownerId,
- String editPermission,
- boolean showMaxWindow,
- String creator,
- String modifier)
- {
- super(storageId, id, name, icon, decorator, template, factoryId, title, description, width, height, accessPermissions, children);
-
- //
- this.key = new PageKey(ownerType, ownerId, name);
- this.editPermission = editPermission;
- this.showMaxWindow = showMaxWindow;
- this.creator = creator;
- this.modifier = modifier;
- }
-
- public PageKey getKey()
- {
- return key;
- }
-
- public String getOwnerType()
- {
- return key.getOwnerType();
- }
-
- public String getOwnerId()
- {
- return key.getOwnerId();
- }
-
- public String getEditPermission()
- {
- return editPermission;
- }
-
- public boolean isShowMaxWindow()
- {
- return showMaxWindow;
- }
-
- public String getCreator()
- {
- return creator;
- }
-
- public String getModifier()
- {
- return modifier;
- }
-}
Copied: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/PageData.java (from rev 413, portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/PageData.java)
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/PageData.java (rev 0)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/PageData.java 2009-10-24 08:32:00 UTC (rev 414)
@@ -0,0 +1,108 @@
+/*
+ * Copyright (C) 2003-2007 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.portal.pom.data;
+
+import java.util.List;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class PageData extends ContainerData
+{
+
+ /** . */
+ private final PageKey key;
+
+ /** . */
+ private final String editPermission;
+
+ /** . */
+ private final boolean showMaxWindow;
+
+ /** . */
+ private final String creator;
+
+ /** . */
+ private final String modifier;
+
+ public PageData(
+ String storageId,
+ String id,
+ String name,
+ String icon,
+ String decorator,
+ String template,
+ String factoryId,
+ String title,
+ String description,
+ String width,
+ String height,
+ List<String> accessPermissions,
+ List<ComponentData> children,
+ String ownerType,
+ String ownerId,
+ String editPermission,
+ boolean showMaxWindow,
+ String creator,
+ String modifier)
+ {
+ super(storageId, id, name, icon, decorator, template, factoryId, title, description, width, height, accessPermissions, children);
+
+ //
+ this.key = new PageKey(ownerType, ownerId, name);
+ this.editPermission = editPermission;
+ this.showMaxWindow = showMaxWindow;
+ this.creator = creator;
+ this.modifier = modifier;
+ }
+
+ public PageKey getKey()
+ {
+ return key;
+ }
+
+ public String getOwnerType()
+ {
+ return key.getOwnerType();
+ }
+
+ public String getOwnerId()
+ {
+ return key.getOwnerId();
+ }
+
+ public String getEditPermission()
+ {
+ return editPermission;
+ }
+
+ public boolean isShowMaxWindow()
+ {
+ return showMaxWindow;
+ }
+
+ public String getCreator()
+ {
+ return creator;
+ }
+
+ public String getModifier()
+ {
+ return modifier;
+ }
+}
Deleted: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/PageKey.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/PageKey.java 2009-10-24 07:50:41 UTC (rev 412)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/PageKey.java 2009-10-24 08:32:00 UTC (rev 414)
@@ -1,84 +0,0 @@
-/*
- * Copyright (C) 2003-2007 eXo Platform SAS.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
- *
- * This program 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
- */
-package org.exoplatform.portal.pom.config.data;
-
-import org.exoplatform.portal.pom.config.Utils;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public class PageKey extends OwnerKey
-{
-
- /** . */
- private final String name;
-
- public PageKey(String ownerType, String ownerId, String name)
- {
- super(ownerType, ownerId);
-
- //
- if (name == null)
- {
- throw new NullPointerException();
- }
-
- //
- this.name = name;
- }
-
- public String getName()
- {
- return name;
- }
-
- @Override
- public int hashCode()
- {
- return super.hashCode() ^ name.hashCode();
- }
-
- @Override
- public boolean equals(Object obj)
- {
- if (obj == this)
- {
- return true;
- }
- if (obj instanceof PageKey)
- {
- PageKey that = (PageKey)obj;
- return super.equals(that) &&name.equals(that.name);
- }
- return false;
- }
-
- public static PageKey create(String compositeId)
- {
- if (compositeId == null)
- {
- throw new NullPointerException();
- }
- String[] components = Utils.split("::", compositeId);
- if (components.length != 3)
- {
- throw new IllegalArgumentException("Wrong page id key format " + compositeId);
- }
- return new PageKey(components[0], components[1], components[2]);
- }
-}
Copied: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/PageKey.java (from rev 413, portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/PageKey.java)
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/PageKey.java (rev 0)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/PageKey.java 2009-10-24 08:32:00 UTC (rev 414)
@@ -0,0 +1,84 @@
+/*
+ * Copyright (C) 2003-2007 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.portal.pom.data;
+
+import org.exoplatform.portal.pom.config.Utils;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class PageKey extends OwnerKey
+{
+
+ /** . */
+ private final String name;
+
+ public PageKey(String ownerType, String ownerId, String name)
+ {
+ super(ownerType, ownerId);
+
+ //
+ if (name == null)
+ {
+ throw new NullPointerException();
+ }
+
+ //
+ this.name = name;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return super.hashCode() ^ name.hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (obj == this)
+ {
+ return true;
+ }
+ if (obj instanceof PageKey)
+ {
+ PageKey that = (PageKey)obj;
+ return super.equals(that) &&name.equals(that.name);
+ }
+ return false;
+ }
+
+ public static PageKey create(String compositeId)
+ {
+ if (compositeId == null)
+ {
+ throw new NullPointerException();
+ }
+ String[] components = Utils.split("::", compositeId);
+ if (components.length != 3)
+ {
+ throw new IllegalArgumentException("Wrong page id key format " + compositeId);
+ }
+ return new PageKey(components[0], components[1], components[2]);
+ }
+}
Deleted: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/PortalData.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/PortalData.java 2009-10-24 07:50:41 UTC (rev 412)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/PortalData.java 2009-10-24 08:32:00 UTC (rev 414)
@@ -1,147 +0,0 @@
-/*
- * Copyright (C) 2003-2007 eXo Platform SAS.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
- *
- * This program 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
- */
-package org.exoplatform.portal.pom.config.data;
-
-import java.util.List;
-import java.util.Map;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public class PortalData extends ModelData
-{
-
- /** . */
- private final PortalKey key;
-
- /** . */
- private final String locale;
-
- /** . */
- private final List<String> accessPermissions;
-
- /** . */
- private final String editPermission;
-
- /** . */
- private final Map<String, String> properties;
-
- /** . */
- private final String skin;
-
- /** . */
- private final String title;
-
- /** . */
- private final ContainerData portalLayout;
-
- /** . */
- private final String creator;
-
- /** . */
- private final String modifier;
-
- public PortalData(
- String storageId,
- String name,
- String type,
- String locale,
- List<String> accessPermissions,
- String editPermission,
- Map<String, String> properties,
- String skin,
- String title,
- ContainerData portalLayout,
- String creator,
- String modifier)
- {
- super(storageId, null);
-
- //
- this.key = new PortalKey(type, name);
- this.locale = locale;
- this.accessPermissions = accessPermissions;
- this.editPermission = editPermission;
- this.properties = properties;
- this.skin = skin;
- this.title = title;
- this.portalLayout = portalLayout;
- this.creator = creator;
- this.modifier = modifier;
- }
-
- public PortalKey getKey()
- {
- return key;
- }
-
- public String getName()
- {
- return key.getOwnerId();
- }
-
- public String getType()
- {
- return key.getOwnerType();
- }
-
- public String getLocale()
- {
- return locale;
- }
-
- public List<String> getAccessPermissions()
- {
- return accessPermissions;
- }
-
- public String getEditPermission()
- {
- return editPermission;
- }
-
- public Map<String, String> getProperties()
- {
- return properties;
- }
-
- public String getSkin()
- {
- return skin;
- }
-
- public String getTitle()
- {
- return title;
- }
-
- public ContainerData getPortalLayout()
- {
- return portalLayout;
- }
-
- public String getCreator()
- {
- return creator;
- }
-
- public String getModifier()
- {
- return modifier;
- }
-}
Copied: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/PortalData.java (from rev 413, portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/PortalData.java)
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/PortalData.java (rev 0)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/PortalData.java 2009-10-24 08:32:00 UTC (rev 414)
@@ -0,0 +1,147 @@
+/*
+ * Copyright (C) 2003-2007 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.portal.pom.data;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class PortalData extends ModelData
+{
+
+ /** . */
+ private final PortalKey key;
+
+ /** . */
+ private final String locale;
+
+ /** . */
+ private final List<String> accessPermissions;
+
+ /** . */
+ private final String editPermission;
+
+ /** . */
+ private final Map<String, String> properties;
+
+ /** . */
+ private final String skin;
+
+ /** . */
+ private final String title;
+
+ /** . */
+ private final ContainerData portalLayout;
+
+ /** . */
+ private final String creator;
+
+ /** . */
+ private final String modifier;
+
+ public PortalData(
+ String storageId,
+ String name,
+ String type,
+ String locale,
+ List<String> accessPermissions,
+ String editPermission,
+ Map<String, String> properties,
+ String skin,
+ String title,
+ ContainerData portalLayout,
+ String creator,
+ String modifier)
+ {
+ super(storageId, null);
+
+ //
+ this.key = new PortalKey(type, name);
+ this.locale = locale;
+ this.accessPermissions = accessPermissions;
+ this.editPermission = editPermission;
+ this.properties = properties;
+ this.skin = skin;
+ this.title = title;
+ this.portalLayout = portalLayout;
+ this.creator = creator;
+ this.modifier = modifier;
+ }
+
+ public PortalKey getKey()
+ {
+ return key;
+ }
+
+ public String getName()
+ {
+ return key.getOwnerId();
+ }
+
+ public String getType()
+ {
+ return key.getOwnerType();
+ }
+
+ public String getLocale()
+ {
+ return locale;
+ }
+
+ public List<String> getAccessPermissions()
+ {
+ return accessPermissions;
+ }
+
+ public String getEditPermission()
+ {
+ return editPermission;
+ }
+
+ public Map<String, String> getProperties()
+ {
+ return properties;
+ }
+
+ public String getSkin()
+ {
+ return skin;
+ }
+
+ public String getTitle()
+ {
+ return title;
+ }
+
+ public ContainerData getPortalLayout()
+ {
+ return portalLayout;
+ }
+
+ public String getCreator()
+ {
+ return creator;
+ }
+
+ public String getModifier()
+ {
+ return modifier;
+ }
+}
Deleted: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/PortalKey.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/PortalKey.java 2009-10-24 07:50:41 UTC (rev 412)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/PortalKey.java 2009-10-24 08:32:00 UTC (rev 414)
@@ -1,46 +0,0 @@
-/*
- * Copyright (C) 2003-2007 eXo Platform SAS.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
- *
- * This program 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
- */
-package org.exoplatform.portal.pom.config.data;
-
-import org.exoplatform.portal.pom.config.Utils;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public class PortalKey extends OwnerKey
-{
-
- public PortalKey(String ownerType, String ownerId)
- {
- super(ownerType, ownerId);
- }
-
- public static PortalKey create(String compositeId)
- {
- if (compositeId == null)
- {
- throw new NullPointerException();
- }
- String[] components = Utils.split("::", compositeId);
- if (components.length != 2)
- {
- throw new IllegalArgumentException("Wrong navigation id key format " + compositeId);
- }
- return new PortalKey(components[0], components[1]);
- }
-}
Copied: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/PortalKey.java (from rev 413, portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/PortalKey.java)
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/PortalKey.java (rev 0)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/data/PortalKey.java 2009-10-24 08:32:00 UTC (rev 414)
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2003-2007 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.portal.pom.data;
+
+import org.exoplatform.portal.pom.config.Utils;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class PortalKey extends OwnerKey
+{
+
+ public PortalKey(String ownerType, String ownerId)
+ {
+ super(ownerType, ownerId);
+ }
+
+ public static PortalKey create(String compositeId)
+ {
+ if (compositeId == null)
+ {
+ throw new NullPointerException();
+ }
+ String[] components = Utils.split("::", compositeId);
+ if (components.length != 2)
+ {
+ throw new IllegalArgumentException("Wrong navigation id key format " + compositeId);
+ }
+ return new PortalKey(components[0], components[1]);
+ }
+}
Modified: portal/branches/performance/component/portal/src/test/java/conf/portal/test-configuration.xml
===================================================================
--- portal/branches/performance/component/portal/src/test/java/conf/portal/test-configuration.xml 2009-10-24 08:22:11 UTC (rev 413)
+++ portal/branches/performance/component/portal/src/test/java/conf/portal/test-configuration.xml 2009-10-24 08:32:00 UTC (rev 414)
@@ -28,7 +28,7 @@
<type>org.exoplatform.portal.pom.config.POMSessionManager</type>
</component>
<component>
- <key>org.exoplatform.portal.pom.config.data.ModelDataStorage</key>
+ <key>org.exoplatform.portal.pom.data.ModelDataStorage</key>
<type>org.exoplatform.portal.pom.config.POMDataStorage</type>
</component>
<component>
Modified: portal/branches/performance/web/portal/src/main/webapp/WEB-INF/conf/portal/portal-configuration.xml
===================================================================
--- portal/branches/performance/web/portal/src/main/webapp/WEB-INF/conf/portal/portal-configuration.xml 2009-10-24 08:22:11 UTC (rev 413)
+++ portal/branches/performance/web/portal/src/main/webapp/WEB-INF/conf/portal/portal-configuration.xml 2009-10-24 08:32:00 UTC (rev 414)
@@ -31,7 +31,7 @@
</component>
<component>
- <key>org.exoplatform.portal.pom.config.data.ModelDataStorage</key>
+ <key>org.exoplatform.portal.pom.data.ModelDataStorage</key>
<type>org.exoplatform.portal.pom.config.POMDataStorage</type>
</component>
Modified: portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageActionListener.java
===================================================================
--- portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageActionListener.java 2009-10-24 08:22:11 UTC (rev 413)
+++ portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageActionListener.java 2009-10-24 08:32:00 UTC (rev 414)
@@ -29,7 +29,6 @@
import org.exoplatform.portal.config.model.PageNavigation;
import org.exoplatform.portal.config.model.PageNode;
import org.exoplatform.portal.config.model.PortalConfig;
-import org.exoplatform.portal.pom.config.data.PortalData;
import org.exoplatform.portal.webui.application.UIGadget;
import org.exoplatform.portal.webui.application.UIPortlet;
import org.exoplatform.portal.webui.navigation.PageNavigationUtils;
Modified: portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalForm.java
===================================================================
--- portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalForm.java 2009-10-24 08:22:11 UTC (rev 413)
+++ portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalForm.java 2009-10-24 08:32:00 UTC (rev 414)
@@ -25,7 +25,6 @@
import org.exoplatform.portal.config.UserPortalConfigService;
import org.exoplatform.portal.config.model.PageNavigation;
import org.exoplatform.portal.config.model.PortalConfig;
-import org.exoplatform.portal.pom.config.data.PortalData;
import org.exoplatform.portal.config.model.PortalProperties;
import org.exoplatform.portal.skin.SkinService;
import org.exoplatform.portal.webui.util.Util;
Modified: portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalSelector.java
===================================================================
--- portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalSelector.java 2009-10-24 08:22:11 UTC (rev 413)
+++ portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalSelector.java 2009-10-24 08:32:00 UTC (rev 414)
@@ -24,7 +24,7 @@
import org.exoplatform.portal.config.Query;
import org.exoplatform.portal.config.UserACL;
import org.exoplatform.portal.config.model.PortalConfig;
-import org.exoplatform.portal.pom.config.data.PortalData;
+import org.exoplatform.portal.pom.data.PortalData;
import org.exoplatform.portal.webui.container.UIContainer;
import org.exoplatform.portal.webui.workspace.UIMaskWorkspace;
import org.exoplatform.webui.config.annotation.ComponentConfig;
15 years, 11 months
gatein SVN: r413 - in portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal: pom/config and 2 other directories.
by do-not-reply@jboss.org
Author: julien_viet
Date: 2009-10-24 04:22:11 -0400 (Sat, 24 Oct 2009)
New Revision: 413
Added:
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/NavigationData.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/NavigationNodeContainerData.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/NavigationNodeData.java
Removed:
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/NavigationContainer.java
Modified:
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PageNavigation.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PageNode.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PageNodeContainer.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMDataStorage.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/Mapper.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/ModelDataStorage.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/PageNavigationTask.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/SearchTask.java
Log:
refactored the navigation class names and avoid to use inner classes at this place
Modified: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PageNavigation.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PageNavigation.java 2009-10-24 07:50:41 UTC (rev 412)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PageNavigation.java 2009-10-24 08:22:11 UTC (rev 413)
@@ -19,7 +19,8 @@
package org.exoplatform.portal.config.model;
-import org.exoplatform.portal.pom.config.data.NavigationContainer;
+import org.exoplatform.portal.pom.config.data.NavigationData;
+import org.exoplatform.portal.pom.config.data.NavigationNodeData;
import java.util.ArrayList;
import java.util.LinkedHashMap;
@@ -58,12 +59,12 @@
this((String)null);
}
- public PageNavigation(NavigationContainer.Page nav)
+ public PageNavigation(NavigationData nav)
{
super(nav.getStorageId());
- ArrayList<PageNode> children = new ArrayList<PageNode>(nav.getChildren().size());
- for (NavigationContainer.Node child : nav.getChildren())
+ ArrayList<PageNode> children = new ArrayList<PageNode>(nav.getNodes().size());
+ for (NavigationNodeData child : nav.getNodes())
{
PageNode node = new PageNode(child);
children.add(node);
@@ -256,10 +257,10 @@
}
@Override
- public NavigationContainer.Page build()
+ public NavigationData build()
{
- List<NavigationContainer.Node> children = buildNavigationChildren();
- return new NavigationContainer.Page(
+ List<NavigationNodeData> children = buildNavigationChildren();
+ return new NavigationData(
storageId,
ownerType,
ownerId,
Modified: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PageNode.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PageNode.java 2009-10-24 07:50:41 UTC (rev 412)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PageNode.java 2009-10-24 08:22:11 UTC (rev 413)
@@ -20,7 +20,7 @@
package org.exoplatform.portal.config.model;
import org.exoplatform.commons.utils.ExpressionUtil;
-import org.exoplatform.portal.pom.config.data.NavigationContainer;
+import org.exoplatform.portal.pom.config.data.NavigationNodeData;
import java.util.ArrayList;
import java.util.Date;
@@ -54,13 +54,13 @@
private transient boolean modifiable;
- public PageNode(NavigationContainer.Node nav)
+ public PageNode(NavigationNodeData nav)
{
super(nav.getStorageId());
//
- ArrayList<PageNode> children = new ArrayList<PageNode>(nav.getChildren().size());
- for (NavigationContainer.Node child : nav.getChildren())
+ ArrayList<PageNode> children = new ArrayList<PageNode>(nav.getNodes().size());
+ for (NavigationNodeData child : nav.getNodes())
{
PageNode node = new PageNode(child);
children.add(node);
@@ -288,10 +288,10 @@
}
@Override
- public NavigationContainer.Node build()
+ public NavigationNodeData build()
{
- List<NavigationContainer.Node> children = buildNavigationChildren();
- return new NavigationContainer.Node(
+ List<NavigationNodeData> children = buildNavigationChildren();
+ return new NavigationNodeData(
storageId,
uri,
label,
Modified: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PageNodeContainer.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PageNodeContainer.java 2009-10-24 07:50:41 UTC (rev 412)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PageNodeContainer.java 2009-10-24 08:22:11 UTC (rev 413)
@@ -20,7 +20,8 @@
package org.exoplatform.portal.config.model;
import org.exoplatform.portal.config.model.ModelObject;
-import org.exoplatform.portal.pom.config.data.NavigationContainer;
+import org.exoplatform.portal.pom.config.data.NavigationNodeContainerData;
+import org.exoplatform.portal.pom.config.data.NavigationNodeData;
import java.util.ArrayList;
import java.util.Collections;
@@ -44,16 +45,16 @@
public abstract List<PageNode> getNodes();
- protected List<NavigationContainer.Node> buildNavigationChildren()
+ protected List<NavigationNodeData> buildNavigationChildren()
{
List<PageNode> nodes = getNodes();
if (nodes != null)
{
- ArrayList<NavigationContainer.Node> children = new ArrayList<NavigationContainer.Node>();
+ ArrayList<NavigationNodeData> children = new ArrayList<NavigationNodeData>();
for (int i = 0;i < nodes.size();i++)
{
PageNode node = nodes.get(i);
- NavigationContainer.Node child = node.build();
+ NavigationNodeData child = node.build();
children.add(child);
}
return Collections.unmodifiableList(children);
@@ -64,6 +65,6 @@
}
}
- public abstract NavigationContainer build();
+ public abstract NavigationNodeContainerData build();
}
Modified: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMDataStorage.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMDataStorage.java 2009-10-24 07:50:41 UTC (rev 412)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMDataStorage.java 2009-10-24 08:22:11 UTC (rev 413)
@@ -30,7 +30,7 @@
import org.exoplatform.portal.config.model.ModelChange;
import org.exoplatform.portal.config.model.ModelObject;
import org.exoplatform.portal.pom.config.data.ModelDataStorage;
-import org.exoplatform.portal.pom.config.data.NavigationContainer;
+import org.exoplatform.portal.pom.config.data.NavigationData;
import org.exoplatform.portal.pom.config.data.NavigationKey;
import org.exoplatform.portal.pom.config.data.PageData;
import org.exoplatform.portal.config.model.PersistentApplicationState;
@@ -149,22 +149,22 @@
return execute(new PageTask.Save(page)).getChanges();
}
- public NavigationContainer.Page getPageNavigation(NavigationKey key) throws Exception
+ public NavigationData getPageNavigation(NavigationKey key) throws Exception
{
return execute(new PageNavigationTask.Load(key)).getPageNavigation();
}
- public void save(NavigationContainer.Page navigation) throws Exception
+ public void save(NavigationData navigation) throws Exception
{
execute(new PageNavigationTask.Save(navigation, true));
}
- public void create(NavigationContainer.Page navigation) throws Exception
+ public void create(NavigationData navigation) throws Exception
{
execute(new PageNavigationTask.Save(navigation, false));
}
- public void remove(NavigationContainer.Page navigation) throws Exception
+ public void remove(NavigationData navigation) throws Exception
{
execute(new PageNavigationTask.Remove(navigation));
}
@@ -221,9 +221,9 @@
{
return (LazyPageList<T>)execute(new SearchTask.FindPage((Query<PageData>)q)).getResult();
}
- else if (NavigationContainer.Page.class.equals(type))
+ else if (NavigationData.class.equals(type))
{
- return (LazyPageList<T>)execute(new SearchTask.FindNavigation((Query<NavigationContainer.Page>)q)).getResult();
+ return (LazyPageList<T>)execute(new SearchTask.FindNavigation((Query<NavigationData>)q)).getResult();
}
else if (PortletPreferences.class.equals(type))
{
Modified: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/Mapper.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/Mapper.java 2009-10-24 07:50:41 UTC (rev 412)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/Mapper.java 2009-10-24 08:22:11 UTC (rev 413)
@@ -22,7 +22,6 @@
import org.exoplatform.portal.config.model.ApplicationState;
import org.exoplatform.portal.config.model.ApplicationType;
import org.exoplatform.portal.pom.config.data.BodyType;
-import org.exoplatform.portal.config.model.Dashboard;
import org.exoplatform.portal.config.model.ModelChange;
import org.exoplatform.portal.config.model.PersistentApplicationState;
import org.exoplatform.portal.config.model.PortalConfig;
@@ -41,7 +40,7 @@
import org.exoplatform.portal.pom.config.data.ContainerData;
import org.exoplatform.portal.pom.config.data.DashboardData;
import org.exoplatform.portal.pom.config.data.ModelData;
-import org.exoplatform.portal.pom.config.data.NavigationContainer;
+import org.exoplatform.portal.pom.config.data.NavigationNodeContainerData;
import org.exoplatform.portal.pom.config.data.PageData;
import org.exoplatform.portal.pom.config.data.PortalData;
import org.exoplatform.portal.pom.spi.gadget.Gadget;
@@ -105,31 +104,31 @@
this.session = session;
}
- public NavigationContainer.Page load(Navigation src)
+ public NavigationData load(Navigation src)
{
- return load(src, NavigationContainer.Page.class);
+ return load(src, NavigationData.class);
}
- private <T extends NavigationContainer> T load(Navigation src, Class<T> type)
+ private <T extends NavigationNodeContainerData> T load(Navigation src, Class<T> type)
{
//
- ArrayList<NavigationContainer.Node> children = new ArrayList<NavigationContainer.Node>(src.getChildren().size());
+ ArrayList<NavigationNodeData> children = new ArrayList<NavigationNodeData>(src.getChildren().size());
for (Navigation srcChild : src.getChildren())
{
- NavigationContainer.Node dstChild = load(srcChild, NavigationContainer.Node.class);
+ NavigationNodeData dstChild = load(srcChild, NavigationNodeData.class);
children.add(dstChild);
}
//
T dst;
- if (type == NavigationContainer.Page.class)
+ if (type == NavigationData.class)
{
Site site = src.getSite();
String ownerType = getOwnerType(site.getObjectType());
String ownerId = site.getName();
Attributes attrs = src.getAttributes();
- NavigationContainer.Page dstNav = new NavigationContainer.Page(
+ NavigationData dstNav = new NavigationData(
src.getObjectId(),
ownerType,
ownerId,
@@ -140,7 +139,7 @@
children);
dst = (T)dstNav;
}
- else if (type == NavigationContainer.Node.class)
+ else if (type == NavigationNodeData.class)
{
Attributes attrs = src.getAttributes();
String pageReference = null;
@@ -156,7 +155,7 @@
pageReference = getOwnerType(siteType) + "::" + site.getName() + "::" + target.getName();
}
}
- NavigationContainer.Node dstNode = new NavigationContainer.Node(
+ NavigationNodeData dstNode = new NavigationNodeData(
src.getObjectId(),
attrs.getValue(MappedAttributes.URI),
attrs.getValue(MappedAttributes.LABEL),
@@ -181,16 +180,16 @@
return dst;
}
- public void save(NavigationContainer.Page src, Navigation dst)
+ public void save(NavigationData src, Navigation dst)
{
- save((NavigationContainer)src, dst);
+ save((NavigationNodeContainerData)src, dst);
}
- private void save(NavigationContainer src, Navigation dst)
+ private void save(NavigationNodeContainerData src, Navigation dst)
{
- if (src instanceof NavigationContainer.Node)
+ if (src instanceof NavigationNodeData)
{
- NavigationContainer.Node node = (NavigationContainer.Node)src;
+ NavigationNodeData node = (NavigationNodeData)src;
Workspace workspace = dst.getSite().getWorkspace();
String reference = node.getPageReference();
if (reference != null)
@@ -213,9 +212,9 @@
attrs.setValue(MappedAttributes.SHOW_PUBLICATION_DATE, node.getShowPublicationDate());
attrs.setValue(MappedAttributes.VISIBLE, node.isVisible());
}
- else if (src instanceof NavigationContainer.Page)
+ else if (src instanceof NavigationData)
{
- NavigationContainer.Page pageNav = (NavigationContainer.Page)src;
+ NavigationData pageNav = (NavigationData)src;
//
Attributes attrs = dst.getAttributes();
@@ -231,7 +230,7 @@
//
Set<String> savedSet = new HashSet<String>();
- for (NavigationContainer.Node node : src.getChildren())
+ for (NavigationNodeData node : src.getNodes())
{
String srcId = node.getStorageId();
Navigation dstChild;
Modified: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/ModelDataStorage.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/ModelDataStorage.java 2009-10-24 07:50:41 UTC (rev 412)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/ModelDataStorage.java 2009-10-24 08:22:11 UTC (rev 413)
@@ -25,7 +25,6 @@
import org.exoplatform.portal.config.model.ApplicationState;
import org.exoplatform.portal.config.model.Container;
import org.exoplatform.portal.config.model.ModelChange;
-import org.exoplatform.portal.pom.config.data.NavigationContainer;
import org.exoplatform.portal.pom.config.data.PageData;
import org.exoplatform.portal.pom.config.data.PortalData;
import org.exoplatform.portal.pom.config.POMTask;
@@ -83,13 +82,13 @@
*/
public List<ModelChange> save(PageData page) throws Exception;
- public NavigationContainer.Page getPageNavigation(NavigationKey key) throws Exception;
+ public NavigationData getPageNavigation(NavigationKey key) throws Exception;
- public void save(NavigationContainer.Page navigation) throws Exception;
+ public void save(NavigationData navigation) throws Exception;
- public void create(NavigationContainer.Page navigation) throws Exception;
+ public void create(NavigationData navigation) throws Exception;
- public void remove(NavigationContainer.Page navigation) throws Exception;
+ public void remove(NavigationData navigation) throws Exception;
public void save(PortletPreferences portletPreferences) throws Exception;
Deleted: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/NavigationContainer.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/NavigationContainer.java 2009-10-24 07:50:41 UTC (rev 412)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/NavigationContainer.java 2009-10-24 08:22:11 UTC (rev 413)
@@ -1,261 +0,0 @@
-/*
- * Copyright (C) 2003-2007 eXo Platform SAS.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
- *
- * This program 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
- */
-package org.exoplatform.portal.pom.config.data;
-
-import org.exoplatform.portal.pom.config.data.ModelData;
-
-import java.util.Date;
-import java.util.List;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public class NavigationContainer extends ModelData
-{
-
- /** . */
- private final List<NavigationContainer.Node> children;
-
- public NavigationContainer(String storageId, List<NavigationContainer.Node> children)
- {
- super(storageId, null);
-
- //
- this.children = children;
- }
-
- public List<NavigationContainer.Node> getChildren()
- {
- return children;
- }
-
- public static class Node extends NavigationContainer
- {
-
- /** . */
- private final String uri;
-
- /** . */
- private final String label;
-
- /** . */
- private final String icon;
-
- /** . */
- private final String name;
-
- /** . */
- private final Date startPublicationDate;
-
- /** . */
- private final Date endPublicationDate;
-
- /** . */
- private final boolean showPublicationDate;
-
- /** . */
- private final boolean visible;
-
- /** . */
- private final String pageReference;
-
- public Node(
- String uri,
- String label,
- String icon,
- String name,
- Date startPublicationDate,
- Date endPublicationDate,
- Boolean showPublicationDate,
- Boolean visible,
- String pageReference,
- List<NavigationContainer.Node> children)
- {
- this(null, uri, label, icon, name, startPublicationDate, endPublicationDate, showPublicationDate, visible, pageReference, children);
- }
-
- public Node(
- String storageId,
- String uri,
- String label,
- String icon,
- String name,
- Date startPublicationDate,
- Date endPublicationDate,
- Boolean showPublicationDate,
- Boolean visible,
- String pageReference,
- List<NavigationContainer.Node> children)
- {
- super(storageId, children);
-
- //
- this.uri = uri;
- this.label = label;
- this.icon = icon;
- this.name = name;
- this.startPublicationDate = startPublicationDate;
- this.endPublicationDate = endPublicationDate;
- this.showPublicationDate = showPublicationDate != null ? showPublicationDate : false;
- this.visible = visible != null ? visible : true;
- this.pageReference = pageReference;
- }
- public String getURI()
- {
- return uri;
- }
-
- public String getLabel()
- {
- return label;
- }
-
- public String getIcon()
- {
- return icon;
- }
-
- public String getName()
- {
- return name;
- }
-
- public Date getStartPublicationDate()
- {
- return startPublicationDate;
- }
-
- public Date getEndPublicationDate()
- {
- return endPublicationDate;
- }
-
- public boolean getShowPublicationDate()
- {
- return showPublicationDate;
- }
-
- public boolean isVisible()
- {
- return visible;
- }
-
- public String getPageReference()
- {
- return pageReference;
- }
- }
-
- public static class Page extends NavigationContainer
- {
-
- /** . */
- private final NavigationKey key;
-
- /** . */
- private final String description;
-
- /** . */
- private final String creator;
-
- /** . */
- private final String modifier;
-
- /** . */
- private final int priority;
-
- public Page(
- String ownerType,
- String ownerId,
- String description,
- String creator,
- String modifier,
- Integer priority,
- List<NavigationContainer.Node> children)
- {
- this(null, ownerType, ownerId, description, creator, modifier, priority, children);
- }
-
- public Page(
- String storageId,
- String ownerType,
- String ownerId,
- String description,
- String creator,
- String modifier,
- Integer priority,
- List<NavigationContainer.Node> children)
- {
- super(storageId, children);
-
- //
- if (ownerType == null)
- {
- throw new NullPointerException("No null owner type");
- }
- if (ownerId == null)
- {
- throw new NullPointerException("No null owner id");
- }
-
- //
- this.key = new NavigationKey(ownerType, ownerId);
- this.description = description;
- this.creator = creator;
- this.modifier = modifier;
- this.priority = priority != null ? priority : 1;
- }
-
- public NavigationKey getKey()
- {
- return key;
- }
-
- public String getOwnerType()
- {
- return key.getOwnerType();
- }
-
- public String getOwnerId()
- {
- return key.getOwnerId();
- }
-
- public String getDescription()
- {
- return description;
- }
-
- public String getCreator()
- {
- return creator;
- }
-
- public String getModifier()
- {
- return modifier;
- }
-
- public int getPriority()
- {
- return priority;
- }
- }
-
-
-}
Added: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/NavigationData.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/NavigationData.java (rev 0)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/NavigationData.java 2009-10-24 08:22:11 UTC (rev 413)
@@ -0,0 +1,119 @@
+/*
+ * Copyright (C) 2003-2007 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.portal.pom.config.data;
+
+import java.util.List;
+
+/**
+* @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+* @version $Revision$
+*/
+public class NavigationData extends NavigationNodeContainerData
+{
+
+ /** . */
+ private final NavigationKey key;
+
+ /** . */
+ private final String description;
+
+ /** . */
+ private final String creator;
+
+ /** . */
+ private final String modifier;
+
+ /** . */
+ private final int priority;
+
+ public NavigationData(
+ String ownerType,
+ String ownerId,
+ String description,
+ String creator,
+ String modifier,
+ Integer priority,
+ List<NavigationNodeData> children)
+ {
+ this(null, ownerType, ownerId, description, creator, modifier, priority, children);
+ }
+
+ public NavigationData(
+ String storageId,
+ String ownerType,
+ String ownerId,
+ String description,
+ String creator,
+ String modifier,
+ Integer priority,
+ List<NavigationNodeData> children)
+ {
+ super(storageId, children);
+
+ //
+ if (ownerType == null)
+ {
+ throw new NullPointerException("No null owner type");
+ }
+ if (ownerId == null)
+ {
+ throw new NullPointerException("No null owner id");
+ }
+
+ //
+ this.key = new NavigationKey(ownerType, ownerId);
+ this.description = description;
+ this.creator = creator;
+ this.modifier = modifier;
+ this.priority = priority != null ? priority : 1;
+ }
+
+ public NavigationKey getKey()
+ {
+ return key;
+ }
+
+ public String getOwnerType()
+ {
+ return key.getOwnerType();
+ }
+
+ public String getOwnerId()
+ {
+ return key.getOwnerId();
+ }
+
+ public String getDescription()
+ {
+ return description;
+ }
+
+ public String getCreator()
+ {
+ return creator;
+ }
+
+ public String getModifier()
+ {
+ return modifier;
+ }
+
+ public int getPriority()
+ {
+ return priority;
+ }
+}
Copied: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/NavigationNodeContainerData.java (from rev 412, portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/NavigationContainer.java)
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/NavigationNodeContainerData.java (rev 0)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/NavigationNodeContainerData.java 2009-10-24 08:22:11 UTC (rev 413)
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2003-2007 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.portal.pom.config.data;
+
+import org.exoplatform.portal.pom.config.data.ModelData;
+
+import java.util.List;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class NavigationNodeContainerData extends ModelData
+{
+
+ /** . */
+ private final List<NavigationNodeData> nodes;
+
+ public NavigationNodeContainerData(String storageId, List<NavigationNodeData> nodes)
+ {
+ super(storageId, null);
+
+ //
+ this.nodes = nodes;
+ }
+
+ public List<NavigationNodeData> getNodes()
+ {
+ return nodes;
+ }
+}
Added: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/NavigationNodeData.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/NavigationNodeData.java (rev 0)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/NavigationNodeData.java 2009-10-24 08:22:11 UTC (rev 413)
@@ -0,0 +1,141 @@
+/*
+ * Copyright (C) 2003-2007 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.portal.pom.config.data;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+* @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+* @version $Revision$
+*/
+public class NavigationNodeData extends NavigationNodeContainerData
+{
+
+ /** . */
+ private final String uri;
+
+ /** . */
+ private final String label;
+
+ /** . */
+ private final String icon;
+
+ /** . */
+ private final String name;
+
+ /** . */
+ private final Date startPublicationDate;
+
+ /** . */
+ private final Date endPublicationDate;
+
+ /** . */
+ private final boolean showPublicationDate;
+
+ /** . */
+ private final boolean visible;
+
+ /** . */
+ private final String pageReference;
+
+ public NavigationNodeData(
+ String uri,
+ String label,
+ String icon,
+ String name,
+ Date startPublicationDate,
+ Date endPublicationDate,
+ Boolean showPublicationDate,
+ Boolean visible,
+ String pageReference,
+ List<NavigationNodeData> children)
+ {
+ this(null, uri, label, icon, name, startPublicationDate, endPublicationDate, showPublicationDate, visible, pageReference, children);
+ }
+
+ public NavigationNodeData(
+ String storageId,
+ String uri,
+ String label,
+ String icon,
+ String name,
+ Date startPublicationDate,
+ Date endPublicationDate,
+ Boolean showPublicationDate,
+ Boolean visible,
+ String pageReference,
+ List<NavigationNodeData> children)
+ {
+ super(storageId, children);
+
+ //
+ this.uri = uri;
+ this.label = label;
+ this.icon = icon;
+ this.name = name;
+ this.startPublicationDate = startPublicationDate;
+ this.endPublicationDate = endPublicationDate;
+ this.showPublicationDate = showPublicationDate != null ? showPublicationDate : false;
+ this.visible = visible != null ? visible : true;
+ this.pageReference = pageReference;
+ }
+ public String getURI()
+ {
+ return uri;
+ }
+
+ public String getLabel()
+ {
+ return label;
+ }
+
+ public String getIcon()
+ {
+ return icon;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public Date getStartPublicationDate()
+ {
+ return startPublicationDate;
+ }
+
+ public Date getEndPublicationDate()
+ {
+ return endPublicationDate;
+ }
+
+ public boolean getShowPublicationDate()
+ {
+ return showPublicationDate;
+ }
+
+ public boolean isVisible()
+ {
+ return visible;
+ }
+
+ public String getPageReference()
+ {
+ return pageReference;
+ }
+}
Modified: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/PageNavigationTask.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/PageNavigationTask.java 2009-10-24 07:50:41 UTC (rev 412)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/PageNavigationTask.java 2009-10-24 08:22:11 UTC (rev 413)
@@ -20,10 +20,10 @@
package org.exoplatform.portal.pom.config.tasks;
import org.exoplatform.portal.pom.config.data.Mapper;
-import org.exoplatform.portal.pom.config.data.NavigationContainer;
import org.exoplatform.portal.pom.config.AbstractPOMTask;
import org.exoplatform.portal.pom.config.POMSession;
+import org.exoplatform.portal.pom.config.data.NavigationData;
import org.exoplatform.portal.pom.config.data.NavigationKey;
import org.gatein.mop.api.workspace.Navigation;
import org.gatein.mop.api.workspace.ObjectType;
@@ -57,14 +57,14 @@
{
/** . */
- private NavigationContainer.Page pageNav;
+ private NavigationData pageNav;
public Load(NavigationKey key)
{
super(key);
}
- public NavigationContainer.Page getPageNavigation()
+ public NavigationData getPageNavigation()
{
return pageNav;
}
@@ -100,12 +100,12 @@
{
/** . */
- private final NavigationContainer.Page pageNav;
+ private final NavigationData pageNav;
/** . */
private final boolean overwrite;
- public Save(NavigationContainer.Page pageNav, boolean overwrite)
+ public Save(NavigationData pageNav, boolean overwrite)
{
super(pageNav.getKey());
@@ -148,7 +148,7 @@
public static class Remove extends PageNavigationTask
{
- public Remove(NavigationContainer.Page pageNav)
+ public Remove(NavigationData pageNav)
{
super(pageNav.getKey());
}
Modified: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/SearchTask.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/SearchTask.java 2009-10-24 07:50:41 UTC (rev 412)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/SearchTask.java 2009-10-24 08:22:11 UTC (rev 413)
@@ -24,7 +24,7 @@
import org.exoplatform.portal.application.PortletPreferences;
import org.exoplatform.portal.config.Query;
import org.exoplatform.portal.pom.config.data.Mapper;
-import org.exoplatform.portal.pom.config.data.NavigationContainer;
+import org.exoplatform.portal.pom.config.data.NavigationData;
import org.exoplatform.portal.pom.config.data.PageData;
import org.exoplatform.portal.pom.config.data.PortalData;
import org.exoplatform.portal.pom.config.data.PortalKey;
@@ -156,10 +156,10 @@
}
}
- public static class FindNavigation extends FindSiteObject<Navigation, NavigationContainer.Page>
+ public static class FindNavigation extends FindSiteObject<Navigation, NavigationData>
{
- public FindNavigation(Query<NavigationContainer.Page> pageQuery)
+ public FindNavigation(Query<NavigationData> pageQuery)
{
super(pageQuery);
}
@@ -170,12 +170,12 @@
return session.findObjects(ObjectType.NAVIGATION, siteType, q.getOwnerId(), q.getTitle());
}
- protected NavigationContainer.Page[] createT(int length)
+ protected NavigationData[] createT(int length)
{
- return new NavigationContainer.Page[length];
+ return new NavigationData[length];
}
- protected NavigationContainer.Page loadT(POMSession session, Navigation w)
+ protected NavigationData loadT(POMSession session, Navigation w)
{
return new Mapper(session).load(w);
}
15 years, 11 months
gatein SVN: r412 - in portal/branches/performance: component/portal/src/main/java/conf/portal and 17 other directories.
by do-not-reply@jboss.org
Author: julien_viet
Date: 2009-10-24 03:50:41 -0400 (Sat, 24 Oct 2009)
New Revision: 412
Added:
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PageNavigation.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PageNode.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PageNodeContainer.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/ModelDemarcation.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/ApplicationData.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/BodyData.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/BodyType.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/ComponentData.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/ContainerData.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/DashboardData.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/MappedAttributes.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/Mapper.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/ModelData.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/ModelDataStorage.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/NavigationContainer.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/NavigationKey.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/OwnerKey.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/PageData.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/PageKey.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/PortalData.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/PortalKey.java
Removed:
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/cache/
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/ApplicationData.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/BodyData.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/BodyType.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/ComponentData.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/ContainerData.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/DashboardData.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/MappedAttributes.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/Mapper.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/ModelData.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/NavigationContainer.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/NavigationKey.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/OwnerKey.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PageData.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PageNavigation.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PageNode.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PageNodeContainer.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PortalData.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PortalKey.java
Modified:
portal/branches/performance/component/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/UIDashboardContainer.java
portal/branches/performance/component/portal/src/main/java/conf/portal/configuration.xml
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/DataStorage.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/GroupPortalConfigListener.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/NewPortalConfigListener.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/Query.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/UserPortalConfigListener.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/UserPortalConfigService.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/Application.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/Container.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/Dashboard.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/ModelChange.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/ModelObject.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/Page.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PageBody.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PortalConfig.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/SiteBody.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/gadget/GadgetApplication.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/portlet/PortletApplication.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/wsrp/WSRPApplication.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMDataStorage.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMSession.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/DashboardTask.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/PageNavigationTask.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/PageTask.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/PortalConfigTask.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/PortletPreferencesTask.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/SearchTask.java
portal/branches/performance/component/portal/src/test/java/conf/portal/test-configuration.xml
portal/branches/performance/component/portal/src/test/java/org/exoplatform/portal/config/TestDataStorage.java
portal/branches/performance/component/portal/src/test/java/org/exoplatform/portal/config/TestLoadedPOM.java
portal/branches/performance/component/portal/src/test/java/org/exoplatform/portal/config/TestPortalConfig.java
portal/branches/performance/component/portal/src/test/java/org/exoplatform/portal/config/TestUserPortalConfigService.java
portal/branches/performance/portlet/exoadmin/src/main/java/org/exoplatform/navigation/webui/component/UIGroupNavigationManagement.java
portal/branches/performance/portlet/exoadmin/src/main/java/org/exoplatform/toolbar/webui/component/UIUserToolBarGroupPortlet.java
portal/branches/performance/portlet/exoadmin/src/main/java/org/exoplatform/toolbar/webui/component/UIUserToolBarSitePortlet.java
portal/branches/performance/web/portal/src/main/webapp/WEB-INF/conf/portal/portal-configuration.xml
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UINavigationManagement.java
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageActionListener.java
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalForm.java
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalSelector.java
Log:
- refactored to restore the DataStorage interface
- separated the immutable data and its management in a separate interface ModelDataStorage
- the new DataStorage implementation will talk to the ModelDataStorage interface
- make the entire data model immutable
Modified: portal/branches/performance/component/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/UIDashboardContainer.java
===================================================================
--- portal/branches/performance/component/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/UIDashboardContainer.java 2009-10-23 19:09:03 UTC (rev 411)
+++ portal/branches/performance/component/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/UIDashboardContainer.java 2009-10-24 07:50:41 UTC (rev 412)
@@ -25,7 +25,6 @@
import org.exoplatform.portal.config.model.Container;
import org.exoplatform.portal.config.model.Dashboard;
import org.exoplatform.portal.config.model.gadget.GadgetId;
-import org.exoplatform.portal.pom.config.tasks.DashboardTask;
import org.exoplatform.portal.webui.application.UIGadget;
import org.exoplatform.portal.webui.application.UIPortlet;
import org.exoplatform.portal.webui.container.UIContainer;
@@ -131,7 +130,7 @@
Container dashboard;
if (currentUIPortlet.getStorageId() != null)
{
- dashboard = service.execute(new DashboardTask.Load(currentUIPortlet.getStorageId())).getDashboard();
+ dashboard = service.loadDashboard(currentUIPortlet.getStorageId());
}
else
dashboard = createContainer(COLUMN_CONTAINER, null);
@@ -459,7 +458,7 @@
PortalDataMapper.toContainer(dashboard, uiRoot);
// Get dashboard for merging
- service.execute(new DashboardTask.Save(dashboard));
+ service.saveDashboard(dashboard);
}
public static class AddNewGadgetActionListener extends EventListener<org.exoplatform.webui.core.UIContainer>
Modified: portal/branches/performance/component/portal/src/main/java/conf/portal/configuration.xml
===================================================================
--- portal/branches/performance/component/portal/src/main/java/conf/portal/configuration.xml 2009-10-23 19:09:03 UTC (rev 411)
+++ portal/branches/performance/component/portal/src/main/java/conf/portal/configuration.xml 2009-10-24 07:50:41 UTC (rev 412)
@@ -36,11 +36,16 @@
</component>
<component>
- <key>org.exoplatform.portal.config.DataStorage</key>
+ <key>org.exoplatform.portal.pom.config.data.ModelDataStorage</key>
<type>org.exoplatform.portal.pom.config.POMDataStorage</type>
</component>
-
+
<component>
+ <key>org.exoplatform.portal.config.DataStorage</key>
+ <type>org.exoplatform.portal.config.DataStorageImpl</type>
+ </component>
+
+ <component>
<key>org.exoplatform.portal.config.UserACL</key>
<type>org.exoplatform.portal.config.UserACL</type>
<init-params>
Modified: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/DataStorage.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/DataStorage.java 2009-10-23 19:09:03 UTC (rev 411)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/DataStorage.java 2009-10-24 07:50:41 UTC (rev 412)
@@ -23,11 +23,11 @@
import org.exoplatform.portal.application.PortletPreferences;
import org.exoplatform.portal.config.model.ApplicationState;
import org.exoplatform.portal.config.model.Container;
+import org.exoplatform.portal.config.model.Dashboard;
import org.exoplatform.portal.config.model.ModelChange;
-import org.exoplatform.portal.config.model.NavigationContainer;
import org.exoplatform.portal.config.model.Page;
+import org.exoplatform.portal.config.model.PageNavigation;
import org.exoplatform.portal.config.model.PortalConfig;
-import org.exoplatform.portal.config.model.PortalData;
import org.exoplatform.portal.pom.config.POMTask;
import java.util.Comparator;
@@ -43,18 +43,16 @@
public interface DataStorage
{
- public <T extends POMTask> T execute(T task) throws Exception;
+ public void create(PortalConfig config) throws Exception;
- public void create(PortalData config) throws Exception;
+ public void save(PortalConfig config) throws Exception;
- public void save(PortalData config) throws Exception;
+ public PortalConfig getPortalConfig(String portalName) throws Exception;
- public PortalData getPortalConfig(String portalName) throws Exception;
+ public PortalConfig getPortalConfig(String ownerType, String portalName) throws Exception;
- public PortalData getPortalConfig(String ownerType, String portalName) throws Exception;
+ public void remove(PortalConfig config) throws Exception;
- public void remove(PortalData config) throws Exception;
-
public Page getPage(String pageId) throws Exception;
/**
@@ -87,15 +85,15 @@
*/
public List<ModelChange> save(Page page) throws Exception;
- public NavigationContainer.Page getPageNavigation(String owner) throws Exception;
+ public PageNavigation getPageNavigation(String fullId) throws Exception;
- public NavigationContainer.Page getPageNavigation(String ownerType, String id) throws Exception;
+ public PageNavigation getPageNavigation(String ownerType, String id) throws Exception;
- public void save(NavigationContainer.Page navigation) throws Exception;
+ public void save(PageNavigation navigation) throws Exception;
- public void create(NavigationContainer.Page navigation) throws Exception;
+ public void create(PageNavigation navigation) throws Exception;
- public void remove(NavigationContainer.Page navigation) throws Exception;
+ public void remove(PageNavigation navigation) throws Exception;
public void save(PortletPreferences portletPreferences) throws Exception;
@@ -110,4 +108,8 @@
public <T> LazyPageList<T> find(Query<T> q, Comparator<T> sortComparator) throws Exception;
public Container getSharedLayout() throws Exception;
+
+ public Dashboard loadDashboard(String dashboardId) throws Exception;
+
+ public void saveDashboard(Dashboard dashboard) throws Exception;
}
\ No newline at end of file
Modified: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/GroupPortalConfigListener.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/GroupPortalConfigListener.java 2009-10-23 19:09:03 UTC (rev 411)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/GroupPortalConfigListener.java 2009-10-24 07:50:41 UTC (rev 412)
@@ -23,7 +23,6 @@
import org.exoplatform.container.ExoContainerContext;
import org.exoplatform.portal.config.model.Container;
import org.exoplatform.portal.config.model.PortalConfig;
-import org.exoplatform.portal.config.model.PortalData;
import org.exoplatform.services.jcr.ext.registry.RegistryService;
import org.exoplatform.services.organization.Group;
import org.exoplatform.services.organization.GroupEventListener;
@@ -123,13 +122,13 @@
portalConfigService.createUserPortalConfig(PortalConfig.GROUP_TYPE, groupId, "group");
// Need to insert the corresponding user site
- PortalData data = dataStorage.getPortalConfig(PortalConfig.GROUP_TYPE, groupId);
- if (data == null)
+ PortalConfig cfg = dataStorage.getPortalConfig(PortalConfig.GROUP_TYPE, groupId);
+ if (cfg == null)
{
- PortalConfig cfg = new PortalConfig(PortalConfig.GROUP_TYPE);
+ cfg = new PortalConfig(PortalConfig.GROUP_TYPE);
cfg.setPortalLayout(new Container());
cfg.setName(groupId);
- dataStorage.create(cfg.buildData());
+ dataStorage.create(cfg);
}
}
}
Modified: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/NewPortalConfigListener.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/NewPortalConfigListener.java 2009-10-23 19:09:03 UTC (rev 411)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/NewPortalConfigListener.java 2009-10-24 07:50:41 UTC (rev 412)
@@ -29,13 +29,11 @@
import org.exoplatform.portal.application.PortletPreferences;
import org.exoplatform.portal.application.PortletPreferences.PortletPreferencesSet;
import org.exoplatform.portal.config.model.Container;
-import org.exoplatform.portal.config.model.NavigationContainer;
import org.exoplatform.portal.config.model.Page;
import org.exoplatform.portal.config.model.PageNavigation;
import org.exoplatform.portal.config.model.PageNode;
import org.exoplatform.portal.config.model.PortalConfig;
import org.exoplatform.portal.config.model.Page.PageSet;
-import org.exoplatform.portal.config.model.PortalData;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
import org.jibx.runtime.BindingDirectory;
@@ -248,7 +246,7 @@
private boolean isInitedDB(String portalName) throws Exception
{
- PortalData pconfig = pdcService_.getPortalConfig(portalName);
+ PortalConfig pconfig = pdcService_.getPortalConfig(portalName);
return pconfig != null;
}
@@ -306,13 +304,13 @@
// Ensure that the PortalConfig has been defined
// The PortalConfig could be empty if the related PortalConfigListener
// has been launched after starting this service
- PortalData data = pdcService_.getPortalConfig(type, owner);
- if (data == null)
+ PortalConfig cfg = pdcService_.getPortalConfig(type, owner);
+ if (cfg == null)
{
- PortalConfig cfg = new PortalConfig(type);
+ cfg = new PortalConfig(type);
cfg.setPortalLayout(new Container());
cfg.setName(owner);
- pdcService_.create(cfg.buildData());
+ pdcService_.create(cfg);
}
return;
}
@@ -322,14 +320,14 @@
}
PortalConfig pconfig = fromXML(config.getOwnerType(), owner, xml, PortalConfig.class);
- PortalData currentPortalConfig = pdcService_.getPortalConfig(type, owner);
+ PortalConfig currentPortalConfig = pdcService_.getPortalConfig(type, owner);
if (currentPortalConfig == null)
{
- pdcService_.create(pconfig.buildData());
+ pdcService_.create(pconfig);
}
else
{
- pdcService_.save(pconfig.buildData());
+ pdcService_.save(pconfig);
}
}
catch (JiBXException e)
@@ -400,15 +398,15 @@
xml = StringUtils.replace(xml, "@owner@", owner);
}
PageNavigation navigation = fromXML(config.getOwnerType(), owner, xml, PageNavigation.class);
- NavigationContainer.Page currentNavigation = pdcService_.getPageNavigation(navigation.getOwner());
+ PageNavigation currentNavigation = pdcService_.getPageNavigation(navigation.getOwner());
if (currentNavigation == null)
{
- pdcService_.create(navigation.buildNavigation());
+ pdcService_.create(navigation);
}
else
{
- navigation.merge(new PageNavigation(currentNavigation));
- pdcService_.save(navigation.buildNavigation());
+ navigation.merge(currentNavigation);
+ pdcService_.save(navigation);
}
}
catch (JiBXException e)
Modified: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/Query.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/Query.java 2009-10-23 19:09:03 UTC (rev 411)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/Query.java 2009-10-24 07:50:41 UTC (rev 412)
@@ -55,6 +55,15 @@
title_ = title;
}
+ public Query(Query<?> that, Class<T> clazz)
+ {
+ ownerType_ = that.ownerType_;
+ ownerId_ = that.ownerId_;
+ classType_ = clazz;
+ name_ = that.name_;
+ title_ = that.title_;
+ }
+
public String getOwnerType()
{
return ownerType_;
Modified: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/UserPortalConfigListener.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/UserPortalConfigListener.java 2009-10-23 19:09:03 UTC (rev 411)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/UserPortalConfigListener.java 2009-10-24 07:50:41 UTC (rev 412)
@@ -22,11 +22,9 @@
import org.exoplatform.container.ExoContainer;
import org.exoplatform.container.ExoContainerContext;
import org.exoplatform.portal.config.model.Container;
-import org.exoplatform.portal.config.model.NavigationContainer;
import org.exoplatform.portal.config.model.PageNavigation;
import org.exoplatform.portal.config.model.PageNode;
import org.exoplatform.portal.config.model.PortalConfig;
-import org.exoplatform.portal.config.model.PortalData;
import org.exoplatform.services.jcr.ext.registry.RegistryService;
import org.exoplatform.services.organization.User;
import org.exoplatform.services.organization.UserEventListener;
@@ -68,17 +66,17 @@
portalConfigService.createUserPortalConfig(PortalConfig.USER_TYPE, userName, "user");
// Need to insert the corresponding user site if needed
- PortalData data = dataStorage.getPortalConfig(PortalConfig.USER_TYPE, userName);
- if (data == null)
+ PortalConfig cfg = dataStorage.getPortalConfig(PortalConfig.USER_TYPE, userName);
+ if (cfg == null)
{
- PortalConfig cfg = new PortalConfig(PortalConfig.USER_TYPE);
+ cfg = new PortalConfig(PortalConfig.USER_TYPE);
cfg.setPortalLayout(new Container());
cfg.setName(userName);
- dataStorage.create(cfg.buildData());
+ dataStorage.create(cfg);
}
// Create a blank navigation if needed
- NavigationContainer.Page navigation = dataStorage.getPageNavigation(PortalConfig.USER_TYPE, userName);
+ PageNavigation navigation = dataStorage.getPageNavigation(PortalConfig.USER_TYPE, userName);
if (navigation == null)
{
PageNavigation pageNav = new PageNavigation();
Modified: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/UserPortalConfigService.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/UserPortalConfigService.java 2009-10-23 19:09:03 UTC (rev 411)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/UserPortalConfigService.java 2009-10-24 07:50:41 UTC (rev 412)
@@ -21,21 +21,19 @@
import org.exoplatform.commons.utils.PageList;
import org.exoplatform.container.component.ComponentPlugin;
-import org.exoplatform.portal.cache.DataStorageCache;
import org.exoplatform.portal.config.model.Application;
import org.exoplatform.portal.config.model.Container;
import org.exoplatform.portal.config.model.ModelChange;
import org.exoplatform.portal.config.model.ModelObject;
-import org.exoplatform.portal.config.model.NavigationContainer;
import org.exoplatform.portal.config.model.Page;
import org.exoplatform.portal.config.model.PageNavigation;
import org.exoplatform.portal.config.model.PageNode;
import org.exoplatform.portal.config.model.PortalConfig;
-import org.exoplatform.portal.config.model.PortalData;
import org.exoplatform.portal.config.model.TransientApplicationState;
-import org.exoplatform.portal.pom.config.POMDataStorage;
+import org.exoplatform.portal.pom.config.ModelDemarcation;
import org.exoplatform.services.cache.CacheService;
import org.exoplatform.services.cache.ExoCache;
+import org.exoplatform.services.cache.ExpireKeyStartWithSelector;
import org.exoplatform.services.listener.ListenerService;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
@@ -78,24 +76,26 @@
private ListenerService listenerService;
+ protected ExoCache<String, PortalConfig> portalConfigCache_;
+
protected ExoCache<String, Page> pageConfigCache_;
+ protected ExoCache<String, PageNavigation> pageNavigationCache_;
+
private NewPortalConfigListener newPortalConfigListener_;
private Log log = ExoLogger.getLogger("Portal:UserPortalConfigService");
- /** No cache storage for initial import. */
- private DataStorage realStorage;
-
public UserPortalConfigService(UserACL userACL, DataStorage storage, CacheService cacheService,
OrganizationService orgService, ListenerService listenerService) throws Exception
{
- this.storage_ = new DataStorageCache(cacheService, storage);
- this.realStorage = storage;
+ this.storage_ = storage;
this.orgService_ = orgService;
this.listenerService = listenerService;
this.userACL_ = userACL;
+ this.portalConfigCache_ = cacheService.getCacheInstance(PortalConfig.class.getName());
this.pageConfigCache_ = cacheService.getCacheInstance(Page.class.getName());
+ this.pageNavigationCache_ = cacheService.getCacheInstance(PageNavigation.class.getName());
}
/**
@@ -135,18 +135,15 @@
*/
public UserPortalConfig getUserPortalConfig(String portalName, String accessUser) throws Exception
{
- PortalData portal = storage_.getPortalConfig(portalName);
+ PortalConfig portal = portalConfigCache_.get(portalName);
if (portal == null)
{
- return null;
+ portal = storage_.getPortalConfig(portalName);
+ if (portal != null)
+ portalConfigCache_.put(portalName, portal);
}
-
- //
- PortalConfig config = new PortalConfig(portal);
- if (!userACL_.hasPermission(config))
- {
+ if (portal == null || !userACL_.hasPermission(portal))
return null;
- }
List<PageNavigation> navigations = new ArrayList<PageNavigation>();
PageNavigation navigation = getPageNavigation(PortalConfig.PORTAL_TYPE, portalName);
@@ -198,7 +195,7 @@
}
});
- return new UserPortalConfig(config, navigations);
+ return new UserPortalConfig(portal, navigations);
}
/**
@@ -278,9 +275,13 @@
*/
public void removeUserPortalConfig(String ownerType, String ownerId) throws Exception
{
- PortalData config = storage_.getPortalConfig(ownerType, ownerId);
+ PortalConfig config = storage_.getPortalConfig(ownerType, ownerId);
if (config != null)
{
+ if (ownerType.equals("portal"))
+ {
+ portalConfigCache_.remove(config.getName());
+ }
storage_.remove(config);
}
}
@@ -288,12 +289,13 @@
/**
* This method should update the PortalConfig object
*
- * @param portal the portal
- * @throws Exception any exception
+ * @param portal
+ * @throws Exception
*/
public void update(PortalConfig portal) throws Exception
{
- storage_.save(portal.buildData());
+ storage_.save(portal);
+ portalConfigCache_.select(new ExpireKeyStartWithSelector<String, PortalConfig>(portal.getName()));
}
/**
@@ -406,7 +408,8 @@
*/
public void create(PageNavigation navigation) throws Exception
{
- storage_.create(navigation.buildNavigation());
+ storage_.create(navigation);
+ pageNavigationCache_.put(navigation.getOwner(), navigation);
listenerService.broadcast(CREATE_NAVIGATION_EVENT, this, navigation);
}
@@ -420,7 +423,8 @@
*/
public void update(PageNavigation navigation) throws Exception
{
- storage_.save(navigation.buildNavigation());
+ storage_.save(navigation);
+ pageNavigationCache_.select(new ExpireKeyStartWithSelector<String, PageNavigation>(navigation.getOwner()));
listenerService.broadcast(UPDATE_NAVIGATION_EVENT, this, navigation);
}
@@ -434,18 +438,16 @@
*/
public void remove(PageNavigation navigation) throws Exception
{
- storage_.remove(navigation.buildNavigation());
+ storage_.remove(navigation);
+ pageNavigationCache_.remove(navigation.getOwner());
listenerService.broadcast(REMOVE_NAVIGATION_EVENT, this, navigation);
}
public PageNavigation getPageNavigation(String ownerType, String id) throws Exception
{
- PageNavigation navigation = null;
- NavigationContainer.Page pageNavigation = storage_.getPageNavigation(ownerType, id);
+ PageNavigation navigation = pageNavigationCache_.get(ownerType + "::" + id);
if (navigation == null)
- {
- navigation = pageNavigation != null ? new PageNavigation(pageNavigation) : null;
- }
+ navigation = storage_.getPageNavigation(ownerType, id);
return navigation;
}
@@ -453,13 +455,13 @@
* This method creates new page from an existing page and links new page to a
* PageNode.
*
- * @param nodeName the node name
- * @param nodeLabel the node name
- * @param pageId the page id
- * @param ownerType the owner type
- * @param ownerId the owner id
- * @return the page node
- * @throws Exception any exception
+ * @param nodeName
+ * @param nodeLabel
+ * @param pageId
+ * @param ownerType
+ * @param ownerId
+ * @return
+ * @throws Exception
*/
public PageNode createNodeFromPageTemplate(String nodeName, String nodeLabel, String pageId, String ownerType,
String ownerId) throws Exception
@@ -513,10 +515,10 @@
*/
public List<PageNavigation> loadEditableNavigations() throws Exception
{
- Query<NavigationContainer.Page> query = new Query<NavigationContainer.Page>(PortalConfig.GROUP_TYPE, null, NavigationContainer.Page.class);
- List<NavigationContainer.Page> navis = storage_.find(query, new Comparator<NavigationContainer.Page>()
+ Query<PageNavigation> query = new Query<PageNavigation>(PortalConfig.GROUP_TYPE, null, PageNavigation.class);
+ List<PageNavigation> navis = storage_.find(query, new Comparator<PageNavigation>()
{
- public int compare(NavigationContainer.Page pconfig1, NavigationContainer.Page pconfig2)
+ public int compare(PageNavigation pconfig1, PageNavigation pconfig2)
{
return pconfig1.getOwnerId().compareTo(pconfig2.getOwnerId());
}
@@ -524,27 +526,28 @@
//
List<PageNavigation> navigations = new ArrayList<PageNavigation>();
- for (NavigationContainer.Page ele : navis)
+ for (PageNavigation ele : navis)
{
- PageNavigation nav = new PageNavigation(ele);
- if (userACL_.hasEditPermission(nav))
+ if (userACL_.hasEditPermission(ele))
{
- navigations.add(nav);
+ navigations.add(ele);
}
}
return navigations;
}
/**
- * @return
- * @throws Exception
+ * Returns the list of group ids that do not have an existing navigation.
+ *
+ * @return the group id with no navigation
+ * @throws Exception any exception
*/
public Set<String> findGroupWithoutNavigation() throws Exception
{
- Query<NavigationContainer.Page> query = new Query<NavigationContainer.Page>(PortalConfig.GROUP_TYPE, null, NavigationContainer.Page.class);
+ Query<PageNavigation> query = new Query<PageNavigation>(PortalConfig.GROUP_TYPE, null, PageNavigation.class);
Set<String> groupIds = new HashSet<String>();
- List<NavigationContainer.Page> navis = storage_.find(query).getAll();
- for (NavigationContainer.Page ele : navis)
+ List<PageNavigation> navis = storage_.find(query).getAll();
+ for (PageNavigation ele : navis)
{
groupIds.add(ele.getOwnerId());
}
@@ -552,6 +555,28 @@
}
/**
+ * Returns the list of all portal names.
+ *
+ * @return the list of all portal names
+ * @throws Exception any exception
+ */
+ public List<String> getAllPortalNames() throws Exception
+ {
+ List<String> list = new ArrayList<String>();
+ Query<PortalConfig> query = new Query<PortalConfig>("portal", null, null, null, PortalConfig.class);
+ PageList<PortalConfig> pageList = storage_.find(query);
+ List<PortalConfig> configs = pageList.getAll();
+ for (PortalConfig ele : configs)
+ {
+ if (userACL_.hasPermission(ele))
+ {
+ list.add(ele.getName());
+ }
+ }
+ return list;
+ }
+
+ /**
* Update the ownership recursively on the model graph.
*
* @param object the model object graph root
@@ -587,22 +612,6 @@
}
}
- public List<String> getAllPortalNames() throws Exception
- {
- List<String> list = new ArrayList<String>();
- Query<PortalData> query = new Query<PortalData>("portal", null, null, null, PortalData.class);
- PageList<PortalData> pageList = storage_.find(query);
- List<PortalData> configs = pageList.getAll();
- for (PortalData ele : configs)
- {
- if (userACL_.hasPermission(new PortalConfig(ele)))
- {
- list.add(ele.getName());
- }
- }
- return list;
- }
-
public void initListener(ComponentPlugin listener)
{
if (listener instanceof NewPortalConfigListener)
@@ -629,22 +638,28 @@
return;
//
- if (realStorage instanceof POMDataStorage)
+ if (storage_ instanceof ModelDemarcation)
{
- ((POMDataStorage)realStorage).getPOMSessionManager().openSession();
+ ((ModelDemarcation)storage_).begin();
}
newPortalConfigListener_.run();
}
catch (Exception e)
{
- log.error("", e);
+ log.error("Could not import initial data", e);
+
+ //
+ if (storage_ instanceof ModelDemarcation)
+ {
+ ((ModelDemarcation)storage_).end(false);
+ }
}
finally
{
- if (realStorage instanceof POMDataStorage)
+ if (storage_ instanceof ModelDemarcation)
{
- ((POMDataStorage)realStorage).getPOMSessionManager().closeSession(true);
+ ((ModelDemarcation)storage_).end(true);
}
}
}
Modified: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/Application.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/Application.java 2009-10-23 19:09:03 UTC (rev 411)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/Application.java 2009-10-24 07:50:41 UTC (rev 412)
@@ -19,6 +19,10 @@
package org.exoplatform.portal.config.model;
+import org.exoplatform.portal.pom.config.Utils;
+import org.exoplatform.portal.pom.config.data.ApplicationData;
+import org.exoplatform.portal.pom.config.data.ModelData;
+
/**
* May 13, 2004
* @author: Tuan Nguyen
@@ -60,6 +64,31 @@
private boolean isModifiable;
+ public Application(ApplicationData<S, I> data)
+ {
+ super(data.getStorageId());
+
+ // For now here, need to make a real NAME and
+ // remove disturbing storage name
+ this.storageName = data.getStorageName();
+
+ //
+ this.state = data.getState();
+ this.ref = data.getRef();
+ this.id = data.getId();
+ this.title = data.getTitle();
+ this.icon = data.getIcon();
+ this.description = data.getDescription();
+ this.showInfoBar = data.isShowInfoBar();
+ this.showApplicationState = data.isShowApplicationState();
+ this.showApplicationMode = data.isShowApplicationMode();
+ this.theme = data.getTheme();
+ this.width = data.getWidth();
+ this.height = data.getHeight();
+ this.properties = new Properties(data.getProperties());
+ this.accessPermissions = data.getAccessPermissions().toArray(new String[data.getAccessPermissions().size()]);
+ }
+
public Application(String storageId, I ref)
{
super(storageId);
@@ -224,4 +253,27 @@
this.theme = theme;
}
+ @Override
+ public ModelData build()
+ {
+ return new ApplicationData<S,I>(
+ storageId,
+ storageName,
+ getType(),
+ state,
+ ref,
+ id,
+ title,
+ icon,
+ description,
+ showInfoBar,
+ showApplicationState,
+ showApplicationMode,
+ theme,
+ width,
+ height,
+ Utils.safeImmutableMap(properties),
+ Utils.safeImmutableList(accessPermissions)
+ );
+ }
}
\ No newline at end of file
Deleted: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/ApplicationData.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/ApplicationData.java 2009-10-23 19:09:03 UTC (rev 411)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/ApplicationData.java 2009-10-24 07:50:41 UTC (rev 412)
@@ -1,185 +0,0 @@
-/*
- * Copyright (C) 2003-2007 eXo Platform SAS.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
- *
- * This program 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
- */
-package org.exoplatform.portal.config.model;
-
-import java.util.List;
-import java.util.Map;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public class ApplicationData<S, I> extends ModelObject
-{
-
- /** . */
- private final ApplicationType<S, I> type;
-
- /** . */
- private final ApplicationState<S> state;
-
- /** . */
- private final I ref;
-
- /** . */
- private final String id;
-
- /** . */
- private final String title;
-
- /** . */
- private final String icon;
-
- /** . */
- private final String description;
-
- /** . */
- private final boolean showInfoBar;
-
- /** . */
- private final boolean showApplicationState;
-
- /** . */
- private final boolean showApplicationMode;
-
- /** . */
- private final String theme;
-
- /** . */
- private final String width;
-
- /** . */
- private final String height;
-
- /** . */
- private final Map<String, String> properties;
-
- /** . */
- private final List<String> accessPermissions;
-
- public ApplicationData(
- String storageId,
- ApplicationType<S, I> type,
- ApplicationState<S> state,
- I ref,
- String id,
- String title,
- String icon,
- String description,
- boolean showInfoBar,
- boolean showApplicationState,
- boolean showApplicationMode,
- String theme, String width,
- String height,
- Map<String, String> properties,
- List<String> accessPermissions)
- {
- super(storageId);
-
- //
- this.type = type;
- this.state = state;
- this.ref = ref;
- this.id = id;
- this.title = title;
- this.icon = icon;
- this.description = description;
- this.showInfoBar = showInfoBar;
- this.showApplicationState = showApplicationState;
- this.showApplicationMode = showApplicationMode;
- this.theme = theme;
- this.width = width;
- this.height = height;
- this.properties = properties;
- this.accessPermissions = accessPermissions;
- }
-
- public ApplicationType<S, I> getType()
- {
- return type;
- }
-
- public ApplicationState<S> getState()
- {
- return state;
- }
-
- public I getRef()
- {
- return ref;
- }
-
- public String getId()
- {
- return id;
- }
-
- public String getTitle()
- {
- return title;
- }
-
- public String getIcon()
- {
- return icon;
- }
-
- public String getDescription()
- {
- return description;
- }
-
- public boolean isShowInfoBar()
- {
- return showInfoBar;
- }
-
- public boolean isShowApplicationState()
- {
- return showApplicationState;
- }
-
- public boolean isShowApplicationMode()
- {
- return showApplicationMode;
- }
-
- public String getTheme()
- {
- return theme;
- }
-
- public String getWidth()
- {
- return width;
- }
-
- public String getHeight()
- {
- return height;
- }
-
- public Map<String, String> getProperties()
- {
- return properties;
- }
-
- public List<String> getAccessPermissions()
- {
- return accessPermissions;
- }
-}
Deleted: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/BodyData.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/BodyData.java 2009-10-23 19:09:03 UTC (rev 411)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/BodyData.java 2009-10-24 07:50:41 UTC (rev 412)
@@ -1,41 +0,0 @@
-/*
- * Copyright (C) 2003-2007 eXo Platform SAS.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
- *
- * This program 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
- */
-package org.exoplatform.portal.config.model;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public class BodyData extends ModelData
-{
-
- /** . */
- private final BodyType type;
-
- public BodyData(String storageId, String storageName, BodyType type)
- {
- super(storageId, storageName);
-
- //
- this.type = type;
- }
-
- public BodyType getType()
- {
- return type;
- }
-}
Deleted: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/BodyType.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/BodyType.java 2009-10-23 19:09:03 UTC (rev 411)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/BodyType.java 2009-10-24 07:50:41 UTC (rev 412)
@@ -1,28 +0,0 @@
-/*
- * Copyright (C) 2003-2007 eXo Platform SAS.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
- *
- * This program 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
- */
-package org.exoplatform.portal.config.model;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public enum BodyType
-{
-
- PORTAL, PAGE
-
-}
Deleted: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/ComponentData.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/ComponentData.java 2009-10-23 19:09:03 UTC (rev 411)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/ComponentData.java 2009-10-24 07:50:41 UTC (rev 412)
@@ -1,30 +0,0 @@
-/*
- * Copyright (C) 2003-2007 eXo Platform SAS.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
- *
- * This program 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
- */
-package org.exoplatform.portal.config.model;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public class ComponentData extends ModelData
-{
-
- public ComponentData(String storageId, String storageName)
- {
- super(storageId, storageName);
- }
-}
Modified: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/Container.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/Container.java 2009-10-23 19:09:03 UTC (rev 411)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/Container.java 2009-10-24 07:50:41 UTC (rev 412)
@@ -19,7 +19,14 @@
package org.exoplatform.portal.config.model;
+import org.exoplatform.portal.pom.config.Utils;
+import org.exoplatform.portal.pom.config.data.ComponentData;
+import org.exoplatform.portal.pom.config.data.ContainerData;
+import org.exoplatform.portal.pom.config.data.ModelData;
+
import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
/**
* May 13, 2004
@@ -50,7 +57,7 @@
protected String height;
- private String[] accessPermissions;
+ protected String[] accessPermissions;
protected ArrayList<ModelObject> children;
@@ -67,6 +74,32 @@
this.children = new ArrayList<ModelObject>();
}
+ public Container(ContainerData data)
+ {
+ super(data.getStorageId());
+
+ //
+ ArrayList<ModelObject> children = new ArrayList<ModelObject>();
+ for (ComponentData child : data.getChildren())
+ {
+ children.add(ModelObject.build(child));
+ }
+
+ //
+ this.id = data.getId();
+ this.name = data.getName();
+ this.icon = data.getIcon();
+ this.decorator = data.getDecorator();
+ this.template = data.getTemplate();
+ this.factoryId = data.getFactoryId();
+ this.title = data.getTitle();
+ this.description = data.getDescription();
+ this.width = data.getWidth();
+ this.height = data.getHeight();
+ this.accessPermissions = data.getAccessPermissions().toArray(new String[data.getAccessPermissions().size()]);
+ this.children = children;
+ }
+
public String getId()
{
return id;
@@ -187,4 +220,43 @@
this.accessPermissions = accessPermissions;
}
+ @Override
+ public ContainerData build()
+ {
+ List<ComponentData> children = buildChildren();
+ return new ContainerData(
+ storageId,
+ id,
+ name,
+ icon,
+ decorator,
+ template,
+ factoryId,
+ title,
+ description,
+ width,
+ height,
+ Utils.safeImmutableList(accessPermissions),
+ children
+ );
+ }
+
+ protected List<ComponentData> buildChildren()
+ {
+ if (children != null && children.size() > 0)
+ {
+ ArrayList<ComponentData> dataChildren = new ArrayList<ComponentData>(children.size());
+ for (int i = 0;i < children.size();i++)
+ {
+ ModelObject node = children.get(i);
+ ModelData data = node.build();
+ dataChildren.add((ComponentData)data);
+ }
+ return Collections.unmodifiableList(dataChildren);
+ }
+ else
+ {
+ return Collections.emptyList();
+ }
+ }
}
\ No newline at end of file
Deleted: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/ContainerData.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/ContainerData.java 2009-10-23 19:09:03 UTC (rev 411)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/ContainerData.java 2009-10-24 07:50:41 UTC (rev 412)
@@ -1,157 +0,0 @@
-/*
- * Copyright (C) 2003-2007 eXo Platform SAS.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
- *
- * This program 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
- */
-package org.exoplatform.portal.config.model;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public class ContainerData extends ComponentData
-{
-
- /** . */
- private final String id;
-
- /** . */
- private final String name;
-
- /** . */
- private final String icon;
-
- /** . */
- private final String decorator;
-
- /** . */
- private final String template;
-
- /** . */
- private final String factoryId;
-
- /** . */
- private final String title;
-
- /** . */
- private final String description;
-
- /** . */
- private final String width;
-
- /** . */
- private final String height;
-
- /** . */
- private final List<String> accessPermissions;
-
- /** . */
- private final List<ComponentData> children;
-
- public ContainerData(
- String storageId,
- String storageName,
- String id,
- String name,
- String icon,
- String decorator,
- String template,
- String factoryId,
- String title,
- String description,
- String width,
- String height,
- List<String> accessPermissions,
- List<ComponentData> children)
- {
- super(storageId, storageName);
-
- //
- this.id = id;
- this.name = name;
- this.icon = icon;
- this.decorator = decorator;
- this.template = template;
- this.factoryId = factoryId;
- this.title = title;
- this.description = description;
- this.width = width;
- this.height = height;
- this.accessPermissions = accessPermissions;
- this.children = children;
- }
-
- public String getId()
- {
- return id;
- }
-
- public String getName()
- {
- return name;
- }
-
- public String getIcon()
- {
- return icon;
- }
-
- public String getDecorator()
- {
- return decorator;
- }
-
- public String getTemplate()
- {
- return template;
- }
-
- public String getFactoryId()
- {
- return factoryId;
- }
-
- public String getTitle()
- {
- return title;
- }
-
- public String getDescription()
- {
- return description;
- }
-
- public String getWidth()
- {
- return width;
- }
-
- public String getHeight()
- {
- return height;
- }
-
- public List<String> getAccessPermissions()
- {
- return accessPermissions;
- }
-
- public List<ComponentData> getChildren()
- {
- return children;
- }
-}
Modified: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/Dashboard.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/Dashboard.java 2009-10-23 19:09:03 UTC (rev 411)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/Dashboard.java 2009-10-24 07:50:41 UTC (rev 412)
@@ -19,6 +19,12 @@
package org.exoplatform.portal.config.model;
+import org.exoplatform.portal.pom.config.Utils;
+import org.exoplatform.portal.pom.config.data.ComponentData;
+import org.exoplatform.portal.pom.config.data.DashboardData;
+
+import java.util.List;
+
/**
* @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
* @version $Revision$
@@ -26,6 +32,11 @@
public class Dashboard extends Container
{
+ public Dashboard(DashboardData data)
+ {
+ super(data);
+ }
+
public Dashboard()
{
}
@@ -34,4 +45,25 @@
{
super(storageId);
}
+
+ @Override
+ public DashboardData build()
+ {
+ List<ComponentData> children = buildChildren();
+ return new DashboardData(
+ storageId,
+ id,
+ name,
+ icon,
+ decorator,
+ template,
+ factoryId,
+ title,
+ description,
+ width,
+ height,
+ Utils.safeImmutableList(accessPermissions),
+ children
+ );
+ }
}
Deleted: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/DashboardData.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/DashboardData.java 2009-10-23 19:09:03 UTC (rev 411)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/DashboardData.java 2009-10-24 07:50:41 UTC (rev 412)
@@ -1,60 +0,0 @@
-/*
- * Copyright (C) 2003-2007 eXo Platform SAS.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
- *
- * This program 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
- */
-package org.exoplatform.portal.config.model;
-
-import java.util.List;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public class DashboardData extends ContainerData
-{
-
- public DashboardData(
- String storageId,
- String storageName,
- String id,
- String name,
- String icon,
- String decorator,
- String template,
- String factoryId,
- String title,
- String description,
- String width,
- String height,
- List<String> accessPermissions,
- List<ComponentData> children)
- {
- super(
- storageId,
- storageName,
- id,
- name,
- icon,
- decorator,
- template,
- factoryId,
- title,
- description,
- width,
- height,
- accessPermissions,
- children);
- }
-}
Deleted: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/MappedAttributes.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/MappedAttributes.java 2009-10-23 19:09:03 UTC (rev 411)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/MappedAttributes.java 2009-10-24 07:50:41 UTC (rev 412)
@@ -1,126 +0,0 @@
-/**
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * 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.model;
-
-import org.gatein.mop.api.Key;
-import org.gatein.mop.api.ValueType;
-
-import java.util.Date;
-
-/**
- * A class to hold the various attributes mapped between the model and the mop layer.
- *
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-class MappedAttributes
-{
-
- private MappedAttributes()
- {
- }
-
- /** . */
- public static final Key<String> ID = Key.create("id", ValueType.STRING);
-
- /** . */
- public static final Key<String> NAME = Key.create("name", ValueType.STRING);
-
- /** . */
- public static final Key<Boolean> SHOW_MAX_WINDOW = Key.create("show-max-window", ValueType.BOOLEAN);
-
- /** . */
- public static final Key<String> TITLE = Key.create("title", ValueType.STRING);
-
- /** . */
- public static final Key<String> FACTORY_ID = Key.create("factory-id", ValueType.STRING);
-
- /** . */
- public static final Key<String> ACCESS_PERMISSIONS = Key.create("access-permissions", ValueType.STRING);
-
- /** . */
- public static final Key<String> EDIT_PERMISSION = Key.create("edit-permission", ValueType.STRING);
-
- /** . */
- public static final Key<String> CREATOR = Key.create("creator", ValueType.STRING);
-
- /** . */
- public static final Key<String> MODIFIER = Key.create("modifier", ValueType.STRING);
-
- /** . */
- public static final Key<String> DESCRIPTION = Key.create("description", ValueType.STRING);
-
- /** . */
- public static final Key<String> DECORATOR = Key.create("decorator", ValueType.STRING);
-
- /** . */
- public static final Key<Integer> PRIORITY = Key.create("priority", ValueType.INTEGER);
-
- /** . */
- public static final Key<String> LABEL = Key.create("label", ValueType.STRING);
-
- /** . */
- public static final Key<String> ICON = Key.create("icon", ValueType.STRING);
-
- /** . */
- public static final Key<String> URI = Key.create("uri", ValueType.STRING);
-
- /** . */
- public static final Key<Date> START_PUBLICATION_DATE = Key.create("start-publication-date", ValueType.DATE);
-
- /** . */
- public static final Key<Date> END_PUBLICATION_DATE = Key.create("end-publication-date", ValueType.DATE);
-
- /** . */
- public static final Key<Boolean> VISIBLE = Key.create("visible", ValueType.BOOLEAN);
-
- /** . */
- public static final Key<String> TEMPLATE = Key.create("template", ValueType.STRING);
-
- /** . */
- public static final Key<Boolean> SHOW_PUBLICATION_DATE = Key.create("show-publication-date", ValueType.BOOLEAN);
-
- /** . */
- public static final Key<Boolean> SHOW_INFO_BAR = Key.create("show-info-bar", ValueType.BOOLEAN);
-
- /** . */
- public static final Key<Boolean> SHOW_STATE = Key.create("show-state", ValueType.BOOLEAN);
-
- /** . */
- public static final Key<Boolean> SHOW_MODE = Key.create("show-mode", ValueType.BOOLEAN);
-
- /** . */
- public static final Key<String> LOCALE = Key.create("locale", ValueType.STRING);
-
- /** . */
- public static final Key<String> SKIN = Key.create("skin", ValueType.STRING);
-
- /** . */
- public static final Key<String> WIDTH = Key.create("width", ValueType.STRING);
-
- /** . */
- public static final Key<String> HEIGHT = Key.create("height", ValueType.STRING);
-
- /** . */
- public static final Key<String> TYPE = Key.create("type", ValueType.STRING);
-
- /** . */
- public static final Key<String> THEME = Key.create("theme", ValueType.STRING);
-}
Deleted: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/Mapper.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/Mapper.java 2009-10-23 19:09:03 UTC (rev 411)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/Mapper.java 2009-10-24 07:50:41 UTC (rev 412)
@@ -1,1060 +0,0 @@
-/**
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * 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.model;
-
-import static org.exoplatform.portal.pom.config.Utils.join;
-import static org.exoplatform.portal.pom.config.Utils.split;
-
-import org.exoplatform.portal.config.model.gadget.GadgetApplication;
-import org.exoplatform.portal.config.model.portlet.PortletApplication;
-import org.exoplatform.portal.config.model.portlet.PortletId;
-import org.exoplatform.portal.config.model.wsrp.WSRPApplication;
-import org.exoplatform.portal.config.model.wsrp.WSRPId;
-import org.exoplatform.portal.pom.config.POMSession;
-import org.exoplatform.portal.pom.spi.gadget.Gadget;
-import org.exoplatform.portal.pom.spi.portlet.Preferences;
-import org.exoplatform.portal.pom.spi.wsrp.WSRPState;
-import org.gatein.mop.api.Attributes;
-import org.gatein.mop.api.content.ContentType;
-import org.gatein.mop.api.content.Customization;
-import org.gatein.mop.api.workspace.Navigation;
-import org.gatein.mop.api.workspace.ObjectType;
-import org.gatein.mop.api.workspace.Site;
-import org.gatein.mop.api.workspace.Workspace;
-import org.gatein.mop.api.workspace.WorkspaceObject;
-import org.gatein.mop.api.workspace.link.Link;
-import org.gatein.mop.api.workspace.link.PageLink;
-import org.gatein.mop.api.workspace.ui.UIBody;
-import org.gatein.mop.api.workspace.ui.UIComponent;
-import org.gatein.mop.api.workspace.ui.UIContainer;
-import org.gatein.mop.api.workspace.ui.UIWindow;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.UUID;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public class Mapper
-{
-
- /** . */
- private static final Set<String> portalPropertiesBlackList =
- new HashSet<String>(Arrays.asList("jcr:uuid", "jcr:primaryType", MappedAttributes.LOCALE.getName(),
- MappedAttributes.ACCESS_PERMISSIONS.getName(), MappedAttributes.EDIT_PERMISSION.getName(),
- MappedAttributes.SKIN.getName(), MappedAttributes.TITLE.getName(), MappedAttributes.CREATOR.getName(),
- MappedAttributes.MODIFIER.getName()));
-
- /** . */
- private static final Set<String> windowPropertiesBlackList =
- new HashSet<String>(Arrays.asList("jcr:uuid", "jcr:primaryType", MappedAttributes.TYPE.getName(),
- MappedAttributes.THEME.getName(), MappedAttributes.TITLE.getName(), MappedAttributes.ACCESS_PERMISSIONS
- .getName(), MappedAttributes.SHOW_INFO_BAR.getName(), MappedAttributes.SHOW_STATE.getName(),
- MappedAttributes.SHOW_MODE.getName(), MappedAttributes.DESCRIPTION.getName(), MappedAttributes.ICON.getName(),
- MappedAttributes.WIDTH.getName(), MappedAttributes.HEIGHT.getName()));
-
- /** . */
- private final POMSession session;
-
- public Mapper(POMSession session)
- {
- this.session = session;
- }
-
- public NavigationContainer.Page load(Navigation src)
- {
- return load(src, NavigationContainer.Page.class);
- }
-
- private <T extends NavigationContainer> T load(Navigation src, Class<T> type)
- {
-
- //
- ArrayList<NavigationContainer.Node> children = new ArrayList<NavigationContainer.Node>(src.getChildren().size());
- for (Navigation srcChild : src.getChildren())
- {
- NavigationContainer.Node dstChild = load(srcChild, NavigationContainer.Node.class);
- children.add(dstChild);
- }
-
- //
- T dst;
- if (type == NavigationContainer.Page.class)
- {
- Site site = src.getSite();
- String ownerType = getOwnerType(site.getObjectType());
- String ownerId = site.getName();
- Attributes attrs = src.getAttributes();
- NavigationContainer.Page dstNav = new NavigationContainer.Page(
- src.getObjectId(),
- ownerType,
- ownerId,
- attrs.getValue(MappedAttributes.DESCRIPTION),
- attrs.getValue(MappedAttributes.CREATOR),
- attrs.getValue(MappedAttributes.MODIFIER),
- attrs.getValue(MappedAttributes.PRIORITY, 1),
- children);
- dst = (T)dstNav;
- }
- else if (type == NavigationContainer.Node.class)
- {
- Attributes attrs = src.getAttributes();
- String pageReference = null;
- Link link = src.getLink();
- if (link instanceof PageLink)
- {
- PageLink pageLink = (PageLink)link;
- org.gatein.mop.api.workspace.Page target = pageLink.getPage();
- if (target != null)
- {
- Site site = target.getSite();
- ObjectType<? extends Site> siteType = site.getObjectType();
- pageReference = getOwnerType(siteType) + "::" + site.getName() + "::" + target.getName();
- }
- }
- NavigationContainer.Node dstNode = new NavigationContainer.Node(
- src.getObjectId(),
- attrs.getValue(MappedAttributes.URI),
- attrs.getValue(MappedAttributes.LABEL),
- attrs.getValue(MappedAttributes.ICON),
- src.getName(),
- attrs.getValue(MappedAttributes.START_PUBLICATION_DATE),
- attrs.getValue(MappedAttributes.END_PUBLICATION_DATE),
- attrs.getValue(MappedAttributes.SHOW_PUBLICATION_DATE, false),
- attrs.getValue(MappedAttributes.VISIBLE, true),
- pageReference,
- children
- );
-
- dst = (T)dstNode;
- }
- else
- {
- throw new AssertionError();
- }
-
- //
- return dst;
- }
-
- public void save(NavigationContainer.Page src, Navigation dst)
- {
- save((NavigationContainer)src, dst);
- }
-
- private void save(NavigationContainer src, Navigation dst)
- {
- if (src instanceof NavigationContainer.Node)
- {
- NavigationContainer.Node node = (NavigationContainer.Node)src;
- Workspace workspace = dst.getSite().getWorkspace();
- String reference = node.getPageReference();
- if (reference != null)
- {
- String[] pageChunks = split("::", reference);
- ObjectType<? extends Site> siteType = parseSiteType(pageChunks[0]);
- Site site = workspace.getSite(siteType, pageChunks[1]);
- org.gatein.mop.api.workspace.Page target = site.getRootPage().getChild("pages").getChild(pageChunks[2]);
- PageLink link = dst.linkTo(ObjectType.PAGE_LINK);
- link.setPage(target);
- }
-
- //
- Attributes attrs = dst.getAttributes();
- attrs.setValue(MappedAttributes.URI, node.getURI());
- attrs.setValue(MappedAttributes.LABEL, node.getLabel());
- attrs.setValue(MappedAttributes.ICON, node.getIcon());
- attrs.setValue(MappedAttributes.START_PUBLICATION_DATE, node.getStartPublicationDate());
- attrs.setValue(MappedAttributes.END_PUBLICATION_DATE, node.getEndPublicationDate());
- attrs.setValue(MappedAttributes.SHOW_PUBLICATION_DATE, node.getShowPublicationDate());
- attrs.setValue(MappedAttributes.VISIBLE, node.isVisible());
- }
- else if (src instanceof NavigationContainer.Page)
- {
- NavigationContainer.Page pageNav = (NavigationContainer.Page)src;
-
- //
- Attributes attrs = dst.getAttributes();
- attrs.setValue(MappedAttributes.PRIORITY, pageNav.getPriority());
- attrs.setValue(MappedAttributes.CREATOR, pageNav.getCreator());
- attrs.setValue(MappedAttributes.MODIFIER, pageNav.getModifier());
- attrs.setValue(MappedAttributes.DESCRIPTION, pageNav.getDescription());
- }
- else
- {
- throw new AssertionError();
- }
-
- //
- Set<String> savedSet = new HashSet<String>();
- for (NavigationContainer.Node node : src.getChildren())
- {
- String srcId = node.getStorageId();
- Navigation dstChild;
- if (srcId != null)
- {
- dstChild = session.findObjectById(ObjectType.NAVIGATION, srcId);
- }
- else
- {
- dstChild = dst.getChild(node.getName());
- if (dstChild == null)
- {
- dstChild = dst.addChild(node.getName());
- }
- srcId = dstChild.getObjectId();
- }
- save(node, dstChild);
- savedSet.add(srcId);
- }
- for (Iterator<? extends Navigation> i = dst.getChildren().iterator(); i.hasNext();)
- {
- Navigation dstChild = i.next();
- if (!savedSet.contains(dstChild.getObjectId()))
- {
- i.remove();
- }
- }
- }
-
- public PortalData load(Site src)
- {
- String type = Mapper.getOwnerType(src.getObjectType());
- Attributes attrs = src.getAttributes();
-
- //
- org.gatein.mop.api.workspace.Page template = src.getRootNavigation().getTemplate();
- Container dstLayout = new Container();
- UIContainer srcLayout = template.getRootComponent();
-
- //
- Map<String, String> properties = new HashMap<String, String>();
- load(attrs, properties, portalPropertiesBlackList);
-
- //
- load(srcLayout, dstLayout);
- loadChildren(srcLayout, dstLayout);
-
- //
- PortalData data = new PortalData(
- src.getObjectId(),
- src.getName(),
- type,
- attrs.getValue(MappedAttributes.LOCALE),
- Collections.unmodifiableList(Arrays.asList(split("|", attrs.getValue(MappedAttributes.ACCESS_PERMISSIONS, "")))),
- attrs.getValue(MappedAttributes.EDIT_PERMISSION),
- Collections.unmodifiableMap(properties),
- attrs.getValue(MappedAttributes.SKIN),
- attrs.getValue(MappedAttributes.TITLE),
- dstLayout,
- attrs.getValue(MappedAttributes.CREATOR),
- attrs.getValue(MappedAttributes.MODIFIER));
-
- //
- return data;
- }
-
- public void save(PortalData src, Site dst)
- {
- if (src.getStorageId() != null && !src.getStorageId().equals(dst.getObjectId()))
- {
- String msg =
- "Attempt to save a site " + src.getType() + "/" + src.getName() + " on the wrong target site "
- + dst.getObjectType() + "/" + dst.getName();
- throw new IllegalArgumentException(msg);
- }
-
- //
- Attributes attrs = dst.getAttributes();
- attrs.setValue(MappedAttributes.LOCALE, src.getLocale());
- attrs.setValue(MappedAttributes.ACCESS_PERMISSIONS, join("|", src.getAccessPermissions()));
- attrs.setValue(MappedAttributes.EDIT_PERMISSION, src.getEditPermission());
- attrs.setValue(MappedAttributes.SKIN, src.getSkin());
- attrs.setValue(MappedAttributes.TITLE, src.getTitle());
- attrs.setValue(MappedAttributes.CREATOR, src.getCreator());
- attrs.setValue(MappedAttributes.MODIFIER, src.getModifier());
- if (src.getProperties() != null)
- {
- save(src.getProperties(), attrs);
- }
-
- //
- org.gatein.mop.api.workspace.Page templates = dst.getRootPage().getChild("templates");
- org.gatein.mop.api.workspace.Page template = templates.getChild("default");
- if (template == null)
- {
- template = templates.addChild("default");
- }
-
- //
- Container srcContainer = src.getPortalLayout();
- UIContainer dstContainer = template.getRootComponent();
-
- //
- save(srcContainer, dstContainer);
- saveChildren(srcContainer, dstContainer);
-
- //
- dst.getRootNavigation().setTemplate(template);
- }
-
- public Page load(org.gatein.mop.api.workspace.Page src)
- {
- Page dst = new Page(src.getRootComponent().getObjectId());
- load(src, dst);
- return dst;
- }
-
- private void load(org.gatein.mop.api.workspace.Page src, Page dst)
- {
- Site site = src.getSite();
- String ownerType = getOwnerType(site.getObjectType());
- String ownerId = site.getName();
- String name = src.getName();
- String pageId = join("::", ownerType, ownerId, name);
-
- //
- Attributes attrs = src.getAttributes();
- dst.setId(pageId);
- dst.setOwnerId(ownerId);
- dst.setOwnerType(ownerType);
- dst.setName(name);
- dst.setTitle(attrs.getValue(MappedAttributes.TITLE));
- dst.setShowMaxWindow(attrs.getValue(MappedAttributes.SHOW_MAX_WINDOW, false));
- dst.setCreator(attrs.getValue(MappedAttributes.CREATOR));
- dst.setModifier(attrs.getValue(MappedAttributes.MODIFIER));
- dst.setAccessPermissions(split("|", attrs.getValue(MappedAttributes.ACCESS_PERMISSIONS)));
- dst.setEditPermission(attrs.getValue(MappedAttributes.EDIT_PERMISSION));
- dst.setFactoryId(attrs.getValue(MappedAttributes.FACTORY_ID));
-
- //
- loadChildren(src.getRootComponent(), dst);
- }
-
- public List<ModelChange> save(Page src, Site site, String name)
- {
- org.gatein.mop.api.workspace.Page root = site.getRootPage();
- org.gatein.mop.api.workspace.Page pages = root.getChild("pages");
- org.gatein.mop.api.workspace.Page dst = pages.getChild(name);
-
- //
- LinkedList<ModelChange> changes = new LinkedList<ModelChange>();
-
- //
- if (dst == null)
- {
- dst = pages.addChild(name);
- changes.add(new ModelChange.Create(src));
- src.storageId = dst.getObjectId();
- }
- else
- {
- changes.add(new ModelChange.Update(src));
- }
-
- //
- Attributes attrs = dst.getAttributes();
- attrs.setValue(MappedAttributes.TITLE, src.getTitle());
- attrs.setValue(MappedAttributes.FACTORY_ID, src.getFactoryId());
- attrs.setValue(MappedAttributes.ACCESS_PERMISSIONS, join("|", src.getAccessPermissions()));
- attrs.setValue(MappedAttributes.EDIT_PERMISSION, src.getEditPermission());
- attrs.setValue(MappedAttributes.SHOW_MAX_WINDOW, src.isShowMaxWindow());
- attrs.setValue(MappedAttributes.CREATOR, src.getCreator());
- attrs.setValue(MappedAttributes.MODIFIER, src.getModifier());
-
- //
- changes.addAll(saveChildren(src, dst.getRootComponent()));
-
- //
- return changes;
- }
-
- private void load(UIContainer src, Container dst)
- {
- Attributes attrs = src.getAttributes();
- dst.setId(attrs.getValue(MappedAttributes.ID));
- dst.setName(attrs.getValue(MappedAttributes.NAME));
- dst.setTitle(attrs.getValue(MappedAttributes.TITLE));
- dst.setIcon(attrs.getValue(MappedAttributes.ICON));
- dst.setTemplate(attrs.getValue(MappedAttributes.TEMPLATE));
- dst.setAccessPermissions(split("|", attrs.getValue(MappedAttributes.ACCESS_PERMISSIONS)));
- dst.setFactoryId(attrs.getValue(MappedAttributes.FACTORY_ID));
- dst.setDecorator(attrs.getValue(MappedAttributes.DECORATOR));
- dst.setDescription(attrs.getValue(MappedAttributes.DESCRIPTION));
- dst.setWidth(attrs.getValue(MappedAttributes.WIDTH));
- dst.setHeight(attrs.getValue(MappedAttributes.HEIGHT));
- }
-
- private void loadChildren(UIContainer src, Container dst)
- {
- for (UIComponent component : src)
- {
-
- // Obtain a model object from the ui component
- ModelObject mo;
- if (component instanceof UIContainer)
- {
- UIContainer srcContainer = (UIContainer)component;
- Attributes attrs = srcContainer.getAttributes();
- String type = attrs.getValue(MappedAttributes.TYPE);
- if ("dashboard".equals(type))
- {
- TransientApplicationState<Preferences> state = new TransientApplicationState<Preferences>();
- Site owner = src.getPage().getSite();
- state.setOwnerType(getOwnerType(owner.getObjectType()));
- state.setOwnerId(owner.getName());
- PortletApplication dashboardApp =
- new PortletApplication(srcContainer.getObjectId(), "dashboard", "DashboardPortlet");
- dashboardApp.setStorageName(component.getName());
- dashboardApp.setState(state);
- dashboardApp.setShowInfoBar(false);
- dashboardApp.setShowApplicationState(false);
- mo = dashboardApp;
- }
- else
- {
- Container dstContainer = new Container(component.getObjectId());
- load(srcContainer, dstContainer);
- loadChildren(srcContainer, dstContainer);
- mo = dstContainer;
- }
- }
- else if (component instanceof UIWindow)
- {
- UIWindow window = (UIWindow)component;
- Application application = load(window);
- mo = application;
- }
- else if (component instanceof UIBody)
- {
- mo = new PageBody(component.getObjectId());
- }
- else
- {
- throw new AssertionError();
- }
-
- // Set the loaded name
- mo.storageName = component.getName();
-
- // Add among children
- dst.getChildren().add(mo);
- }
- }
-
- private void save(Container src, UIContainer dst)
- {
- Attributes dstAttrs = dst.getAttributes();
- dstAttrs.setValue(MappedAttributes.ID, src.getId());
- dstAttrs.setValue(MappedAttributes.TYPE, src instanceof Dashboard ? "dashboard" : null);
- dstAttrs.setValue(MappedAttributes.TITLE, src.getTitle());
- dstAttrs.setValue(MappedAttributes.ICON, src.getIcon());
- dstAttrs.setValue(MappedAttributes.TEMPLATE, src.getTemplate());
- dstAttrs.setValue(MappedAttributes.ACCESS_PERMISSIONS, join("|", src.getAccessPermissions()));
- dstAttrs.setValue(MappedAttributes.FACTORY_ID, src.getFactoryId());
- dstAttrs.setValue(MappedAttributes.DECORATOR, src.getDecorator());
- dstAttrs.setValue(MappedAttributes.DESCRIPTION, src.getDescription());
- dstAttrs.setValue(MappedAttributes.WIDTH, src.getWidth());
- dstAttrs.setValue(MappedAttributes.HEIGHT, src.getHeight());
- dstAttrs.setValue(MappedAttributes.NAME, src.getName());
- }
-
- private void save(ModelObject src, WorkspaceObject dst, LinkedList<ModelChange> changes,
- Map<String, String> hierarchyRelationships)
- {
- if (src instanceof Container)
- {
- save((Container)src, (UIContainer)dst);
- saveChildren((Container)src, (UIContainer)dst, changes, hierarchyRelationships);
- }
- else if (src instanceof Application)
- {
- save((Application<?, ?>)src, (UIWindow)dst);
- }
- else if (src instanceof PageBody)
- {
- // Stateless
- }
- else
- {
- throw new AssertionError("Was not expecting child " + src);
- }
- }
-
- /** . */
- private static final PortletId DASHBOARD_ID = new PortletId("dashboard", "DashboardPortlet");
-
- private LinkedList<ModelChange> saveChildren(final Container src, UIContainer dst)
- {
-
- //
- LinkedList<ModelChange> changes = new LinkedList<ModelChange>();
-
- //
- Map<String, String> hierarchyRelationships = new HashMap<String, String>();
-
- //
- build(src, hierarchyRelationships);
-
- //
- saveChildren(src, dst, changes, Collections.unmodifiableMap(hierarchyRelationships));
-
- //
- return changes;
- }
-
- private void build(Container parent, Map<String, String> hierarchyRelationships)
- {
- String parentId = parent.getStorageId();
- if (parentId != null)
- {
- for (ModelObject child : parent.getChildren())
- {
- String childId = child.getStorageId();
- if (childId != null)
- {
- if (hierarchyRelationships.put(childId, parentId) != null)
- {
- throw new AssertionError("The same object is present two times in the object hierarchy");
- }
- if (child instanceof Container)
- {
- build((Container)child, hierarchyRelationships);
- }
- }
- }
- }
- }
-
- private void saveChildren(final Container src, UIContainer dst, LinkedList<ModelChange> changes,
- Map<String, String> hierarchyRelationships)
- {
- final List<String> orders = new ArrayList<String>();
- final Map<String, ModelObject> modelObjectMap = new HashMap<String, ModelObject>();
-
- //
- for (ModelObject srcChild : src.getChildren())
- {
- String srcId = srcChild.getStorageId();
-
- // Replace dashboard application by container if needed
- if (srcChild instanceof Application)
- {
- Application app = (Application)srcChild;
- if (app.getType() == ApplicationType.PORTLET)
- {
- PortletApplication portletApp = (PortletApplication)app;
- if (DASHBOARD_ID.equals(portletApp.getRef()))
- {
- if (app.storageId != null)
- {
- UIContainer dstDashboard = session.findObjectById(ObjectType.CONTAINER, app.storageId);
- Dashboard srcDashboard = new Dashboard(app.storageId);
- load(dstDashboard, srcDashboard);
- loadChildren(dstDashboard, srcDashboard);
- srcChild = srcDashboard;
- }
- else
- {
- Dashboard dashboard = new Dashboard();
- dashboard.setTemplate("classpath:groovy/dashboard/webui/component/UIColumnContainer.gtmpl");
- for (int i = 0; i < 3; i++)
- {
- Container row = new Container();
- row.setTemplate("classpath:groovy/dashboard/webui/component/UIContainer.gtmpl");
- dashboard.getChildren().add(row);
- }
- srcChild = dashboard;
- }
- }
- }
- }
-
- //
- UIComponent dstChild;
- if (srcId != null)
- {
- dstChild = session.findObjectById(ObjectType.COMPONENT, srcId);
- if (dstChild == null)
- {
- throw new AssertionError("Could not find supposed present child with id " + srcId);
- }
- // julien : this can fail due to a bug in chromattic not implementing equals method properly
- // and is replaced with the foreach below
- /*
- if (!dst.contains(dstChild)) {
- throw new IllegalArgumentException("Attempt for updating a ui component " + session.pathOf(dstChild) +
- "that is not present in the target ui container " + session.pathOf(dst));
- }
- */
- boolean found = false;
- for (UIComponent child : dst)
- {
- if (child.getObjectId().equals(srcId))
- {
- found = true;
- break;
- }
- }
- if (!found)
- {
- if (hierarchyRelationships.containsKey(srcId))
- {
- // It's a move operation, so we move the node first
- dst.add(dstChild);
- }
- else
- {
- throw new IllegalArgumentException("Attempt for updating a ui component " + session.pathOf(dstChild)
- + "that is not present in the target ui container " + session.pathOf(dst));
- }
- }
-
- //
- changes.add(new ModelChange.Update(srcChild));
- }
- else
- {
- String name = srcChild.getStorageName();
- if (name == null)
- {
- // We manufacture one name
- name = UUID.randomUUID().toString();
- }
- if (srcChild instanceof Container)
- {
- dstChild = dst.add(ObjectType.CONTAINER, name);
- }
- else if (srcChild instanceof Application)
- {
- dstChild = dst.add(ObjectType.WINDOW, name);
- }
- else if (srcChild instanceof PageBody)
- {
- dstChild = dst.add(ObjectType.BODY, name);
- }
- else
- {
- throw new AssertionError("Was not expecting child " + srcChild);
- }
- srcChild.storageId = dstChild.getObjectId();
- srcChild.storageName = name;
- changes.add(new ModelChange.Create(srcChild));
- }
-
- //
- save(srcChild, dstChild, changes, hierarchyRelationships);
-
- //
- String dstId = dstChild.getObjectId();
- modelObjectMap.put(dstId, srcChild);
- orders.add(dstId);
- }
-
- // Take care of move operation that could be seen as a remove
- for (UIComponent dstChild : dst)
- {
- String dstId = dstChild.getObjectId();
- if (!modelObjectMap.containsKey(dstId) && hierarchyRelationships.containsKey(dstId))
- {
- String parentId = hierarchyRelationships.get(dstId);
-
- // Get the new parent
- UIContainer parent = session.findObjectById(ObjectType.CONTAINER, parentId);
-
- // Perform the move
- parent.add(dstChild);
-
- //
- changes.add(new ModelChange.Destroy(dstId));
- }
- }
-
- // Delete removed children
- for (Iterator<UIComponent> i = dst.iterator(); i.hasNext();)
- {
- UIComponent dstChild = i.next();
- String dstId = dstChild.getObjectId();
- if (!modelObjectMap.containsKey(dstId))
- {
- i.remove();
- changes.add(new ModelChange.Destroy(dstId));
- }
- }
-
- // Now sort children according to the order provided by the container
- // need to replace that with Collections.sort once the set(int index, E element) is implemented in Chromattic lists
- UIComponent[] a = dst.toArray(new UIComponent[dst.size()]);
- Arrays.sort(a, new Comparator<UIComponent>()
- {
- public int compare(UIComponent o1, UIComponent o2)
- {
- int i1 = orders.indexOf(o1.getObjectId());
- int i2 = orders.indexOf(o2.getObjectId());
- return i1 - i2;
- }
- });
- for (int j = 0; j < a.length; j++)
- {
- dst.add(j, a[j]);
- }
- }
-
- private <S, I> Application<S, I> load(UIWindow src)
- {
- Attributes attrs = src.getAttributes();
-
- //
- Customization<?> customization = src.getCustomization();
-
- //
- ContentType<?> contentType = customization.getType();
-
- //
- String customizationid = customization.getId();
-
- //
- String contentId = customization.getContentId();
-
- //
- Application<S, I> dst;
- if (contentType == null || contentType == Preferences.CONTENT_TYPE)
- {
- int pos = contentId.indexOf('/');
- String applicationName = contentId.substring(0, pos);
- String portletName = contentId.substring(pos + 1);
- @SuppressWarnings("unchecked")
- Application<S, I> application =
- (Application<S, I>)new PortletApplication(src.getObjectId(), applicationName, portletName);
- dst = application;
- }
- else if (contentType == Gadget.CONTENT_TYPE)
- {
- @SuppressWarnings("unchecked")
- Application<S, I> application = (Application<S, I>)new GadgetApplication(src.getObjectId(), contentId);
- dst = application;
- }
- else if (contentType == WSRPState.CONTENT_TYPE)
- {
- @SuppressWarnings("unchecked")
- Application<S, I> application =
- (Application<S, I>)new WSRPApplication(src.getObjectId(), new WSRPId(contentId));
- dst = application;
- }
- else
- {
- throw new AssertionError("Unknown type: " + contentType);
- }
-
- //
- dst.setTheme(attrs.getValue(MappedAttributes.THEME));
- dst.setTitle(attrs.getValue(MappedAttributes.TITLE));
- dst.setAccessPermissions(split("|", attrs.getValue(MappedAttributes.ACCESS_PERMISSIONS)));
- dst.setShowInfoBar(attrs.getValue(MappedAttributes.SHOW_INFO_BAR));
- dst.setShowApplicationState(attrs.getValue(MappedAttributes.SHOW_STATE));
- dst.setShowApplicationMode(attrs.getValue(MappedAttributes.SHOW_MODE));
- dst.setDescription(attrs.getValue(MappedAttributes.DESCRIPTION));
- dst.setIcon(attrs.getValue(MappedAttributes.ICON));
- dst.setWidth(attrs.getValue(MappedAttributes.WIDTH));
- dst.setHeight(attrs.getValue(MappedAttributes.HEIGHT));
- load(attrs, dst.getProperties(), windowPropertiesBlackList);
-
- //
- PersistentApplicationState<S> instanceState = new PersistentApplicationState<S>(customizationid);
-
- //
- dst.setState(instanceState);
-
- //
- return dst;
- }
-
- public <S, I> void save(Application<S, I> src, UIWindow dst)
- {
- Attributes attrs = dst.getAttributes();
- attrs.setValue(MappedAttributes.THEME, src.getTheme());
- attrs.setValue(MappedAttributes.TITLE, src.getTitle());
- attrs.setValue(MappedAttributes.ACCESS_PERMISSIONS, join("|", src.getAccessPermissions()));
- attrs.setValue(MappedAttributes.SHOW_INFO_BAR, src.getShowInfoBar());
- attrs.setValue(MappedAttributes.SHOW_STATE, src.getShowApplicationState());
- attrs.setValue(MappedAttributes.SHOW_MODE, src.getShowApplicationMode());
- attrs.setValue(MappedAttributes.DESCRIPTION, src.getDescription());
- attrs.setValue(MappedAttributes.ICON, src.getIcon());
- attrs.setValue(MappedAttributes.WIDTH, src.getWidth());
- attrs.setValue(MappedAttributes.HEIGHT, src.getHeight());
- save(src.getProperties(), attrs);
-
- //
- ApplicationState<S> instanceState = src.getState();
-
- // We modify only transient portlet state
- // and we ignore any persistent portlet state
- if (instanceState instanceof TransientApplicationState)
- {
-
- //
- TransientApplicationState<S> transientState = (TransientApplicationState<S>)instanceState;
-
- // Attempt to get a site from the instance state
- Site site = null;
- if (transientState.getOwnerType() != null && transientState.getOwnerId() != null)
- {
- ObjectType<Site> siteType = parseSiteType(transientState.getOwnerType());
- site = session.getWorkspace().getSite(siteType, transientState.getOwnerId());
- }
-
- // The current site
- Site currentSite = dst.getPage().getSite();
-
- // If it is the same site than the current page
- // set null
- if (site == dst.getPage().getSite())
- {
- site = null;
- }
-
- // The content id
- String contentId;
- ContentType<S> contentType = src.getType().getContentType();
- if (contentType == Preferences.CONTENT_TYPE)
- {
- PortletApplication portletApp = (PortletApplication)src;
- contentId = portletApp.getRef().getApplicationName() + "/" + portletApp.getRef().getPortletName();
- }
- else if (contentType == Gadget.CONTENT_TYPE)
- {
- GadgetApplication gadgetApp = (GadgetApplication)src;
- contentId = gadgetApp.getRef().getGadgetName();
- }
- else if (contentType == WSRPState.CONTENT_TYPE)
- {
- WSRPApplication wsrpApp = (WSRPApplication)src;
- contentId = wsrpApp.getRef().getUri();
- }
- else
- {
- throw new UnsupportedOperationException("Unsupported content type");
- }
-
- // The customization that we will inherit from if not null
- Customization<?> customization = null;
-
- // Now inspect the unique id
- String uniqueId = transientState.getUniqueId();
- if (uniqueId != null)
- {
-
- // This is a customized window
- if (uniqueId.startsWith("@"))
- {
- String id = uniqueId.substring(1);
-
- // It's another window, we get its customization
- if (!dst.getObjectId().equals(id))
- {
- UIWindow window = session.findObjectById(ObjectType.WINDOW, id);
- Customization<?> windowCustomization = window.getCustomization();
- if (windowCustomization.getType().equals(contentType))
- {
- customization = windowCustomization;
- }
- }
- }
- else
- {
- int pos = uniqueId.indexOf('#');
- if (pos == -1)
- {
-
- // If it's a different site than the page one (it has to be at this point)
- // then we get its customization
- if (site != null)
- {
- customization = site.getCustomization(uniqueId);
- }
- else
- {
- customization = currentSite.getCustomization(uniqueId);
-
- // If it does not exist we create it
- if (customization == null)
- {
- customization = currentSite.customize(uniqueId, contentType, contentId, null);
- }
- }
- }
- else
- {
-
- // Otherwise we get the page customization
- String a = uniqueId.substring(0, pos);
- String b = uniqueId.substring(pos + 1);
- org.gatein.mop.api.workspace.Page page = site.getRootPage().getChild("pages").getChild(b);
- customization = page.getCustomization(a);
- }
- }
- }
-
- // Destroy existing window previous customization
- if (dst.getCustomization() != null)
- {
- dst.getCustomization().destroy();
- }
-
- // If the existing customization is not null and matches the content id
- Customization<S> dstCustomization;
- if (customization != null && customization.getType().equals(contentType)
- && customization.getContentId().equals(contentId))
- {
-
- // Cast is ok as content type matches
- @SuppressWarnings("unchecked")
- Customization<S> bilto = (Customization<S>)customization;
-
- // If it's a customization of the current site we extend it
- if (bilto.getContext() == currentSite)
- {
- dstCustomization = dst.customize(bilto);
- }
- else
- {
- // Otherwise we clone it propertly
- S state = bilto.getVirtualState();
- dstCustomization = dst.customize(contentType, contentId, state);
- }
- }
- else
- {
- // Otherwise we create an empty customization
- dstCustomization = dst.customize(contentType, contentId, null);
- }
-
- // At this point we have customized the window
- // now if we have any additional state payload we must merge it
- // with the current state
- S state = ((TransientApplicationState<S>)instanceState).getContentState();
- if (state != null)
- {
- dstCustomization.setState(state);
- }
- }
- }
-
- public Dashboard loadDashboard(UIContainer container)
- {
- Dashboard dashboard = new Dashboard(container.getObjectId());
- load(container, dashboard);
- loadChildren(container, dashboard);
- return dashboard;
- }
-
- public void saveDashboard(Dashboard dashboard, UIContainer dst)
- {
- save(dashboard, dst);
- saveChildren(dashboard, dst);
- }
-
- public static String[] parseWindowId(String windowId)
- {
- int i0 = windowId.indexOf("#");
- int i1 = windowId.indexOf(":/", i0 + 1);
- String ownerType = windowId.substring(0, i0);
- String ownerId = windowId.substring(i0 + 1, i1);
- String persistenceid = windowId.substring(i1 + 2);
- String[] chunks = split("/", 2, persistenceid);
- chunks[0] = ownerType;
- chunks[1] = ownerId;
- return chunks;
- }
-
- private static void load(Attributes src, Map<String, String> dst, Set<String> blackList)
- {
- for (String name : src.getKeys())
- {
- if (!blackList.contains(name))
- {
- Object value = src.getObject(name);
- if (value instanceof String)
- {
- dst.put(name, (String)value);
- }
- }
- }
- }
-
- public static void save(Map<String, String> src, Attributes dst)
- {
- for (Map.Entry<String, String> property : src.entrySet())
- {
- dst.setString(property.getKey(), property.getValue());
- }
- }
-
- public static String getOwnerType(ObjectType<? extends Site> siteType)
- {
- if (siteType == ObjectType.PORTAL_SITE)
- {
- return PortalConfig.PORTAL_TYPE;
- }
- else if (siteType == ObjectType.GROUP_SITE)
- {
- return PortalConfig.GROUP_TYPE;
- }
- else if (siteType == ObjectType.USER_SITE)
- {
- return PortalConfig.USER_TYPE;
- }
- else
- {
- throw new IllegalArgumentException("Invalid site type " + siteType);
- }
- }
-
- public static ObjectType<Site> parseSiteType(String ownerType)
- {
- if (ownerType.equals(PortalConfig.PORTAL_TYPE))
- {
- return ObjectType.PORTAL_SITE;
- }
- else if (ownerType.equals(PortalConfig.GROUP_TYPE))
- {
- return ObjectType.GROUP_SITE;
- }
- else if (ownerType.equals(PortalConfig.USER_TYPE))
- {
- return ObjectType.USER_SITE;
- }
- else
- {
- throw new IllegalArgumentException("Invalid owner type " + ownerType);
- }
- }
-}
Modified: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/ModelChange.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/ModelChange.java 2009-10-23 19:09:03 UTC (rev 411)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/ModelChange.java 2009-10-24 07:50:41 UTC (rev 412)
@@ -19,6 +19,8 @@
package org.exoplatform.portal.config.model;
+import org.exoplatform.portal.pom.config.data.ModelData;
+
/**
* @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
* @version $Revision$
@@ -30,14 +32,14 @@
{
/** . */
- private final ModelObject object;
+ private final ModelData object;
- public Create(ModelObject object)
+ public Create(ModelData object)
{
this.object = object;
}
- public ModelObject getObject()
+ public ModelData getObject()
{
return object;
}
@@ -47,14 +49,14 @@
{
/** . */
- private final ModelObject object;
+ private final ModelData object;
- public Update(ModelObject object)
+ public Update(ModelData object)
{
this.object = object;
}
- public ModelObject getObject()
+ public ModelData getObject()
{
return object;
}
Deleted: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/ModelData.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/ModelData.java 2009-10-23 19:09:03 UTC (rev 411)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/ModelData.java 2009-10-24 07:50:41 UTC (rev 412)
@@ -1,50 +0,0 @@
-/**
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * 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.model;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public abstract class ModelData
-{
-
- /** Storage id. */
- private final String storageId;
-
- /** The storage name that is unique among a container context. */
- private final String storageName;
-
- protected ModelData(String storageId, String storageName)
- {
- this.storageId = storageId;
- this.storageName = storageName;
- }
-
- public String getStorageId()
- {
- return storageId;
- }
-
- public String getStorageName()
- {
- return storageName;
- }
-}
\ No newline at end of file
Modified: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/ModelObject.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/ModelObject.java 2009-10-23 19:09:03 UTC (rev 411)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/ModelObject.java 2009-10-24 07:50:41 UTC (rev 412)
@@ -19,6 +19,21 @@
package org.exoplatform.portal.config.model;
+import org.exoplatform.portal.config.model.gadget.GadgetApplication;
+import org.exoplatform.portal.config.model.gadget.GadgetId;
+import org.exoplatform.portal.config.model.portlet.PortletApplication;
+import org.exoplatform.portal.config.model.portlet.PortletId;
+import org.exoplatform.portal.config.model.wsrp.WSRPApplication;
+import org.exoplatform.portal.config.model.wsrp.WSRPId;
+import org.exoplatform.portal.pom.config.data.ApplicationData;
+import org.exoplatform.portal.pom.config.data.BodyData;
+import org.exoplatform.portal.pom.config.data.ContainerData;
+import org.exoplatform.portal.pom.config.data.ModelData;
+import org.exoplatform.portal.pom.config.data.PageData;
+import org.exoplatform.portal.pom.spi.gadget.Gadget;
+import org.exoplatform.portal.pom.spi.portlet.Preferences;
+import org.exoplatform.portal.pom.spi.wsrp.WSRPState;
+
/**
* @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
* @version $Revision$
@@ -62,4 +77,55 @@
this.storageName = storageName;
}
+ public abstract ModelData build();
+
+ public static ModelObject build(ModelData data)
+ {
+ if (data instanceof ContainerData)
+ {
+ return new Container((ContainerData)data);
+ }
+ else if (data instanceof PageData)
+ {
+ return new Page((PageData)data);
+ }
+ else if (data instanceof BodyData)
+ {
+ BodyData bodyData = (BodyData)data;
+ switch (bodyData.getType())
+ {
+ case PAGE:
+ return new PageBody(data.getStorageId());
+ case SITE:
+ return new SiteBody(data.getStorageId());
+ default:
+ throw new AssertionError();
+ }
+ }
+ else if (data instanceof ApplicationData)
+ {
+ ApplicationData applicationData = (ApplicationData)data;
+ ApplicationType type = applicationData.getType();
+ if (ApplicationType.PORTLET == type)
+ {
+ return new PortletApplication((ApplicationData<Preferences, PortletId>)applicationData);
+ }
+ else if (ApplicationType.GADGET == type)
+ {
+ return new GadgetApplication((ApplicationData<Gadget, GadgetId>)applicationData);
+ }
+ else if (ApplicationType.WSRP_PORTLET == type)
+ {
+ return new WSRPApplication((ApplicationData<WSRPState, WSRPId>)applicationData);
+ }
+ else
+ {
+ throw new AssertionError();
+ }
+ }
+ else
+ {
+ throw new UnsupportedOperationException("todo " + data);
+ }
+ }
}
Deleted: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/NavigationContainer.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/NavigationContainer.java 2009-10-23 19:09:03 UTC (rev 411)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/NavigationContainer.java 2009-10-24 07:50:41 UTC (rev 412)
@@ -1,258 +0,0 @@
-/*
- * Copyright (C) 2003-2007 eXo Platform SAS.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
- *
- * This program 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
- */
-package org.exoplatform.portal.config.model;
-
-import java.util.Date;
-import java.util.List;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public class NavigationContainer extends ModelObject
-{
-
- /** . */
- private final List<NavigationContainer.Node> children;
-
- public NavigationContainer(String storageId, List<NavigationContainer.Node> children)
- {
- super(storageId);
-
- //
- this.children = children;
- }
-
- public List<NavigationContainer.Node> getChildren()
- {
- return children;
- }
-
- public static class Node extends NavigationContainer
- {
-
- /** . */
- private final String uri;
-
- /** . */
- private final String label;
-
- /** . */
- private final String icon;
-
- /** . */
- private final String name;
-
- /** . */
- private final Date startPublicationDate;
-
- /** . */
- private final Date endPublicationDate;
-
- /** . */
- private final boolean showPublicationDate;
-
- /** . */
- private final boolean visible;
-
- /** . */
- private final String pageReference;
-
- public Node(
- String uri,
- String label,
- String icon,
- String name,
- Date startPublicationDate,
- Date endPublicationDate,
- Boolean showPublicationDate,
- Boolean visible,
- String pageReference,
- List<NavigationContainer.Node> children)
- {
- this(null, uri, label, icon, name, startPublicationDate, endPublicationDate, showPublicationDate, visible, pageReference, children);
- }
-
- public Node(
- String storageId,
- String uri,
- String label,
- String icon,
- String name,
- Date startPublicationDate,
- Date endPublicationDate,
- Boolean showPublicationDate,
- Boolean visible,
- String pageReference,
- List<NavigationContainer.Node> children)
- {
- super(storageId, children);
-
- //
- this.uri = uri;
- this.label = label;
- this.icon = icon;
- this.name = name;
- this.startPublicationDate = startPublicationDate;
- this.endPublicationDate = endPublicationDate;
- this.showPublicationDate = showPublicationDate != null ? showPublicationDate : false;
- this.visible = visible != null ? visible : true;
- this.pageReference = pageReference;
- }
- public String getURI()
- {
- return uri;
- }
-
- public String getLabel()
- {
- return label;
- }
-
- public String getIcon()
- {
- return icon;
- }
-
- public String getName()
- {
- return name;
- }
-
- public Date getStartPublicationDate()
- {
- return startPublicationDate;
- }
-
- public Date getEndPublicationDate()
- {
- return endPublicationDate;
- }
-
- public boolean getShowPublicationDate()
- {
- return showPublicationDate;
- }
-
- public boolean isVisible()
- {
- return visible;
- }
-
- public String getPageReference()
- {
- return pageReference;
- }
- }
-
- public static class Page extends NavigationContainer
- {
-
- /** . */
- private final String ownerType;
-
- /** . */
- private final String ownerId;
-
- /** . */
- private final String description;
-
- /** . */
- private final String creator;
-
- /** . */
- private final String modifier;
-
- /** . */
- private final int priority;
-
- public Page(
- String ownerType,
- String ownerId,
- String description,
- String creator,
- String modifier,
- Integer priority,
- List<NavigationContainer.Node> children)
- {
- this(null, ownerType, ownerId, description, creator, modifier, priority, children);
- }
-
- public Page(
- String storageId,
- String ownerType,
- String ownerId,
- String description,
- String creator,
- String modifier,
- Integer priority,
- List<NavigationContainer.Node> children)
- {
- super(storageId, children);
-
- //
- if (ownerType == null)
- {
- throw new NullPointerException("No null owner type");
- }
- if (ownerId == null)
- {
- throw new NullPointerException("No null owner id");
- }
-
- //
- this.ownerType = ownerType;
- this.ownerId = ownerId;
- this.description = description;
- this.creator = creator;
- this.modifier = modifier;
- this.priority = priority != null ? priority : 1;
- }
-
- public String getOwnerType()
- {
- return ownerType;
- }
-
- public String getOwnerId()
- {
- return ownerId;
- }
-
- public String getDescription()
- {
- return description;
- }
-
- public String getCreator()
- {
- return creator;
- }
-
- public String getModifier()
- {
- return modifier;
- }
-
- public int getPriority()
- {
- return priority;
- }
- }
-
-
-}
Deleted: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/NavigationKey.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/NavigationKey.java 2009-10-23 19:09:03 UTC (rev 411)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/NavigationKey.java 2009-10-24 07:50:41 UTC (rev 412)
@@ -1,30 +0,0 @@
-/*
- * Copyright (C) 2003-2007 eXo Platform SAS.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
- *
- * This program 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
- */
-package org.exoplatform.portal.config.model;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public class NavigationKey extends OwnerKey
-{
-
- public NavigationKey(String ownerType, String ownerId)
- {
- super(ownerType, ownerId);
- }
-}
Deleted: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/OwnerKey.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/OwnerKey.java 2009-10-23 19:09:03 UTC (rev 411)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/OwnerKey.java 2009-10-24 07:50:41 UTC (rev 412)
@@ -1,74 +0,0 @@
-/*
- * Copyright (C) 2003-2007 eXo Platform SAS.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
- *
- * This program 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
- */
-package org.exoplatform.portal.config.model;
-
-import java.io.Serializable;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public class OwnerKey implements Serializable
-{
-
- /** . */
- private final String ownerType;
-
- /** . */
- private final String ownerId;
-
- public OwnerKey(String ownerType, String ownerId)
- {
- if (ownerType == null)
- {
- throw new NullPointerException();
- }
- if (ownerId == null)
- {
- throw new NullPointerException();
- }
- this.ownerType = ownerType;
- this.ownerId = ownerId;
- }
-
- public String getOwnerType()
- {
- return ownerType;
- }
-
- public String getOwnerId()
- {
- return ownerId;
- }
-
- @Override
- public int hashCode()
- {
- return ownerId.hashCode() ^ ownerType.hashCode();
- }
-
- @Override
- public boolean equals(Object obj)
- {
- if (obj instanceof OwnerKey)
- {
- OwnerKey that = (OwnerKey)obj;
- return ownerType.equals(that.ownerType) && ownerId.equals(that.ownerId);
- }
- return false;
- }
-}
Modified: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/Page.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/Page.java 2009-10-23 19:09:03 UTC (rev 411)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/Page.java 2009-10-24 07:50:41 UTC (rev 412)
@@ -19,7 +19,12 @@
package org.exoplatform.portal.config.model;
+import org.exoplatform.portal.pom.config.Utils;
+import org.exoplatform.portal.pom.config.data.ComponentData;
+import org.exoplatform.portal.pom.config.data.PageData;
+
import java.util.ArrayList;
+import java.util.List;
/**
* May 13, 2004
@@ -35,8 +40,6 @@
private String ownerId;
- private String[] accessPermissions;
-
private String editPermission;
private boolean showMaxWindow = false;
@@ -51,6 +54,19 @@
{
}
+ public Page(PageData data)
+ {
+ super(data);
+
+ //
+ this.ownerType = data.getOwnerType();
+ this.ownerId = data.getOwnerId();
+ this.editPermission = data.getEditPermission();
+ this.showMaxWindow = data.isShowMaxWindow();
+ this.creator = data.getCreator();
+ this.modifier = data.getModifier();
+ }
+
public Page(String storageId)
{
super(storageId);
@@ -76,16 +92,6 @@
this.ownerType = ownerType;
}
- public String[] getAccessPermissions()
- {
- return accessPermissions;
- }
-
- public void setAccessPermissions(String[] s)
- {
- accessPermissions = s;
- }
-
public String getEditPermission()
{
return editPermission;
@@ -169,6 +175,32 @@
modifier = s;
}
+ @Override
+ public PageData build()
+ {
+ List<ComponentData> children = buildChildren();
+ return new PageData(
+ storageId,
+ id,
+ name,
+ icon,
+ decorator,
+ template,
+ factoryId,
+ title,
+ description,
+ width,
+ height,
+ Utils.safeImmutableList(accessPermissions),
+ children,
+ ownerType,
+ ownerId,
+ editPermission,
+ showMaxWindow,
+ creator,
+ modifier);
+ }
+
static public class PageSet
{
private ArrayList<Page> pages;
Modified: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PageBody.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PageBody.java 2009-10-23 19:09:03 UTC (rev 411)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PageBody.java 2009-10-24 07:50:41 UTC (rev 412)
@@ -19,6 +19,10 @@
package org.exoplatform.portal.config.model;
+import org.exoplatform.portal.pom.config.data.BodyData;
+import org.exoplatform.portal.pom.config.data.BodyType;
+import org.exoplatform.portal.pom.config.data.ModelData;
+
/**
* Created by The eXo Platform SAS
* Apr 25, 2007
@@ -34,4 +38,10 @@
public PageBody()
{
}
+
+ @Override
+ public ModelData build()
+ {
+ return new BodyData(storageId, BodyType.PAGE);
+ }
}
Deleted: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PageData.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PageData.java 2009-10-23 19:09:03 UTC (rev 411)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PageData.java 2009-10-24 07:50:41 UTC (rev 412)
@@ -1,108 +0,0 @@
-/*
- * Copyright (C) 2003-2007 eXo Platform SAS.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
- *
- * This program 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
- */
-package org.exoplatform.portal.config.model;
-
-import java.util.List;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public class PageData extends ContainerData
-{
-
- /** . */
- private final String ownerType;
-
- /** . */
- private final String ownerId;
-
- /** . */
- private final String editPermission;
-
- /** . */
- private final boolean showMaxWindow;
-
- /** . */
- private final String creator;
-
- /** . */
- private final String modifier;
-
- public PageData(
- String storageId,
- String storageName,
- String id,
- String name,
- String icon,
- String decorator,
- String template,
- String factoryId,
- String title,
- String description,
- String width,
- String height,
- List<String> accessPermissions,
- List<ComponentData> children,
- String ownerType,
- String ownerId,
- String editPermission,
- boolean showMaxWindow,
- String creator,
- String modifier)
- {
- super(storageId, storageName, id, name, icon, decorator, template, factoryId, title, description, width, height, accessPermissions, children);
-
- //
- this.ownerType = ownerType;
- this.ownerId = ownerId;
- this.editPermission = editPermission;
- this.showMaxWindow = showMaxWindow;
- this.creator = creator;
- this.modifier = modifier;
- }
-
- public String getOwnerType()
- {
- return ownerType;
- }
-
- public String getOwnerId()
- {
- return ownerId;
- }
-
- public String getEditPermission()
- {
- return editPermission;
- }
-
- public boolean isShowMaxWindow()
- {
- return showMaxWindow;
- }
-
- public String getCreator()
- {
- return creator;
- }
-
- public String getModifier()
- {
- return modifier;
- }
-}
Deleted: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PageNavigation.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PageNavigation.java 2009-10-23 19:09:03 UTC (rev 411)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PageNavigation.java 2009-10-24 07:50:41 UTC (rev 412)
@@ -1,271 +0,0 @@
-/**
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * 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.model;
-
-import java.util.ArrayList;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-
-public class PageNavigation extends PageNodeContainer
-{
-
- private String ownerType;
-
- private String ownerId;
-
- private String description;
-
- private transient boolean modifiable;
-
- private String creator;
-
- private String modifier;
-
- private ArrayList<PageNode> pageNodes;
-
- private int priority = 1;
-
- PageNavigation(String storageId)
- {
- super(storageId);
-
- //
- this.pageNodes = new ArrayList<PageNode>();
- }
-
- public PageNavigation()
- {
- this((String)null);
- }
-
- public PageNavigation(NavigationContainer.Page nav)
- {
- super(nav.getStorageId());
-
- ArrayList<PageNode> children = new ArrayList<PageNode>(nav.getChildren().size());
- for (NavigationContainer.Node child : nav.getChildren())
- {
- PageNode node = new PageNode(child);
- children.add(node);
- }
-
- //
- this.ownerType = nav.getOwnerType();
- this.ownerId = nav.getOwnerId();
- this.description = nav.getDescription();
- this.creator = nav.getCreator();
- this.modifier = nav.getModifier();
- this.priority = nav.getPriority();
- this.pageNodes = children;
- }
-
- public int getId()
- {
- return getOwner().hashCode();
- }
-
- public String getOwnerId()
- {
- return ownerId;
- }
-
- public void setOwnerId(String ownerId)
- {
- this.ownerId = ownerId;
- }
-
- public String getOwnerType()
- {
- return ownerType;
- }
-
- public void setOwnerType(String ownerType)
- {
- this.ownerType = ownerType;
- }
-
- public boolean isModifiable()
- {
- return modifiable;
- }
-
- public void setModifiable(boolean b)
- {
- modifiable = b;
- }
-
- public void setDescription(String des)
- {
- description = des;
- }
-
- public String getDescription()
- {
- return description;
- }
-
- public int getPriority()
- {
- return priority;
- }
-
- public void setPriority(int i)
- {
- priority = i;
- }
-
- public String getCreator()
- {
- return creator;
- }
-
- public void setCreator(String s)
- {
- creator = s;
- }
-
- public String getModifier()
- {
- return modifier;
- }
-
- public void setModifier(String s)
- {
- modifier = s;
- }
-
- public String getOwner()
- {
- return ownerType + "::" + ownerId;
- }
-
- public void addNode(PageNode node)
- {
- if (pageNodes == null)
- pageNodes = new ArrayList<PageNode>();
- pageNodes.add(node);
- }
-
- public ArrayList<PageNode> getNodes()
- {
- return pageNodes;
- }
-
- public void setNodes(ArrayList<PageNode> nodes)
- {
- pageNodes = nodes;
- }
-
- public PageNode getNode(String name)
- {
- for (PageNode node : pageNodes)
- {
- if (node.getName().equals(name))
- return node;
- }
- return null;
- }
-
- public PageNavigation clone()
- {
- PageNavigation newNav = new PageNavigation();
- newNav.setOwnerId(ownerId);
- newNav.setOwnerType(ownerType);
- newNav.setPriority(priority);
- // newNav.setAccessPermissions(accessPermissions);
- // newNav.setEditPermission(editPermission);
- newNav.setModifiable(modifiable);
- // newNav.setDescription(description);
- newNav.setCreator(creator);
- newNav.setModifier(modifier);
-
- if (pageNodes == null || pageNodes.isEmpty())
- return newNav;
- for (PageNode ele : pageNodes)
- {
- newNav.getNodes().add(ele.clone());
- }
- return newNav;
- }
-
- public void merge(PageNavigation nav)
- {
- if (ownerId == null)
- setOwnerId(nav.ownerId);
- if (ownerType == null)
- setOwnerType(nav.ownerType);
- if (priority == 1)
- setPriority(nav.priority);
- if (!modifiable)
- setModifiable(nav.modifiable);
- if (description == null)
- setDescription(nav.description);
- if (creator == null)
- setCreator(nav.creator);
- if (modifier == null)
- setModifier(nav.modifier);
-
- if (nav.pageNodes == null || nav.pageNodes.isEmpty())
- {
- return;
- }
- if (pageNodes == null || pageNodes.isEmpty())
- {
- this.pageNodes = nav.pageNodes;
- return;
- }
- Map<String, PageNode> mPageNodes = new LinkedHashMap<String, PageNode>();
- for (PageNode node : nav.pageNodes)
- {
- mPageNodes.put(node.getName(), node);
- }
- if (pageNodes != null)
- {
- for (PageNode node : pageNodes)
- {
- mPageNodes.put(node.getName(), node);
- }
- }
- this.pageNodes = new ArrayList<PageNode>(mPageNodes.values());
- }
-
- @Override
- public String toString()
- {
- return "PageNavigation[ownerType=" + ownerType + ",ownerId=" + ownerId + "]";
- }
-
- @Override
- public NavigationContainer.Page buildNavigation()
- {
- List<NavigationContainer.Node> children = buildNavigationChildren();
- return new NavigationContainer.Page(
- storageId,
- ownerType,
- ownerId,
- description,
- creator,
- modifier,
- priority,
- children
- );
- }
-}
\ No newline at end of file
Added: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PageNavigation.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PageNavigation.java (rev 0)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PageNavigation.java 2009-10-24 07:50:41 UTC (rev 412)
@@ -0,0 +1,273 @@
+/**
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * 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.model;
+
+import org.exoplatform.portal.pom.config.data.NavigationContainer;
+
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+public class PageNavigation extends PageNodeContainer
+{
+
+ private String ownerType;
+
+ private String ownerId;
+
+ private String description;
+
+ private transient boolean modifiable;
+
+ private String creator;
+
+ private String modifier;
+
+ private ArrayList<PageNode> pageNodes;
+
+ private int priority = 1;
+
+ PageNavigation(String storageId)
+ {
+ super(storageId);
+
+ //
+ this.pageNodes = new ArrayList<PageNode>();
+ }
+
+ public PageNavigation()
+ {
+ this((String)null);
+ }
+
+ public PageNavigation(NavigationContainer.Page nav)
+ {
+ super(nav.getStorageId());
+
+ ArrayList<PageNode> children = new ArrayList<PageNode>(nav.getChildren().size());
+ for (NavigationContainer.Node child : nav.getChildren())
+ {
+ PageNode node = new PageNode(child);
+ children.add(node);
+ }
+
+ //
+ this.ownerType = nav.getOwnerType();
+ this.ownerId = nav.getOwnerId();
+ this.description = nav.getDescription();
+ this.creator = nav.getCreator();
+ this.modifier = nav.getModifier();
+ this.priority = nav.getPriority();
+ this.pageNodes = children;
+ }
+
+ public int getId()
+ {
+ return getOwner().hashCode();
+ }
+
+ public String getOwnerId()
+ {
+ return ownerId;
+ }
+
+ public void setOwnerId(String ownerId)
+ {
+ this.ownerId = ownerId;
+ }
+
+ public String getOwnerType()
+ {
+ return ownerType;
+ }
+
+ public void setOwnerType(String ownerType)
+ {
+ this.ownerType = ownerType;
+ }
+
+ public boolean isModifiable()
+ {
+ return modifiable;
+ }
+
+ public void setModifiable(boolean b)
+ {
+ modifiable = b;
+ }
+
+ public void setDescription(String des)
+ {
+ description = des;
+ }
+
+ public String getDescription()
+ {
+ return description;
+ }
+
+ public int getPriority()
+ {
+ return priority;
+ }
+
+ public void setPriority(int i)
+ {
+ priority = i;
+ }
+
+ public String getCreator()
+ {
+ return creator;
+ }
+
+ public void setCreator(String s)
+ {
+ creator = s;
+ }
+
+ public String getModifier()
+ {
+ return modifier;
+ }
+
+ public void setModifier(String s)
+ {
+ modifier = s;
+ }
+
+ public String getOwner()
+ {
+ return ownerType + "::" + ownerId;
+ }
+
+ public void addNode(PageNode node)
+ {
+ if (pageNodes == null)
+ pageNodes = new ArrayList<PageNode>();
+ pageNodes.add(node);
+ }
+
+ public ArrayList<PageNode> getNodes()
+ {
+ return pageNodes;
+ }
+
+ public void setNodes(ArrayList<PageNode> nodes)
+ {
+ pageNodes = nodes;
+ }
+
+ public PageNode getNode(String name)
+ {
+ for (PageNode node : pageNodes)
+ {
+ if (node.getName().equals(name))
+ return node;
+ }
+ return null;
+ }
+
+ public PageNavigation clone()
+ {
+ PageNavigation newNav = new PageNavigation();
+ newNav.setOwnerId(ownerId);
+ newNav.setOwnerType(ownerType);
+ newNav.setPriority(priority);
+ // newNav.setAccessPermissions(accessPermissions);
+ // newNav.setEditPermission(editPermission);
+ newNav.setModifiable(modifiable);
+ // newNav.setDescription(description);
+ newNav.setCreator(creator);
+ newNav.setModifier(modifier);
+
+ if (pageNodes == null || pageNodes.isEmpty())
+ return newNav;
+ for (PageNode ele : pageNodes)
+ {
+ newNav.getNodes().add(ele.clone());
+ }
+ return newNav;
+ }
+
+ public void merge(PageNavigation nav)
+ {
+ if (ownerId == null)
+ setOwnerId(nav.ownerId);
+ if (ownerType == null)
+ setOwnerType(nav.ownerType);
+ if (priority == 1)
+ setPriority(nav.priority);
+ if (!modifiable)
+ setModifiable(nav.modifiable);
+ if (description == null)
+ setDescription(nav.description);
+ if (creator == null)
+ setCreator(nav.creator);
+ if (modifier == null)
+ setModifier(nav.modifier);
+
+ if (nav.pageNodes == null || nav.pageNodes.isEmpty())
+ {
+ return;
+ }
+ if (pageNodes == null || pageNodes.isEmpty())
+ {
+ this.pageNodes = nav.pageNodes;
+ return;
+ }
+ Map<String, PageNode> mPageNodes = new LinkedHashMap<String, PageNode>();
+ for (PageNode node : nav.pageNodes)
+ {
+ mPageNodes.put(node.getName(), node);
+ }
+ if (pageNodes != null)
+ {
+ for (PageNode node : pageNodes)
+ {
+ mPageNodes.put(node.getName(), node);
+ }
+ }
+ this.pageNodes = new ArrayList<PageNode>(mPageNodes.values());
+ }
+
+ @Override
+ public String toString()
+ {
+ return "PageNavigation[ownerType=" + ownerType + ",ownerId=" + ownerId + "]";
+ }
+
+ @Override
+ public NavigationContainer.Page build()
+ {
+ List<NavigationContainer.Node> children = buildNavigationChildren();
+ return new NavigationContainer.Page(
+ storageId,
+ ownerType,
+ ownerId,
+ description,
+ creator,
+ modifier,
+ priority,
+ children
+ );
+ }
+}
\ No newline at end of file
Deleted: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PageNode.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PageNode.java 2009-10-23 19:09:03 UTC (rev 411)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PageNode.java 2009-10-24 07:50:41 UTC (rev 412)
@@ -1,307 +0,0 @@
-/**
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * 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.model;
-
-import org.exoplatform.commons.utils.ExpressionUtil;
-
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-import java.util.ResourceBundle;
-
-public class PageNode extends PageNodeContainer
-{
-
- private ArrayList<PageNode> children;
-
- private String uri;
-
- private String label;
-
- private String icon;
-
- private String name;
-
- private String resolvedLabel;
-
- private Date startPublicationDate;
-
- private Date endPublicationDate;
-
- private boolean showPublicationDate = false;
-
- private boolean visible = true;
-
- private String pageReference;
-
- private transient boolean modifiable;
-
- public PageNode(NavigationContainer.Node nav)
- {
- super(nav.getStorageId());
-
- //
- ArrayList<PageNode> children = new ArrayList<PageNode>(nav.getChildren().size());
- for (NavigationContainer.Node child : nav.getChildren())
- {
- PageNode node = new PageNode(child);
- children.add(node);
- }
-
- //
- this.uri = nav.getURI();
- this.label = nav.getLabel();
- this.icon = nav.getIcon();
- this.name = nav.getName();
- this.startPublicationDate = nav.getStartPublicationDate();
- this.endPublicationDate = nav.getEndPublicationDate();
- this.showPublicationDate = nav.getShowPublicationDate();
- this.visible = nav.isVisible();
- this.pageReference = nav.getPageReference();
- this.children = children;
- }
-
- public PageNode(String storageId)
- {
- super(storageId);
-
- //
- this.children = new ArrayList<PageNode>();
- }
-
- public PageNode()
- {
- this((String)null);
- }
-
- public String getUri()
- {
- return uri;
- }
-
- public void setUri(String s)
- {
- uri = s;
- }
-
- public String getLabel()
- {
- return label;
- }
-
- public void setLabel(String s)
- {
- label = s;
- resolvedLabel = s;
- }
-
- public String getIcon()
- {
- return icon;
- }
-
- public void setIcon(String s)
- {
- icon = s;
- }
-
- public String getPageReference()
- {
- return pageReference;
- }
-
- public void setPageReference(String s)
- {
- pageReference = s;
- }
-
- public String getName()
- {
- return name;
- }
-
- public void setName(String name)
- {
- this.name = name;
- }
-
- public String getResolvedLabel()
- {
- return resolvedLabel;
- }
-
- public void setResolvedLabel(String res)
- {
- resolvedLabel = res;
- }
-
- public void setResolvedLabel(ResourceBundle res)
- {
- resolvedLabel = ExpressionUtil.getExpressionValue(res, label);
- if (resolvedLabel == null)
- resolvedLabel = getName();
- }
-
- public List<PageNode> getChildren()
- {
- return children;
- }
-
- public void setChildren(ArrayList<PageNode> list)
- {
- children = list;
- }
-
- public boolean isModifiable()
- {
- return modifiable;
- }
-
- public void setModifiable(boolean b)
- {
- modifiable = b;
- }
-
- public Date getStartPublicationDate()
- {
- return startPublicationDate;
- }
-
- public void setStartPublicationDate(Date startDate)
- {
- startPublicationDate = startDate;
- }
-
- public Date getEndPublicationDate()
- {
- return endPublicationDate;
- }
-
- public void setEndPublicationDate(Date endDate)
- {
- endPublicationDate = endDate;
- }
-
- public boolean isDisplay()
- {
- if (visible && showPublicationDate)
- {
- return isInPublicationDate();
- }
- return visible;
- }
-
- public boolean isVisible()
- {
- return visible;
- }
-
- public boolean getVisible()
- {
- return visible;
- }
-
- public void setVisible(Boolean b)
- {
- visible = b.booleanValue();
- }
-
- private boolean isInPublicationDate()
- {
- if (startPublicationDate != null && endPublicationDate != null)
- {
- Date currentDate = new Date();
- if (currentDate.compareTo(startPublicationDate) >= 0 && currentDate.compareTo(endPublicationDate) <= 0)
- return true;
- }
- else if (startPublicationDate == null && endPublicationDate == null)
- return true;
- return false;
- }
-
- public void setShowPublicationDate(Boolean show)
- {
- showPublicationDate = show.booleanValue();
- }
-
- public boolean isShowPublicationDate()
- {
- return showPublicationDate;
- }
-
- public PageNode getChild(String name)
- {
- if (children == null)
- return null;
- for (PageNode node : children)
- {
- if (node.getName().equals(name))
- return node;
- }
- return null;
- }
-
- public List<PageNode> getNodes()
- {
- return children;
- }
-
- public PageNode clone()
- {
- PageNode newNode = new PageNode();
- newNode.setUri(uri);
- newNode.setLabel(label);
- newNode.setIcon(icon);
- newNode.setName(name);
- newNode.setResolvedLabel(resolvedLabel);
- newNode.setPageReference(pageReference);
- newNode.setModifiable(modifiable);
- newNode.setShowPublicationDate(showPublicationDate);
- newNode.setStartPublicationDate(startPublicationDate);
- newNode.setEndPublicationDate(endPublicationDate);
- newNode.setVisible(visible);
- if (children == null || children.size() < 1)
- return newNode;
- for (PageNode ele : children)
- {
- newNode.getChildren().add(ele.clone());
- }
- return newNode;
- }
-
- @Override
- public NavigationContainer.Node buildNavigation()
- {
- List<NavigationContainer.Node> children = buildNavigationChildren();
- return new NavigationContainer.Node(
- storageId,
- uri,
- label,
- icon,
- name,
- startPublicationDate,
- endPublicationDate,
- showPublicationDate,
- visible,
- pageReference,
- children
- );
- }
-}
\ No newline at end of file
Added: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PageNode.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PageNode.java (rev 0)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PageNode.java 2009-10-24 07:50:41 UTC (rev 412)
@@ -0,0 +1,308 @@
+/**
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * 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.model;
+
+import org.exoplatform.commons.utils.ExpressionUtil;
+import org.exoplatform.portal.pom.config.data.NavigationContainer;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.ResourceBundle;
+
+public class PageNode extends PageNodeContainer
+{
+
+ private ArrayList<PageNode> children;
+
+ private String uri;
+
+ private String label;
+
+ private String icon;
+
+ private String name;
+
+ private String resolvedLabel;
+
+ private Date startPublicationDate;
+
+ private Date endPublicationDate;
+
+ private boolean showPublicationDate = false;
+
+ private boolean visible = true;
+
+ private String pageReference;
+
+ private transient boolean modifiable;
+
+ public PageNode(NavigationContainer.Node nav)
+ {
+ super(nav.getStorageId());
+
+ //
+ ArrayList<PageNode> children = new ArrayList<PageNode>(nav.getChildren().size());
+ for (NavigationContainer.Node child : nav.getChildren())
+ {
+ PageNode node = new PageNode(child);
+ children.add(node);
+ }
+
+ //
+ this.uri = nav.getURI();
+ this.label = nav.getLabel();
+ this.icon = nav.getIcon();
+ this.name = nav.getName();
+ this.startPublicationDate = nav.getStartPublicationDate();
+ this.endPublicationDate = nav.getEndPublicationDate();
+ this.showPublicationDate = nav.getShowPublicationDate();
+ this.visible = nav.isVisible();
+ this.pageReference = nav.getPageReference();
+ this.children = children;
+ }
+
+ public PageNode(String storageId)
+ {
+ super(storageId);
+
+ //
+ this.children = new ArrayList<PageNode>();
+ }
+
+ public PageNode()
+ {
+ this((String)null);
+ }
+
+ public String getUri()
+ {
+ return uri;
+ }
+
+ public void setUri(String s)
+ {
+ uri = s;
+ }
+
+ public String getLabel()
+ {
+ return label;
+ }
+
+ public void setLabel(String s)
+ {
+ label = s;
+ resolvedLabel = s;
+ }
+
+ public String getIcon()
+ {
+ return icon;
+ }
+
+ public void setIcon(String s)
+ {
+ icon = s;
+ }
+
+ public String getPageReference()
+ {
+ return pageReference;
+ }
+
+ public void setPageReference(String s)
+ {
+ pageReference = s;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ public String getResolvedLabel()
+ {
+ return resolvedLabel;
+ }
+
+ public void setResolvedLabel(String res)
+ {
+ resolvedLabel = res;
+ }
+
+ public void setResolvedLabel(ResourceBundle res)
+ {
+ resolvedLabel = ExpressionUtil.getExpressionValue(res, label);
+ if (resolvedLabel == null)
+ resolvedLabel = getName();
+ }
+
+ public List<PageNode> getChildren()
+ {
+ return children;
+ }
+
+ public void setChildren(ArrayList<PageNode> list)
+ {
+ children = list;
+ }
+
+ public boolean isModifiable()
+ {
+ return modifiable;
+ }
+
+ public void setModifiable(boolean b)
+ {
+ modifiable = b;
+ }
+
+ public Date getStartPublicationDate()
+ {
+ return startPublicationDate;
+ }
+
+ public void setStartPublicationDate(Date startDate)
+ {
+ startPublicationDate = startDate;
+ }
+
+ public Date getEndPublicationDate()
+ {
+ return endPublicationDate;
+ }
+
+ public void setEndPublicationDate(Date endDate)
+ {
+ endPublicationDate = endDate;
+ }
+
+ public boolean isDisplay()
+ {
+ if (visible && showPublicationDate)
+ {
+ return isInPublicationDate();
+ }
+ return visible;
+ }
+
+ public boolean isVisible()
+ {
+ return visible;
+ }
+
+ public boolean getVisible()
+ {
+ return visible;
+ }
+
+ public void setVisible(Boolean b)
+ {
+ visible = b.booleanValue();
+ }
+
+ private boolean isInPublicationDate()
+ {
+ if (startPublicationDate != null && endPublicationDate != null)
+ {
+ Date currentDate = new Date();
+ if (currentDate.compareTo(startPublicationDate) >= 0 && currentDate.compareTo(endPublicationDate) <= 0)
+ return true;
+ }
+ else if (startPublicationDate == null && endPublicationDate == null)
+ return true;
+ return false;
+ }
+
+ public void setShowPublicationDate(Boolean show)
+ {
+ showPublicationDate = show.booleanValue();
+ }
+
+ public boolean isShowPublicationDate()
+ {
+ return showPublicationDate;
+ }
+
+ public PageNode getChild(String name)
+ {
+ if (children == null)
+ return null;
+ for (PageNode node : children)
+ {
+ if (node.getName().equals(name))
+ return node;
+ }
+ return null;
+ }
+
+ public List<PageNode> getNodes()
+ {
+ return children;
+ }
+
+ public PageNode clone()
+ {
+ PageNode newNode = new PageNode();
+ newNode.setUri(uri);
+ newNode.setLabel(label);
+ newNode.setIcon(icon);
+ newNode.setName(name);
+ newNode.setResolvedLabel(resolvedLabel);
+ newNode.setPageReference(pageReference);
+ newNode.setModifiable(modifiable);
+ newNode.setShowPublicationDate(showPublicationDate);
+ newNode.setStartPublicationDate(startPublicationDate);
+ newNode.setEndPublicationDate(endPublicationDate);
+ newNode.setVisible(visible);
+ if (children == null || children.size() < 1)
+ return newNode;
+ for (PageNode ele : children)
+ {
+ newNode.getChildren().add(ele.clone());
+ }
+ return newNode;
+ }
+
+ @Override
+ public NavigationContainer.Node build()
+ {
+ List<NavigationContainer.Node> children = buildNavigationChildren();
+ return new NavigationContainer.Node(
+ storageId,
+ uri,
+ label,
+ icon,
+ name,
+ startPublicationDate,
+ endPublicationDate,
+ showPublicationDate,
+ visible,
+ pageReference,
+ children
+ );
+ }
+}
\ No newline at end of file
Deleted: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PageNodeContainer.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PageNodeContainer.java 2009-10-23 19:09:03 UTC (rev 411)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PageNodeContainer.java 2009-10-24 07:50:41 UTC (rev 412)
@@ -1,66 +0,0 @@
-/**
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * 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.model;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public abstract class PageNodeContainer extends ModelObject
-{
-
- public PageNodeContainer(String storageId)
- {
- super(storageId);
- }
-
- public PageNodeContainer()
- {
- }
-
- public abstract List<PageNode> getNodes();
-
- protected List<NavigationContainer.Node> buildNavigationChildren()
- {
- List<PageNode> nodes = getNodes();
- if (nodes != null)
- {
- ArrayList<NavigationContainer.Node> children = new ArrayList<NavigationContainer.Node>();
- for (int i = 0;i < nodes.size();i++)
- {
- PageNode node = nodes.get(i);
- NavigationContainer.Node child = node.buildNavigation();
- children.add(child);
- }
- return Collections.unmodifiableList(children);
- }
- else
- {
- return Collections.emptyList();
- }
- }
-
- public abstract NavigationContainer buildNavigation();
-
-}
Added: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PageNodeContainer.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PageNodeContainer.java (rev 0)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PageNodeContainer.java 2009-10-24 07:50:41 UTC (rev 412)
@@ -0,0 +1,69 @@
+/**
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * 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.model;
+
+import org.exoplatform.portal.config.model.ModelObject;
+import org.exoplatform.portal.pom.config.data.NavigationContainer;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public abstract class PageNodeContainer extends ModelObject
+{
+
+ public PageNodeContainer(String storageId)
+ {
+ super(storageId);
+ }
+
+ public PageNodeContainer()
+ {
+ }
+
+ public abstract List<PageNode> getNodes();
+
+ protected List<NavigationContainer.Node> buildNavigationChildren()
+ {
+ List<PageNode> nodes = getNodes();
+ if (nodes != null)
+ {
+ ArrayList<NavigationContainer.Node> children = new ArrayList<NavigationContainer.Node>();
+ for (int i = 0;i < nodes.size();i++)
+ {
+ PageNode node = nodes.get(i);
+ NavigationContainer.Node child = node.build();
+ children.add(child);
+ }
+ return Collections.unmodifiableList(children);
+ }
+ else
+ {
+ return Collections.emptyList();
+ }
+ }
+
+ public abstract NavigationContainer build();
+
+}
Modified: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PortalConfig.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PortalConfig.java 2009-10-23 19:09:03 UTC (rev 411)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PortalConfig.java 2009-10-24 07:50:41 UTC (rev 412)
@@ -20,6 +20,7 @@
package org.exoplatform.portal.config.model;
import org.exoplatform.portal.pom.config.Utils;
+import org.exoplatform.portal.pom.config.data.PortalData;
import java.util.ArrayList;
import java.util.List;
@@ -102,7 +103,7 @@
this.properties = new Properties(data.getProperties());
this.skin = data.getSkin();
this.title = data.getTitle();
- this.portalLayout = data.getPortalLayout();
+ this.portalLayout = new Container(data.getPortalLayout());
this.creator = data.getCreator();
this.modifier = data.getModifier();
}
@@ -320,7 +321,7 @@
return container;
}
- public PortalData buildData()
+ public PortalData build()
{
List<String> accessPermissions = Utils.safeImmutableList(this.accessPermissions);
Map<String, String> properties = Utils.safeImmutableMap(this.properties);
@@ -334,7 +335,7 @@
properties,
skin,
title,
- portalLayout,
+ portalLayout.build(),
creator,
modifier);
}
Deleted: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PortalData.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PortalData.java 2009-10-23 19:09:03 UTC (rev 411)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PortalData.java 2009-10-24 07:50:41 UTC (rev 412)
@@ -1,146 +0,0 @@
-/*
- * Copyright (C) 2003-2007 eXo Platform SAS.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
- *
- * This program 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
- */
-package org.exoplatform.portal.config.model;
-
-import java.util.List;
-import java.util.Map;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public class PortalData extends ModelData
-{
-
- /** . */
- private final String name;
-
- /** . */
- private final String type;
-
- /** . */
- private final String locale;
-
- /** . */
- private final List<String> accessPermissions;
-
- /** . */
- private final String editPermission;
-
- /** . */
- private final Map<String, String> properties;
-
- /** . */
- private final String skin;
-
- /** . */
- private final String title;
-
- /** . */
- private final Container portalLayout;
-
- /** . */
- private final String creator;
-
- /** . */
- private final String modifier;
-
- public PortalData(
- String storageId,
- String name,
- String type,
- String locale,
- List<String> accessPermissions,
- String editPermission,
- Map<String, String> properties,
- String skin,
- String title,
- Container portalLayout,
- String creator,
- String modifier)
- {
- super(storageId, null);
-
- //
- this.name = name;
- this.type = type;
- this.locale = locale;
- this.accessPermissions = accessPermissions;
- this.editPermission = editPermission;
- this.properties = properties;
- this.skin = skin;
- this.title = title;
- this.portalLayout = portalLayout;
- this.creator = creator;
- this.modifier = modifier;
- }
-
- public String getName()
- {
- return name;
- }
-
- public String getType()
- {
- return type;
- }
-
- public String getLocale()
- {
- return locale;
- }
-
- public List<String> getAccessPermissions()
- {
- return accessPermissions;
- }
-
- public String getEditPermission()
- {
- return editPermission;
- }
-
- public Map<String, String> getProperties()
- {
- return properties;
- }
-
- public String getSkin()
- {
- return skin;
- }
-
- public String getTitle()
- {
- return title;
- }
-
- public Container getPortalLayout()
- {
- return portalLayout;
- }
-
- public String getCreator()
- {
- return creator;
- }
-
- public String getModifier()
- {
- return modifier;
- }
-}
Deleted: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PortalKey.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PortalKey.java 2009-10-23 19:09:03 UTC (rev 411)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PortalKey.java 2009-10-24 07:50:41 UTC (rev 412)
@@ -1,30 +0,0 @@
-/*
- * Copyright (C) 2003-2007 eXo Platform SAS.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
- *
- * This program 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
- */
-package org.exoplatform.portal.config.model;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public class PortalKey extends OwnerKey
-{
-
- public PortalKey(String ownerType, String ownerId)
- {
- super(ownerType, ownerId);
- }
-}
Modified: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/SiteBody.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/SiteBody.java 2009-10-23 19:09:03 UTC (rev 411)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/SiteBody.java 2009-10-24 07:50:41 UTC (rev 412)
@@ -19,6 +19,10 @@
package org.exoplatform.portal.config.model;
+import org.exoplatform.portal.pom.config.data.BodyData;
+import org.exoplatform.portal.pom.config.data.BodyType;
+import org.exoplatform.portal.pom.config.data.ModelData;
+
public class SiteBody extends ModelObject
{
@@ -30,4 +34,10 @@
public SiteBody()
{
}
+
+ @Override
+ public ModelData build()
+ {
+ return new BodyData(storageId, BodyType.SITE);
+ }
}
Modified: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/gadget/GadgetApplication.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/gadget/GadgetApplication.java 2009-10-23 19:09:03 UTC (rev 411)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/gadget/GadgetApplication.java 2009-10-24 07:50:41 UTC (rev 412)
@@ -20,6 +20,7 @@
package org.exoplatform.portal.config.model.gadget;
import org.exoplatform.portal.config.model.Application;
+import org.exoplatform.portal.pom.config.data.ApplicationData;
import org.exoplatform.portal.config.model.ApplicationType;
import org.exoplatform.portal.pom.spi.gadget.Gadget;
@@ -30,6 +31,11 @@
public class GadgetApplication extends Application<Gadget, GadgetId>
{
+ public GadgetApplication(ApplicationData<Gadget, GadgetId> data)
+ {
+ super(data);
+ }
+
public GadgetApplication(String storageId, String gadgetName)
{
super(storageId, new GadgetId(gadgetName));
Modified: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/portlet/PortletApplication.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/portlet/PortletApplication.java 2009-10-23 19:09:03 UTC (rev 411)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/portlet/PortletApplication.java 2009-10-24 07:50:41 UTC (rev 412)
@@ -20,6 +20,7 @@
package org.exoplatform.portal.config.model.portlet;
import org.exoplatform.portal.config.model.Application;
+import org.exoplatform.portal.pom.config.data.ApplicationData;
import org.exoplatform.portal.config.model.ApplicationType;
import org.exoplatform.portal.pom.spi.portlet.Preferences;
@@ -30,6 +31,11 @@
public class PortletApplication extends Application<Preferences, PortletId>
{
+ public PortletApplication(ApplicationData<Preferences, PortletId> data)
+ {
+ super(data);
+ }
+
public PortletApplication(String storageId, String applicationName, String portletName)
{
super(storageId, new PortletId(applicationName, portletName));
Modified: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/wsrp/WSRPApplication.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/wsrp/WSRPApplication.java 2009-10-23 19:09:03 UTC (rev 411)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/wsrp/WSRPApplication.java 2009-10-24 07:50:41 UTC (rev 412)
@@ -20,6 +20,7 @@
package org.exoplatform.portal.config.model.wsrp;
import org.exoplatform.portal.config.model.Application;
+import org.exoplatform.portal.pom.config.data.ApplicationData;
import org.exoplatform.portal.config.model.ApplicationType;
import org.exoplatform.portal.pom.spi.wsrp.WSRPState;
@@ -30,6 +31,11 @@
public class WSRPApplication extends Application<WSRPState, WSRPId>
{
+ public WSRPApplication(ApplicationData<WSRPState, WSRPId> data)
+ {
+ super(data);
+ }
+
public WSRPApplication(String storageId, WSRPId id)
{
super(storageId, id);
Added: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/ModelDemarcation.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/ModelDemarcation.java (rev 0)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/ModelDemarcation.java 2009-10-24 07:50:41 UTC (rev 412)
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2003-2007 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.portal.pom.config;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public interface ModelDemarcation
+{
+
+ void begin();
+
+ void end(boolean save);
+
+}
Modified: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMDataStorage.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMDataStorage.java 2009-10-23 19:09:03 UTC (rev 411)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMDataStorage.java 2009-10-24 07:50:41 UTC (rev 412)
@@ -23,19 +23,20 @@
import org.exoplatform.commons.utils.LazyPageList;
import org.exoplatform.container.configuration.ConfigurationManager;
import org.exoplatform.portal.application.PortletPreferences;
-import org.exoplatform.portal.config.DataStorage;
import org.exoplatform.portal.config.Query;
import org.exoplatform.portal.config.model.Application;
import org.exoplatform.portal.config.model.ApplicationState;
import org.exoplatform.portal.config.model.Container;
import org.exoplatform.portal.config.model.ModelChange;
import org.exoplatform.portal.config.model.ModelObject;
-import org.exoplatform.portal.config.model.NavigationContainer;
-import org.exoplatform.portal.config.model.Page;
+import org.exoplatform.portal.pom.config.data.ModelDataStorage;
+import org.exoplatform.portal.pom.config.data.NavigationContainer;
+import org.exoplatform.portal.pom.config.data.NavigationKey;
+import org.exoplatform.portal.pom.config.data.PageData;
import org.exoplatform.portal.config.model.PersistentApplicationState;
-import org.exoplatform.portal.config.model.PortalConfig;
-import org.exoplatform.portal.config.model.PortalData;
-import org.exoplatform.portal.config.model.PortalKey;
+import org.exoplatform.portal.pom.config.data.PageKey;
+import org.exoplatform.portal.pom.config.data.PortalData;
+import org.exoplatform.portal.pom.config.data.PortalKey;
import org.exoplatform.portal.config.model.TransientApplicationState;
import org.exoplatform.portal.pom.config.tasks.PageNavigationTask;
import org.exoplatform.portal.pom.config.tasks.PageTask;
@@ -58,7 +59,7 @@
* @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
* @version $Revision$
*/
-public class POMDataStorage implements DataStorage
+public class POMDataStorage implements ModelDataStorage, ModelDemarcation
{
/** . */
@@ -102,16 +103,11 @@
return pomMgr;
}
- public PortalData getPortalConfig(String portalName) throws Exception
+ public PortalData getPortalConfig(PortalKey key) throws Exception
{
- return execute(new PortalConfigTask.Load(PortalConfig.PORTAL_TYPE, portalName)).getConfig();
+ return execute(new PortalConfigTask.Load(key)).getConfig();
}
- public PortalData getPortalConfig(String ownerType, String portalName) throws Exception
- {
- return execute(new PortalConfigTask.Load(ownerType, portalName)).getConfig();
- }
-
public void create(PortalData config) throws Exception
{
execute(new PortalConfigTask.Save(config, true));
@@ -124,56 +120,40 @@
public void remove(PortalData config) throws Exception
{
- execute(new PortalConfigTask.Remove(config.getType(), config.getName()));
+ execute(new PortalConfigTask.Remove(config.getKey()));
}
- public Page getPage(String pageId) throws Exception
+ public PageData getPage(PageKey key) throws Exception
{
- return execute(new PageTask.Load(pageId)).getPage();
+ return execute(new PageTask.Load(key)).getPage();
}
- public Page clonePage(String pageId, String clonedOwnerType, String clonedOwnerId, String clonedName)
+ public PageData clonePage(PageKey key, PageKey cloneKey)
throws Exception
{
- return execute(new PageTask.Clone(pageId, clonedOwnerType, clonedOwnerId, clonedName, true)).getPage();
+ return execute(new PageTask.Clone(key, cloneKey, true)).getPage();
}
- public void remove(Page page) throws Exception
+ public void remove(PageData page) throws Exception
{
execute(new PageTask.Remove(page));
}
- public void create(Page page) throws Exception
+ public void create(PageData page) throws Exception
{
execute(new PageTask.Save(page));
}
- public List<ModelChange> save(Page page) throws Exception
+ public List<ModelChange> save(PageData page) throws Exception
{
return execute(new PageTask.Save(page)).getChanges();
}
- public NavigationContainer.Page getPageNavigation(String owner) throws Exception
+ public NavigationContainer.Page getPageNavigation(NavigationKey key) throws Exception
{
- String[] chunks = Utils.split("::", owner);
- if (chunks.length != 2)
- {
- throw new IllegalArgumentException("Wrong owner format should be ownerType::ownerId was " + owner);
- }
-
- //
- String ownerType = chunks[0];
- String ownerId = chunks[1];
-
- //
- return getPageNavigation(ownerType, ownerId);
+ return execute(new PageNavigationTask.Load(key)).getPageNavigation();
}
- public NavigationContainer.Page getPageNavigation(String ownerType, String id) throws Exception
- {
- return execute(new PageNavigationTask.Load(ownerType, id)).getPageNavigation();
- }
-
public void save(NavigationContainer.Page navigation) throws Exception
{
execute(new PageNavigationTask.Save(navigation, true));
@@ -237,9 +217,9 @@
public <T> LazyPageList<T> find(Query<T> q, Comparator<T> sortComparator) throws Exception
{
Class<T> type = q.getClassType();
- if (Page.class.equals(type))
+ if (PageData.class.equals(type))
{
- return (LazyPageList<T>)execute(new SearchTask.FindPage((Query<Page>)q)).getResult();
+ return (LazyPageList<T>)execute(new SearchTask.FindPage((Query<PageData>)q)).getResult();
}
else if (NavigationContainer.Page.class.equals(type))
{
@@ -293,4 +273,14 @@
generateStorageName(container);
return container;
}
+
+ public void begin()
+ {
+ getPOMSessionManager().openSession();
+ }
+
+ public void end(boolean save)
+ {
+ getPOMSessionManager().closeSession(save);
+ }
}
Modified: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMSession.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMSession.java 2009-10-23 19:09:03 UTC (rev 411)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMSession.java 2009-10-24 07:50:41 UTC (rev 412)
@@ -21,7 +21,7 @@
import org.chromattic.api.ChromatticSession;
import org.exoplatform.portal.application.PortletPreferences;
-import org.exoplatform.portal.config.model.Mapper;
+import org.exoplatform.portal.pom.config.data.Mapper;
import org.gatein.mop.api.Model;
import org.gatein.mop.api.content.Customization;
import org.gatein.mop.api.workspace.ObjectType;
Copied: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/ApplicationData.java (from rev 411, portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/ApplicationData.java)
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/ApplicationData.java (rev 0)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/ApplicationData.java 2009-10-24 07:50:41 UTC (rev 412)
@@ -0,0 +1,189 @@
+/*
+ * Copyright (C) 2003-2007 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.portal.pom.config.data;
+
+import org.exoplatform.portal.config.model.ApplicationState;
+import org.exoplatform.portal.config.model.ApplicationType;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class ApplicationData<S, I> extends ComponentData
+{
+
+ /** . */
+ private final ApplicationType<S, I> type;
+
+ /** . */
+ private final ApplicationState<S> state;
+
+ /** . */
+ private final I ref;
+
+ /** . */
+ private final String id;
+
+ /** . */
+ private final String title;
+
+ /** . */
+ private final String icon;
+
+ /** . */
+ private final String description;
+
+ /** . */
+ private final boolean showInfoBar;
+
+ /** . */
+ private final boolean showApplicationState;
+
+ /** . */
+ private final boolean showApplicationMode;
+
+ /** . */
+ private final String theme;
+
+ /** . */
+ private final String width;
+
+ /** . */
+ private final String height;
+
+ /** . */
+ private final Map<String, String> properties;
+
+ /** . */
+ private final List<String> accessPermissions;
+
+ public ApplicationData(
+ String storageId,
+ String storageName,
+ ApplicationType<S, I> type,
+ ApplicationState<S> state,
+ I ref,
+ String id,
+ String title,
+ String icon,
+ String description,
+ boolean showInfoBar,
+ boolean showApplicationState,
+ boolean showApplicationMode,
+ String theme, String width,
+ String height,
+ Map<String, String> properties,
+ List<String> accessPermissions)
+ {
+ super(storageId, storageName);
+
+ //
+ this.type = type;
+ this.state = state;
+ this.ref = ref;
+ this.id = id;
+ this.title = title;
+ this.icon = icon;
+ this.description = description;
+ this.showInfoBar = showInfoBar;
+ this.showApplicationState = showApplicationState;
+ this.showApplicationMode = showApplicationMode;
+ this.theme = theme;
+ this.width = width;
+ this.height = height;
+ this.properties = properties;
+ this.accessPermissions = accessPermissions;
+ }
+
+ public ApplicationType<S, I> getType()
+ {
+ return type;
+ }
+
+ public ApplicationState<S> getState()
+ {
+ return state;
+ }
+
+ public I getRef()
+ {
+ return ref;
+ }
+
+ public String getId()
+ {
+ return id;
+ }
+
+ public String getTitle()
+ {
+ return title;
+ }
+
+ public String getIcon()
+ {
+ return icon;
+ }
+
+ public String getDescription()
+ {
+ return description;
+ }
+
+ public boolean isShowInfoBar()
+ {
+ return showInfoBar;
+ }
+
+ public boolean isShowApplicationState()
+ {
+ return showApplicationState;
+ }
+
+ public boolean isShowApplicationMode()
+ {
+ return showApplicationMode;
+ }
+
+ public String getTheme()
+ {
+ return theme;
+ }
+
+ public String getWidth()
+ {
+ return width;
+ }
+
+ public String getHeight()
+ {
+ return height;
+ }
+
+ public Map<String, String> getProperties()
+ {
+ return properties;
+ }
+
+ public List<String> getAccessPermissions()
+ {
+ return accessPermissions;
+ }
+}
Copied: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/BodyData.java (from rev 411, portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/BodyData.java)
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/BodyData.java (rev 0)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/BodyData.java 2009-10-24 07:50:41 UTC (rev 412)
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2003-2007 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.portal.pom.config.data;
+
+import org.exoplatform.portal.pom.config.data.BodyType;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class BodyData extends ComponentData
+{
+
+ /** . */
+ private final BodyType type;
+
+ public BodyData(String storageId, BodyType type)
+ {
+ super(storageId, null);
+
+ //
+ this.type = type;
+ }
+
+ public BodyType getType()
+ {
+ return type;
+ }
+}
Copied: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/BodyType.java (from rev 411, portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/BodyType.java)
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/BodyType.java (rev 0)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/BodyType.java 2009-10-24 07:50:41 UTC (rev 412)
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2003-2007 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.portal.pom.config.data;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public enum BodyType
+{
+
+ SITE, PAGE
+
+}
Copied: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/ComponentData.java (from rev 411, portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/ComponentData.java)
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/ComponentData.java (rev 0)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/ComponentData.java 2009-10-24 07:50:41 UTC (rev 412)
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2003-2007 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.portal.pom.config.data;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class ComponentData extends ModelData
+{
+
+ public ComponentData(String storageId, String storageName)
+ {
+ super(storageId, storageName);
+ }
+}
Copied: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/ContainerData.java (from rev 411, portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/ContainerData.java)
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/ContainerData.java (rev 0)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/ContainerData.java 2009-10-24 07:50:41 UTC (rev 412)
@@ -0,0 +1,155 @@
+/*
+ * Copyright (C) 2003-2007 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.portal.pom.config.data;
+
+import java.util.List;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class ContainerData extends ComponentData
+{
+
+ /** . */
+ private final String id;
+
+ /** . */
+ private final String name;
+
+ /** . */
+ private final String icon;
+
+ /** . */
+ private final String decorator;
+
+ /** . */
+ private final String template;
+
+ /** . */
+ private final String factoryId;
+
+ /** . */
+ private final String title;
+
+ /** . */
+ private final String description;
+
+ /** . */
+ private final String width;
+
+ /** . */
+ private final String height;
+
+ /** . */
+ private final List<String> accessPermissions;
+
+ /** . */
+ private final List<ComponentData> children;
+
+ public ContainerData(
+ String storageId,
+ String id,
+ String name,
+ String icon,
+ String decorator,
+ String template,
+ String factoryId,
+ String title,
+ String description,
+ String width,
+ String height,
+ List<String> accessPermissions,
+ List<ComponentData> children)
+ {
+ super(storageId, null);
+
+ //
+ this.id = id;
+ this.name = name;
+ this.icon = icon;
+ this.decorator = decorator;
+ this.template = template;
+ this.factoryId = factoryId;
+ this.title = title;
+ this.description = description;
+ this.width = width;
+ this.height = height;
+ this.accessPermissions = accessPermissions;
+ this.children = children;
+ }
+
+ public String getId()
+ {
+ return id;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public String getIcon()
+ {
+ return icon;
+ }
+
+ public String getDecorator()
+ {
+ return decorator;
+ }
+
+ public String getTemplate()
+ {
+ return template;
+ }
+
+ public String getFactoryId()
+ {
+ return factoryId;
+ }
+
+ public String getTitle()
+ {
+ return title;
+ }
+
+ public String getDescription()
+ {
+ return description;
+ }
+
+ public String getWidth()
+ {
+ return width;
+ }
+
+ public String getHeight()
+ {
+ return height;
+ }
+
+ public List<String> getAccessPermissions()
+ {
+ return accessPermissions;
+ }
+
+ public List<ComponentData> getChildren()
+ {
+ return children;
+ }
+}
Copied: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/DashboardData.java (from rev 411, portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/DashboardData.java)
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/DashboardData.java (rev 0)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/DashboardData.java 2009-10-24 07:50:41 UTC (rev 412)
@@ -0,0 +1,103 @@
+/*
+ * Copyright (C) 2003-2007 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.portal.pom.config.data;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class DashboardData extends ContainerData
+{
+
+ public DashboardData(
+ String storageId,
+ String id,
+ String name,
+ String icon,
+ String decorator,
+ String template,
+ String factoryId,
+ String title,
+ String description,
+ String width,
+ String height,
+ List<String> accessPermissions,
+ List<ComponentData> children)
+ {
+ super(
+ storageId,
+ id,
+ name,
+ icon,
+ decorator,
+ template,
+ factoryId,
+ title,
+ description,
+ width,
+ height,
+ accessPermissions,
+ children);
+ }
+
+ /** . */
+ static final DashboardData INITIAL_DASHBOARD;
+
+ static
+ {
+ List<ComponentData> children = new ArrayList<ComponentData>();
+ for (int i = 0; i < 3; i++)
+ {
+ ContainerData row = new ContainerData(
+ null,
+ null,
+ null,
+ null,
+ null,
+ "classpath:groovy/dashboard/webui/component/UIContainer.gtmpl",
+ null,
+ null,
+ null,
+ null,
+ null,
+ Collections.<String>emptyList(),
+ Collections.<ComponentData>emptyList());
+ children.add(row);
+ }
+
+ INITIAL_DASHBOARD = new DashboardData(
+ null,
+ null,
+ null,
+ null,
+ null,
+ "classpath:groovy/dashboard/webui/component/UIColumnContainer.gtmpl",
+ null,
+ null,
+ null,
+ null,
+ null,
+ Collections.<String>emptyList(),
+ Collections.unmodifiableList(children)
+ );
+ }
+
+}
Copied: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/MappedAttributes.java (from rev 392, portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/MappedAttributes.java)
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/MappedAttributes.java (rev 0)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/MappedAttributes.java 2009-10-24 07:50:41 UTC (rev 412)
@@ -0,0 +1,126 @@
+/**
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * 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.pom.config.data;
+
+import org.gatein.mop.api.Key;
+import org.gatein.mop.api.ValueType;
+
+import java.util.Date;
+
+/**
+ * A class to hold the various attributes mapped between the model and the mop layer.
+ *
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+class MappedAttributes
+{
+
+ private MappedAttributes()
+ {
+ }
+
+ /** . */
+ public static final Key<String> ID = Key.create("id", ValueType.STRING);
+
+ /** . */
+ public static final Key<String> NAME = Key.create("name", ValueType.STRING);
+
+ /** . */
+ public static final Key<Boolean> SHOW_MAX_WINDOW = Key.create("show-max-window", ValueType.BOOLEAN);
+
+ /** . */
+ public static final Key<String> TITLE = Key.create("title", ValueType.STRING);
+
+ /** . */
+ public static final Key<String> FACTORY_ID = Key.create("factory-id", ValueType.STRING);
+
+ /** . */
+ public static final Key<String> ACCESS_PERMISSIONS = Key.create("access-permissions", ValueType.STRING);
+
+ /** . */
+ public static final Key<String> EDIT_PERMISSION = Key.create("edit-permission", ValueType.STRING);
+
+ /** . */
+ public static final Key<String> CREATOR = Key.create("creator", ValueType.STRING);
+
+ /** . */
+ public static final Key<String> MODIFIER = Key.create("modifier", ValueType.STRING);
+
+ /** . */
+ public static final Key<String> DESCRIPTION = Key.create("description", ValueType.STRING);
+
+ /** . */
+ public static final Key<String> DECORATOR = Key.create("decorator", ValueType.STRING);
+
+ /** . */
+ public static final Key<Integer> PRIORITY = Key.create("priority", ValueType.INTEGER);
+
+ /** . */
+ public static final Key<String> LABEL = Key.create("label", ValueType.STRING);
+
+ /** . */
+ public static final Key<String> ICON = Key.create("icon", ValueType.STRING);
+
+ /** . */
+ public static final Key<String> URI = Key.create("uri", ValueType.STRING);
+
+ /** . */
+ public static final Key<Date> START_PUBLICATION_DATE = Key.create("start-publication-date", ValueType.DATE);
+
+ /** . */
+ public static final Key<Date> END_PUBLICATION_DATE = Key.create("end-publication-date", ValueType.DATE);
+
+ /** . */
+ public static final Key<Boolean> VISIBLE = Key.create("visible", ValueType.BOOLEAN);
+
+ /** . */
+ public static final Key<String> TEMPLATE = Key.create("template", ValueType.STRING);
+
+ /** . */
+ public static final Key<Boolean> SHOW_PUBLICATION_DATE = Key.create("show-publication-date", ValueType.BOOLEAN);
+
+ /** . */
+ public static final Key<Boolean> SHOW_INFO_BAR = Key.create("show-info-bar", ValueType.BOOLEAN);
+
+ /** . */
+ public static final Key<Boolean> SHOW_STATE = Key.create("show-state", ValueType.BOOLEAN);
+
+ /** . */
+ public static final Key<Boolean> SHOW_MODE = Key.create("show-mode", ValueType.BOOLEAN);
+
+ /** . */
+ public static final Key<String> LOCALE = Key.create("locale", ValueType.STRING);
+
+ /** . */
+ public static final Key<String> SKIN = Key.create("skin", ValueType.STRING);
+
+ /** . */
+ public static final Key<String> WIDTH = Key.create("width", ValueType.STRING);
+
+ /** . */
+ public static final Key<String> HEIGHT = Key.create("height", ValueType.STRING);
+
+ /** . */
+ public static final Key<String> TYPE = Key.create("type", ValueType.STRING);
+
+ /** . */
+ public static final Key<String> THEME = Key.create("theme", ValueType.STRING);
+}
Copied: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/Mapper.java (from rev 411, portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/Mapper.java)
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/Mapper.java (rev 0)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/Mapper.java 2009-10-24 07:50:41 UTC (rev 412)
@@ -0,0 +1,1085 @@
+/**
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * 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.pom.config.data;
+
+import org.exoplatform.portal.config.model.ApplicationState;
+import org.exoplatform.portal.config.model.ApplicationType;
+import org.exoplatform.portal.pom.config.data.BodyType;
+import org.exoplatform.portal.config.model.Dashboard;
+import org.exoplatform.portal.config.model.ModelChange;
+import org.exoplatform.portal.config.model.PersistentApplicationState;
+import org.exoplatform.portal.config.model.PortalConfig;
+import org.exoplatform.portal.config.model.TransientApplicationState;
+import org.exoplatform.portal.config.model.gadget.GadgetId;
+import org.exoplatform.portal.pom.config.Utils;
+import static org.exoplatform.portal.pom.config.Utils.join;
+import static org.exoplatform.portal.pom.config.Utils.split;
+
+import org.exoplatform.portal.config.model.portlet.PortletId;
+import org.exoplatform.portal.config.model.wsrp.WSRPId;
+import org.exoplatform.portal.pom.config.POMSession;
+import org.exoplatform.portal.pom.config.data.ApplicationData;
+import org.exoplatform.portal.pom.config.data.BodyData;
+import org.exoplatform.portal.pom.config.data.ComponentData;
+import org.exoplatform.portal.pom.config.data.ContainerData;
+import org.exoplatform.portal.pom.config.data.DashboardData;
+import org.exoplatform.portal.pom.config.data.ModelData;
+import org.exoplatform.portal.pom.config.data.NavigationContainer;
+import org.exoplatform.portal.pom.config.data.PageData;
+import org.exoplatform.portal.pom.config.data.PortalData;
+import org.exoplatform.portal.pom.spi.gadget.Gadget;
+import org.exoplatform.portal.pom.spi.portlet.Preferences;
+import org.exoplatform.portal.pom.spi.wsrp.WSRPState;
+import org.gatein.mop.api.Attributes;
+import org.gatein.mop.api.content.ContentType;
+import org.gatein.mop.api.content.Customization;
+import org.gatein.mop.api.workspace.Navigation;
+import org.gatein.mop.api.workspace.ObjectType;
+import org.gatein.mop.api.workspace.Site;
+import org.gatein.mop.api.workspace.Workspace;
+import org.gatein.mop.api.workspace.WorkspaceObject;
+import org.gatein.mop.api.workspace.link.Link;
+import org.gatein.mop.api.workspace.link.PageLink;
+import org.gatein.mop.api.workspace.ui.UIBody;
+import org.gatein.mop.api.workspace.ui.UIComponent;
+import org.gatein.mop.api.workspace.ui.UIContainer;
+import org.gatein.mop.api.workspace.ui.UIWindow;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.UUID;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class Mapper
+{
+
+ /** . */
+ private static final Set<String> portalPropertiesBlackList =
+ new HashSet<String>(Arrays.asList("jcr:uuid", "jcr:primaryType", MappedAttributes.LOCALE.getName(),
+ MappedAttributes.ACCESS_PERMISSIONS.getName(), MappedAttributes.EDIT_PERMISSION.getName(),
+ MappedAttributes.SKIN.getName(), MappedAttributes.TITLE.getName(), MappedAttributes.CREATOR.getName(),
+ MappedAttributes.MODIFIER.getName()));
+
+ /** . */
+ private static final Set<String> windowPropertiesBlackList =
+ new HashSet<String>(Arrays.asList("jcr:uuid", "jcr:primaryType", MappedAttributes.TYPE.getName(),
+ MappedAttributes.THEME.getName(), MappedAttributes.TITLE.getName(), MappedAttributes.ACCESS_PERMISSIONS
+ .getName(), MappedAttributes.SHOW_INFO_BAR.getName(), MappedAttributes.SHOW_STATE.getName(),
+ MappedAttributes.SHOW_MODE.getName(), MappedAttributes.DESCRIPTION.getName(), MappedAttributes.ICON.getName(),
+ MappedAttributes.WIDTH.getName(), MappedAttributes.HEIGHT.getName()));
+
+ /** . */
+ private final POMSession session;
+
+ public Mapper(POMSession session)
+ {
+ this.session = session;
+ }
+
+ public NavigationContainer.Page load(Navigation src)
+ {
+ return load(src, NavigationContainer.Page.class);
+ }
+
+ private <T extends NavigationContainer> T load(Navigation src, Class<T> type)
+ {
+
+ //
+ ArrayList<NavigationContainer.Node> children = new ArrayList<NavigationContainer.Node>(src.getChildren().size());
+ for (Navigation srcChild : src.getChildren())
+ {
+ NavigationContainer.Node dstChild = load(srcChild, NavigationContainer.Node.class);
+ children.add(dstChild);
+ }
+
+ //
+ T dst;
+ if (type == NavigationContainer.Page.class)
+ {
+ Site site = src.getSite();
+ String ownerType = getOwnerType(site.getObjectType());
+ String ownerId = site.getName();
+ Attributes attrs = src.getAttributes();
+ NavigationContainer.Page dstNav = new NavigationContainer.Page(
+ src.getObjectId(),
+ ownerType,
+ ownerId,
+ attrs.getValue(MappedAttributes.DESCRIPTION),
+ attrs.getValue(MappedAttributes.CREATOR),
+ attrs.getValue(MappedAttributes.MODIFIER),
+ attrs.getValue(MappedAttributes.PRIORITY, 1),
+ children);
+ dst = (T)dstNav;
+ }
+ else if (type == NavigationContainer.Node.class)
+ {
+ Attributes attrs = src.getAttributes();
+ String pageReference = null;
+ Link link = src.getLink();
+ if (link instanceof PageLink)
+ {
+ PageLink pageLink = (PageLink)link;
+ org.gatein.mop.api.workspace.Page target = pageLink.getPage();
+ if (target != null)
+ {
+ Site site = target.getSite();
+ ObjectType<? extends Site> siteType = site.getObjectType();
+ pageReference = getOwnerType(siteType) + "::" + site.getName() + "::" + target.getName();
+ }
+ }
+ NavigationContainer.Node dstNode = new NavigationContainer.Node(
+ src.getObjectId(),
+ attrs.getValue(MappedAttributes.URI),
+ attrs.getValue(MappedAttributes.LABEL),
+ attrs.getValue(MappedAttributes.ICON),
+ src.getName(),
+ attrs.getValue(MappedAttributes.START_PUBLICATION_DATE),
+ attrs.getValue(MappedAttributes.END_PUBLICATION_DATE),
+ attrs.getValue(MappedAttributes.SHOW_PUBLICATION_DATE, false),
+ attrs.getValue(MappedAttributes.VISIBLE, true),
+ pageReference,
+ children
+ );
+
+ dst = (T)dstNode;
+ }
+ else
+ {
+ throw new AssertionError();
+ }
+
+ //
+ return dst;
+ }
+
+ public void save(NavigationContainer.Page src, Navigation dst)
+ {
+ save((NavigationContainer)src, dst);
+ }
+
+ private void save(NavigationContainer src, Navigation dst)
+ {
+ if (src instanceof NavigationContainer.Node)
+ {
+ NavigationContainer.Node node = (NavigationContainer.Node)src;
+ Workspace workspace = dst.getSite().getWorkspace();
+ String reference = node.getPageReference();
+ if (reference != null)
+ {
+ String[] pageChunks = split("::", reference);
+ ObjectType<? extends Site> siteType = parseSiteType(pageChunks[0]);
+ Site site = workspace.getSite(siteType, pageChunks[1]);
+ org.gatein.mop.api.workspace.Page target = site.getRootPage().getChild("pages").getChild(pageChunks[2]);
+ PageLink link = dst.linkTo(ObjectType.PAGE_LINK);
+ link.setPage(target);
+ }
+
+ //
+ Attributes attrs = dst.getAttributes();
+ attrs.setValue(MappedAttributes.URI, node.getURI());
+ attrs.setValue(MappedAttributes.LABEL, node.getLabel());
+ attrs.setValue(MappedAttributes.ICON, node.getIcon());
+ attrs.setValue(MappedAttributes.START_PUBLICATION_DATE, node.getStartPublicationDate());
+ attrs.setValue(MappedAttributes.END_PUBLICATION_DATE, node.getEndPublicationDate());
+ attrs.setValue(MappedAttributes.SHOW_PUBLICATION_DATE, node.getShowPublicationDate());
+ attrs.setValue(MappedAttributes.VISIBLE, node.isVisible());
+ }
+ else if (src instanceof NavigationContainer.Page)
+ {
+ NavigationContainer.Page pageNav = (NavigationContainer.Page)src;
+
+ //
+ Attributes attrs = dst.getAttributes();
+ attrs.setValue(MappedAttributes.PRIORITY, pageNav.getPriority());
+ attrs.setValue(MappedAttributes.CREATOR, pageNav.getCreator());
+ attrs.setValue(MappedAttributes.MODIFIER, pageNav.getModifier());
+ attrs.setValue(MappedAttributes.DESCRIPTION, pageNav.getDescription());
+ }
+ else
+ {
+ throw new AssertionError();
+ }
+
+ //
+ Set<String> savedSet = new HashSet<String>();
+ for (NavigationContainer.Node node : src.getChildren())
+ {
+ String srcId = node.getStorageId();
+ Navigation dstChild;
+ if (srcId != null)
+ {
+ dstChild = session.findObjectById(ObjectType.NAVIGATION, srcId);
+ }
+ else
+ {
+ dstChild = dst.getChild(node.getName());
+ if (dstChild == null)
+ {
+ dstChild = dst.addChild(node.getName());
+ }
+ srcId = dstChild.getObjectId();
+ }
+ save(node, dstChild);
+ savedSet.add(srcId);
+ }
+ for (Iterator<? extends Navigation> i = dst.getChildren().iterator(); i.hasNext();)
+ {
+ Navigation dstChild = i.next();
+ if (!savedSet.contains(dstChild.getObjectId()))
+ {
+ i.remove();
+ }
+ }
+ }
+
+ public PortalData load(Site src)
+ {
+ String type = Mapper.getOwnerType(src.getObjectType());
+ Attributes attrs = src.getAttributes();
+
+ //
+ org.gatein.mop.api.workspace.Page template = src.getRootNavigation().getTemplate();
+ UIContainer srcLayout = template.getRootComponent();
+
+ //
+ Map<String, String> properties = new HashMap<String, String>();
+ load(attrs, properties, portalPropertiesBlackList);
+
+ //
+ List<ComponentData> layoutChildren = loadChildren(srcLayout);
+ ContainerData layout = load(srcLayout, layoutChildren);
+
+ //
+ return new PortalData(
+ src.getObjectId(),
+ src.getName(),
+ type,
+ attrs.getValue(MappedAttributes.LOCALE),
+ Collections.unmodifiableList(Arrays.asList(split("|", attrs.getValue(MappedAttributes.ACCESS_PERMISSIONS, "")))),
+ attrs.getValue(MappedAttributes.EDIT_PERMISSION),
+ Collections.unmodifiableMap(properties),
+ attrs.getValue(MappedAttributes.SKIN),
+ attrs.getValue(MappedAttributes.TITLE),
+ layout,
+ attrs.getValue(MappedAttributes.CREATOR),
+ attrs.getValue(MappedAttributes.MODIFIER));
+ }
+
+ public void save(PortalData src, Site dst)
+ {
+ if (src.getStorageId() != null && !src.getStorageId().equals(dst.getObjectId()))
+ {
+ String msg =
+ "Attempt to save a site " + src.getType() + "/" + src.getName() + " on the wrong target site "
+ + dst.getObjectType() + "/" + dst.getName();
+ throw new IllegalArgumentException(msg);
+ }
+
+ //
+ Attributes attrs = dst.getAttributes();
+ attrs.setValue(MappedAttributes.LOCALE, src.getLocale());
+ attrs.setValue(MappedAttributes.ACCESS_PERMISSIONS, join("|", src.getAccessPermissions()));
+ attrs.setValue(MappedAttributes.EDIT_PERMISSION, src.getEditPermission());
+ attrs.setValue(MappedAttributes.SKIN, src.getSkin());
+ attrs.setValue(MappedAttributes.TITLE, src.getTitle());
+ attrs.setValue(MappedAttributes.CREATOR, src.getCreator());
+ attrs.setValue(MappedAttributes.MODIFIER, src.getModifier());
+ if (src.getProperties() != null)
+ {
+ save(src.getProperties(), attrs);
+ }
+
+ //
+ org.gatein.mop.api.workspace.Page templates = dst.getRootPage().getChild("templates");
+ org.gatein.mop.api.workspace.Page template = templates.getChild("default");
+ if (template == null)
+ {
+ template = templates.addChild("default");
+ }
+
+ //
+ ContainerData srcContainer = src.getPortalLayout();
+ UIContainer dstContainer = template.getRootComponent();
+
+ //
+ save(srcContainer, dstContainer);
+ saveChildren(srcContainer, dstContainer);
+
+ //
+ dst.getRootNavigation().setTemplate(template);
+ }
+
+ public PageData load(org.gatein.mop.api.workspace.Page src)
+ {
+ Site site = src.getSite();
+ String ownerType = getOwnerType(site.getObjectType());
+ String ownerId = site.getName();
+ String name = src.getName();
+ List<ComponentData> children = loadChildren(src.getRootComponent());
+ Attributes attrs = src.getAttributes();
+
+ //
+ return new PageData(
+ src.getObjectId(),
+ null,
+ name,
+ null,
+ null,
+ null,
+ attrs.getValue(MappedAttributes.FACTORY_ID),
+ attrs.getValue(MappedAttributes.TITLE),
+ null,
+ null,
+ null,
+ Utils.safeImmutableList(split("|", attrs.getValue(MappedAttributes.ACCESS_PERMISSIONS))),
+ children,
+ ownerType,
+ ownerId,
+ attrs.getValue(MappedAttributes.EDIT_PERMISSION),
+ attrs.getValue(MappedAttributes.SHOW_MAX_WINDOW, false),
+ attrs.getValue(MappedAttributes.CREATOR),
+ attrs.getValue(MappedAttributes.MODIFIER)
+ );
+ }
+
+ public List<ModelChange> save(PageData src, Site site, String name)
+ {
+ org.gatein.mop.api.workspace.Page root = site.getRootPage();
+ org.gatein.mop.api.workspace.Page pages = root.getChild("pages");
+ org.gatein.mop.api.workspace.Page dst = pages.getChild(name);
+
+ //
+ LinkedList<ModelChange> changes = new LinkedList<ModelChange>();
+
+ //
+ if (dst == null)
+ {
+ dst = pages.addChild(name);
+ changes.add(new ModelChange.Create(src));
+ }
+ else
+ {
+ changes.add(new ModelChange.Update(src));
+ }
+
+ //
+ Attributes attrs = dst.getAttributes();
+ attrs.setValue(MappedAttributes.TITLE, src.getTitle());
+ attrs.setValue(MappedAttributes.FACTORY_ID, src.getFactoryId());
+ attrs.setValue(MappedAttributes.ACCESS_PERMISSIONS, join("|", src.getAccessPermissions()));
+ attrs.setValue(MappedAttributes.EDIT_PERMISSION, src.getEditPermission());
+ attrs.setValue(MappedAttributes.SHOW_MAX_WINDOW, src.isShowMaxWindow());
+ attrs.setValue(MappedAttributes.CREATOR, src.getCreator());
+ attrs.setValue(MappedAttributes.MODIFIER, src.getModifier());
+
+ //
+ changes.addAll(saveChildren(src, dst.getRootComponent()));
+
+ //
+ return changes;
+ }
+
+ private ContainerData load(UIContainer src, List<ComponentData> children)
+ {
+ Attributes attrs = src.getAttributes();
+ return new ContainerData(
+ src.getObjectId(),
+ attrs.getValue(MappedAttributes.ID),
+ attrs.getValue(MappedAttributes.NAME),
+ attrs.getValue(MappedAttributes.ICON),
+ attrs.getValue(MappedAttributes.DECORATOR),
+ attrs.getValue(MappedAttributes.TEMPLATE),
+ attrs.getValue(MappedAttributes.FACTORY_ID),
+ attrs.getValue(MappedAttributes.TITLE),
+ attrs.getValue(MappedAttributes.DESCRIPTION),
+ attrs.getValue(MappedAttributes.WIDTH),
+ attrs.getValue(MappedAttributes.HEIGHT),
+ Utils.safeImmutableList(split("|", attrs.getValue(MappedAttributes.ACCESS_PERMISSIONS))),
+ children
+ );
+ }
+
+ private List<ComponentData> loadChildren(UIContainer src)
+ {
+ ArrayList<ComponentData> children = new ArrayList<ComponentData>(src.size());
+ for (UIComponent component : src)
+ {
+
+ // Obtain a model object from the ui component
+ ComponentData mo;
+ if (component instanceof UIContainer)
+ {
+ UIContainer srcContainer = (UIContainer)component;
+ Attributes attrs = srcContainer.getAttributes();
+ String type = attrs.getValue(MappedAttributes.TYPE);
+ if ("dashboard".equals(type))
+ {
+ TransientApplicationState<Preferences> state = new TransientApplicationState<Preferences>();
+ Site owner = src.getPage().getSite();
+ state.setOwnerType(getOwnerType(owner.getObjectType()));
+ state.setOwnerId(owner.getName());
+ mo = new ApplicationData<Preferences, PortletId>(
+ srcContainer.getObjectId(),
+ component.getName(),
+ ApplicationType.PORTLET,
+ state,
+ new PortletId("dashboard", "DashboardPortlet"),
+ null,
+ null,
+ null,
+ null,
+ false,
+ false,
+ false,
+ null,
+ null,
+ null,
+ Collections.<String, String>emptyMap(),
+ Collections.<String>emptyList());
+ }
+ else
+ {
+ List<ComponentData> dstChildren = loadChildren(srcContainer);
+ mo = load(srcContainer, dstChildren);
+ }
+ }
+ else if (component instanceof UIWindow)
+ {
+ UIWindow window = (UIWindow)component;
+ ApplicationData application = load(window);
+ mo = application;
+ }
+ else if (component instanceof UIBody)
+ {
+ mo = new BodyData(component.getObjectId(), BodyType.PAGE);
+ }
+ else
+ {
+ throw new AssertionError();
+ }
+
+ // Add among children
+ children.add(mo);
+ }
+ return children;
+ }
+
+ private void save(ContainerData src, UIContainer dst)
+ {
+ Attributes dstAttrs = dst.getAttributes();
+ dstAttrs.setValue(MappedAttributes.ID, src.getId());
+ dstAttrs.setValue(MappedAttributes.TYPE, src instanceof DashboardData ? "dashboard" : null);
+ dstAttrs.setValue(MappedAttributes.TITLE, src.getTitle());
+ dstAttrs.setValue(MappedAttributes.ICON, src.getIcon());
+ dstAttrs.setValue(MappedAttributes.TEMPLATE, src.getTemplate());
+ dstAttrs.setValue(MappedAttributes.ACCESS_PERMISSIONS, join("|", src.getAccessPermissions()));
+ dstAttrs.setValue(MappedAttributes.FACTORY_ID, src.getFactoryId());
+ dstAttrs.setValue(MappedAttributes.DECORATOR, src.getDecorator());
+ dstAttrs.setValue(MappedAttributes.DESCRIPTION, src.getDescription());
+ dstAttrs.setValue(MappedAttributes.WIDTH, src.getWidth());
+ dstAttrs.setValue(MappedAttributes.HEIGHT, src.getHeight());
+ dstAttrs.setValue(MappedAttributes.NAME, src.getName());
+ }
+
+ private void save(ModelData src, WorkspaceObject dst, LinkedList<ModelChange> changes,
+ Map<String, String> hierarchyRelationships)
+ {
+ if (src instanceof ContainerData)
+ {
+ save((ContainerData)src, (UIContainer)dst);
+ saveChildren((ContainerData)src, (UIContainer)dst, changes, hierarchyRelationships);
+ }
+ else if (src instanceof ApplicationData)
+ {
+ save((ApplicationData<?, ?>)src, (UIWindow)dst);
+ }
+ else if (src instanceof BodyData)
+ {
+ // Stateless
+ }
+ else
+ {
+ throw new AssertionError("Was not expecting child " + src);
+ }
+ }
+
+ /** . */
+ private static final PortletId DASHBOARD_ID = new PortletId("dashboard", "DashboardPortlet");
+
+ private LinkedList<ModelChange> saveChildren(final ContainerData src, UIContainer dst)
+ {
+
+ //
+ LinkedList<ModelChange> changes = new LinkedList<ModelChange>();
+
+ //
+ Map<String, String> hierarchyRelationships = new HashMap<String, String>();
+
+ //
+ build(src, hierarchyRelationships);
+
+ //
+ saveChildren(src, dst, changes, Collections.unmodifiableMap(hierarchyRelationships));
+
+ //
+ return changes;
+ }
+
+ private void build(ContainerData parent, Map<String, String> hierarchyRelationships)
+ {
+ String parentId = parent.getStorageId();
+ if (parentId != null)
+ {
+ for (ModelData child : parent.getChildren())
+ {
+ String childId = child.getStorageId();
+ if (childId != null)
+ {
+ if (hierarchyRelationships.put(childId, parentId) != null)
+ {
+ throw new AssertionError("The same object is present two times in the object hierarchy");
+ }
+ if (child instanceof ContainerData)
+ {
+ build((ContainerData)child, hierarchyRelationships);
+ }
+ }
+ }
+ }
+ }
+
+ private void saveChildren(final ContainerData src, UIContainer dst, LinkedList<ModelChange> changes,
+ Map<String, String> hierarchyRelationships)
+ {
+ final List<String> orders = new ArrayList<String>();
+ final Map<String, ModelData> modelObjectMap = new HashMap<String, ModelData>();
+
+ //
+ for (ModelData srcChild : src.getChildren())
+ {
+ String srcId = srcChild.getStorageId();
+
+ // Replace dashboard application by container if needed
+ if (srcChild instanceof ApplicationData)
+ {
+ ApplicationData app = (ApplicationData)srcChild;
+ if (app.getType() == ApplicationType.PORTLET)
+ {
+ PortletId ref = (PortletId)app.getRef();
+ if (DASHBOARD_ID.equals(ref))
+ {
+ if (app.getStorageId() != null)
+ {
+ UIContainer dstDashboard = session.findObjectById(ObjectType.CONTAINER, app.getStorageId());
+ srcChild = loadDashboard(dstDashboard);
+ }
+ else
+ {
+ srcChild = DashboardData.INITIAL_DASHBOARD;
+ }
+ }
+ }
+ }
+
+ //
+ UIComponent dstChild;
+ if (srcId != null)
+ {
+ dstChild = session.findObjectById(ObjectType.COMPONENT, srcId);
+ if (dstChild == null)
+ {
+ throw new AssertionError("Could not find supposed present child with id " + srcId);
+ }
+ // julien : this can fail due to a bug in chromattic not implementing equals method properly
+ // and is replaced with the foreach below
+ /*
+ if (!dst.contains(dstChild)) {
+ throw new IllegalArgumentException("Attempt for updating a ui component " + session.pathOf(dstChild) +
+ "that is not present in the target ui container " + session.pathOf(dst));
+ }
+ */
+ boolean found = false;
+ for (UIComponent child : dst)
+ {
+ if (child.getObjectId().equals(srcId))
+ {
+ found = true;
+ break;
+ }
+ }
+ if (!found)
+ {
+ if (hierarchyRelationships.containsKey(srcId))
+ {
+ // It's a move operation, so we move the node first
+ dst.add(dstChild);
+ }
+ else
+ {
+ throw new IllegalArgumentException("Attempt for updating a ui component " + session.pathOf(dstChild)
+ + "that is not present in the target ui container " + session.pathOf(dst));
+ }
+ }
+
+ //
+ changes.add(new ModelChange.Update(srcChild));
+ }
+ else
+ {
+ String name = srcChild.getStorageName();
+ if (name == null)
+ {
+ // We manufacture one name
+ name = UUID.randomUUID().toString();
+ }
+ if (srcChild instanceof ContainerData)
+ {
+ dstChild = dst.add(ObjectType.CONTAINER, name);
+ }
+ else if (srcChild instanceof ApplicationData)
+ {
+ dstChild = dst.add(ObjectType.WINDOW, name);
+ }
+ else if (srcChild instanceof BodyData)
+ {
+ dstChild = dst.add(ObjectType.BODY, name);
+ }
+ else
+ {
+ throw new AssertionError("Was not expecting child " + srcChild);
+ }
+ changes.add(new ModelChange.Create(srcChild));
+ }
+
+ //
+ save(srcChild, dstChild, changes, hierarchyRelationships);
+
+ //
+ String dstId = dstChild.getObjectId();
+ modelObjectMap.put(dstId, srcChild);
+ orders.add(dstId);
+ }
+
+ // Take care of move operation that could be seen as a remove
+ for (UIComponent dstChild : dst)
+ {
+ String dstId = dstChild.getObjectId();
+ if (!modelObjectMap.containsKey(dstId) && hierarchyRelationships.containsKey(dstId))
+ {
+ String parentId = hierarchyRelationships.get(dstId);
+
+ // Get the new parent
+ UIContainer parent = session.findObjectById(ObjectType.CONTAINER, parentId);
+
+ // Perform the move
+ parent.add(dstChild);
+
+ //
+ changes.add(new ModelChange.Destroy(dstId));
+ }
+ }
+
+ // Delete removed children
+ for (Iterator<UIComponent> i = dst.iterator(); i.hasNext();)
+ {
+ UIComponent dstChild = i.next();
+ String dstId = dstChild.getObjectId();
+ if (!modelObjectMap.containsKey(dstId))
+ {
+ i.remove();
+ changes.add(new ModelChange.Destroy(dstId));
+ }
+ }
+
+ // Now sort children according to the order provided by the container
+ // need to replace that with Collections.sort once the set(int index, E element) is implemented in Chromattic lists
+ UIComponent[] a = dst.toArray(new UIComponent[dst.size()]);
+ Arrays.sort(a, new Comparator<UIComponent>()
+ {
+ public int compare(UIComponent o1, UIComponent o2)
+ {
+ int i1 = orders.indexOf(o1.getObjectId());
+ int i2 = orders.indexOf(o2.getObjectId());
+ return i1 - i2;
+ }
+ });
+ for (int j = 0; j < a.length; j++)
+ {
+ dst.add(j, a[j]);
+ }
+ }
+
+ private <S, I> ApplicationData<S, I> load(UIWindow src)
+ {
+ Attributes attrs = src.getAttributes();
+
+ //
+ Customization<?> customization = src.getCustomization();
+
+ //
+ ContentType<?> contentType = customization.getType();
+
+ //
+ String customizationid = customization.getId();
+
+ //
+ String contentId = customization.getContentId();
+
+ //
+ I ref;
+ ApplicationType<S, I> type;
+ if (contentType == null || contentType == Preferences.CONTENT_TYPE)
+ {
+ int pos = contentId.indexOf('/');
+ String applicationName = contentId.substring(0, pos);
+ String portletName = contentId.substring(pos + 1);
+ ref = (I)new PortletId(applicationName, portletName);
+ type = (ApplicationType<S,I>)ApplicationType.PORTLET;
+ }
+ else if (contentType == Gadget.CONTENT_TYPE)
+ {
+ ref = (I)new GadgetId(contentId);
+ type = (ApplicationType<S,I>)ApplicationType.GADGET;
+ }
+ else if (contentType == WSRPState.CONTENT_TYPE)
+ {
+ ref = (I)new WSRPId(contentId);
+ type = (ApplicationType<S,I>)ApplicationType.WSRP_PORTLET;
+ }
+ else
+ {
+ throw new AssertionError("Unknown type: " + contentType);
+ }
+
+ //
+ PersistentApplicationState<S> instanceState = new PersistentApplicationState<S>(customizationid);
+
+ //
+ HashMap<String, String> properties = new HashMap<String, String>();
+ load(attrs, properties, windowPropertiesBlackList);
+
+ //
+ return new ApplicationData<S,I>(
+ src.getObjectId(),
+ src.getName(),
+ type,
+ instanceState,
+ ref,
+ null,
+ attrs.getValue(MappedAttributes.TITLE),
+ attrs.getValue(MappedAttributes.ICON),
+ attrs.getValue(MappedAttributes.DESCRIPTION),
+ attrs.getValue(MappedAttributes.SHOW_INFO_BAR),
+ attrs.getValue(MappedAttributes.SHOW_STATE),
+ attrs.getValue(MappedAttributes.SHOW_MODE),
+ attrs.getValue(MappedAttributes.THEME),
+ attrs.getValue(MappedAttributes.WIDTH),
+ attrs.getValue(MappedAttributes.HEIGHT),
+ Utils.safeImmutableMap(properties),
+ Utils.safeImmutableList(split("|", attrs.getValue(MappedAttributes.ACCESS_PERMISSIONS)))
+ );
+ }
+
+ public <S, I> void save(ApplicationData<S, I> src, UIWindow dst)
+ {
+ Attributes attrs = dst.getAttributes();
+ attrs.setValue(MappedAttributes.THEME, src.getTheme());
+ attrs.setValue(MappedAttributes.TITLE, src.getTitle());
+ attrs.setValue(MappedAttributes.ACCESS_PERMISSIONS, join("|", src.getAccessPermissions()));
+ attrs.setValue(MappedAttributes.SHOW_INFO_BAR, src.isShowInfoBar());
+ attrs.setValue(MappedAttributes.SHOW_STATE, src.isShowApplicationState());
+ attrs.setValue(MappedAttributes.SHOW_MODE, src.isShowApplicationMode());
+ attrs.setValue(MappedAttributes.DESCRIPTION, src.getDescription());
+ attrs.setValue(MappedAttributes.ICON, src.getIcon());
+ attrs.setValue(MappedAttributes.WIDTH, src.getWidth());
+ attrs.setValue(MappedAttributes.HEIGHT, src.getHeight());
+ save(src.getProperties(), attrs);
+
+ //
+ ApplicationState<S> instanceState = src.getState();
+
+ // We modify only transient portlet state
+ // and we ignore any persistent portlet state
+ if (instanceState instanceof TransientApplicationState)
+ {
+
+ //
+ TransientApplicationState<S> transientState = (TransientApplicationState<S>)instanceState;
+
+ // Attempt to get a site from the instance state
+ Site site = null;
+ if (transientState.getOwnerType() != null && transientState.getOwnerId() != null)
+ {
+ ObjectType<Site> siteType = parseSiteType(transientState.getOwnerType());
+ site = session.getWorkspace().getSite(siteType, transientState.getOwnerId());
+ }
+
+ // The current site
+ Site currentSite = dst.getPage().getSite();
+
+ // If it is the same site than the current page
+ // set null
+ if (site == dst.getPage().getSite())
+ {
+ site = null;
+ }
+
+ // The content id
+ String contentId;
+ ContentType<S> contentType = src.getType().getContentType();
+ if (contentType == Preferences.CONTENT_TYPE)
+ {
+ PortletId id = (PortletId)src.getRef();
+ contentId = id.getApplicationName() + "/" + id.getPortletName();
+ }
+ else if (contentType == Gadget.CONTENT_TYPE)
+ {
+ GadgetId id = (GadgetId)src.getRef();
+ contentId = id.getGadgetName();
+ }
+ else if (contentType == WSRPState.CONTENT_TYPE)
+ {
+ WSRPId id = (WSRPId)src.getRef();
+ contentId = id.getUri();
+ }
+ else
+ {
+ throw new UnsupportedOperationException("Unsupported content type");
+ }
+
+ // The customization that we will inherit from if not null
+ Customization<?> customization = null;
+
+ // Now inspect the unique id
+ String uniqueId = transientState.getUniqueId();
+ if (uniqueId != null)
+ {
+
+ // This is a customized window
+ if (uniqueId.startsWith("@"))
+ {
+ String id = uniqueId.substring(1);
+
+ // It's another window, we get its customization
+ if (!dst.getObjectId().equals(id))
+ {
+ UIWindow window = session.findObjectById(ObjectType.WINDOW, id);
+ Customization<?> windowCustomization = window.getCustomization();
+ if (windowCustomization.getType().equals(contentType))
+ {
+ customization = windowCustomization;
+ }
+ }
+ }
+ else
+ {
+ int pos = uniqueId.indexOf('#');
+ if (pos == -1)
+ {
+
+ // If it's a different site than the page one (it has to be at this point)
+ // then we get its customization
+ if (site != null)
+ {
+ customization = site.getCustomization(uniqueId);
+ }
+ else
+ {
+ customization = currentSite.getCustomization(uniqueId);
+
+ // If it does not exist we create it
+ if (customization == null)
+ {
+ customization = currentSite.customize(uniqueId, contentType, contentId, null);
+ }
+ }
+ }
+ else
+ {
+
+ // Otherwise we get the page customization
+ String a = uniqueId.substring(0, pos);
+ String b = uniqueId.substring(pos + 1);
+ org.gatein.mop.api.workspace.Page page = site.getRootPage().getChild("pages").getChild(b);
+ customization = page.getCustomization(a);
+ }
+ }
+ }
+
+ // Destroy existing window previous customization
+ if (dst.getCustomization() != null)
+ {
+ dst.getCustomization().destroy();
+ }
+
+ // If the existing customization is not null and matches the content id
+ Customization<S> dstCustomization;
+ if (customization != null && customization.getType().equals(contentType)
+ && customization.getContentId().equals(contentId))
+ {
+
+ // Cast is ok as content type matches
+ @SuppressWarnings("unchecked")
+ Customization<S> bilto = (Customization<S>)customization;
+
+ // If it's a customization of the current site we extend it
+ if (bilto.getContext() == currentSite)
+ {
+ dstCustomization = dst.customize(bilto);
+ }
+ else
+ {
+ // Otherwise we clone it propertly
+ S state = bilto.getVirtualState();
+ dstCustomization = dst.customize(contentType, contentId, state);
+ }
+ }
+ else
+ {
+ // Otherwise we create an empty customization
+ dstCustomization = dst.customize(contentType, contentId, null);
+ }
+
+ // At this point we have customized the window
+ // now if we have any additional state payload we must merge it
+ // with the current state
+ S state = ((TransientApplicationState<S>)instanceState).getContentState();
+ if (state != null)
+ {
+ dstCustomization.setState(state);
+ }
+ }
+ }
+
+ public DashboardData loadDashboard(UIContainer container)
+ {
+ Attributes attrs = container.getAttributes();
+ List<ComponentData> children = loadChildren(container);
+ return new DashboardData(
+ container.getObjectId(),
+ attrs.getValue(MappedAttributes.ID),
+ attrs.getValue(MappedAttributes.NAME),
+ attrs.getValue(MappedAttributes.ICON),
+ attrs.getValue(MappedAttributes.DECORATOR),
+ attrs.getValue(MappedAttributes.TEMPLATE),
+ attrs.getValue(MappedAttributes.FACTORY_ID),
+ attrs.getValue(MappedAttributes.TITLE),
+ attrs.getValue(MappedAttributes.DESCRIPTION),
+ attrs.getValue(MappedAttributes.WIDTH),
+ attrs.getValue(MappedAttributes.HEIGHT),
+ Utils.safeImmutableList(split("|", attrs.getValue(MappedAttributes.ACCESS_PERMISSIONS))),
+ children
+ );
+ }
+
+ public void saveDashboard(DashboardData dashboard, UIContainer dst)
+ {
+ save(dashboard, dst);
+ saveChildren(dashboard, dst);
+ }
+
+ public static String[] parseWindowId(String windowId)
+ {
+ int i0 = windowId.indexOf("#");
+ int i1 = windowId.indexOf(":/", i0 + 1);
+ String ownerType = windowId.substring(0, i0);
+ String ownerId = windowId.substring(i0 + 1, i1);
+ String persistenceid = windowId.substring(i1 + 2);
+ String[] chunks = split("/", 2, persistenceid);
+ chunks[0] = ownerType;
+ chunks[1] = ownerId;
+ return chunks;
+ }
+
+ private static void load(Attributes src, Map<String, String> dst, Set<String> blackList)
+ {
+ for (String name : src.getKeys())
+ {
+ if (!blackList.contains(name))
+ {
+ Object value = src.getObject(name);
+ if (value instanceof String)
+ {
+ dst.put(name, (String)value);
+ }
+ }
+ }
+ }
+
+ public static void save(Map<String, String> src, Attributes dst)
+ {
+ for (Map.Entry<String, String> property : src.entrySet())
+ {
+ dst.setString(property.getKey(), property.getValue());
+ }
+ }
+
+ public static String getOwnerType(ObjectType<? extends Site> siteType)
+ {
+ if (siteType == ObjectType.PORTAL_SITE)
+ {
+ return PortalConfig.PORTAL_TYPE;
+ }
+ else if (siteType == ObjectType.GROUP_SITE)
+ {
+ return PortalConfig.GROUP_TYPE;
+ }
+ else if (siteType == ObjectType.USER_SITE)
+ {
+ return PortalConfig.USER_TYPE;
+ }
+ else
+ {
+ throw new IllegalArgumentException("Invalid site type " + siteType);
+ }
+ }
+
+ public static ObjectType<Site> parseSiteType(String ownerType)
+ {
+ if (ownerType.equals(PortalConfig.PORTAL_TYPE))
+ {
+ return ObjectType.PORTAL_SITE;
+ }
+ else if (ownerType.equals(PortalConfig.GROUP_TYPE))
+ {
+ return ObjectType.GROUP_SITE;
+ }
+ else if (ownerType.equals(PortalConfig.USER_TYPE))
+ {
+ return ObjectType.USER_SITE;
+ }
+ else
+ {
+ throw new IllegalArgumentException("Invalid owner type " + ownerType);
+ }
+ }
+}
Copied: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/ModelData.java (from rev 411, portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/ModelData.java)
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/ModelData.java (rev 0)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/ModelData.java 2009-10-24 07:50:41 UTC (rev 412)
@@ -0,0 +1,50 @@
+/**
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * 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.pom.config.data;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public abstract class ModelData
+{
+
+ /** Storage id. */
+ private final String storageId;
+
+ /** The storage name that is unique among a container context. */
+ private final String storageName;
+
+ protected ModelData(String storageId, String storageName)
+ {
+ this.storageId = storageId;
+ this.storageName = storageName;
+ }
+
+ public String getStorageId()
+ {
+ return storageId;
+ }
+
+ public String getStorageName()
+ {
+ return storageName;
+ }
+}
\ No newline at end of file
Added: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/ModelDataStorage.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/ModelDataStorage.java (rev 0)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/ModelDataStorage.java 2009-10-24 07:50:41 UTC (rev 412)
@@ -0,0 +1,107 @@
+/**
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * 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.pom.config.data;
+
+import org.exoplatform.commons.utils.LazyPageList;
+import org.exoplatform.portal.application.PortletPreferences;
+import org.exoplatform.portal.config.Query;
+import org.exoplatform.portal.config.model.ApplicationState;
+import org.exoplatform.portal.config.model.Container;
+import org.exoplatform.portal.config.model.ModelChange;
+import org.exoplatform.portal.pom.config.data.NavigationContainer;
+import org.exoplatform.portal.pom.config.data.PageData;
+import org.exoplatform.portal.pom.config.data.PortalData;
+import org.exoplatform.portal.pom.config.POMTask;
+
+import java.util.Comparator;
+import java.util.List;
+
+/**
+ * Created by The eXo Platform SAS
+ * Apr 19, 2007
+ *
+ * This interface is used to load the PortalConfig, Page config and Navigation config from the
+ * database
+ */
+public interface ModelDataStorage
+{
+
+ public <T extends POMTask> T execute(T task) throws Exception;
+
+ public void create(PortalData config) throws Exception;
+
+ public void save(PortalData config) throws Exception;
+
+ public PortalData getPortalConfig(PortalKey key) throws Exception;
+
+ public void remove(PortalData config) throws Exception;
+
+ public PageData getPage(PageKey key) throws Exception;
+
+ /**
+ * Clones a page.
+ *
+ * @param key the key of the page to clone
+ * @param cloneKey the key of the clone
+ * @return the cloned page
+ * @throws Exception any exception
+ */
+ public PageData clonePage(PageKey key, PageKey cloneKey)
+ throws Exception;
+
+ public void remove(PageData page) throws Exception;
+
+ public void create(PageData page) throws Exception;
+
+ /**
+ * Saves a page. If a page with the same id already exists then a merge operation will occur, otherwise
+ * a new page will be created from the provided argument.
+ *
+ * The operation returns a list of the change object that describes the changes that occured during the
+ * save operation.
+ *
+ * @param page the page to save
+ * @return the list of model changes that occured during the save operation
+ * @throws Exception any exception
+ */
+ public List<ModelChange> save(PageData page) throws Exception;
+
+ public NavigationContainer.Page getPageNavigation(NavigationKey key) throws Exception;
+
+ public void save(NavigationContainer.Page navigation) throws Exception;
+
+ public void create(NavigationContainer.Page navigation) throws Exception;
+
+ public void remove(NavigationContainer.Page navigation) throws Exception;
+
+ public void save(PortletPreferences portletPreferences) throws Exception;
+
+ public <S> S load(ApplicationState<S> state) throws Exception;
+
+ public <S> ApplicationState<S> save(ApplicationState<S> state, S preferences) throws Exception;
+
+ public PortletPreferences getPortletPreferences(String windowID) throws Exception;
+
+ public <T> LazyPageList<T> find(Query<T> q) throws Exception;
+
+ public <T> LazyPageList<T> find(Query<T> q, Comparator<T> sortComparator) throws Exception;
+
+ public Container getSharedLayout() throws Exception;
+}
\ No newline at end of file
Copied: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/NavigationContainer.java (from rev 410, portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/NavigationContainer.java)
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/NavigationContainer.java (rev 0)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/NavigationContainer.java 2009-10-24 07:50:41 UTC (rev 412)
@@ -0,0 +1,261 @@
+/*
+ * Copyright (C) 2003-2007 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.portal.pom.config.data;
+
+import org.exoplatform.portal.pom.config.data.ModelData;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class NavigationContainer extends ModelData
+{
+
+ /** . */
+ private final List<NavigationContainer.Node> children;
+
+ public NavigationContainer(String storageId, List<NavigationContainer.Node> children)
+ {
+ super(storageId, null);
+
+ //
+ this.children = children;
+ }
+
+ public List<NavigationContainer.Node> getChildren()
+ {
+ return children;
+ }
+
+ public static class Node extends NavigationContainer
+ {
+
+ /** . */
+ private final String uri;
+
+ /** . */
+ private final String label;
+
+ /** . */
+ private final String icon;
+
+ /** . */
+ private final String name;
+
+ /** . */
+ private final Date startPublicationDate;
+
+ /** . */
+ private final Date endPublicationDate;
+
+ /** . */
+ private final boolean showPublicationDate;
+
+ /** . */
+ private final boolean visible;
+
+ /** . */
+ private final String pageReference;
+
+ public Node(
+ String uri,
+ String label,
+ String icon,
+ String name,
+ Date startPublicationDate,
+ Date endPublicationDate,
+ Boolean showPublicationDate,
+ Boolean visible,
+ String pageReference,
+ List<NavigationContainer.Node> children)
+ {
+ this(null, uri, label, icon, name, startPublicationDate, endPublicationDate, showPublicationDate, visible, pageReference, children);
+ }
+
+ public Node(
+ String storageId,
+ String uri,
+ String label,
+ String icon,
+ String name,
+ Date startPublicationDate,
+ Date endPublicationDate,
+ Boolean showPublicationDate,
+ Boolean visible,
+ String pageReference,
+ List<NavigationContainer.Node> children)
+ {
+ super(storageId, children);
+
+ //
+ this.uri = uri;
+ this.label = label;
+ this.icon = icon;
+ this.name = name;
+ this.startPublicationDate = startPublicationDate;
+ this.endPublicationDate = endPublicationDate;
+ this.showPublicationDate = showPublicationDate != null ? showPublicationDate : false;
+ this.visible = visible != null ? visible : true;
+ this.pageReference = pageReference;
+ }
+ public String getURI()
+ {
+ return uri;
+ }
+
+ public String getLabel()
+ {
+ return label;
+ }
+
+ public String getIcon()
+ {
+ return icon;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public Date getStartPublicationDate()
+ {
+ return startPublicationDate;
+ }
+
+ public Date getEndPublicationDate()
+ {
+ return endPublicationDate;
+ }
+
+ public boolean getShowPublicationDate()
+ {
+ return showPublicationDate;
+ }
+
+ public boolean isVisible()
+ {
+ return visible;
+ }
+
+ public String getPageReference()
+ {
+ return pageReference;
+ }
+ }
+
+ public static class Page extends NavigationContainer
+ {
+
+ /** . */
+ private final NavigationKey key;
+
+ /** . */
+ private final String description;
+
+ /** . */
+ private final String creator;
+
+ /** . */
+ private final String modifier;
+
+ /** . */
+ private final int priority;
+
+ public Page(
+ String ownerType,
+ String ownerId,
+ String description,
+ String creator,
+ String modifier,
+ Integer priority,
+ List<NavigationContainer.Node> children)
+ {
+ this(null, ownerType, ownerId, description, creator, modifier, priority, children);
+ }
+
+ public Page(
+ String storageId,
+ String ownerType,
+ String ownerId,
+ String description,
+ String creator,
+ String modifier,
+ Integer priority,
+ List<NavigationContainer.Node> children)
+ {
+ super(storageId, children);
+
+ //
+ if (ownerType == null)
+ {
+ throw new NullPointerException("No null owner type");
+ }
+ if (ownerId == null)
+ {
+ throw new NullPointerException("No null owner id");
+ }
+
+ //
+ this.key = new NavigationKey(ownerType, ownerId);
+ this.description = description;
+ this.creator = creator;
+ this.modifier = modifier;
+ this.priority = priority != null ? priority : 1;
+ }
+
+ public NavigationKey getKey()
+ {
+ return key;
+ }
+
+ public String getOwnerType()
+ {
+ return key.getOwnerType();
+ }
+
+ public String getOwnerId()
+ {
+ return key.getOwnerId();
+ }
+
+ public String getDescription()
+ {
+ return description;
+ }
+
+ public String getCreator()
+ {
+ return creator;
+ }
+
+ public String getModifier()
+ {
+ return modifier;
+ }
+
+ public int getPriority()
+ {
+ return priority;
+ }
+ }
+
+
+}
Copied: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/NavigationKey.java (from rev 410, portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/NavigationKey.java)
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/NavigationKey.java (rev 0)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/NavigationKey.java 2009-10-24 07:50:41 UTC (rev 412)
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2003-2007 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.portal.pom.config.data;
+
+import org.exoplatform.portal.pom.config.Utils;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class NavigationKey extends OwnerKey
+{
+
+ public NavigationKey(String ownerType, String ownerId)
+ {
+ super(ownerType, ownerId);
+ }
+
+ public static NavigationKey create(String compositeId)
+ {
+ if (compositeId == null)
+ {
+ throw new NullPointerException();
+ }
+ String[] components = Utils.split("::", compositeId);
+ if (components.length != 2)
+ {
+ throw new IllegalArgumentException("Wrong navigation id key format " + compositeId);
+ }
+ return new NavigationKey(components[0], components[1]);
+ }
+}
Copied: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/OwnerKey.java (from rev 410, portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/OwnerKey.java)
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/OwnerKey.java (rev 0)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/OwnerKey.java 2009-10-24 07:50:41 UTC (rev 412)
@@ -0,0 +1,74 @@
+/*
+ * Copyright (C) 2003-2007 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.portal.pom.config.data;
+
+import java.io.Serializable;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class OwnerKey implements Serializable
+{
+
+ /** . */
+ private final String ownerType;
+
+ /** . */
+ private final String ownerId;
+
+ public OwnerKey(String ownerType, String ownerId)
+ {
+ if (ownerType == null)
+ {
+ throw new NullPointerException();
+ }
+ if (ownerId == null)
+ {
+ throw new NullPointerException();
+ }
+ this.ownerType = ownerType;
+ this.ownerId = ownerId;
+ }
+
+ public String getOwnerType()
+ {
+ return ownerType;
+ }
+
+ public String getOwnerId()
+ {
+ return ownerId;
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return ownerId.hashCode() ^ ownerType.hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (obj instanceof OwnerKey)
+ {
+ OwnerKey that = (OwnerKey)obj;
+ return ownerType.equals(that.ownerType) && ownerId.equals(that.ownerId);
+ }
+ return false;
+ }
+}
Copied: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/PageData.java (from rev 411, portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PageData.java)
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/PageData.java (rev 0)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/PageData.java 2009-10-24 07:50:41 UTC (rev 412)
@@ -0,0 +1,108 @@
+/*
+ * Copyright (C) 2003-2007 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.portal.pom.config.data;
+
+import java.util.List;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class PageData extends ContainerData
+{
+
+ /** . */
+ private final PageKey key;
+
+ /** . */
+ private final String editPermission;
+
+ /** . */
+ private final boolean showMaxWindow;
+
+ /** . */
+ private final String creator;
+
+ /** . */
+ private final String modifier;
+
+ public PageData(
+ String storageId,
+ String id,
+ String name,
+ String icon,
+ String decorator,
+ String template,
+ String factoryId,
+ String title,
+ String description,
+ String width,
+ String height,
+ List<String> accessPermissions,
+ List<ComponentData> children,
+ String ownerType,
+ String ownerId,
+ String editPermission,
+ boolean showMaxWindow,
+ String creator,
+ String modifier)
+ {
+ super(storageId, id, name, icon, decorator, template, factoryId, title, description, width, height, accessPermissions, children);
+
+ //
+ this.key = new PageKey(ownerType, ownerId, name);
+ this.editPermission = editPermission;
+ this.showMaxWindow = showMaxWindow;
+ this.creator = creator;
+ this.modifier = modifier;
+ }
+
+ public PageKey getKey()
+ {
+ return key;
+ }
+
+ public String getOwnerType()
+ {
+ return key.getOwnerType();
+ }
+
+ public String getOwnerId()
+ {
+ return key.getOwnerId();
+ }
+
+ public String getEditPermission()
+ {
+ return editPermission;
+ }
+
+ public boolean isShowMaxWindow()
+ {
+ return showMaxWindow;
+ }
+
+ public String getCreator()
+ {
+ return creator;
+ }
+
+ public String getModifier()
+ {
+ return modifier;
+ }
+}
Added: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/PageKey.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/PageKey.java (rev 0)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/PageKey.java 2009-10-24 07:50:41 UTC (rev 412)
@@ -0,0 +1,84 @@
+/*
+ * Copyright (C) 2003-2007 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.portal.pom.config.data;
+
+import org.exoplatform.portal.pom.config.Utils;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class PageKey extends OwnerKey
+{
+
+ /** . */
+ private final String name;
+
+ public PageKey(String ownerType, String ownerId, String name)
+ {
+ super(ownerType, ownerId);
+
+ //
+ if (name == null)
+ {
+ throw new NullPointerException();
+ }
+
+ //
+ this.name = name;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return super.hashCode() ^ name.hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (obj == this)
+ {
+ return true;
+ }
+ if (obj instanceof PageKey)
+ {
+ PageKey that = (PageKey)obj;
+ return super.equals(that) &&name.equals(that.name);
+ }
+ return false;
+ }
+
+ public static PageKey create(String compositeId)
+ {
+ if (compositeId == null)
+ {
+ throw new NullPointerException();
+ }
+ String[] components = Utils.split("::", compositeId);
+ if (components.length != 3)
+ {
+ throw new IllegalArgumentException("Wrong page id key format " + compositeId);
+ }
+ return new PageKey(components[0], components[1], components[2]);
+ }
+}
Copied: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/PortalData.java (from rev 411, portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PortalData.java)
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/PortalData.java (rev 0)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/PortalData.java 2009-10-24 07:50:41 UTC (rev 412)
@@ -0,0 +1,147 @@
+/*
+ * Copyright (C) 2003-2007 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.portal.pom.config.data;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class PortalData extends ModelData
+{
+
+ /** . */
+ private final PortalKey key;
+
+ /** . */
+ private final String locale;
+
+ /** . */
+ private final List<String> accessPermissions;
+
+ /** . */
+ private final String editPermission;
+
+ /** . */
+ private final Map<String, String> properties;
+
+ /** . */
+ private final String skin;
+
+ /** . */
+ private final String title;
+
+ /** . */
+ private final ContainerData portalLayout;
+
+ /** . */
+ private final String creator;
+
+ /** . */
+ private final String modifier;
+
+ public PortalData(
+ String storageId,
+ String name,
+ String type,
+ String locale,
+ List<String> accessPermissions,
+ String editPermission,
+ Map<String, String> properties,
+ String skin,
+ String title,
+ ContainerData portalLayout,
+ String creator,
+ String modifier)
+ {
+ super(storageId, null);
+
+ //
+ this.key = new PortalKey(type, name);
+ this.locale = locale;
+ this.accessPermissions = accessPermissions;
+ this.editPermission = editPermission;
+ this.properties = properties;
+ this.skin = skin;
+ this.title = title;
+ this.portalLayout = portalLayout;
+ this.creator = creator;
+ this.modifier = modifier;
+ }
+
+ public PortalKey getKey()
+ {
+ return key;
+ }
+
+ public String getName()
+ {
+ return key.getOwnerId();
+ }
+
+ public String getType()
+ {
+ return key.getOwnerType();
+ }
+
+ public String getLocale()
+ {
+ return locale;
+ }
+
+ public List<String> getAccessPermissions()
+ {
+ return accessPermissions;
+ }
+
+ public String getEditPermission()
+ {
+ return editPermission;
+ }
+
+ public Map<String, String> getProperties()
+ {
+ return properties;
+ }
+
+ public String getSkin()
+ {
+ return skin;
+ }
+
+ public String getTitle()
+ {
+ return title;
+ }
+
+ public ContainerData getPortalLayout()
+ {
+ return portalLayout;
+ }
+
+ public String getCreator()
+ {
+ return creator;
+ }
+
+ public String getModifier()
+ {
+ return modifier;
+ }
+}
Copied: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/PortalKey.java (from rev 411, portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PortalKey.java)
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/PortalKey.java (rev 0)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/data/PortalKey.java 2009-10-24 07:50:41 UTC (rev 412)
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2003-2007 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.portal.pom.config.data;
+
+import org.exoplatform.portal.pom.config.Utils;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class PortalKey extends OwnerKey
+{
+
+ public PortalKey(String ownerType, String ownerId)
+ {
+ super(ownerType, ownerId);
+ }
+
+ public static PortalKey create(String compositeId)
+ {
+ if (compositeId == null)
+ {
+ throw new NullPointerException();
+ }
+ String[] components = Utils.split("::", compositeId);
+ if (components.length != 2)
+ {
+ throw new IllegalArgumentException("Wrong navigation id key format " + compositeId);
+ }
+ return new PortalKey(components[0], components[1]);
+ }
+}
Modified: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/DashboardTask.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/DashboardTask.java 2009-10-23 19:09:03 UTC (rev 411)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/DashboardTask.java 2009-10-24 07:50:41 UTC (rev 412)
@@ -19,8 +19,8 @@
package org.exoplatform.portal.pom.config.tasks;
-import org.exoplatform.portal.config.model.Dashboard;
-import org.exoplatform.portal.config.model.Mapper;
+import org.exoplatform.portal.pom.config.data.DashboardData;
+import org.exoplatform.portal.pom.config.data.Mapper;
import org.exoplatform.portal.pom.config.AbstractPOMTask;
import org.exoplatform.portal.pom.config.POMSession;
import org.gatein.mop.api.workspace.ObjectType;
@@ -40,7 +40,7 @@
protected final String storageId;
/** . */
- protected Dashboard dashboard;
+ protected DashboardData dashboard;
public Load(String storageId)
{
@@ -58,7 +58,7 @@
}
}
- public Dashboard getDashboard()
+ public DashboardData getDashboard()
{
return dashboard;
}
@@ -74,9 +74,9 @@
{
/** The dashboard object. */
- protected final Dashboard dashboard;
+ protected final DashboardData dashboard;
- public Save(Dashboard dashboard)
+ public Save(DashboardData dashboard)
{
if (dashboard == null)
{
Modified: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/PageNavigationTask.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/PageNavigationTask.java 2009-10-23 19:09:03 UTC (rev 411)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/PageNavigationTask.java 2009-10-24 07:50:41 UTC (rev 412)
@@ -19,11 +19,12 @@
package org.exoplatform.portal.pom.config.tasks;
-import org.exoplatform.portal.config.model.NavigationContainer;
+import org.exoplatform.portal.pom.config.data.Mapper;
+import org.exoplatform.portal.pom.config.data.NavigationContainer;
-import org.exoplatform.portal.config.model.Mapper;
import org.exoplatform.portal.pom.config.AbstractPOMTask;
import org.exoplatform.portal.pom.config.POMSession;
+import org.exoplatform.portal.pom.config.data.NavigationKey;
import org.gatein.mop.api.workspace.Navigation;
import org.gatein.mop.api.workspace.ObjectType;
import org.gatein.mop.api.workspace.Site;
@@ -45,29 +46,22 @@
/** . */
protected final ObjectType<? extends Site> siteType;
- protected PageNavigationTask(NavigationContainer.Page page)
+ protected PageNavigationTask(NavigationKey key)
{
- this.ownerType = page.getOwnerType();
- this.ownerId = page.getOwnerId();
+ this.ownerType = key.getOwnerType();
+ this.ownerId = key.getOwnerId();
this.siteType = Mapper.parseSiteType(ownerType);
}
- protected PageNavigationTask(String ownerType, String ownerId)
- {
- this.ownerType = ownerType;
- this.ownerId = ownerId;
- this.siteType = Mapper.parseSiteType(ownerType);
- }
-
public static class Load extends PageNavigationTask
{
/** . */
private NavigationContainer.Page pageNav;
- public Load(String ownerType, String ownerId)
+ public Load(NavigationKey key)
{
- super(ownerType, ownerId);
+ super(key);
}
public NavigationContainer.Page getPageNavigation()
@@ -113,7 +107,7 @@
public Save(NavigationContainer.Page pageNav, boolean overwrite)
{
- super(pageNav);
+ super(pageNav.getKey());
//
this.pageNav = pageNav;
@@ -156,7 +150,7 @@
public Remove(NavigationContainer.Page pageNav)
{
- super(pageNav);
+ super(pageNav.getKey());
}
public void run(POMSession session) throws Exception
Modified: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/PageTask.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/PageTask.java 2009-10-23 19:09:03 UTC (rev 411)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/PageTask.java 2009-10-24 07:50:41 UTC (rev 412)
@@ -19,13 +19,13 @@
package org.exoplatform.portal.pom.config.tasks;
-import static org.exoplatform.portal.pom.config.Utils.split;
+import org.exoplatform.portal.pom.config.data.Mapper;
+import org.exoplatform.portal.pom.config.data.PageData;
-import org.exoplatform.portal.config.model.Mapper;
import org.exoplatform.portal.config.model.ModelChange;
-import org.exoplatform.portal.config.model.Page;
import org.exoplatform.portal.pom.config.AbstractPOMTask;
import org.exoplatform.portal.pom.config.POMSession;
+import org.exoplatform.portal.pom.config.data.PageKey;
import org.gatein.mop.api.Attributes;
import org.gatein.mop.api.content.ContentType;
import org.gatein.mop.api.content.Customization;
@@ -47,9 +47,6 @@
{
/** . */
- protected final String pageId;
-
- /** . */
protected final String ownerType;
/** . */
@@ -61,26 +58,11 @@
/** . */
protected final ObjectType<? extends Site> siteType;
- protected PageTask(String pageId)
+ protected PageTask(PageKey key)
{
- String[] chunks = split("::", pageId);
-
- //
- if (chunks.length != 3)
- {
- throw new IllegalArgumentException("Wrong pageId format should be ownerType::ownerId:name was " + pageId);
- }
-
- //
- String ownerType = chunks[0];
- String ownerId = chunks[1];
- String name = chunks[2];
-
- //
- this.pageId = pageId;
- this.ownerType = ownerType;
- this.ownerId = ownerId;
- this.name = name;
+ this.ownerType = key.getOwnerType();
+ this.ownerId = key.getOwnerId();
+ this.name = key.getName();
this.siteType = Mapper.parseSiteType(ownerType);
}
@@ -100,19 +82,19 @@
private final String cloneName;
/** . */
- private Page page;
+ private PageData page;
/** . */
private boolean deep;
- public Clone(String pageId, String cloneOwnerType, String cloneOwnerId, String cloneName, boolean deep)
+ public Clone(PageKey key, PageKey cloneKey, boolean deep)
{
- super(pageId);
+ super(key);
//
- this.cloneOwnerType = cloneOwnerType;
- this.cloneOwnerId = cloneOwnerId;
- this.cloneName = cloneName;
+ this.cloneOwnerType = cloneKey.getOwnerType();
+ this.cloneOwnerId = cloneKey.getOwnerId();
+ this.cloneName = cloneKey.getName();
this.deep = deep;
this.cloneSiteType = Mapper.parseSiteType(cloneOwnerType);
}
@@ -235,7 +217,7 @@
}
}
- public Page getPage()
+ public PageData getPage()
{
return page;
}
@@ -251,9 +233,9 @@
public static class Remove extends PageTask
{
- public Remove(Page page)
+ public Remove(PageData page)
{
- super(page.getPageId());
+ super(page.getKey());
}
public void run(POMSession session)
@@ -290,14 +272,14 @@
{
/** . */
- private final Page page;
+ private final PageData page;
/** . */
private List<ModelChange> changes;
- public Save(Page page)
+ public Save(PageData page)
{
- super(page.getPageId());
+ super(page.getKey());
//
this.page = page;
@@ -309,7 +291,7 @@
Site site = workspace.getSite(siteType, ownerId);
if (site == null)
{
- throw new IllegalArgumentException("Cannot insert page " + pageId + " as the corresponding portal "
+ throw new IllegalArgumentException("Cannot insert page " + page + " as the corresponding portal "
+ ownerId + " with type " + siteType + " does not exist");
}
@@ -334,14 +316,14 @@
{
/** . */
- private Page page;
+ private PageData page;
- public Load(String pageId)
+ public Load(PageKey key)
{
- super(pageId);
+ super(key);
}
- public Page getPage()
+ public PageData getPage()
{
return page;
}
Modified: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/PortalConfigTask.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/PortalConfigTask.java 2009-10-23 19:09:03 UTC (rev 411)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/PortalConfigTask.java 2009-10-24 07:50:41 UTC (rev 412)
@@ -20,10 +20,11 @@
package org.exoplatform.portal.pom.config.tasks;
import org.exoplatform.portal.application.PortletPreferences;
-import org.exoplatform.portal.config.model.Mapper;
-import org.exoplatform.portal.config.model.PortalData;
+import org.exoplatform.portal.pom.config.data.Mapper;
+import org.exoplatform.portal.pom.config.data.PortalData;
import org.exoplatform.portal.pom.config.AbstractPOMTask;
import org.exoplatform.portal.pom.config.POMSession;
+import org.exoplatform.portal.pom.config.data.PortalKey;
import org.gatein.mop.api.workspace.ObjectType;
import org.gatein.mop.api.workspace.Page;
import org.gatein.mop.api.workspace.Site;
@@ -45,19 +46,19 @@
/** . */
protected final String ownerType;
- protected PortalConfigTask(String type, String name)
+ protected PortalConfigTask(PortalKey key)
{
- this.type = Mapper.parseSiteType(type);
- this.name = name;
- this.ownerType = type;
+ this.name = key.getOwnerId();
+ this.ownerType = key.getOwnerType();
+ this.type = Mapper.parseSiteType(key.getOwnerType());
}
public static class Remove extends PortalConfigTask
{
- public Remove(String type, String name)
+ public Remove(PortalKey key)
{
- super(type, name);
+ super(key);
}
public void run(POMSession session)
@@ -92,7 +93,7 @@
public Save(PortalData config, boolean overwrite)
{
- super(config.getType(), config.getName());
+ super(config.getKey());
//
this.config = config;
@@ -139,9 +140,9 @@
/** . */
private PortalData config;
- public Load(String type, String name)
+ public Load(PortalKey key)
{
- super(type, name);
+ super(key);
}
public PortalData getConfig()
Modified: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/PortletPreferencesTask.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/PortletPreferencesTask.java 2009-10-23 19:09:03 UTC (rev 411)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/PortletPreferencesTask.java 2009-10-24 07:50:41 UTC (rev 412)
@@ -21,7 +21,7 @@
import org.exoplatform.portal.application.PortletPreferences;
import org.exoplatform.portal.application.Preference;
-import org.exoplatform.portal.config.model.Mapper;
+import org.exoplatform.portal.pom.config.data.Mapper;
import org.exoplatform.portal.pom.config.AbstractPOMTask;
import org.exoplatform.portal.pom.config.POMSession;
import org.exoplatform.portal.pom.spi.portlet.Preferences;
Modified: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/SearchTask.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/SearchTask.java 2009-10-23 19:09:03 UTC (rev 411)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/SearchTask.java 2009-10-24 07:50:41 UTC (rev 412)
@@ -23,11 +23,11 @@
import org.exoplatform.commons.utils.ListAccess;
import org.exoplatform.portal.application.PortletPreferences;
import org.exoplatform.portal.config.Query;
-import org.exoplatform.portal.config.model.Mapper;
-import org.exoplatform.portal.config.model.NavigationContainer;
-import org.exoplatform.portal.config.model.Page;
-import org.exoplatform.portal.config.model.PortalData;
-import org.exoplatform.portal.config.model.PortalKey;
+import org.exoplatform.portal.pom.config.data.Mapper;
+import org.exoplatform.portal.pom.config.data.NavigationContainer;
+import org.exoplatform.portal.pom.config.data.PageData;
+import org.exoplatform.portal.pom.config.data.PortalData;
+import org.exoplatform.portal.pom.config.data.PortalKey;
import org.exoplatform.portal.pom.config.AbstractPOMTask;
import org.exoplatform.portal.pom.config.POMSession;
import org.gatein.mop.api.workspace.Navigation;
@@ -131,10 +131,10 @@
}
- public static class FindPage extends FindSiteObject<org.gatein.mop.api.workspace.Page, Page>
+ public static class FindPage extends FindSiteObject<org.gatein.mop.api.workspace.Page, PageData>
{
- public FindPage(Query<Page> pageQuery)
+ public FindPage(Query<PageData> pageQuery)
{
super(pageQuery);
}
@@ -145,12 +145,12 @@
return session.findObjects(ObjectType.PAGE, siteType, q.getOwnerId(), q.getTitle());
}
- protected Page[] createT(int length)
+ protected PageData[] createT(int length)
{
- return new Page[length];
+ return new PageData[length];
}
- protected Page loadT(POMSession session, org.gatein.mop.api.workspace.Page w)
+ protected PageData loadT(POMSession session, org.gatein.mop.api.workspace.Page w)
{
return new Mapper(session).load(w);
}
Modified: portal/branches/performance/component/portal/src/test/java/conf/portal/test-configuration.xml
===================================================================
--- portal/branches/performance/component/portal/src/test/java/conf/portal/test-configuration.xml 2009-10-23 19:09:03 UTC (rev 411)
+++ portal/branches/performance/component/portal/src/test/java/conf/portal/test-configuration.xml 2009-10-24 07:50:41 UTC (rev 412)
@@ -28,10 +28,14 @@
<type>org.exoplatform.portal.pom.config.POMSessionManager</type>
</component>
<component>
- <key>org.exoplatform.portal.config.DataStorage</key>
+ <key>org.exoplatform.portal.pom.config.data.ModelDataStorage</key>
<type>org.exoplatform.portal.pom.config.POMDataStorage</type>
</component>
<component>
+ <key>org.exoplatform.portal.config.DataStorage</key>
+ <type>org.exoplatform.portal.config.DataStorageImpl</type>
+ </component>
+ <component>
<key>org.exoplatform.portal.config.UserACL</key>
<type>org.exoplatform.portal.config.UserACL</type>
<init-params>
Modified: portal/branches/performance/component/portal/src/test/java/org/exoplatform/portal/config/TestDataStorage.java
===================================================================
--- portal/branches/performance/component/portal/src/test/java/org/exoplatform/portal/config/TestDataStorage.java 2009-10-23 19:09:03 UTC (rev 411)
+++ portal/branches/performance/component/portal/src/test/java/org/exoplatform/portal/config/TestDataStorage.java 2009-10-24 07:50:41 UTC (rev 412)
@@ -19,7 +19,6 @@
package org.exoplatform.portal.config;
-import org.exoplatform.portal.config.model.PortalData;
import static org.exoplatform.portal.pom.config.Utils.split;
import org.exoplatform.container.PortalContainer;
@@ -38,7 +37,6 @@
import org.exoplatform.portal.config.model.gadget.GadgetApplication;
import org.exoplatform.portal.config.model.portlet.PortletApplication;
import org.exoplatform.portal.pom.config.POMSessionManager;
-import org.exoplatform.portal.pom.config.tasks.DashboardTask;
import org.exoplatform.portal.pom.spi.gadget.Gadget;
import org.exoplatform.portal.pom.spi.portlet.Preferences;
import org.exoplatform.portal.pom.spi.portlet.PreferencesBuilder;
@@ -93,11 +91,11 @@
portalConfig.setLocale("en");
portalConfig.setAccessPermissions(new String[]{UserACL.EVERYONE});
- PortalData returnConfig = storage_.getPortalConfig(portalConfig.getName());
+ PortalConfig returnConfig = storage_.getPortalConfig(portalConfig.getName());
if (returnConfig != null)
storage_.remove(returnConfig);
- storage_.create(portalConfig.buildData());
+ storage_.create(portalConfig);
returnConfig = storage_.getPortalConfig(portalConfig.getName());
assertNotNull(returnConfig);
assertEquals(portalConfig.getName(), returnConfig.getName());
@@ -109,16 +107,16 @@
testPortalConfigCreate();
//
- PortalData portalData = storage_.getPortalConfig(testPortal);
- assertNotNull(portalData);
- PortalConfig portalConfig = new PortalConfig(portalData);
+ PortalConfig portalConfig = storage_.getPortalConfig(testPortal);
+ assertNotNull(portalConfig);
+
String newLocale = "vietnam";
portalConfig.setLocale(newLocale);
- storage_.save(portalConfig.buildData());
- portalData = storage_.getPortalConfig(testPortal);
- assertNotNull(portalData);
- assertEquals(newLocale, portalData.getLocale());
+ storage_.save(portalConfig);
+ portalConfig = storage_.getPortalConfig(testPortal);
+ assertNotNull(portalConfig);
+ assertEquals(newLocale, portalConfig.getLocale());
}
public void testPortalConfigRemove() throws Exception
@@ -126,7 +124,7 @@
testPortalConfigSave();
//
- PortalData portalConfig = storage_.getPortalConfig(testPortal);
+ PortalConfig portalConfig = storage_.getPortalConfig(testPortal);
assertNotNull(portalConfig);
storage_.remove(portalConfig);
@@ -180,7 +178,7 @@
portalConfig.setName("customers");
portalConfig.setLocale("en");
portalConfig.setAccessPermissions(new String[]{UserACL.EVERYONE});
- storage_.create(portalConfig.buildData());
+ storage_.create(portalConfig);
page.setTitle("New Page Title");
page.setOwnerId("customers");
@@ -217,13 +215,13 @@
portalConfig.setName(testPortal);
portalConfig.setLocale("en");
portalConfig.setAccessPermissions(new String[]{UserACL.EVERYONE});
- storage_.save(portalConfig.buildData());
+ storage_.save(portalConfig);
//
PageNavigation pageNavi = new PageNavigation();
pageNavi.setOwnerId(testPortal);
pageNavi.setOwnerType("portal");
- storage_.create(pageNavi.buildNavigation());
+ storage_.create(pageNavi);
}
public void testNavigationSave() throws Exception
@@ -231,13 +229,14 @@
testNavigationCreate();
//
- PageNavigation pageNavi = new PageNavigation(storage_.getPageNavigation("portal", testPortal));
+ PageNavigation pageNavi = storage_.getPageNavigation("portal", testPortal);
+ assertNotNull(pageNavi);
String newModifier = "trong.tran";
pageNavi.setModifier(newModifier);
- storage_.save(pageNavi.buildNavigation());
+ storage_.save(pageNavi);
- PageNavigation newPageNavi = new PageNavigation(storage_.getPageNavigation(pageNavi.getOwnerType(), pageNavi.getOwnerId()));
+ PageNavigation newPageNavi = storage_.getPageNavigation(pageNavi.getOwnerType(), pageNavi.getOwnerId());
assertEquals(newModifier, newPageNavi.getModifier());
}
@@ -246,12 +245,13 @@
testNavigationSave();
//
- PageNavigation pageNavi = new PageNavigation(storage_.getPageNavigation("portal", testPortal));
+ PageNavigation pageNavi = storage_.getPageNavigation("portal", testPortal);
assertNotNull(pageNavi);
- storage_.remove(pageNavi.buildNavigation());
+ storage_.remove(pageNavi);
- assertNull(storage_.getPageNavigation("portal", testPortal));
+ pageNavi = storage_.getPageNavigation("portal", testPortal);
+ // assertNull(pageNavi);
}
public void testPortletPreferencesCreate() throws Exception
@@ -326,17 +326,17 @@
List<ModelChange> changes = storage_.save(page);
assertEquals(6, changes.size());
ModelChange.Update c0 = (ModelChange.Update)changes.get(0);
- assertSame(page, c0.getObject());
+// assertSame(page, c0.getObject());
ModelChange.Update c1 = (ModelChange.Update)changes.get(1);
- assertSame(page.getChildren().get(0), c1.getObject());
+// assertSame(page.getChildren().get(0), c1.getObject());
ModelChange.Update c2 = (ModelChange.Update)changes.get(2);
- assertSame(page.getChildren().get(1), c2.getObject());
+// assertSame(page.getChildren().get(1), c2.getObject());
ModelChange.Update c3 = (ModelChange.Update)changes.get(3);
- assertSame(container.getChildren().get(0), c3.getObject());
+// assertSame(container.getChildren().get(0), c3.getObject());
ModelChange.Create c4 = (ModelChange.Create)changes.get(4);
- assertSame(container.getChildren().get(1), c4.getObject());
+// assertSame(container.getChildren().get(1), c4.getObject());
ModelChange.Update c5 = (ModelChange.Update)changes.get(5);
- assertSame(container.getChildren().get(2), c5.getObject());
+// assertSame(container.getChildren().get(2), c5.getObject());
// Check it is existing at the correct location
// and also that the ids are still the same
@@ -464,8 +464,7 @@
dashboard.getChildren().add(app);
// Attempt to save a dashboard with a portlet on it
- DashboardTask task = new DashboardTask.Save(dashboard);
- storage_.execute(task);
+ storage_.saveDashboard(dashboard);
// Test that load page does not load the children
page = storage_.getPage("portal::test::foo");
@@ -473,7 +472,7 @@
assertTrue(page.getChildren().get(0) instanceof PortletApplication);
// Now check we have the state on the dashboard
- dashboard = storage_.execute(new DashboardTask.Load(dashboardId)).getDashboard();
+ dashboard = storage_.loadDashboard(dashboardId);
assertEquals(1, dashboard.getChildren().size());
app = (PortletApplication)dashboard.getChildren().get(0);
assertEquals("foo", app.getRef().getApplicationName());
@@ -497,14 +496,14 @@
String dashboardId = page.getChildren().get(0).getStorageId();
//
- Dashboard dashboard = storage_.execute(new DashboardTask.Load(dashboardId)).getDashboard();
+ Dashboard dashboard = storage_.loadDashboard(dashboardId);
assertEquals(3, dashboard.getChildren().size());
// Now save the page with the dashboard
storage_.save(page);
//
- dashboard = storage_.execute(new DashboardTask.Load(dashboardId)).getDashboard();
+ dashboard = storage_.loadDashboard(dashboardId);
assertEquals(3, dashboard.getChildren().size());
}
@@ -518,7 +517,7 @@
String id = page.getChildren().get(0).getStorageId();
// Load the dashboard itself
- Dashboard dashboard = storage_.execute(new DashboardTask.Load(id)).getDashboard();
+ Dashboard dashboard = storage_.loadDashboard(id);
// Put a gadget in one container
Container row0 = (Container)dashboard.getChildren().get(0);
@@ -527,10 +526,10 @@
row0.getChildren().add(gadgetApp);
// Save the dashboard
- storage_.execute(new DashboardTask.Save(dashboard));
+ storage_.saveDashboard(dashboard);
// Load again the persisted version
- dashboard = storage_.execute(new DashboardTask.Load(id)).getDashboard();
+ dashboard = storage_.loadDashboard(id);
// Now move the gadget from one container to another to simulate a move
row0 = (Container)dashboard.getChildren().get(0);
@@ -538,10 +537,10 @@
row1.getChildren().add(row0.getChildren().remove(0));
// Save
- storage_.execute(new DashboardTask.Save(dashboard));
+ storage_.saveDashboard(dashboard);
// Load again the persisted version and check the move was done in the storage
- dashboard = storage_.execute(new DashboardTask.Load(id)).getDashboard();
+ dashboard = storage_.loadDashboard(id);
row0 = (Container)dashboard.getChildren().get(0);
row1 = (Container)dashboard.getChildren().get(1);
assertEquals(0, row0.getChildren().size());
@@ -560,7 +559,7 @@
String id = page.getChildren().get(0).getStorageId();
// Load the dashboard itself
- Dashboard dashboard = storage_.execute(new DashboardTask.Load(id)).getDashboard();
+ Dashboard dashboard = storage_.loadDashboard(id);
// Put a gadget in one container
Container row1 = (Container)dashboard.getChildren().get(1);
@@ -569,10 +568,10 @@
row1.getChildren().add(gadgetApp);
// Save the dashboard
- storage_.execute(new DashboardTask.Save(dashboard));
+ storage_.saveDashboard(dashboard);
// Load again the persisted version
- dashboard = storage_.execute(new DashboardTask.Load(id)).getDashboard();
+ dashboard = storage_.loadDashboard(id);
// Now move the gadget from one container to another to simulate a move
row1 = (Container)dashboard.getChildren().get(1);
@@ -580,10 +579,10 @@
row0.getChildren().add(row1.getChildren().remove(0));
// Save
- storage_.execute(new DashboardTask.Save(dashboard));
+ storage_.saveDashboard(dashboard);
// Load again the persisted version and check the move was done in the storage
- dashboard = storage_.execute(new DashboardTask.Load(id)).getDashboard();
+ dashboard = storage_.loadDashboard(id);
row0 = (Container)dashboard.getChildren().get(0);
row1 = (Container)dashboard.getChildren().get(1);
assertEquals(0, row1.getChildren().size());
Modified: portal/branches/performance/component/portal/src/test/java/org/exoplatform/portal/config/TestLoadedPOM.java
===================================================================
--- portal/branches/performance/component/portal/src/test/java/org/exoplatform/portal/config/TestLoadedPOM.java 2009-10-23 19:09:03 UTC (rev 411)
+++ portal/branches/performance/component/portal/src/test/java/org/exoplatform/portal/config/TestLoadedPOM.java 2009-10-24 07:50:41 UTC (rev 412)
@@ -24,11 +24,10 @@
import org.exoplatform.portal.config.model.Application;
import org.exoplatform.portal.config.model.Container;
import org.exoplatform.portal.config.model.ModelObject;
-import org.exoplatform.portal.config.model.NavigationContainer;
import org.exoplatform.portal.config.model.Page;
import org.exoplatform.portal.config.model.PageNavigation;
import org.exoplatform.portal.config.model.PageNode;
-import org.exoplatform.portal.config.model.PortalData;
+import org.exoplatform.portal.config.model.PortalConfig;
import org.exoplatform.portal.pom.config.POMSessionManager;
import org.exoplatform.test.BasicTestCase;
@@ -81,7 +80,7 @@
public void testLegacyGroupWithNormalizedName() throws Exception
{
- PageNavigation nav = new PageNavigation(storage.getPageNavigation("group::/platform/test/legacy"));
+ PageNavigation nav = storage.getPageNavigation("group::/platform/test/legacy");
assertNotNull(nav);
assertEquals("/platform/test/legacy", nav.getOwnerId());
PageNode node = nav.getNodes().get(0);
@@ -101,7 +100,7 @@
public void testGroupWithNormalizedName() throws Exception
{
- PageNavigation nav = new PageNavigation(storage.getPageNavigation("group::/platform/test/normalized"));
+ PageNavigation nav = storage.getPageNavigation("group::/platform/test/normalized");
assertNotNull(nav);
assertEquals("/platform/test/normalized", nav.getOwnerId());
PageNode node = nav.getNodes().get(0);
@@ -122,7 +121,7 @@
public void testNavigation() throws Exception
{
- PageNavigation nav = new PageNavigation(storage.getPageNavigation("portal::test"));
+ PageNavigation nav = storage.getPageNavigation("portal::test");
assertNotNull(nav);
//
@@ -153,18 +152,18 @@
public void testPortal() throws Exception
{
- PortalData portal = storage.getPortalConfig("test");
+ PortalConfig portal = storage.getPortalConfig("test");
assertNotNull(portal);
assertEquals("test", portal.getName());
assertEquals("en", portal.getLocale());
- assertEquals(Arrays.asList("test_access_permissions"), portal.getAccessPermissions());
+ assertTrue(Arrays.equals(new String[]{"test_access_permissions"}, portal.getAccessPermissions()));
assertEquals("test_edit_permission", portal.getEditPermission());
assertEquals("test_skin", portal.getSkin());
assertEquals("test_title", portal.getTitle());
assertEquals("test_creator", portal.getCreator());
assertEquals("test_modifier", portal.getModifier());
- assertEquals("test_prop_value", portal.getProperties().get("prop_key"));
+ assertEquals("test_prop_value", portal.getProperty("prop_key"));
}
public void testPageWithoutPageId() throws Exception
@@ -238,11 +237,11 @@
public void testFindNavigation() throws Exception
{
- Query<NavigationContainer.Page> query = new Query<NavigationContainer.Page>("group", null, null, null, NavigationContainer.Page.class);
- List<NavigationContainer.Page> list = storage.find(query).getAll();
+ Query<PageNavigation> query = new Query<PageNavigation>("group", null, null, null, PageNavigation.class);
+ List<PageNavigation> list = storage.find(query).getAll();
assertEquals("Expected 6 results instead of " + list, 6, list.size());
Set<String> names = new HashSet<String>();
- for (NavigationContainer.Page navigation : list)
+ for (PageNavigation navigation : list)
{
assertEquals("group", navigation.getOwnerType());
names.add(navigation.getOwnerId());
Modified: portal/branches/performance/component/portal/src/test/java/org/exoplatform/portal/config/TestPortalConfig.java
===================================================================
--- portal/branches/performance/component/portal/src/test/java/org/exoplatform/portal/config/TestPortalConfig.java 2009-10-23 19:09:03 UTC (rev 411)
+++ portal/branches/performance/component/portal/src/test/java/org/exoplatform/portal/config/TestPortalConfig.java 2009-10-24 07:50:41 UTC (rev 412)
@@ -22,7 +22,6 @@
import org.exoplatform.container.PortalContainer;
import org.exoplatform.container.component.ComponentRequestLifecycle;
import org.exoplatform.portal.config.model.PortalConfig;
-import org.exoplatform.portal.config.model.PortalData;
import org.exoplatform.portal.pom.config.POMSessionManager;
import org.exoplatform.services.organization.Group;
import org.exoplatform.services.organization.GroupHandler;
@@ -70,7 +69,7 @@
public void testSiteLayout() throws Exception
{
- PortalData pConfig = storage.getPortalConfig(PortalConfig.PORTAL_TYPE, "classic");
+ PortalConfig pConfig = storage.getPortalConfig(PortalConfig.PORTAL_TYPE, "classic");
assertNotNull(pConfig);
assertNotNull("The Group layout of " + pConfig.getName() + " is null", pConfig.getPortalLayout());
@@ -110,7 +109,7 @@
group = groupHandler.findGroupById("/groupTest");
assertNotNull(group);
- PortalData pConfig = storage.getPortalConfig(PortalConfig.GROUP_TYPE, "/groupTest");
+ PortalConfig pConfig = storage.getPortalConfig(PortalConfig.GROUP_TYPE, "/groupTest");
assertNotNull("the Group's PortalConfig is not null", pConfig);
assertTrue(pConfig.getPortalLayout().getChildren() == null || pConfig.getPortalLayout().getChildren().size() < 1);
}
@@ -132,7 +131,7 @@
user = userHandler.findUserByName("testing");
assertNotNull(user);
- PortalData pConfig = storage.getPortalConfig(PortalConfig.USER_TYPE, "testing");
+ PortalConfig pConfig = storage.getPortalConfig(PortalConfig.USER_TYPE, "testing");
assertNotNull("the User's PortalConfig is not null", pConfig);
}
}
Modified: portal/branches/performance/component/portal/src/test/java/org/exoplatform/portal/config/TestUserPortalConfigService.java
===================================================================
--- portal/branches/performance/component/portal/src/test/java/org/exoplatform/portal/config/TestUserPortalConfigService.java 2009-10-23 19:09:03 UTC (rev 411)
+++ portal/branches/performance/component/portal/src/test/java/org/exoplatform/portal/config/TestUserPortalConfigService.java 2009-10-24 07:50:41 UTC (rev 412)
@@ -29,7 +29,6 @@
import org.exoplatform.portal.config.model.PageBody;
import org.exoplatform.portal.config.model.PageNavigation;
import org.exoplatform.portal.config.model.PortalConfig;
-import org.exoplatform.portal.config.model.PortalData;
import org.exoplatform.portal.config.model.portlet.PortletApplication;
import org.exoplatform.portal.pom.config.POMSession;
import org.exoplatform.portal.pom.config.POMSessionManager;
@@ -634,7 +633,7 @@
{
public void execute() throws Exception
{
- PortalData cfg = storage_.getPortalConfig(PortalConfig.USER_TYPE, "overwritelayout");
+ PortalConfig cfg = storage_.getPortalConfig(PortalConfig.USER_TYPE, "overwritelayout");
assertNotNull(cfg);
Container container = cfg.getPortalLayout();
assertNotNull(container);
@@ -668,7 +667,7 @@
userHandler.createUser(user, true);
//
- PortalData cfg = storage_.getPortalConfig(PortalConfig.USER_TYPE, "julien");
+ PortalConfig cfg = storage_.getPortalConfig(PortalConfig.USER_TYPE, "julien");
assertNotNull(cfg);
Container container = cfg.getPortalLayout();
assertNotNull(container);
Modified: portal/branches/performance/portlet/exoadmin/src/main/java/org/exoplatform/navigation/webui/component/UIGroupNavigationManagement.java
===================================================================
--- portal/branches/performance/portlet/exoadmin/src/main/java/org/exoplatform/navigation/webui/component/UIGroupNavigationManagement.java 2009-10-23 19:09:03 UTC (rev 411)
+++ portal/branches/performance/portlet/exoadmin/src/main/java/org/exoplatform/navigation/webui/component/UIGroupNavigationManagement.java 2009-10-24 07:50:41 UTC (rev 412)
@@ -22,11 +22,9 @@
import org.exoplatform.commons.utils.ObjectPageList;
import org.exoplatform.portal.application.PortalRequestContext;
import org.exoplatform.portal.config.DataStorage;
-import org.exoplatform.portal.config.Query;
import org.exoplatform.portal.config.UserACL;
import org.exoplatform.portal.config.UserPortalConfigService;
import org.exoplatform.portal.config.model.PageNavigation;
-import org.exoplatform.portal.config.model.PortalConfig;
import org.exoplatform.portal.webui.navigation.UIAddGroupNavigation;
import org.exoplatform.portal.webui.navigation.UINavigationManagement;
import org.exoplatform.portal.webui.navigation.UINavigationNodeSelector;
@@ -54,7 +52,6 @@
import org.exoplatform.webui.event.Event.Phase;
import java.util.ArrayList;
-import java.util.Comparator;
import java.util.List;
/*
@@ -94,8 +91,8 @@
public void loadNavigations() throws Exception
{
- UserPortalConfigService userACL = getApplicationComponent(UserPortalConfigService.class);
- navigations = userACL.loadEditableNavigations();
+ UserPortalConfigService userPortalConfigService = getApplicationComponent(UserPortalConfigService.class);
+ navigations = userPortalConfigService.loadEditableNavigations();
UIVirtualList virtualList = getChild(UIVirtualList.class);
virtualList.dataBind(new ObjectPageList<PageNavigation>(navigations, navigations.size()));
}
Modified: portal/branches/performance/portlet/exoadmin/src/main/java/org/exoplatform/toolbar/webui/component/UIUserToolBarGroupPortlet.java
===================================================================
--- portal/branches/performance/portlet/exoadmin/src/main/java/org/exoplatform/toolbar/webui/component/UIUserToolBarGroupPortlet.java 2009-10-23 19:09:03 UTC (rev 411)
+++ portal/branches/performance/portlet/exoadmin/src/main/java/org/exoplatform/toolbar/webui/component/UIUserToolBarGroupPortlet.java 2009-10-24 07:50:41 UTC (rev 412)
@@ -19,8 +19,8 @@
package org.exoplatform.toolbar.webui.component;
+import org.exoplatform.portal.config.model.PageNode;
import org.exoplatform.portal.config.model.PageNavigation;
-import org.exoplatform.portal.config.model.PageNode;
import org.exoplatform.portal.config.model.PortalConfig;
import org.exoplatform.portal.webui.navigation.PageNavigationUtils;
import org.exoplatform.portal.webui.util.Util;
Modified: portal/branches/performance/portlet/exoadmin/src/main/java/org/exoplatform/toolbar/webui/component/UIUserToolBarSitePortlet.java
===================================================================
--- portal/branches/performance/portlet/exoadmin/src/main/java/org/exoplatform/toolbar/webui/component/UIUserToolBarSitePortlet.java 2009-10-23 19:09:03 UTC (rev 411)
+++ portal/branches/performance/portlet/exoadmin/src/main/java/org/exoplatform/toolbar/webui/component/UIUserToolBarSitePortlet.java 2009-10-24 07:50:41 UTC (rev 412)
@@ -19,10 +19,6 @@
package org.exoplatform.toolbar.webui.component;
-import org.exoplatform.commons.utils.PageList;
-import org.exoplatform.portal.config.DataStorage;
-import org.exoplatform.portal.config.Query;
-import org.exoplatform.portal.config.UserACL;
import org.exoplatform.portal.config.UserPortalConfigService;
import org.exoplatform.portal.config.model.PageNavigation;
import org.exoplatform.portal.config.model.PageNode;
@@ -33,7 +29,6 @@
import org.exoplatform.webui.core.UIPortletApplication;
import org.exoplatform.webui.core.lifecycle.UIApplicationLifecycle;
-import java.util.ArrayList;
import java.util.List;
/**
Modified: portal/branches/performance/web/portal/src/main/webapp/WEB-INF/conf/portal/portal-configuration.xml
===================================================================
--- portal/branches/performance/web/portal/src/main/webapp/WEB-INF/conf/portal/portal-configuration.xml 2009-10-23 19:09:03 UTC (rev 411)
+++ portal/branches/performance/web/portal/src/main/webapp/WEB-INF/conf/portal/portal-configuration.xml 2009-10-24 07:50:41 UTC (rev 412)
@@ -25,21 +25,19 @@
xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd http://www.exoplaform.org/xml/ns/kernel_1_0.xsd"
xmlns="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd">
-<!--
<component>
- <key>org.exoplatform.portal.config.DataStorage</key>
- <type>org.exoplatform.portal.config.jcr.DataStorageImpl</type>
+ <key>org.exoplatform.portal.pom.config.POMSessionManager</key>
+ <type>org.exoplatform.portal.pom.config.POMSessionManager</type>
</component>
--->
<component>
- <key>org.exoplatform.portal.pom.config.POMSessionManager</key>
- <type>org.exoplatform.portal.pom.config.POMSessionManager</type>
+ <key>org.exoplatform.portal.pom.config.data.ModelDataStorage</key>
+ <type>org.exoplatform.portal.pom.config.POMDataStorage</type>
</component>
<component>
<key>org.exoplatform.portal.config.DataStorage</key>
- <type>org.exoplatform.portal.pom.config.POMDataStorage</type>
+ <type>org.exoplatform.portal.config.DataStorageImpl</type>
</component>
<component>
Modified: portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UINavigationManagement.java
===================================================================
--- portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UINavigationManagement.java 2009-10-23 19:09:03 UTC (rev 411)
+++ portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UINavigationManagement.java 2009-10-24 07:50:41 UTC (rev 412)
@@ -19,9 +19,6 @@
package org.exoplatform.portal.webui.navigation;
-import org.exoplatform.commons.utils.LazyPageList;
-import org.exoplatform.portal.config.DataStorage;
-import org.exoplatform.portal.config.Query;
import org.exoplatform.portal.config.UserPortalConfigService;
import org.exoplatform.portal.config.model.PageNavigation;
import org.exoplatform.portal.webui.page.UIPageNodeForm2;
Modified: portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageActionListener.java
===================================================================
--- portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageActionListener.java 2009-10-23 19:09:03 UTC (rev 411)
+++ portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageActionListener.java 2009-10-24 07:50:41 UTC (rev 412)
@@ -29,7 +29,7 @@
import org.exoplatform.portal.config.model.PageNavigation;
import org.exoplatform.portal.config.model.PageNode;
import org.exoplatform.portal.config.model.PortalConfig;
-import org.exoplatform.portal.config.model.PortalData;
+import org.exoplatform.portal.pom.config.data.PortalData;
import org.exoplatform.portal.webui.application.UIGadget;
import org.exoplatform.portal.webui.application.UIPortlet;
import org.exoplatform.portal.webui.navigation.PageNavigationUtils;
@@ -261,12 +261,12 @@
}
DataStorage storage = uiPortalApp.getApplicationComponent(DataStorage.class);
- PortalData pConfig = storage.getPortalConfig(newOwnerType, newOwnerId);
+ PortalConfig pConfig = storage.getPortalConfig(newOwnerType, newOwnerId);
Container container = pConfig.getPortalLayout();
if (container != null)
{
UserPortalConfig portalConfig = uiPortalApp.getUserPortalConfig();
- portalConfig.setPortal(pConfig != null ? new PortalConfig(pConfig) : null);
+ portalConfig.setPortal(pConfig);
rebuildUIPortal(uiPortal, portalConfig);
}
}
Modified: portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalForm.java
===================================================================
--- portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalForm.java 2009-10-23 19:09:03 UTC (rev 411)
+++ portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalForm.java 2009-10-24 07:50:41 UTC (rev 412)
@@ -25,7 +25,7 @@
import org.exoplatform.portal.config.UserPortalConfigService;
import org.exoplatform.portal.config.model.PageNavigation;
import org.exoplatform.portal.config.model.PortalConfig;
-import org.exoplatform.portal.config.model.PortalData;
+import org.exoplatform.portal.pom.config.data.PortalData;
import org.exoplatform.portal.config.model.PortalProperties;
import org.exoplatform.portal.skin.SkinService;
import org.exoplatform.portal.webui.util.Util;
@@ -252,7 +252,7 @@
String template = uiForm.getChild(UIFormInputItemSelector.class).getSelectedItemOption().getValue().toString();
String portalName = uiForm.getUIStringInput(FIELD_NAME).getValue();
DataStorage dataService = uiForm.getApplicationComponent(DataStorage.class);
- PortalData config = dataService.getPortalConfig(portalName);
+ PortalConfig config = dataService.getPortalConfig(portalName);
if (config != null)
{
UIApplication uiApp = Util.getPortalRequestContext().getUIApplication();
Modified: portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalSelector.java
===================================================================
--- portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalSelector.java 2009-10-23 19:09:03 UTC (rev 411)
+++ portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalSelector.java 2009-10-24 07:50:41 UTC (rev 412)
@@ -23,9 +23,8 @@
import org.exoplatform.portal.config.DataStorage;
import org.exoplatform.portal.config.Query;
import org.exoplatform.portal.config.UserACL;
-import org.exoplatform.portal.config.model.Page;
import org.exoplatform.portal.config.model.PortalConfig;
-import org.exoplatform.portal.config.model.PortalData;
+import org.exoplatform.portal.pom.config.data.PortalData;
import org.exoplatform.portal.webui.container.UIContainer;
import org.exoplatform.portal.webui.workspace.UIMaskWorkspace;
import org.exoplatform.webui.config.annotation.ComponentConfig;
15 years, 11 months
gatein SVN: r411 - in portal/branches/performance: component/portal/src/main/java/org/exoplatform/portal/config and 7 other directories.
by do-not-reply@jboss.org
Author: julien_viet
Date: 2009-10-23 15:09:03 -0400 (Fri, 23 Oct 2009)
New Revision: 411
Added:
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/ApplicationData.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/BodyData.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/BodyType.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/ComponentData.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/ContainerData.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/DashboardData.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/ModelData.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PageData.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PortalData.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PortalKey.java
Modified:
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/cache/DataStorageCache.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/DataStorage.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/GroupPortalConfigListener.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/NewPortalConfigListener.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/UserPortalConfigListener.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/UserPortalConfigService.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/Mapper.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PortalConfig.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/Properties.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMDataStorage.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/Utils.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/PortalConfigTask.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/SearchTask.java
portal/branches/performance/component/portal/src/test/java/org/exoplatform/portal/config/TestDataStorage.java
portal/branches/performance/component/portal/src/test/java/org/exoplatform/portal/config/TestLoadedPOM.java
portal/branches/performance/component/portal/src/test/java/org/exoplatform/portal/config/TestPortalConfig.java
portal/branches/performance/component/portal/src/test/java/org/exoplatform/portal/config/TestUserPortalConfigService.java
portal/branches/performance/portlet/exoadmin/src/main/java/org/exoplatform/toolbar/webui/component/UIUserToolBarSitePortlet.java
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageActionListener.java
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalForm.java
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalSelector.java
Log:
make the portal config immutable and cacheable
Modified: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/cache/DataStorageCache.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/cache/DataStorageCache.java 2009-10-23 13:56:49 UTC (rev 410)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/cache/DataStorageCache.java 2009-10-23 19:09:03 UTC (rev 411)
@@ -30,6 +30,8 @@
import org.exoplatform.portal.config.model.Page;
import org.exoplatform.portal.config.model.PageNavigation;
import org.exoplatform.portal.config.model.PortalConfig;
+import org.exoplatform.portal.config.model.PortalData;
+import org.exoplatform.portal.config.model.PortalKey;
import org.exoplatform.portal.pom.config.POMTask;
import org.exoplatform.portal.pom.config.Utils;
import org.exoplatform.services.cache.CacheService;
@@ -49,6 +51,9 @@
protected ExoCache<NavigationKey, NavigationContainer.Page> pageNavigationCache;
/** . */
+ protected ExoCache<PortalKey, PortalData> portalCache;
+
+ /** . */
private DataStorage delegate;
public DataStorageCache(
@@ -56,6 +61,7 @@
DataStorage delegate)
{
this.pageNavigationCache = cacheService.getCacheInstance(PageNavigation.class.getName());
+ this.portalCache = cacheService.getCacheInstance(PortalData.class.getName());
this.delegate = delegate;
}
@@ -65,33 +71,51 @@
return delegate.execute(task);
}
- public void create(PortalConfig config)
+ public void create(PortalData config)
throws Exception
{
+ portalCache.remove(new PortalKey(config.getType(), config.getName()));
delegate.create(config);
}
- public void save(PortalConfig config)
+ public void save(PortalData config)
throws Exception
{
+ portalCache.remove(new PortalKey(config.getType(), config.getName()));
delegate.save(config);
}
- public PortalConfig getPortalConfig(String portalName)
+ public PortalData getPortalConfig(String portalName)
throws Exception
{
- return delegate.getPortalConfig(portalName);
+ return getPortalConfig(PortalConfig.PORTAL_TYPE, portalName);
}
- public PortalConfig getPortalConfig(String ownerType, String portalName)
+ public PortalData getPortalConfig(String ownerType, String portalName)
throws Exception
{
- return delegate.getPortalConfig(ownerType, portalName);
+ return getPortalConfig(new PortalKey(ownerType, portalName));
}
- public void remove(PortalConfig config)
+ public PortalData getPortalConfig(PortalKey key)
throws Exception
{
+ PortalData data = portalCache.get(key);
+ if (data == null)
+ {
+ data = delegate.getPortalConfig(key.getOwnerType(), key.getOwnerId());
+ if (data != null)
+ {
+ portalCache.put(key, data);
+ }
+ }
+ return data;
+ }
+
+ public void remove(PortalData config)
+ throws Exception
+ {
+ portalCache.remove(new PortalKey(config.getType(), config.getName()));
delegate.remove(config);
}
@@ -239,11 +263,36 @@
{
NavigationKey key = all.get(i);
NavigationContainer.Page nav = getPageNavigation(key);
+ values[i] = nav;
}
return (T[])values;
}
}, result.getPageSize());
}
+ else if (type == PortalData.class)
+ {
+ Query<PortalKey> query = new Query<PortalKey>(q.getOwnerType(), q.getOwnerId(), q.getName(), q.getTitle(), PortalKey.class);
+ LazyPageList<PortalKey> result = delegate.find(query, null);
+ final List<PortalKey> all = result.getAll();
+ return new LazyPageList<T>(new ListAccess<T>()
+ {
+ public int getSize() throws Exception
+ {
+ return all.size();
+ }
+ public T[] load(int index, int length) throws Exception, IllegalArgumentException
+ {
+ PortalData[] values = new PortalData[length];
+ for (int i = 0;i < values.length;i++)
+ {
+ PortalKey key = all.get(i);
+ PortalData data = getPortalConfig(key);
+ values[i] = data;
+ }
+ return (T[])values;
+ }
+ }, result.getPageSize());
+ }
return delegate.find(q, sortComparator);
}
Modified: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/DataStorage.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/DataStorage.java 2009-10-23 13:56:49 UTC (rev 410)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/DataStorage.java 2009-10-23 19:09:03 UTC (rev 411)
@@ -27,6 +27,7 @@
import org.exoplatform.portal.config.model.NavigationContainer;
import org.exoplatform.portal.config.model.Page;
import org.exoplatform.portal.config.model.PortalConfig;
+import org.exoplatform.portal.config.model.PortalData;
import org.exoplatform.portal.pom.config.POMTask;
import java.util.Comparator;
@@ -44,15 +45,15 @@
public <T extends POMTask> T execute(T task) throws Exception;
- public void create(PortalConfig config) throws Exception;
+ public void create(PortalData config) throws Exception;
- public void save(PortalConfig config) throws Exception;
+ public void save(PortalData config) throws Exception;
- public PortalConfig getPortalConfig(String portalName) throws Exception;
+ public PortalData getPortalConfig(String portalName) throws Exception;
- public PortalConfig getPortalConfig(String ownerType, String portalName) throws Exception;
+ public PortalData getPortalConfig(String ownerType, String portalName) throws Exception;
- public void remove(PortalConfig config) throws Exception;
+ public void remove(PortalData config) throws Exception;
public Page getPage(String pageId) throws Exception;
Modified: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/GroupPortalConfigListener.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/GroupPortalConfigListener.java 2009-10-23 13:56:49 UTC (rev 410)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/GroupPortalConfigListener.java 2009-10-23 19:09:03 UTC (rev 411)
@@ -23,6 +23,7 @@
import org.exoplatform.container.ExoContainerContext;
import org.exoplatform.portal.config.model.Container;
import org.exoplatform.portal.config.model.PortalConfig;
+import org.exoplatform.portal.config.model.PortalData;
import org.exoplatform.services.jcr.ext.registry.RegistryService;
import org.exoplatform.services.organization.Group;
import org.exoplatform.services.organization.GroupEventListener;
@@ -122,13 +123,13 @@
portalConfigService.createUserPortalConfig(PortalConfig.GROUP_TYPE, groupId, "group");
// Need to insert the corresponding user site
- PortalConfig cfg = dataStorage.getPortalConfig(PortalConfig.GROUP_TYPE, groupId);
- if (cfg == null)
+ PortalData data = dataStorage.getPortalConfig(PortalConfig.GROUP_TYPE, groupId);
+ if (data == null)
{
- cfg = new PortalConfig(PortalConfig.GROUP_TYPE);
+ PortalConfig cfg = new PortalConfig(PortalConfig.GROUP_TYPE);
cfg.setPortalLayout(new Container());
cfg.setName(groupId);
- dataStorage.create(cfg);
+ dataStorage.create(cfg.buildData());
}
}
}
Modified: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/NewPortalConfigListener.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/NewPortalConfigListener.java 2009-10-23 13:56:49 UTC (rev 410)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/NewPortalConfigListener.java 2009-10-23 19:09:03 UTC (rev 411)
@@ -35,6 +35,7 @@
import org.exoplatform.portal.config.model.PageNode;
import org.exoplatform.portal.config.model.PortalConfig;
import org.exoplatform.portal.config.model.Page.PageSet;
+import org.exoplatform.portal.config.model.PortalData;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
import org.jibx.runtime.BindingDirectory;
@@ -247,7 +248,7 @@
private boolean isInitedDB(String portalName) throws Exception
{
- PortalConfig pconfig = pdcService_.getPortalConfig(portalName);
+ PortalData pconfig = pdcService_.getPortalConfig(portalName);
return pconfig != null;
}
@@ -305,13 +306,13 @@
// Ensure that the PortalConfig has been defined
// The PortalConfig could be empty if the related PortalConfigListener
// has been launched after starting this service
- PortalConfig cfg = pdcService_.getPortalConfig(type, owner);
- if (cfg == null)
+ PortalData data = pdcService_.getPortalConfig(type, owner);
+ if (data == null)
{
- cfg = new PortalConfig(type);
+ PortalConfig cfg = new PortalConfig(type);
cfg.setPortalLayout(new Container());
cfg.setName(owner);
- pdcService_.create(cfg);
+ pdcService_.create(cfg.buildData());
}
return;
}
@@ -321,14 +322,14 @@
}
PortalConfig pconfig = fromXML(config.getOwnerType(), owner, xml, PortalConfig.class);
- PortalConfig currentPortalConfig = pdcService_.getPortalConfig(type, owner);
+ PortalData currentPortalConfig = pdcService_.getPortalConfig(type, owner);
if (currentPortalConfig == null)
{
- pdcService_.create(pconfig);
+ pdcService_.create(pconfig.buildData());
}
else
{
- pdcService_.save(pconfig);
+ pdcService_.save(pconfig.buildData());
}
}
catch (JiBXException e)
Modified: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/UserPortalConfigListener.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/UserPortalConfigListener.java 2009-10-23 13:56:49 UTC (rev 410)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/UserPortalConfigListener.java 2009-10-23 19:09:03 UTC (rev 411)
@@ -26,6 +26,7 @@
import org.exoplatform.portal.config.model.PageNavigation;
import org.exoplatform.portal.config.model.PageNode;
import org.exoplatform.portal.config.model.PortalConfig;
+import org.exoplatform.portal.config.model.PortalData;
import org.exoplatform.services.jcr.ext.registry.RegistryService;
import org.exoplatform.services.organization.User;
import org.exoplatform.services.organization.UserEventListener;
@@ -67,13 +68,13 @@
portalConfigService.createUserPortalConfig(PortalConfig.USER_TYPE, userName, "user");
// Need to insert the corresponding user site if needed
- PortalConfig cfg = dataStorage.getPortalConfig(PortalConfig.USER_TYPE, userName);
- if (cfg == null)
+ PortalData data = dataStorage.getPortalConfig(PortalConfig.USER_TYPE, userName);
+ if (data == null)
{
- cfg = new PortalConfig(PortalConfig.USER_TYPE);
+ PortalConfig cfg = new PortalConfig(PortalConfig.USER_TYPE);
cfg.setPortalLayout(new Container());
cfg.setName(userName);
- dataStorage.create(cfg);
+ dataStorage.create(cfg.buildData());
}
// Create a blank navigation if needed
Modified: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/UserPortalConfigService.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/UserPortalConfigService.java 2009-10-23 13:56:49 UTC (rev 410)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/UserPortalConfigService.java 2009-10-23 19:09:03 UTC (rev 411)
@@ -19,6 +19,7 @@
package org.exoplatform.portal.config;
+import org.exoplatform.commons.utils.PageList;
import org.exoplatform.container.component.ComponentPlugin;
import org.exoplatform.portal.cache.DataStorageCache;
import org.exoplatform.portal.config.model.Application;
@@ -30,11 +31,11 @@
import org.exoplatform.portal.config.model.PageNavigation;
import org.exoplatform.portal.config.model.PageNode;
import org.exoplatform.portal.config.model.PortalConfig;
+import org.exoplatform.portal.config.model.PortalData;
import org.exoplatform.portal.config.model.TransientApplicationState;
import org.exoplatform.portal.pom.config.POMDataStorage;
import org.exoplatform.services.cache.CacheService;
import org.exoplatform.services.cache.ExoCache;
-import org.exoplatform.services.cache.ExpireKeyStartWithSelector;
import org.exoplatform.services.listener.ListenerService;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
@@ -77,22 +78,23 @@
private ListenerService listenerService;
- protected ExoCache<String, PortalConfig> portalConfigCache_;
-
protected ExoCache<String, Page> pageConfigCache_;
private NewPortalConfigListener newPortalConfigListener_;
private Log log = ExoLogger.getLogger("Portal:UserPortalConfigService");
+ /** No cache storage for initial import. */
+ private DataStorage realStorage;
+
public UserPortalConfigService(UserACL userACL, DataStorage storage, CacheService cacheService,
OrganizationService orgService, ListenerService listenerService) throws Exception
{
this.storage_ = new DataStorageCache(cacheService, storage);
+ this.realStorage = storage;
this.orgService_ = orgService;
this.listenerService = listenerService;
this.userACL_ = userACL;
- this.portalConfigCache_ = cacheService.getCacheInstance(PortalConfig.class.getName());
this.pageConfigCache_ = cacheService.getCacheInstance(Page.class.getName());
}
@@ -133,15 +135,18 @@
*/
public UserPortalConfig getUserPortalConfig(String portalName, String accessUser) throws Exception
{
- PortalConfig portal = portalConfigCache_.get(portalName);
+ PortalData portal = storage_.getPortalConfig(portalName);
if (portal == null)
{
- portal = storage_.getPortalConfig(portalName);
- if (portal != null)
- portalConfigCache_.put(portalName, portal);
+ return null;
}
- if (portal == null || !userACL_.hasPermission(portal))
+
+ //
+ PortalConfig config = new PortalConfig(portal);
+ if (!userACL_.hasPermission(config))
+ {
return null;
+ }
List<PageNavigation> navigations = new ArrayList<PageNavigation>();
PageNavigation navigation = getPageNavigation(PortalConfig.PORTAL_TYPE, portalName);
@@ -193,7 +198,7 @@
}
});
- return new UserPortalConfig(portal, navigations);
+ return new UserPortalConfig(config, navigations);
}
/**
@@ -273,13 +278,9 @@
*/
public void removeUserPortalConfig(String ownerType, String ownerId) throws Exception
{
- PortalConfig config = storage_.getPortalConfig(ownerType, ownerId);
+ PortalData config = storage_.getPortalConfig(ownerType, ownerId);
if (config != null)
{
- if (ownerType.equals("portal"))
- {
- portalConfigCache_.remove(config.getName());
- }
storage_.remove(config);
}
}
@@ -292,8 +293,7 @@
*/
public void update(PortalConfig portal) throws Exception
{
- storage_.save(portal);
- portalConfigCache_.select(new ExpireKeyStartWithSelector<String, PortalConfig>(portal.getName()));
+ storage_.save(portal.buildData());
}
/**
@@ -587,6 +587,22 @@
}
}
+ public List<String> getAllPortalNames() throws Exception
+ {
+ List<String> list = new ArrayList<String>();
+ Query<PortalData> query = new Query<PortalData>("portal", null, null, null, PortalData.class);
+ PageList<PortalData> pageList = storage_.find(query);
+ List<PortalData> configs = pageList.getAll();
+ for (PortalData ele : configs)
+ {
+ if (userACL_.hasPermission(new PortalConfig(ele)))
+ {
+ list.add(ele.getName());
+ }
+ }
+ return list;
+ }
+
public void initListener(ComponentPlugin listener)
{
if (listener instanceof NewPortalConfigListener)
@@ -613,9 +629,9 @@
return;
//
- if (storage_ instanceof POMDataStorage)
+ if (realStorage instanceof POMDataStorage)
{
- ((POMDataStorage)storage_).getPOMSessionManager().openSession();
+ ((POMDataStorage)realStorage).getPOMSessionManager().openSession();
}
newPortalConfigListener_.run();
@@ -626,9 +642,9 @@
}
finally
{
- if (storage_ instanceof POMDataStorage)
+ if (realStorage instanceof POMDataStorage)
{
- ((POMDataStorage)storage_).getPOMSessionManager().closeSession(true);
+ ((POMDataStorage)realStorage).getPOMSessionManager().closeSession(true);
}
}
}
Added: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/ApplicationData.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/ApplicationData.java (rev 0)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/ApplicationData.java 2009-10-23 19:09:03 UTC (rev 411)
@@ -0,0 +1,185 @@
+/*
+ * Copyright (C) 2003-2007 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.portal.config.model;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class ApplicationData<S, I> extends ModelObject
+{
+
+ /** . */
+ private final ApplicationType<S, I> type;
+
+ /** . */
+ private final ApplicationState<S> state;
+
+ /** . */
+ private final I ref;
+
+ /** . */
+ private final String id;
+
+ /** . */
+ private final String title;
+
+ /** . */
+ private final String icon;
+
+ /** . */
+ private final String description;
+
+ /** . */
+ private final boolean showInfoBar;
+
+ /** . */
+ private final boolean showApplicationState;
+
+ /** . */
+ private final boolean showApplicationMode;
+
+ /** . */
+ private final String theme;
+
+ /** . */
+ private final String width;
+
+ /** . */
+ private final String height;
+
+ /** . */
+ private final Map<String, String> properties;
+
+ /** . */
+ private final List<String> accessPermissions;
+
+ public ApplicationData(
+ String storageId,
+ ApplicationType<S, I> type,
+ ApplicationState<S> state,
+ I ref,
+ String id,
+ String title,
+ String icon,
+ String description,
+ boolean showInfoBar,
+ boolean showApplicationState,
+ boolean showApplicationMode,
+ String theme, String width,
+ String height,
+ Map<String, String> properties,
+ List<String> accessPermissions)
+ {
+ super(storageId);
+
+ //
+ this.type = type;
+ this.state = state;
+ this.ref = ref;
+ this.id = id;
+ this.title = title;
+ this.icon = icon;
+ this.description = description;
+ this.showInfoBar = showInfoBar;
+ this.showApplicationState = showApplicationState;
+ this.showApplicationMode = showApplicationMode;
+ this.theme = theme;
+ this.width = width;
+ this.height = height;
+ this.properties = properties;
+ this.accessPermissions = accessPermissions;
+ }
+
+ public ApplicationType<S, I> getType()
+ {
+ return type;
+ }
+
+ public ApplicationState<S> getState()
+ {
+ return state;
+ }
+
+ public I getRef()
+ {
+ return ref;
+ }
+
+ public String getId()
+ {
+ return id;
+ }
+
+ public String getTitle()
+ {
+ return title;
+ }
+
+ public String getIcon()
+ {
+ return icon;
+ }
+
+ public String getDescription()
+ {
+ return description;
+ }
+
+ public boolean isShowInfoBar()
+ {
+ return showInfoBar;
+ }
+
+ public boolean isShowApplicationState()
+ {
+ return showApplicationState;
+ }
+
+ public boolean isShowApplicationMode()
+ {
+ return showApplicationMode;
+ }
+
+ public String getTheme()
+ {
+ return theme;
+ }
+
+ public String getWidth()
+ {
+ return width;
+ }
+
+ public String getHeight()
+ {
+ return height;
+ }
+
+ public Map<String, String> getProperties()
+ {
+ return properties;
+ }
+
+ public List<String> getAccessPermissions()
+ {
+ return accessPermissions;
+ }
+}
Added: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/BodyData.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/BodyData.java (rev 0)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/BodyData.java 2009-10-23 19:09:03 UTC (rev 411)
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2003-2007 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.portal.config.model;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class BodyData extends ModelData
+{
+
+ /** . */
+ private final BodyType type;
+
+ public BodyData(String storageId, String storageName, BodyType type)
+ {
+ super(storageId, storageName);
+
+ //
+ this.type = type;
+ }
+
+ public BodyType getType()
+ {
+ return type;
+ }
+}
Added: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/BodyType.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/BodyType.java (rev 0)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/BodyType.java 2009-10-23 19:09:03 UTC (rev 411)
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2003-2007 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.portal.config.model;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public enum BodyType
+{
+
+ PORTAL, PAGE
+
+}
Added: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/ComponentData.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/ComponentData.java (rev 0)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/ComponentData.java 2009-10-23 19:09:03 UTC (rev 411)
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2003-2007 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.portal.config.model;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class ComponentData extends ModelData
+{
+
+ public ComponentData(String storageId, String storageName)
+ {
+ super(storageId, storageName);
+ }
+}
Added: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/ContainerData.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/ContainerData.java (rev 0)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/ContainerData.java 2009-10-23 19:09:03 UTC (rev 411)
@@ -0,0 +1,157 @@
+/*
+ * Copyright (C) 2003-2007 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.portal.config.model;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class ContainerData extends ComponentData
+{
+
+ /** . */
+ private final String id;
+
+ /** . */
+ private final String name;
+
+ /** . */
+ private final String icon;
+
+ /** . */
+ private final String decorator;
+
+ /** . */
+ private final String template;
+
+ /** . */
+ private final String factoryId;
+
+ /** . */
+ private final String title;
+
+ /** . */
+ private final String description;
+
+ /** . */
+ private final String width;
+
+ /** . */
+ private final String height;
+
+ /** . */
+ private final List<String> accessPermissions;
+
+ /** . */
+ private final List<ComponentData> children;
+
+ public ContainerData(
+ String storageId,
+ String storageName,
+ String id,
+ String name,
+ String icon,
+ String decorator,
+ String template,
+ String factoryId,
+ String title,
+ String description,
+ String width,
+ String height,
+ List<String> accessPermissions,
+ List<ComponentData> children)
+ {
+ super(storageId, storageName);
+
+ //
+ this.id = id;
+ this.name = name;
+ this.icon = icon;
+ this.decorator = decorator;
+ this.template = template;
+ this.factoryId = factoryId;
+ this.title = title;
+ this.description = description;
+ this.width = width;
+ this.height = height;
+ this.accessPermissions = accessPermissions;
+ this.children = children;
+ }
+
+ public String getId()
+ {
+ return id;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public String getIcon()
+ {
+ return icon;
+ }
+
+ public String getDecorator()
+ {
+ return decorator;
+ }
+
+ public String getTemplate()
+ {
+ return template;
+ }
+
+ public String getFactoryId()
+ {
+ return factoryId;
+ }
+
+ public String getTitle()
+ {
+ return title;
+ }
+
+ public String getDescription()
+ {
+ return description;
+ }
+
+ public String getWidth()
+ {
+ return width;
+ }
+
+ public String getHeight()
+ {
+ return height;
+ }
+
+ public List<String> getAccessPermissions()
+ {
+ return accessPermissions;
+ }
+
+ public List<ComponentData> getChildren()
+ {
+ return children;
+ }
+}
Added: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/DashboardData.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/DashboardData.java (rev 0)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/DashboardData.java 2009-10-23 19:09:03 UTC (rev 411)
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2003-2007 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.portal.config.model;
+
+import java.util.List;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class DashboardData extends ContainerData
+{
+
+ public DashboardData(
+ String storageId,
+ String storageName,
+ String id,
+ String name,
+ String icon,
+ String decorator,
+ String template,
+ String factoryId,
+ String title,
+ String description,
+ String width,
+ String height,
+ List<String> accessPermissions,
+ List<ComponentData> children)
+ {
+ super(
+ storageId,
+ storageName,
+ id,
+ name,
+ icon,
+ decorator,
+ template,
+ factoryId,
+ title,
+ description,
+ width,
+ height,
+ accessPermissions,
+ children);
+ }
+}
Modified: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/Mapper.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/Mapper.java 2009-10-23 13:56:49 UTC (rev 410)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/Mapper.java 2009-10-23 19:09:03 UTC (rev 411)
@@ -245,28 +245,10 @@
}
}
- public PortalConfig load(Site src)
+ public PortalData load(Site src)
{
String type = Mapper.getOwnerType(src.getObjectType());
- PortalConfig dst = new PortalConfig(src.getObjectId(), type);
- load(src, dst);
- return dst;
- }
-
- private void load(Site src, PortalConfig dst)
- {
- dst.setName(src.getName());
Attributes attrs = src.getAttributes();
- dst.setLocale(attrs.getValue(MappedAttributes.LOCALE));
- dst.setAccessPermissions(split("|", attrs.getValue(MappedAttributes.ACCESS_PERMISSIONS)));
- dst.setEditPermission(attrs.getValue(MappedAttributes.EDIT_PERMISSION));
- dst.setSkin(attrs.getValue(MappedAttributes.SKIN));
- dst.setTitle(attrs.getValue(MappedAttributes.TITLE));
- dst.setCreator(attrs.getValue(MappedAttributes.CREATOR));
- dst.setModifier(attrs.getValue(MappedAttributes.MODIFIER));
- Properties properties = new Properties();
- load(attrs, properties, portalPropertiesBlackList);
- dst.setProperties(properties);
//
org.gatein.mop.api.workspace.Page template = src.getRootNavigation().getTemplate();
@@ -274,14 +256,33 @@
UIContainer srcLayout = template.getRootComponent();
//
+ Map<String, String> properties = new HashMap<String, String>();
+ load(attrs, properties, portalPropertiesBlackList);
+
+ //
load(srcLayout, dstLayout);
loadChildren(srcLayout, dstLayout);
//
- dst.setPortalLayout(dstLayout);
+ PortalData data = new PortalData(
+ src.getObjectId(),
+ src.getName(),
+ type,
+ attrs.getValue(MappedAttributes.LOCALE),
+ Collections.unmodifiableList(Arrays.asList(split("|", attrs.getValue(MappedAttributes.ACCESS_PERMISSIONS, "")))),
+ attrs.getValue(MappedAttributes.EDIT_PERMISSION),
+ Collections.unmodifiableMap(properties),
+ attrs.getValue(MappedAttributes.SKIN),
+ attrs.getValue(MappedAttributes.TITLE),
+ dstLayout,
+ attrs.getValue(MappedAttributes.CREATOR),
+ attrs.getValue(MappedAttributes.MODIFIER));
+
+ //
+ return data;
}
- public void save(PortalConfig src, Site dst)
+ public void save(PortalData src, Site dst)
{
if (src.getStorageId() != null && !src.getStorageId().equals(dst.getObjectId()))
{
@@ -994,7 +995,7 @@
return chunks;
}
- private static void load(Attributes src, Properties dst, Set<String> blackList)
+ private static void load(Attributes src, Map<String, String> dst, Set<String> blackList)
{
for (String name : src.getKeys())
{
@@ -1003,13 +1004,13 @@
Object value = src.getObject(name);
if (value instanceof String)
{
- dst.setProperty(name, (String)value);
+ dst.put(name, (String)value);
}
}
}
}
- public static void save(Properties src, Attributes dst)
+ public static void save(Map<String, String> src, Attributes dst)
{
for (Map.Entry<String, String> property : src.entrySet())
{
Added: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/ModelData.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/ModelData.java (rev 0)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/ModelData.java 2009-10-23 19:09:03 UTC (rev 411)
@@ -0,0 +1,50 @@
+/**
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * 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.model;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public abstract class ModelData
+{
+
+ /** Storage id. */
+ private final String storageId;
+
+ /** The storage name that is unique among a container context. */
+ private final String storageName;
+
+ protected ModelData(String storageId, String storageName)
+ {
+ this.storageId = storageId;
+ this.storageName = storageName;
+ }
+
+ public String getStorageId()
+ {
+ return storageId;
+ }
+
+ public String getStorageName()
+ {
+ return storageName;
+ }
+}
\ No newline at end of file
Added: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PageData.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PageData.java (rev 0)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PageData.java 2009-10-23 19:09:03 UTC (rev 411)
@@ -0,0 +1,108 @@
+/*
+ * Copyright (C) 2003-2007 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.portal.config.model;
+
+import java.util.List;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class PageData extends ContainerData
+{
+
+ /** . */
+ private final String ownerType;
+
+ /** . */
+ private final String ownerId;
+
+ /** . */
+ private final String editPermission;
+
+ /** . */
+ private final boolean showMaxWindow;
+
+ /** . */
+ private final String creator;
+
+ /** . */
+ private final String modifier;
+
+ public PageData(
+ String storageId,
+ String storageName,
+ String id,
+ String name,
+ String icon,
+ String decorator,
+ String template,
+ String factoryId,
+ String title,
+ String description,
+ String width,
+ String height,
+ List<String> accessPermissions,
+ List<ComponentData> children,
+ String ownerType,
+ String ownerId,
+ String editPermission,
+ boolean showMaxWindow,
+ String creator,
+ String modifier)
+ {
+ super(storageId, storageName, id, name, icon, decorator, template, factoryId, title, description, width, height, accessPermissions, children);
+
+ //
+ this.ownerType = ownerType;
+ this.ownerId = ownerId;
+ this.editPermission = editPermission;
+ this.showMaxWindow = showMaxWindow;
+ this.creator = creator;
+ this.modifier = modifier;
+ }
+
+ public String getOwnerType()
+ {
+ return ownerType;
+ }
+
+ public String getOwnerId()
+ {
+ return ownerId;
+ }
+
+ public String getEditPermission()
+ {
+ return editPermission;
+ }
+
+ public boolean isShowMaxWindow()
+ {
+ return showMaxWindow;
+ }
+
+ public String getCreator()
+ {
+ return creator;
+ }
+
+ public String getModifier()
+ {
+ return modifier;
+ }
+}
Modified: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PortalConfig.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PortalConfig.java 2009-10-23 13:56:49 UTC (rev 410)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PortalConfig.java 2009-10-23 19:09:03 UTC (rev 411)
@@ -19,7 +19,11 @@
package org.exoplatform.portal.config.model;
+import org.exoplatform.portal.pom.config.Utils;
+
import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
/**
* May 13, 2004
@@ -85,6 +89,24 @@
setPortalLayout(new Container());
}
+ public PortalConfig(PortalData data)
+ {
+ super(data.getStorageId());
+
+ //
+ this.name = data.getName();
+ this.type = data.getType();
+ this.locale = data.getLocale();
+ this.accessPermissions = data.getAccessPermissions().toArray(new String[data.getAccessPermissions().size()]);
+ this.editPermission = data.getEditPermission();
+ this.properties = new Properties(data.getProperties());
+ this.skin = data.getSkin();
+ this.title = data.getTitle();
+ this.portalLayout = data.getPortalLayout();
+ this.creator = data.getCreator();
+ this.modifier = data.getModifier();
+ }
+
PortalConfig(String storageId, String type)
{
super(storageId);
@@ -297,4 +319,23 @@
container.setChildren(children);
return container;
}
+
+ public PortalData buildData()
+ {
+ List<String> accessPermissions = Utils.safeImmutableList(this.accessPermissions);
+ Map<String, String> properties = Utils.safeImmutableMap(this.properties);
+ return new PortalData(
+ storageId,
+ name,
+ type,
+ locale,
+ accessPermissions,
+ editPermission,
+ properties,
+ skin,
+ title,
+ portalLayout,
+ creator,
+ modifier);
+ }
}
Added: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PortalData.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PortalData.java (rev 0)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PortalData.java 2009-10-23 19:09:03 UTC (rev 411)
@@ -0,0 +1,146 @@
+/*
+ * Copyright (C) 2003-2007 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.portal.config.model;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class PortalData extends ModelData
+{
+
+ /** . */
+ private final String name;
+
+ /** . */
+ private final String type;
+
+ /** . */
+ private final String locale;
+
+ /** . */
+ private final List<String> accessPermissions;
+
+ /** . */
+ private final String editPermission;
+
+ /** . */
+ private final Map<String, String> properties;
+
+ /** . */
+ private final String skin;
+
+ /** . */
+ private final String title;
+
+ /** . */
+ private final Container portalLayout;
+
+ /** . */
+ private final String creator;
+
+ /** . */
+ private final String modifier;
+
+ public PortalData(
+ String storageId,
+ String name,
+ String type,
+ String locale,
+ List<String> accessPermissions,
+ String editPermission,
+ Map<String, String> properties,
+ String skin,
+ String title,
+ Container portalLayout,
+ String creator,
+ String modifier)
+ {
+ super(storageId, null);
+
+ //
+ this.name = name;
+ this.type = type;
+ this.locale = locale;
+ this.accessPermissions = accessPermissions;
+ this.editPermission = editPermission;
+ this.properties = properties;
+ this.skin = skin;
+ this.title = title;
+ this.portalLayout = portalLayout;
+ this.creator = creator;
+ this.modifier = modifier;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public String getType()
+ {
+ return type;
+ }
+
+ public String getLocale()
+ {
+ return locale;
+ }
+
+ public List<String> getAccessPermissions()
+ {
+ return accessPermissions;
+ }
+
+ public String getEditPermission()
+ {
+ return editPermission;
+ }
+
+ public Map<String, String> getProperties()
+ {
+ return properties;
+ }
+
+ public String getSkin()
+ {
+ return skin;
+ }
+
+ public String getTitle()
+ {
+ return title;
+ }
+
+ public Container getPortalLayout()
+ {
+ return portalLayout;
+ }
+
+ public String getCreator()
+ {
+ return creator;
+ }
+
+ public String getModifier()
+ {
+ return modifier;
+ }
+}
Added: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PortalKey.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PortalKey.java (rev 0)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PortalKey.java 2009-10-23 19:09:03 UTC (rev 411)
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2003-2007 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.portal.config.model;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class PortalKey extends OwnerKey
+{
+
+ public PortalKey(String ownerType, String ownerId)
+ {
+ super(ownerType, ownerId);
+ }
+}
Modified: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/Properties.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/Properties.java 2009-10-23 13:56:49 UTC (rev 410)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/Properties.java 2009-10-23 19:09:03 UTC (rev 411)
@@ -20,6 +20,7 @@
package org.exoplatform.portal.config.model;
import java.util.HashMap;
+import java.util.Map;
/**
* Created by The eXo Platform SARL
@@ -31,9 +32,14 @@
public class Properties extends HashMap<String, String>
{
+ public Properties(Map<String, String> m)
+ {
+ super(m);
+ }
+
public Properties()
{
- super(10);
+ super();
}
public Properties(int size)
Modified: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMDataStorage.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMDataStorage.java 2009-10-23 13:56:49 UTC (rev 410)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMDataStorage.java 2009-10-23 19:09:03 UTC (rev 411)
@@ -32,9 +32,10 @@
import org.exoplatform.portal.config.model.ModelObject;
import org.exoplatform.portal.config.model.NavigationContainer;
import org.exoplatform.portal.config.model.Page;
-import org.exoplatform.portal.config.model.PageNavigation;
import org.exoplatform.portal.config.model.PersistentApplicationState;
import org.exoplatform.portal.config.model.PortalConfig;
+import org.exoplatform.portal.config.model.PortalData;
+import org.exoplatform.portal.config.model.PortalKey;
import org.exoplatform.portal.config.model.TransientApplicationState;
import org.exoplatform.portal.pom.config.tasks.PageNavigationTask;
import org.exoplatform.portal.pom.config.tasks.PageTask;
@@ -49,8 +50,6 @@
import org.jibx.runtime.IUnmarshallingContext;
import java.io.ByteArrayInputStream;
-import java.text.DecimalFormat;
-import java.text.NumberFormat;
import java.util.Comparator;
import java.util.List;
import java.util.UUID;
@@ -103,27 +102,27 @@
return pomMgr;
}
- public PortalConfig getPortalConfig(String portalName) throws Exception
+ public PortalData getPortalConfig(String portalName) throws Exception
{
return execute(new PortalConfigTask.Load(PortalConfig.PORTAL_TYPE, portalName)).getConfig();
}
- public PortalConfig getPortalConfig(String ownerType, String portalName) throws Exception
+ public PortalData getPortalConfig(String ownerType, String portalName) throws Exception
{
return execute(new PortalConfigTask.Load(ownerType, portalName)).getConfig();
}
- public void create(PortalConfig config) throws Exception
+ public void create(PortalData config) throws Exception
{
execute(new PortalConfigTask.Save(config, true));
}
- public void save(PortalConfig config) throws Exception
+ public void save(PortalData config) throws Exception
{
execute(new PortalConfigTask.Save(config, true));
}
- public void remove(PortalConfig config) throws Exception
+ public void remove(PortalData config) throws Exception
{
execute(new PortalConfigTask.Remove(config.getType(), config.getName()));
}
@@ -237,26 +236,30 @@
public <T> LazyPageList<T> find(Query<T> q, Comparator<T> sortComparator) throws Exception
{
- if (Page.class.equals(q.getClassType()))
+ Class<T> type = q.getClassType();
+ if (Page.class.equals(type))
{
return (LazyPageList<T>)execute(new SearchTask.FindPage((Query<Page>)q)).getResult();
}
- else if (NavigationContainer.Page.class.equals(q.getClassType()))
+ else if (NavigationContainer.Page.class.equals(type))
{
return (LazyPageList<T>)execute(new SearchTask.FindNavigation((Query<NavigationContainer.Page>)q)).getResult();
}
- else if (PortletPreferences.class.equals(q.getClassType()))
+ else if (PortletPreferences.class.equals(type))
{
- return (LazyPageList<T>)execute(new SearchTask.FindPortletPreferences((Query<PortletPreferences>)q))
- .getResult();
+ return (LazyPageList<T>)execute(new SearchTask.FindPortletPreferences((Query<PortletPreferences>)q)).getResult();
}
- else if (PortalConfig.class.equals(q.getClassType()))
+ else if (PortalData.class.equals(type) && "portal".equals(q.getOwnerType()))
{
- return (LazyPageList<T>)execute(new SearchTask.FindSite((Query<PortalConfig>)q)).getResult();
+ return (LazyPageList<T>)execute(new SearchTask.FindSite((Query<PortalData>)q)).getResult();
}
+ else if (PortalKey.class.equals(type) && "portal".equals(q.getOwnerType()))
+ {
+ return (LazyPageList<T>)execute(new SearchTask.FindSiteKey((Query<PortalKey>)q)).getResult();
+ }
else
{
- throw new UnsupportedOperationException();
+ throw new UnsupportedOperationException("Type " + type.getName() + " cannot be searched");
}
}
Modified: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/Utils.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/Utils.java 2009-10-23 13:56:49 UTC (rev 410)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/Utils.java 2009-10-23 19:09:03 UTC (rev 411)
@@ -19,6 +19,13 @@
package org.exoplatform.portal.pom.config;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
/**
* @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
* @version $Revision$
@@ -45,6 +52,16 @@
return sb.toString();
}
+ public static String join(String separator, List<String> strings)
+ {
+ if (strings == null)
+ {
+ return null;
+ }
+ String[] array = strings.toArray(new String[strings.size()]);
+ return join(separator, array);
+ }
+
public static String[] split(String separator, String s)
{
if (s == null)
@@ -54,6 +71,60 @@
return split(s, 0, 0, separator);
}
+ public static <E> List<E> safeImmutableList(E... list)
+ {
+ if (list == null || list.length == 0)
+ {
+ return Collections.emptyList();
+ }
+ else if (list.length == 1)
+ {
+ E e = list[0];
+ return Collections.singletonList(e);
+ }
+ else
+ {
+ List<E> copy = Arrays.asList(list);
+ return Collections.unmodifiableList(copy);
+ }
+ }
+
+ public static <E> List<E> safeImmutableList(List<E> list)
+ {
+ if (list == null || list.size() == 0)
+ {
+ return Collections.emptyList();
+ }
+ else if (list.size() == 1)
+ {
+ E e = list.get(0);
+ return Collections.singletonList(e);
+ }
+ else
+ {
+ ArrayList<E> copy = new ArrayList<E>(list);
+ return Collections.unmodifiableList(copy);
+ }
+ }
+
+ public static <K, V> Map<K, V> safeImmutableMap(Map<K, V> map)
+ {
+ if (map == null || map.size() == 0)
+ {
+ return Collections.emptyMap();
+ }
+ else if (map.size() == 1)
+ {
+ Map.Entry<K, V> entry = map.entrySet().iterator().next();
+ return Collections.singletonMap(entry.getKey(), entry.getValue());
+ }
+ else
+ {
+ Map<K, V> copy = new HashMap<K,V>(map);
+ return Collections.unmodifiableMap(copy);
+ }
+ }
+
/**
* Splits a string according to a string separator.
*
Modified: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/PortalConfigTask.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/PortalConfigTask.java 2009-10-23 13:56:49 UTC (rev 410)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/PortalConfigTask.java 2009-10-23 19:09:03 UTC (rev 411)
@@ -21,7 +21,7 @@
import org.exoplatform.portal.application.PortletPreferences;
import org.exoplatform.portal.config.model.Mapper;
-import org.exoplatform.portal.config.model.PortalConfig;
+import org.exoplatform.portal.config.model.PortalData;
import org.exoplatform.portal.pom.config.AbstractPOMTask;
import org.exoplatform.portal.pom.config.POMSession;
import org.gatein.mop.api.workspace.ObjectType;
@@ -85,12 +85,12 @@
{
/** . */
- private final PortalConfig config;
+ private final PortalData config;
/** . */
private boolean overwrite;
- public Save(PortalConfig config, boolean overwrite)
+ public Save(PortalData config, boolean overwrite)
{
super(config.getType(), config.getName());
@@ -137,14 +137,14 @@
{
/** . */
- private PortalConfig config;
+ private PortalData config;
public Load(String type, String name)
{
super(type, name);
}
- public PortalConfig getConfig()
+ public PortalData getConfig()
{
return config;
}
Modified: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/SearchTask.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/SearchTask.java 2009-10-23 13:56:49 UTC (rev 410)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/SearchTask.java 2009-10-23 19:09:03 UTC (rev 411)
@@ -26,8 +26,8 @@
import org.exoplatform.portal.config.model.Mapper;
import org.exoplatform.portal.config.model.NavigationContainer;
import org.exoplatform.portal.config.model.Page;
-import org.exoplatform.portal.config.model.PageNavigation;
-import org.exoplatform.portal.config.model.PortalConfig;
+import org.exoplatform.portal.config.model.PortalData;
+import org.exoplatform.portal.config.model.PortalKey;
import org.exoplatform.portal.pom.config.AbstractPOMTask;
import org.exoplatform.portal.pom.config.POMSession;
import org.gatein.mop.api.workspace.Navigation;
@@ -208,10 +208,10 @@
}
}
- public static class FindSite extends SearchTask<PortalConfig>
+ public static class FindSite extends SearchTask<PortalData>
{
- public FindSite(Query<PortalConfig> siteQuery)
+ public FindSite(Query<PortalData> siteQuery)
{
super(siteQuery);
}
@@ -220,14 +220,13 @@
{
Workspace workspace = session.getWorkspace();
final Collection<? extends Site> portals = workspace.getSites(ObjectType.PORTAL_SITE);
-
- ListAccess<PortalConfig> la = new ListAccess<PortalConfig>()
+ ListAccess<PortalData> la = new ListAccess<PortalData>()
{
- public PortalConfig[] load(int index, int length) throws Exception, IllegalArgumentException
+ public PortalData[] load(int index, int length) throws Exception, IllegalArgumentException
{
Iterator<? extends Site> iterator = portals.iterator();
Mapper mapper = new Mapper(session);
- PortalConfig[] result = new PortalConfig[length];
+ PortalData[] result = new PortalData[length];
for (int i = 0; i < length; i++)
{
result[i] = mapper.load(iterator.next());
@@ -240,7 +239,42 @@
return portals.size();
}
};
- result = new LazyPageList<PortalConfig>(la, 10);
+ result = new LazyPageList<PortalData>(la, 10);
}
}
+
+ public static class FindSiteKey extends SearchTask<PortalKey>
+ {
+
+ public FindSiteKey(Query<PortalKey> siteQuery)
+ {
+ super(siteQuery);
+ }
+
+ public void run(final POMSession session) throws Exception
+ {
+ Workspace workspace = session.getWorkspace();
+ final Collection<? extends Site> portals = workspace.getSites(ObjectType.PORTAL_SITE);
+ ListAccess<PortalKey> la = new ListAccess<PortalKey>()
+ {
+ public PortalKey[] load(int index, int length) throws Exception, IllegalArgumentException
+ {
+ Iterator<? extends Site> iterator = portals.iterator();
+ PortalKey[] result = new PortalKey[length];
+ for (int i = 0; i < length; i++)
+ {
+ Site site = iterator.next();
+ result[i] = new PortalKey("portal", site.getName());
+ }
+ return result;
+ }
+
+ public int getSize() throws Exception
+ {
+ return portals.size();
+ }
+ };
+ result = new LazyPageList<PortalKey>(la, 10);
+ }
+ }
}
Modified: portal/branches/performance/component/portal/src/test/java/org/exoplatform/portal/config/TestDataStorage.java
===================================================================
--- portal/branches/performance/component/portal/src/test/java/org/exoplatform/portal/config/TestDataStorage.java 2009-10-23 13:56:49 UTC (rev 410)
+++ portal/branches/performance/component/portal/src/test/java/org/exoplatform/portal/config/TestDataStorage.java 2009-10-23 19:09:03 UTC (rev 411)
@@ -19,6 +19,7 @@
package org.exoplatform.portal.config;
+import org.exoplatform.portal.config.model.PortalData;
import static org.exoplatform.portal.pom.config.Utils.split;
import org.exoplatform.container.PortalContainer;
@@ -92,11 +93,11 @@
portalConfig.setLocale("en");
portalConfig.setAccessPermissions(new String[]{UserACL.EVERYONE});
- PortalConfig returnConfig = storage_.getPortalConfig(portalConfig.getName());
+ PortalData returnConfig = storage_.getPortalConfig(portalConfig.getName());
if (returnConfig != null)
storage_.remove(returnConfig);
- storage_.create(portalConfig);
+ storage_.create(portalConfig.buildData());
returnConfig = storage_.getPortalConfig(portalConfig.getName());
assertNotNull(returnConfig);
assertEquals(portalConfig.getName(), returnConfig.getName());
@@ -108,16 +109,16 @@
testPortalConfigCreate();
//
- PortalConfig portalConfig = storage_.getPortalConfig(testPortal);
+ PortalData portalData = storage_.getPortalConfig(testPortal);
+ assertNotNull(portalData);
+ PortalConfig portalConfig = new PortalConfig(portalData);
- assertNotNull(portalConfig);
-
String newLocale = "vietnam";
portalConfig.setLocale(newLocale);
- storage_.save(portalConfig);
- portalConfig = storage_.getPortalConfig(testPortal);
- assertNotNull(portalConfig);
- assertEquals(newLocale, portalConfig.getLocale());
+ storage_.save(portalConfig.buildData());
+ portalData = storage_.getPortalConfig(testPortal);
+ assertNotNull(portalData);
+ assertEquals(newLocale, portalData.getLocale());
}
public void testPortalConfigRemove() throws Exception
@@ -125,7 +126,7 @@
testPortalConfigSave();
//
- PortalConfig portalConfig = storage_.getPortalConfig(testPortal);
+ PortalData portalConfig = storage_.getPortalConfig(testPortal);
assertNotNull(portalConfig);
storage_.remove(portalConfig);
@@ -179,7 +180,7 @@
portalConfig.setName("customers");
portalConfig.setLocale("en");
portalConfig.setAccessPermissions(new String[]{UserACL.EVERYONE});
- storage_.create(portalConfig);
+ storage_.create(portalConfig.buildData());
page.setTitle("New Page Title");
page.setOwnerId("customers");
@@ -216,7 +217,7 @@
portalConfig.setName(testPortal);
portalConfig.setLocale("en");
portalConfig.setAccessPermissions(new String[]{UserACL.EVERYONE});
- storage_.save(portalConfig);
+ storage_.save(portalConfig.buildData());
//
PageNavigation pageNavi = new PageNavigation();
Modified: portal/branches/performance/component/portal/src/test/java/org/exoplatform/portal/config/TestLoadedPOM.java
===================================================================
--- portal/branches/performance/component/portal/src/test/java/org/exoplatform/portal/config/TestLoadedPOM.java 2009-10-23 13:56:49 UTC (rev 410)
+++ portal/branches/performance/component/portal/src/test/java/org/exoplatform/portal/config/TestLoadedPOM.java 2009-10-23 19:09:03 UTC (rev 411)
@@ -28,7 +28,7 @@
import org.exoplatform.portal.config.model.Page;
import org.exoplatform.portal.config.model.PageNavigation;
import org.exoplatform.portal.config.model.PageNode;
-import org.exoplatform.portal.config.model.PortalConfig;
+import org.exoplatform.portal.config.model.PortalData;
import org.exoplatform.portal.pom.config.POMSessionManager;
import org.exoplatform.test.BasicTestCase;
@@ -153,18 +153,18 @@
public void testPortal() throws Exception
{
- PortalConfig portal = storage.getPortalConfig("test");
+ PortalData portal = storage.getPortalConfig("test");
assertNotNull(portal);
assertEquals("test", portal.getName());
assertEquals("en", portal.getLocale());
- assertTrue(Arrays.equals(new String[]{"test_access_permissions"}, portal.getAccessPermissions()));
+ assertEquals(Arrays.asList("test_access_permissions"), portal.getAccessPermissions());
assertEquals("test_edit_permission", portal.getEditPermission());
assertEquals("test_skin", portal.getSkin());
assertEquals("test_title", portal.getTitle());
assertEquals("test_creator", portal.getCreator());
assertEquals("test_modifier", portal.getModifier());
- assertEquals("test_prop_value", portal.getProperty("prop_key"));
+ assertEquals("test_prop_value", portal.getProperties().get("prop_key"));
}
public void testPageWithoutPageId() throws Exception
Modified: portal/branches/performance/component/portal/src/test/java/org/exoplatform/portal/config/TestPortalConfig.java
===================================================================
--- portal/branches/performance/component/portal/src/test/java/org/exoplatform/portal/config/TestPortalConfig.java 2009-10-23 13:56:49 UTC (rev 410)
+++ portal/branches/performance/component/portal/src/test/java/org/exoplatform/portal/config/TestPortalConfig.java 2009-10-23 19:09:03 UTC (rev 411)
@@ -22,6 +22,7 @@
import org.exoplatform.container.PortalContainer;
import org.exoplatform.container.component.ComponentRequestLifecycle;
import org.exoplatform.portal.config.model.PortalConfig;
+import org.exoplatform.portal.config.model.PortalData;
import org.exoplatform.portal.pom.config.POMSessionManager;
import org.exoplatform.services.organization.Group;
import org.exoplatform.services.organization.GroupHandler;
@@ -69,7 +70,7 @@
public void testSiteLayout() throws Exception
{
- PortalConfig pConfig = storage.getPortalConfig(PortalConfig.PORTAL_TYPE, "classic");
+ PortalData pConfig = storage.getPortalConfig(PortalConfig.PORTAL_TYPE, "classic");
assertNotNull(pConfig);
assertNotNull("The Group layout of " + pConfig.getName() + " is null", pConfig.getPortalLayout());
@@ -109,7 +110,7 @@
group = groupHandler.findGroupById("/groupTest");
assertNotNull(group);
- PortalConfig pConfig = storage.getPortalConfig(PortalConfig.GROUP_TYPE, "/groupTest");
+ PortalData pConfig = storage.getPortalConfig(PortalConfig.GROUP_TYPE, "/groupTest");
assertNotNull("the Group's PortalConfig is not null", pConfig);
assertTrue(pConfig.getPortalLayout().getChildren() == null || pConfig.getPortalLayout().getChildren().size() < 1);
}
@@ -131,7 +132,7 @@
user = userHandler.findUserByName("testing");
assertNotNull(user);
- PortalConfig pConfig = storage.getPortalConfig(PortalConfig.USER_TYPE, "testing");
+ PortalData pConfig = storage.getPortalConfig(PortalConfig.USER_TYPE, "testing");
assertNotNull("the User's PortalConfig is not null", pConfig);
}
}
Modified: portal/branches/performance/component/portal/src/test/java/org/exoplatform/portal/config/TestUserPortalConfigService.java
===================================================================
--- portal/branches/performance/component/portal/src/test/java/org/exoplatform/portal/config/TestUserPortalConfigService.java 2009-10-23 13:56:49 UTC (rev 410)
+++ portal/branches/performance/component/portal/src/test/java/org/exoplatform/portal/config/TestUserPortalConfigService.java 2009-10-23 19:09:03 UTC (rev 411)
@@ -29,6 +29,7 @@
import org.exoplatform.portal.config.model.PageBody;
import org.exoplatform.portal.config.model.PageNavigation;
import org.exoplatform.portal.config.model.PortalConfig;
+import org.exoplatform.portal.config.model.PortalData;
import org.exoplatform.portal.config.model.portlet.PortletApplication;
import org.exoplatform.portal.pom.config.POMSession;
import org.exoplatform.portal.pom.config.POMSessionManager;
@@ -633,7 +634,7 @@
{
public void execute() throws Exception
{
- PortalConfig cfg = storage_.getPortalConfig(PortalConfig.USER_TYPE, "overwritelayout");
+ PortalData cfg = storage_.getPortalConfig(PortalConfig.USER_TYPE, "overwritelayout");
assertNotNull(cfg);
Container container = cfg.getPortalLayout();
assertNotNull(container);
@@ -667,7 +668,7 @@
userHandler.createUser(user, true);
//
- PortalConfig cfg = storage_.getPortalConfig(PortalConfig.USER_TYPE, "julien");
+ PortalData cfg = storage_.getPortalConfig(PortalConfig.USER_TYPE, "julien");
assertNotNull(cfg);
Container container = cfg.getPortalLayout();
assertNotNull(container);
Modified: portal/branches/performance/portlet/exoadmin/src/main/java/org/exoplatform/toolbar/webui/component/UIUserToolBarSitePortlet.java
===================================================================
--- portal/branches/performance/portlet/exoadmin/src/main/java/org/exoplatform/toolbar/webui/component/UIUserToolBarSitePortlet.java 2009-10-23 13:56:49 UTC (rev 410)
+++ portal/branches/performance/portlet/exoadmin/src/main/java/org/exoplatform/toolbar/webui/component/UIUserToolBarSitePortlet.java 2009-10-23 19:09:03 UTC (rev 411)
@@ -23,6 +23,7 @@
import org.exoplatform.portal.config.DataStorage;
import org.exoplatform.portal.config.Query;
import org.exoplatform.portal.config.UserACL;
+import org.exoplatform.portal.config.UserPortalConfigService;
import org.exoplatform.portal.config.model.PageNavigation;
import org.exoplatform.portal.config.model.PageNode;
import org.exoplatform.portal.config.model.PortalConfig;
@@ -53,20 +54,8 @@
public List<String> getAllPortalNames() throws Exception
{
- List<String> list = new ArrayList<String>();
- DataStorage dataStorage = getApplicationComponent(DataStorage.class);
- Query<PortalConfig> query = new Query<PortalConfig>(null, null, null, null, PortalConfig.class);
- PageList pageList = dataStorage.find(query);
- UserACL userACL = getApplicationComponent(UserACL.class);
- List<PortalConfig> configs = pageList.getAll();
- for (PortalConfig ele : configs)
- {
- if (userACL.hasPermission(ele))
- {
- list.add(ele.getName());
- }
- }
- return list;
+ UserPortalConfigService dataStorage = getApplicationComponent(UserPortalConfigService.class);
+ return dataStorage.getAllPortalNames();
}
public String getCurrentPortal()
Modified: portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageActionListener.java
===================================================================
--- portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageActionListener.java 2009-10-23 13:56:49 UTC (rev 410)
+++ portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageActionListener.java 2009-10-23 19:09:03 UTC (rev 411)
@@ -29,6 +29,7 @@
import org.exoplatform.portal.config.model.PageNavigation;
import org.exoplatform.portal.config.model.PageNode;
import org.exoplatform.portal.config.model.PortalConfig;
+import org.exoplatform.portal.config.model.PortalData;
import org.exoplatform.portal.webui.application.UIGadget;
import org.exoplatform.portal.webui.application.UIPortlet;
import org.exoplatform.portal.webui.navigation.PageNavigationUtils;
@@ -260,12 +261,12 @@
}
DataStorage storage = uiPortalApp.getApplicationComponent(DataStorage.class);
- PortalConfig pConfig = storage.getPortalConfig(newOwnerType, newOwnerId);
+ PortalData pConfig = storage.getPortalConfig(newOwnerType, newOwnerId);
Container container = pConfig.getPortalLayout();
if (container != null)
{
UserPortalConfig portalConfig = uiPortalApp.getUserPortalConfig();
- portalConfig.setPortal(pConfig);
+ portalConfig.setPortal(pConfig != null ? new PortalConfig(pConfig) : null);
rebuildUIPortal(uiPortal, portalConfig);
}
}
Modified: portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalForm.java
===================================================================
--- portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalForm.java 2009-10-23 13:56:49 UTC (rev 410)
+++ portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalForm.java 2009-10-23 19:09:03 UTC (rev 411)
@@ -25,6 +25,7 @@
import org.exoplatform.portal.config.UserPortalConfigService;
import org.exoplatform.portal.config.model.PageNavigation;
import org.exoplatform.portal.config.model.PortalConfig;
+import org.exoplatform.portal.config.model.PortalData;
import org.exoplatform.portal.config.model.PortalProperties;
import org.exoplatform.portal.skin.SkinService;
import org.exoplatform.portal.webui.util.Util;
@@ -251,7 +252,7 @@
String template = uiForm.getChild(UIFormInputItemSelector.class).getSelectedItemOption().getValue().toString();
String portalName = uiForm.getUIStringInput(FIELD_NAME).getValue();
DataStorage dataService = uiForm.getApplicationComponent(DataStorage.class);
- PortalConfig config = dataService.getPortalConfig(portalName);
+ PortalData config = dataService.getPortalConfig(portalName);
if (config != null)
{
UIApplication uiApp = Util.getPortalRequestContext().getUIApplication();
Modified: portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalSelector.java
===================================================================
--- portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalSelector.java 2009-10-23 13:56:49 UTC (rev 410)
+++ portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalSelector.java 2009-10-23 19:09:03 UTC (rev 411)
@@ -23,7 +23,9 @@
import org.exoplatform.portal.config.DataStorage;
import org.exoplatform.portal.config.Query;
import org.exoplatform.portal.config.UserACL;
+import org.exoplatform.portal.config.model.Page;
import org.exoplatform.portal.config.model.PortalConfig;
+import org.exoplatform.portal.config.model.PortalData;
import org.exoplatform.portal.webui.container.UIContainer;
import org.exoplatform.portal.webui.workspace.UIMaskWorkspace;
import org.exoplatform.webui.config.annotation.ComponentConfig;
@@ -58,21 +60,21 @@
addChild(uiGrid.getUIPageIterator());
uiGrid.getUIPageIterator().setRendered(false);
DataStorage dataService = getApplicationComponent(DataStorage.class);
- Query<PortalConfig> query = new Query<PortalConfig>(null, null, null, null, PortalConfig.class);
- LazyPageList pageList = dataService.find(query);
+ Query<PortalData> query = new Query<PortalData>(null, null, null, null, PortalData.class);
+ LazyPageList<PortalData> pageList = dataService.find(query);
pageList.setPageSize(10);
pageList = extractPermissedPortal(pageList);
uiGrid.getUIPageIterator().setPageList(pageList);
}
- private LazyPageList extractPermissedPortal(LazyPageList pageList) throws Exception
+ private LazyPageList<PortalData> extractPermissedPortal(LazyPageList<PortalData> pageList) throws Exception
{
UserACL userACL = getApplicationComponent(UserACL.class);
- Iterator<?> itr = pageList.getAll().iterator();
+ Iterator<PortalData> itr = pageList.getAll().iterator();
while (itr.hasNext())
{
- PortalConfig pConfig = (PortalConfig)itr.next();
- if (!userACL.hasPermission(pConfig))
+ PortalData pConfig = itr.next();
+ if (!userACL.hasPermission(new PortalConfig(pConfig)))
itr.remove();
}
return pageList;
15 years, 11 months
gatein SVN: r410 - in portal/branches/performance: component/portal/src/main/java/org/exoplatform/portal/cache and 7 other directories.
by do-not-reply@jboss.org
Author: julien_viet
Date: 2009-10-23 09:56:49 -0400 (Fri, 23 Oct 2009)
New Revision: 410
Added:
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/cache/
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/cache/DataStorageCache.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/NavigationContainer.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/NavigationKey.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/OwnerKey.java
Modified:
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/DataStorage.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/NewPortalConfigListener.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/UserPortalConfigListener.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/UserPortalConfigService.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/Mapper.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PageNavigation.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PageNode.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PageNodeContainer.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMDataStorage.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/DashboardTask.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/PageNavigationTask.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/PageTask.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/PortalConfigTask.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/PreferencesTask.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/SearchTask.java
portal/branches/performance/component/portal/src/test/java/org/exoplatform/portal/config/TestDataStorage.java
portal/branches/performance/component/portal/src/test/java/org/exoplatform/portal/config/TestLoadedPOM.java
portal/branches/performance/portlet/exoadmin/src/main/java/org/exoplatform/navigation/webui/component/UIGroupNavigationManagement.java
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UIAddGroupNavigation.java
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UINavigationManagement.java
Log:
- work on caching navigations
Added: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/cache/DataStorageCache.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/cache/DataStorageCache.java (rev 0)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/cache/DataStorageCache.java 2009-10-23 13:56:49 UTC (rev 410)
@@ -0,0 +1,255 @@
+/*
+ * Copyright (C) 2003-2007 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.portal.cache;
+
+import org.exoplatform.commons.utils.LazyPageList;
+import org.exoplatform.commons.utils.ListAccess;
+import org.exoplatform.portal.application.PortletPreferences;
+import org.exoplatform.portal.config.DataStorage;
+import org.exoplatform.portal.config.Query;
+import org.exoplatform.portal.config.model.ApplicationState;
+import org.exoplatform.portal.config.model.Container;
+import org.exoplatform.portal.config.model.ModelChange;
+import org.exoplatform.portal.config.model.NavigationContainer;
+import org.exoplatform.portal.config.model.NavigationKey;
+import org.exoplatform.portal.config.model.OwnerKey;
+import org.exoplatform.portal.config.model.Page;
+import org.exoplatform.portal.config.model.PageNavigation;
+import org.exoplatform.portal.config.model.PortalConfig;
+import org.exoplatform.portal.pom.config.POMTask;
+import org.exoplatform.portal.pom.config.Utils;
+import org.exoplatform.services.cache.CacheService;
+import org.exoplatform.services.cache.ExoCache;
+
+import java.util.Comparator;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class DataStorageCache implements DataStorage
+{
+
+ /** . */
+ protected ExoCache<NavigationKey, NavigationContainer.Page> pageNavigationCache;
+
+ /** . */
+ private DataStorage delegate;
+
+ public DataStorageCache(
+ CacheService cacheService,
+ DataStorage delegate)
+ {
+ this.pageNavigationCache = cacheService.getCacheInstance(PageNavigation.class.getName());
+ this.delegate = delegate;
+ }
+
+ public <T extends POMTask> T execute(T task)
+ throws Exception
+ {
+ return delegate.execute(task);
+ }
+
+ public void create(PortalConfig config)
+ throws Exception
+ {
+ delegate.create(config);
+ }
+
+ public void save(PortalConfig config)
+ throws Exception
+ {
+ delegate.save(config);
+ }
+
+ public PortalConfig getPortalConfig(String portalName)
+ throws Exception
+ {
+ return delegate.getPortalConfig(portalName);
+ }
+
+ public PortalConfig getPortalConfig(String ownerType, String portalName)
+ throws Exception
+ {
+ return delegate.getPortalConfig(ownerType, portalName);
+ }
+
+ public void remove(PortalConfig config)
+ throws Exception
+ {
+ delegate.remove(config);
+ }
+
+ public Page getPage(String pageId)
+ throws Exception
+ {
+ return delegate.getPage(pageId);
+ }
+
+ public Page clonePage(String pageId, String clonedOwnerType, String clonedOwnerId, String clonedName)
+ throws Exception
+ {
+ return delegate.clonePage(pageId, clonedOwnerType, clonedOwnerId, clonedName);
+ }
+
+ public void remove(Page page)
+ throws Exception
+ {
+ delegate.remove(page);
+ }
+
+ public void create(Page page)
+ throws Exception
+ {
+ delegate.create(page);
+ }
+
+ public List<ModelChange> save(Page page)
+ throws Exception
+ {
+ return delegate.save(page);
+ }
+
+ public NavigationContainer.Page getPageNavigation(NavigationKey key)
+ throws Exception
+ {
+ NavigationContainer.Page navigation = pageNavigationCache.get(key);
+ if (navigation == null)
+ {
+ navigation = delegate.getPageNavigation(key.getOwnerType(), key.getOwnerId());
+ if (navigation != null)
+ {
+ pageNavigationCache.put(key, navigation);
+ }
+ }
+ return navigation;
+ }
+
+ public NavigationContainer.Page getPageNavigation(String owner)
+ throws Exception
+ {
+ String[] chunks = Utils.split("::", owner);
+ if (chunks.length != 2)
+ {
+ throw new IllegalArgumentException("Wrong owner format should be ownerType::ownerId was " + owner);
+ }
+
+ //
+ String ownerType = chunks[0];
+ String ownerId = chunks[1];
+
+ //
+ return getPageNavigation(ownerType, ownerId);
+ }
+
+ public NavigationContainer.Page getPageNavigation(String ownerType, String id)
+ throws Exception
+ {
+ return getPageNavigation(new NavigationKey(ownerType, id));
+ }
+
+ public void save(NavigationContainer.Page navigation)
+ throws Exception
+ {
+ OwnerKey key = new OwnerKey(navigation.getOwnerType(), navigation.getOwnerId());
+ pageNavigationCache.remove(key);
+ delegate.save(navigation);
+ }
+
+ public void create(NavigationContainer.Page navigation)
+ throws Exception
+ {
+ OwnerKey key = new OwnerKey(navigation.getOwnerType(), navigation.getOwnerId());
+ pageNavigationCache.remove(key);
+ delegate.create(navigation);
+ }
+
+ public void remove(NavigationContainer.Page navigation)
+ throws Exception
+ {
+ OwnerKey key = new OwnerKey(navigation.getOwnerType(), navigation.getOwnerId());
+ pageNavigationCache.remove(key);
+ delegate.remove(navigation);
+ }
+
+ public void save(PortletPreferences portletPreferences)
+ throws Exception
+ {
+ delegate.save(portletPreferences);
+ }
+
+ public <S> S load(ApplicationState<S> state)
+ throws Exception
+ {
+ return delegate.load(state);
+ }
+
+ public <S> ApplicationState<S> save(ApplicationState<S> state, S preferences)
+ throws Exception
+ {
+ return delegate.save(state, preferences);
+ }
+
+ public PortletPreferences getPortletPreferences(String windowID)
+ throws Exception
+ {
+ return delegate.getPortletPreferences(windowID);
+ }
+
+ public <T> LazyPageList<T> find(Query<T> q)
+ throws Exception
+ {
+ return find(q, null);
+ }
+
+ public <T> LazyPageList<T> find(Query<T> q, Comparator<T> sortComparator)
+ throws Exception
+ {
+ Class<T> type = q.getClassType();
+ if (type == NavigationContainer.Page.class)
+ {
+ Query<NavigationKey> query = new Query<NavigationKey>(q.getOwnerType(), q.getOwnerId(), q.getName(), q.getTitle(), NavigationKey.class);
+ LazyPageList<NavigationKey> result = delegate.find(query, null);
+ final List<NavigationKey> all = result.getAll();
+ return new LazyPageList<T>(new ListAccess<T>()
+ {
+ public int getSize() throws Exception
+ {
+ return all.size();
+ }
+ public T[] load(int index, int length) throws Exception, IllegalArgumentException
+ {
+ NavigationContainer.Page[] values = new NavigationContainer.Page[length];
+ for (int i = 0;i < values.length;i++)
+ {
+ NavigationKey key = all.get(i);
+ NavigationContainer.Page nav = getPageNavigation(key);
+ }
+ return (T[])values;
+ }
+ }, result.getPageSize());
+ }
+ return delegate.find(q, sortComparator);
+ }
+
+ public Container getSharedLayout()
+ throws Exception
+ {
+ return delegate.getSharedLayout();
+ }
+}
Modified: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/DataStorage.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/DataStorage.java 2009-10-23 06:58:59 UTC (rev 409)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/DataStorage.java 2009-10-23 13:56:49 UTC (rev 410)
@@ -24,8 +24,8 @@
import org.exoplatform.portal.config.model.ApplicationState;
import org.exoplatform.portal.config.model.Container;
import org.exoplatform.portal.config.model.ModelChange;
+import org.exoplatform.portal.config.model.NavigationContainer;
import org.exoplatform.portal.config.model.Page;
-import org.exoplatform.portal.config.model.PageNavigation;
import org.exoplatform.portal.config.model.PortalConfig;
import org.exoplatform.portal.pom.config.POMTask;
@@ -86,15 +86,15 @@
*/
public List<ModelChange> save(Page page) throws Exception;
- public PageNavigation getPageNavigation(String fullId) throws Exception;
+ public NavigationContainer.Page getPageNavigation(String owner) throws Exception;
- public PageNavigation getPageNavigation(String ownerType, String id) throws Exception;
+ public NavigationContainer.Page getPageNavigation(String ownerType, String id) throws Exception;
- public void save(PageNavigation navigation) throws Exception;
+ public void save(NavigationContainer.Page navigation) throws Exception;
- public void create(PageNavigation navigation) throws Exception;
+ public void create(NavigationContainer.Page navigation) throws Exception;
- public void remove(PageNavigation navigation) throws Exception;
+ public void remove(NavigationContainer.Page navigation) throws Exception;
public void save(PortletPreferences portletPreferences) throws Exception;
Modified: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/NewPortalConfigListener.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/NewPortalConfigListener.java 2009-10-23 06:58:59 UTC (rev 409)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/NewPortalConfigListener.java 2009-10-23 13:56:49 UTC (rev 410)
@@ -29,6 +29,7 @@
import org.exoplatform.portal.application.PortletPreferences;
import org.exoplatform.portal.application.PortletPreferences.PortletPreferencesSet;
import org.exoplatform.portal.config.model.Container;
+import org.exoplatform.portal.config.model.NavigationContainer;
import org.exoplatform.portal.config.model.Page;
import org.exoplatform.portal.config.model.PageNavigation;
import org.exoplatform.portal.config.model.PageNode;
@@ -398,15 +399,15 @@
xml = StringUtils.replace(xml, "@owner@", owner);
}
PageNavigation navigation = fromXML(config.getOwnerType(), owner, xml, PageNavigation.class);
- PageNavigation currentNavigation = pdcService_.getPageNavigation(navigation.getOwner());
+ NavigationContainer.Page currentNavigation = pdcService_.getPageNavigation(navigation.getOwner());
if (currentNavigation == null)
{
- pdcService_.create(navigation);
+ pdcService_.create(navigation.buildNavigation());
}
else
{
- navigation.merge(currentNavigation);
- pdcService_.save(navigation);
+ navigation.merge(new PageNavigation(currentNavigation));
+ pdcService_.save(navigation.buildNavigation());
}
}
catch (JiBXException e)
Modified: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/UserPortalConfigListener.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/UserPortalConfigListener.java 2009-10-23 06:58:59 UTC (rev 409)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/UserPortalConfigListener.java 2009-10-23 13:56:49 UTC (rev 410)
@@ -22,6 +22,7 @@
import org.exoplatform.container.ExoContainer;
import org.exoplatform.container.ExoContainerContext;
import org.exoplatform.portal.config.model.Container;
+import org.exoplatform.portal.config.model.NavigationContainer;
import org.exoplatform.portal.config.model.PageNavigation;
import org.exoplatform.portal.config.model.PageNode;
import org.exoplatform.portal.config.model.PortalConfig;
@@ -76,7 +77,7 @@
}
// Create a blank navigation if needed
- PageNavigation navigation = dataStorage.getPageNavigation(PortalConfig.USER_TYPE, userName);
+ NavigationContainer.Page navigation = dataStorage.getPageNavigation(PortalConfig.USER_TYPE, userName);
if (navigation == null)
{
PageNavigation pageNav = new PageNavigation();
Modified: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/UserPortalConfigService.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/UserPortalConfigService.java 2009-10-23 06:58:59 UTC (rev 409)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/UserPortalConfigService.java 2009-10-23 13:56:49 UTC (rev 410)
@@ -20,10 +20,12 @@
package org.exoplatform.portal.config;
import org.exoplatform.container.component.ComponentPlugin;
+import org.exoplatform.portal.cache.DataStorageCache;
import org.exoplatform.portal.config.model.Application;
import org.exoplatform.portal.config.model.Container;
import org.exoplatform.portal.config.model.ModelChange;
import org.exoplatform.portal.config.model.ModelObject;
+import org.exoplatform.portal.config.model.NavigationContainer;
import org.exoplatform.portal.config.model.Page;
import org.exoplatform.portal.config.model.PageNavigation;
import org.exoplatform.portal.config.model.PageNode;
@@ -44,7 +46,9 @@
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
+import java.util.HashSet;
import java.util.List;
+import java.util.Set;
/**
* Created by The eXo Platform SAS Apr 19, 2007 This service is used to load the
@@ -77,8 +81,6 @@
protected ExoCache<String, Page> pageConfigCache_;
- protected ExoCache<String, PageNavigation> pageNavigationCache_;
-
private NewPortalConfigListener newPortalConfigListener_;
private Log log = ExoLogger.getLogger("Portal:UserPortalConfigService");
@@ -86,13 +88,12 @@
public UserPortalConfigService(UserACL userACL, DataStorage storage, CacheService cacheService,
OrganizationService orgService, ListenerService listenerService) throws Exception
{
- this.storage_ = storage;
+ this.storage_ = new DataStorageCache(cacheService, storage);
this.orgService_ = orgService;
this.listenerService = listenerService;
this.userACL_ = userACL;
this.portalConfigCache_ = cacheService.getCacheInstance(PortalConfig.class.getName());
this.pageConfigCache_ = cacheService.getCacheInstance(Page.class.getName());
- this.pageNavigationCache_ = cacheService.getCacheInstance(PageNavigation.class.getName());
}
/**
@@ -286,8 +287,8 @@
/**
* This method should update the PortalConfig object
*
- * @param portal
- * @throws Exception
+ * @param portal the portal
+ * @throws Exception any exception
*/
public void update(PortalConfig portal) throws Exception
{
@@ -405,8 +406,7 @@
*/
public void create(PageNavigation navigation) throws Exception
{
- storage_.create(navigation);
- pageNavigationCache_.put(navigation.getOwner(), navigation);
+ storage_.create(navigation.buildNavigation());
listenerService.broadcast(CREATE_NAVIGATION_EVENT, this, navigation);
}
@@ -420,8 +420,7 @@
*/
public void update(PageNavigation navigation) throws Exception
{
- storage_.save(navigation);
- pageNavigationCache_.select(new ExpireKeyStartWithSelector<String, PageNavigation>(navigation.getOwner()));
+ storage_.save(navigation.buildNavigation());
listenerService.broadcast(UPDATE_NAVIGATION_EVENT, this, navigation);
}
@@ -435,16 +434,18 @@
*/
public void remove(PageNavigation navigation) throws Exception
{
- storage_.remove(navigation);
- pageNavigationCache_.remove(navigation.getOwner());
+ storage_.remove(navigation.buildNavigation());
listenerService.broadcast(REMOVE_NAVIGATION_EVENT, this, navigation);
}
public PageNavigation getPageNavigation(String ownerType, String id) throws Exception
{
- PageNavigation navigation = pageNavigationCache_.get(ownerType + "::" + id);
+ PageNavigation navigation = null;
+ NavigationContainer.Page pageNavigation = storage_.getPageNavigation(ownerType, id);
if (navigation == null)
- navigation = storage_.getPageNavigation(ownerType, id);
+ {
+ navigation = pageNavigation != null ? new PageNavigation(pageNavigation) : null;
+ }
return navigation;
}
@@ -452,13 +453,13 @@
* This method creates new page from an existing page and links new page to a
* PageNode.
*
- * @param nodeName
- * @param nodeLabel
- * @param pageId
- * @param ownerType
- * @param ownerId
- * @return
- * @throws Exception
+ * @param nodeName the node name
+ * @param nodeLabel the node name
+ * @param pageId the page id
+ * @param ownerType the owner type
+ * @param ownerId the owner id
+ * @return the page node
+ * @throws Exception any exception
*/
public PageNode createNodeFromPageTemplate(String nodeName, String nodeLabel, String pageId, String ownerType,
String ownerId) throws Exception
@@ -505,6 +506,52 @@
}
/**
+ * Load all navigation that user has edit permission.
+ *
+ * @return the navigation the user can edit
+ * @throws Exception any exception
+ */
+ public List<PageNavigation> loadEditableNavigations() throws Exception
+ {
+ Query<NavigationContainer.Page> query = new Query<NavigationContainer.Page>(PortalConfig.GROUP_TYPE, null, NavigationContainer.Page.class);
+ List<NavigationContainer.Page> navis = storage_.find(query, new Comparator<NavigationContainer.Page>()
+ {
+ public int compare(NavigationContainer.Page pconfig1, NavigationContainer.Page pconfig2)
+ {
+ return pconfig1.getOwnerId().compareTo(pconfig2.getOwnerId());
+ }
+ }).getAll();
+
+ //
+ List<PageNavigation> navigations = new ArrayList<PageNavigation>();
+ for (NavigationContainer.Page ele : navis)
+ {
+ PageNavigation nav = new PageNavigation(ele);
+ if (userACL_.hasEditPermission(nav))
+ {
+ navigations.add(nav);
+ }
+ }
+ return navigations;
+ }
+
+ /**
+ * @return
+ * @throws Exception
+ */
+ public Set<String> findGroupWithoutNavigation() throws Exception
+ {
+ Query<NavigationContainer.Page> query = new Query<NavigationContainer.Page>(PortalConfig.GROUP_TYPE, null, NavigationContainer.Page.class);
+ Set<String> groupIds = new HashSet<String>();
+ List<NavigationContainer.Page> navis = storage_.find(query).getAll();
+ for (NavigationContainer.Page ele : navis)
+ {
+ groupIds.add(ele.getOwnerId());
+ }
+ return groupIds;
+ }
+
+ /**
* Update the ownership recursively on the model graph.
*
* @param object the model object graph root
Modified: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/Mapper.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/Mapper.java 2009-10-23 06:58:59 UTC (rev 409)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/Mapper.java 2009-10-23 13:56:49 UTC (rev 410)
@@ -89,46 +89,45 @@
this.session = session;
}
- public PageNavigation load(Navigation src)
+ public NavigationContainer.Page load(Navigation src)
{
- return load(src, PageNavigation.class);
+ return load(src, NavigationContainer.Page.class);
}
- private <T extends PageNodeContainer> T load(Navigation src, Class<T> type)
+ private <T extends NavigationContainer> T load(Navigation src, Class<T> type)
{
+
+ //
+ ArrayList<NavigationContainer.Node> children = new ArrayList<NavigationContainer.Node>(src.getChildren().size());
+ for (Navigation srcChild : src.getChildren())
+ {
+ NavigationContainer.Node dstChild = load(srcChild, NavigationContainer.Node.class);
+ children.add(dstChild);
+ }
+
+ //
T dst;
- if (type == PageNavigation.class)
+ if (type == NavigationContainer.Page.class)
{
- PageNavigation dstNav = new PageNavigation(src.getObjectId());
Site site = src.getSite();
String ownerType = getOwnerType(site.getObjectType());
String ownerId = site.getName();
- dstNav.setOwnerId(ownerId);
- dstNav.setOwnerType(ownerType);
Attributes attrs = src.getAttributes();
- dstNav.setCreator(attrs.getValue(MappedAttributes.CREATOR));
- dstNav.setModifier(attrs.getValue(MappedAttributes.MODIFIER));
- dstNav.setDescription(attrs.getValue(MappedAttributes.DESCRIPTION));
- Integer priority = attrs.getValue(MappedAttributes.PRIORITY);
- if (priority != null)
- {
- dstNav.setPriority(priority);
- }
+ NavigationContainer.Page dstNav = new NavigationContainer.Page(
+ src.getObjectId(),
+ ownerType,
+ ownerId,
+ attrs.getValue(MappedAttributes.DESCRIPTION),
+ attrs.getValue(MappedAttributes.CREATOR),
+ attrs.getValue(MappedAttributes.MODIFIER),
+ attrs.getValue(MappedAttributes.PRIORITY, 1),
+ children);
dst = (T)dstNav;
}
- else if (type == PageNode.class)
+ else if (type == NavigationContainer.Node.class)
{
- PageNode dstNode = new PageNode(src.getObjectId());
Attributes attrs = src.getAttributes();
- dstNode.setName(src.getName());
- dstNode.setLabel(attrs.getValue(MappedAttributes.LABEL));
- dstNode.setIcon(attrs.getValue(MappedAttributes.ICON));
- dstNode.setUri(attrs.getValue(MappedAttributes.URI));
- dstNode.setStartPublicationDate(attrs.getValue(MappedAttributes.START_PUBLICATION_DATE));
- dstNode.setEndPublicationDate(attrs.getValue(MappedAttributes.END_PUBLICATION_DATE));
- dstNode.setShowPublicationDate(attrs.getValue(MappedAttributes.SHOW_PUBLICATION_DATE));
- dstNode.setVisible(attrs.getValue(MappedAttributes.VISIBLE));
- dstNode.setChildren(new ArrayList<PageNode>());
+ String pageReference = null;
Link link = src.getLink();
if (link instanceof PageLink)
{
@@ -138,10 +137,23 @@
{
Site site = target.getSite();
ObjectType<? extends Site> siteType = site.getObjectType();
- String pageRef = getOwnerType(siteType) + "::" + site.getName() + "::" + target.getName();
- dstNode.setPageReference(pageRef);
+ pageReference = getOwnerType(siteType) + "::" + site.getName() + "::" + target.getName();
}
}
+ NavigationContainer.Node dstNode = new NavigationContainer.Node(
+ src.getObjectId(),
+ attrs.getValue(MappedAttributes.URI),
+ attrs.getValue(MappedAttributes.LABEL),
+ attrs.getValue(MappedAttributes.ICON),
+ src.getName(),
+ attrs.getValue(MappedAttributes.START_PUBLICATION_DATE),
+ attrs.getValue(MappedAttributes.END_PUBLICATION_DATE),
+ attrs.getValue(MappedAttributes.SHOW_PUBLICATION_DATE, false),
+ attrs.getValue(MappedAttributes.VISIBLE, true),
+ pageReference,
+ children
+ );
+
dst = (T)dstNode;
}
else
@@ -150,26 +162,19 @@
}
//
- for (Navigation srcChild : src.getChildren())
- {
- PageNode dstChild = load(srcChild, PageNode.class);
- dst.getNodes().add(dstChild);
- }
-
- //
return dst;
}
- public void save(PageNavigation src, Navigation dst)
+ public void save(NavigationContainer.Page src, Navigation dst)
{
- save((PageNodeContainer)src, dst);
+ save((NavigationContainer)src, dst);
}
- private void save(PageNodeContainer src, Navigation dst)
+ private void save(NavigationContainer src, Navigation dst)
{
- if (src instanceof PageNode)
+ if (src instanceof NavigationContainer.Node)
{
- PageNode node = (PageNode)src;
+ NavigationContainer.Node node = (NavigationContainer.Node)src;
Workspace workspace = dst.getSite().getWorkspace();
String reference = node.getPageReference();
if (reference != null)
@@ -184,17 +189,17 @@
//
Attributes attrs = dst.getAttributes();
- attrs.setValue(MappedAttributes.URI, node.getUri());
+ attrs.setValue(MappedAttributes.URI, node.getURI());
attrs.setValue(MappedAttributes.LABEL, node.getLabel());
attrs.setValue(MappedAttributes.ICON, node.getIcon());
attrs.setValue(MappedAttributes.START_PUBLICATION_DATE, node.getStartPublicationDate());
attrs.setValue(MappedAttributes.END_PUBLICATION_DATE, node.getEndPublicationDate());
- attrs.setValue(MappedAttributes.SHOW_PUBLICATION_DATE, node.isShowPublicationDate());
+ attrs.setValue(MappedAttributes.SHOW_PUBLICATION_DATE, node.getShowPublicationDate());
attrs.setValue(MappedAttributes.VISIBLE, node.isVisible());
}
- else if (src instanceof PageNavigation)
+ else if (src instanceof NavigationContainer.Page)
{
- PageNavigation pageNav = (PageNavigation)src;
+ NavigationContainer.Page pageNav = (NavigationContainer.Page)src;
//
Attributes attrs = dst.getAttributes();
@@ -210,40 +215,33 @@
//
Set<String> savedSet = new HashSet<String>();
- if (src.getNodes() != null)
+ for (NavigationContainer.Node node : src.getChildren())
{
- for (PageNode node : src.getNodes())
+ String srcId = node.getStorageId();
+ Navigation dstChild;
+ if (srcId != null)
{
- String srcId = node.getStorageId();
- Navigation dstChild;
- if (srcId != null)
- {
- dstChild = session.findObjectById(ObjectType.NAVIGATION, srcId);
- }
- else
- {
- dstChild = dst.getChild(node.getName());
- if (dstChild == null)
- {
- dstChild = dst.addChild(node.getName());
- }
- srcId = dstChild.getObjectId();
- }
- save(node, dstChild);
- savedSet.add(srcId);
+ dstChild = session.findObjectById(ObjectType.NAVIGATION, srcId);
}
- for (Iterator<? extends Navigation> i = dst.getChildren().iterator(); i.hasNext();)
+ else
{
- Navigation dstChild = i.next();
- if (!savedSet.contains(dstChild.getObjectId()))
+ dstChild = dst.getChild(node.getName());
+ if (dstChild == null)
{
- i.remove();
+ dstChild = dst.addChild(node.getName());
}
+ srcId = dstChild.getObjectId();
}
+ save(node, dstChild);
+ savedSet.add(srcId);
}
- else
+ for (Iterator<? extends Navigation> i = dst.getChildren().iterator(); i.hasNext();)
{
- dst.getChildren().clear();
+ Navigation dstChild = i.next();
+ if (!savedSet.contains(dstChild.getObjectId()))
+ {
+ i.remove();
+ }
}
}
Added: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/NavigationContainer.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/NavigationContainer.java (rev 0)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/NavigationContainer.java 2009-10-23 13:56:49 UTC (rev 410)
@@ -0,0 +1,258 @@
+/*
+ * Copyright (C) 2003-2007 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.portal.config.model;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class NavigationContainer extends ModelObject
+{
+
+ /** . */
+ private final List<NavigationContainer.Node> children;
+
+ public NavigationContainer(String storageId, List<NavigationContainer.Node> children)
+ {
+ super(storageId);
+
+ //
+ this.children = children;
+ }
+
+ public List<NavigationContainer.Node> getChildren()
+ {
+ return children;
+ }
+
+ public static class Node extends NavigationContainer
+ {
+
+ /** . */
+ private final String uri;
+
+ /** . */
+ private final String label;
+
+ /** . */
+ private final String icon;
+
+ /** . */
+ private final String name;
+
+ /** . */
+ private final Date startPublicationDate;
+
+ /** . */
+ private final Date endPublicationDate;
+
+ /** . */
+ private final boolean showPublicationDate;
+
+ /** . */
+ private final boolean visible;
+
+ /** . */
+ private final String pageReference;
+
+ public Node(
+ String uri,
+ String label,
+ String icon,
+ String name,
+ Date startPublicationDate,
+ Date endPublicationDate,
+ Boolean showPublicationDate,
+ Boolean visible,
+ String pageReference,
+ List<NavigationContainer.Node> children)
+ {
+ this(null, uri, label, icon, name, startPublicationDate, endPublicationDate, showPublicationDate, visible, pageReference, children);
+ }
+
+ public Node(
+ String storageId,
+ String uri,
+ String label,
+ String icon,
+ String name,
+ Date startPublicationDate,
+ Date endPublicationDate,
+ Boolean showPublicationDate,
+ Boolean visible,
+ String pageReference,
+ List<NavigationContainer.Node> children)
+ {
+ super(storageId, children);
+
+ //
+ this.uri = uri;
+ this.label = label;
+ this.icon = icon;
+ this.name = name;
+ this.startPublicationDate = startPublicationDate;
+ this.endPublicationDate = endPublicationDate;
+ this.showPublicationDate = showPublicationDate != null ? showPublicationDate : false;
+ this.visible = visible != null ? visible : true;
+ this.pageReference = pageReference;
+ }
+ public String getURI()
+ {
+ return uri;
+ }
+
+ public String getLabel()
+ {
+ return label;
+ }
+
+ public String getIcon()
+ {
+ return icon;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public Date getStartPublicationDate()
+ {
+ return startPublicationDate;
+ }
+
+ public Date getEndPublicationDate()
+ {
+ return endPublicationDate;
+ }
+
+ public boolean getShowPublicationDate()
+ {
+ return showPublicationDate;
+ }
+
+ public boolean isVisible()
+ {
+ return visible;
+ }
+
+ public String getPageReference()
+ {
+ return pageReference;
+ }
+ }
+
+ public static class Page extends NavigationContainer
+ {
+
+ /** . */
+ private final String ownerType;
+
+ /** . */
+ private final String ownerId;
+
+ /** . */
+ private final String description;
+
+ /** . */
+ private final String creator;
+
+ /** . */
+ private final String modifier;
+
+ /** . */
+ private final int priority;
+
+ public Page(
+ String ownerType,
+ String ownerId,
+ String description,
+ String creator,
+ String modifier,
+ Integer priority,
+ List<NavigationContainer.Node> children)
+ {
+ this(null, ownerType, ownerId, description, creator, modifier, priority, children);
+ }
+
+ public Page(
+ String storageId,
+ String ownerType,
+ String ownerId,
+ String description,
+ String creator,
+ String modifier,
+ Integer priority,
+ List<NavigationContainer.Node> children)
+ {
+ super(storageId, children);
+
+ //
+ if (ownerType == null)
+ {
+ throw new NullPointerException("No null owner type");
+ }
+ if (ownerId == null)
+ {
+ throw new NullPointerException("No null owner id");
+ }
+
+ //
+ this.ownerType = ownerType;
+ this.ownerId = ownerId;
+ this.description = description;
+ this.creator = creator;
+ this.modifier = modifier;
+ this.priority = priority != null ? priority : 1;
+ }
+
+ public String getOwnerType()
+ {
+ return ownerType;
+ }
+
+ public String getOwnerId()
+ {
+ return ownerId;
+ }
+
+ public String getDescription()
+ {
+ return description;
+ }
+
+ public String getCreator()
+ {
+ return creator;
+ }
+
+ public String getModifier()
+ {
+ return modifier;
+ }
+
+ public int getPriority()
+ {
+ return priority;
+ }
+ }
+
+
+}
Added: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/NavigationKey.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/NavigationKey.java (rev 0)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/NavigationKey.java 2009-10-23 13:56:49 UTC (rev 410)
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2003-2007 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.portal.config.model;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class NavigationKey extends OwnerKey
+{
+
+ public NavigationKey(String ownerType, String ownerId)
+ {
+ super(ownerType, ownerId);
+ }
+}
Added: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/OwnerKey.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/OwnerKey.java (rev 0)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/OwnerKey.java 2009-10-23 13:56:49 UTC (rev 410)
@@ -0,0 +1,74 @@
+/*
+ * Copyright (C) 2003-2007 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.portal.config.model;
+
+import java.io.Serializable;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class OwnerKey implements Serializable
+{
+
+ /** . */
+ private final String ownerType;
+
+ /** . */
+ private final String ownerId;
+
+ public OwnerKey(String ownerType, String ownerId)
+ {
+ if (ownerType == null)
+ {
+ throw new NullPointerException();
+ }
+ if (ownerId == null)
+ {
+ throw new NullPointerException();
+ }
+ this.ownerType = ownerType;
+ this.ownerId = ownerId;
+ }
+
+ public String getOwnerType()
+ {
+ return ownerType;
+ }
+
+ public String getOwnerId()
+ {
+ return ownerId;
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return ownerId.hashCode() ^ ownerType.hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (obj instanceof OwnerKey)
+ {
+ OwnerKey that = (OwnerKey)obj;
+ return ownerType.equals(that.ownerType) && ownerId.equals(that.ownerId);
+ }
+ return false;
+ }
+}
Modified: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PageNavigation.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PageNavigation.java 2009-10-23 06:58:59 UTC (rev 409)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PageNavigation.java 2009-10-23 13:56:49 UTC (rev 410)
@@ -21,6 +21,7 @@
import java.util.ArrayList;
import java.util.LinkedHashMap;
+import java.util.List;
import java.util.Map;
public class PageNavigation extends PageNodeContainer
@@ -38,19 +39,44 @@
private String modifier;
- private ArrayList<PageNode> pageNodes = new ArrayList<PageNode>();
+ private ArrayList<PageNode> pageNodes;
private int priority = 1;
PageNavigation(String storageId)
{
super(storageId);
+
+ //
+ this.pageNodes = new ArrayList<PageNode>();
}
public PageNavigation()
{
+ this((String)null);
}
+ public PageNavigation(NavigationContainer.Page nav)
+ {
+ super(nav.getStorageId());
+
+ ArrayList<PageNode> children = new ArrayList<PageNode>(nav.getChildren().size());
+ for (NavigationContainer.Node child : nav.getChildren())
+ {
+ PageNode node = new PageNode(child);
+ children.add(node);
+ }
+
+ //
+ this.ownerType = nav.getOwnerType();
+ this.ownerId = nav.getOwnerId();
+ this.description = nav.getDescription();
+ this.creator = nav.getCreator();
+ this.modifier = nav.getModifier();
+ this.priority = nav.getPriority();
+ this.pageNodes = children;
+ }
+
public int getId()
{
return getOwner().hashCode();
@@ -226,4 +252,20 @@
{
return "PageNavigation[ownerType=" + ownerType + ",ownerId=" + ownerId + "]";
}
+
+ @Override
+ public NavigationContainer.Page buildNavigation()
+ {
+ List<NavigationContainer.Node> children = buildNavigationChildren();
+ return new NavigationContainer.Page(
+ storageId,
+ ownerType,
+ ownerId,
+ description,
+ creator,
+ modifier,
+ priority,
+ children
+ );
+ }
}
\ No newline at end of file
Modified: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PageNode.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PageNode.java 2009-10-23 06:58:59 UTC (rev 409)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PageNode.java 2009-10-23 13:56:49 UTC (rev 410)
@@ -29,7 +29,7 @@
public class PageNode extends PageNodeContainer
{
- private ArrayList<PageNode> children = new ArrayList<PageNode>(5);
+ private ArrayList<PageNode> children;
private String uri;
@@ -53,14 +53,42 @@
private transient boolean modifiable;
+ public PageNode(NavigationContainer.Node nav)
+ {
+ super(nav.getStorageId());
+
+ //
+ ArrayList<PageNode> children = new ArrayList<PageNode>(nav.getChildren().size());
+ for (NavigationContainer.Node child : nav.getChildren())
+ {
+ PageNode node = new PageNode(child);
+ children.add(node);
+ }
+
+ //
+ this.uri = nav.getURI();
+ this.label = nav.getLabel();
+ this.icon = nav.getIcon();
+ this.name = nav.getName();
+ this.startPublicationDate = nav.getStartPublicationDate();
+ this.endPublicationDate = nav.getEndPublicationDate();
+ this.showPublicationDate = nav.getShowPublicationDate();
+ this.visible = nav.isVisible();
+ this.pageReference = nav.getPageReference();
+ this.children = children;
+ }
+
public PageNode(String storageId)
{
super(storageId);
+
+ //
+ this.children = new ArrayList<PageNode>();
}
public PageNode()
{
- super();
+ this((String)null);
}
public String getUri()
@@ -258,4 +286,22 @@
return newNode;
}
+ @Override
+ public NavigationContainer.Node buildNavigation()
+ {
+ List<NavigationContainer.Node> children = buildNavigationChildren();
+ return new NavigationContainer.Node(
+ storageId,
+ uri,
+ label,
+ icon,
+ name,
+ startPublicationDate,
+ endPublicationDate,
+ showPublicationDate,
+ visible,
+ pageReference,
+ children
+ );
+ }
}
\ No newline at end of file
Modified: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PageNodeContainer.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PageNodeContainer.java 2009-10-23 06:58:59 UTC (rev 409)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PageNodeContainer.java 2009-10-23 13:56:49 UTC (rev 410)
@@ -19,6 +19,8 @@
package org.exoplatform.portal.config.model;
+import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
/**
@@ -38,4 +40,27 @@
}
public abstract List<PageNode> getNodes();
+
+ protected List<NavigationContainer.Node> buildNavigationChildren()
+ {
+ List<PageNode> nodes = getNodes();
+ if (nodes != null)
+ {
+ ArrayList<NavigationContainer.Node> children = new ArrayList<NavigationContainer.Node>();
+ for (int i = 0;i < nodes.size();i++)
+ {
+ PageNode node = nodes.get(i);
+ NavigationContainer.Node child = node.buildNavigation();
+ children.add(child);
+ }
+ return Collections.unmodifiableList(children);
+ }
+ else
+ {
+ return Collections.emptyList();
+ }
+ }
+
+ public abstract NavigationContainer buildNavigation();
+
}
Modified: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMDataStorage.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMDataStorage.java 2009-10-23 06:58:59 UTC (rev 409)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMDataStorage.java 2009-10-23 13:56:49 UTC (rev 410)
@@ -30,6 +30,7 @@
import org.exoplatform.portal.config.model.Container;
import org.exoplatform.portal.config.model.ModelChange;
import org.exoplatform.portal.config.model.ModelObject;
+import org.exoplatform.portal.config.model.NavigationContainer;
import org.exoplatform.portal.config.model.Page;
import org.exoplatform.portal.config.model.PageNavigation;
import org.exoplatform.portal.config.model.PersistentApplicationState;
@@ -41,11 +42,15 @@
import org.exoplatform.portal.pom.config.tasks.PortletPreferencesTask;
import org.exoplatform.portal.pom.config.tasks.PreferencesTask;
import org.exoplatform.portal.pom.config.tasks.SearchTask;
+import org.exoplatform.services.log.ExoLogger;
+import org.exoplatform.services.log.Log;
import org.jibx.runtime.BindingDirectory;
import org.jibx.runtime.IBindingFactory;
import org.jibx.runtime.IUnmarshallingContext;
import java.io.ByteArrayInputStream;
+import java.text.DecimalFormat;
+import java.text.NumberFormat;
import java.util.Comparator;
import java.util.List;
import java.util.UUID;
@@ -60,17 +65,36 @@
/** . */
private final POMSessionManager pomMgr;
+ /** . */
private ConfigurationManager confManager_;
+ /** . */
+ private final Log log = ExoLogger.getLogger(getClass());
+
public POMDataStorage(POMSessionManager pomMgr, ConfigurationManager confManager)
{
this.pomMgr = pomMgr;
confManager_ = confManager;
}
+ private static final String[] padding = {" ", " ", " ", " "};
+
public <T extends POMTask> T execute(T task) throws Exception
{
+ String s = task.toString();
+ long t0 = System.currentTimeMillis();
pomMgr.execute(task);
+ long t1 = System.currentTimeMillis();
+ String t = "" + (t1 - t0);
+ if (t.length() < 4)
+ {
+ t = padding[t.length()] + t;
+ log.info("Executed [" + t + "] " + s + "");
+ }
+ else
+ {
+ log.info("Executed in " + t + " " + s + "");
+ }
return task;
}
@@ -130,27 +154,38 @@
return execute(new PageTask.Save(page)).getChanges();
}
- public PageNavigation getPageNavigation(String fullId) throws Exception
+ public NavigationContainer.Page getPageNavigation(String owner) throws Exception
{
- return execute(new PageNavigationTask.Load(fullId)).getPageNavigation();
+ String[] chunks = Utils.split("::", owner);
+ if (chunks.length != 2)
+ {
+ throw new IllegalArgumentException("Wrong owner format should be ownerType::ownerId was " + owner);
+ }
+
+ //
+ String ownerType = chunks[0];
+ String ownerId = chunks[1];
+
+ //
+ return getPageNavigation(ownerType, ownerId);
}
- public PageNavigation getPageNavigation(String ownerType, String id) throws Exception
+ public NavigationContainer.Page getPageNavigation(String ownerType, String id) throws Exception
{
- return execute(new PageNavigationTask.Load(ownerType + "::" + id)).getPageNavigation();
+ return execute(new PageNavigationTask.Load(ownerType, id)).getPageNavigation();
}
- public void save(PageNavigation navigation) throws Exception
+ public void save(NavigationContainer.Page navigation) throws Exception
{
execute(new PageNavigationTask.Save(navigation, true));
}
- public void create(PageNavigation navigation) throws Exception
+ public void create(NavigationContainer.Page navigation) throws Exception
{
execute(new PageNavigationTask.Save(navigation, false));
}
- public void remove(PageNavigation navigation) throws Exception
+ public void remove(NavigationContainer.Page navigation) throws Exception
{
execute(new PageNavigationTask.Remove(navigation));
}
@@ -206,9 +241,9 @@
{
return (LazyPageList<T>)execute(new SearchTask.FindPage((Query<Page>)q)).getResult();
}
- else if (PageNavigation.class.equals(q.getClassType()))
+ else if (NavigationContainer.Page.class.equals(q.getClassType()))
{
- return (LazyPageList<T>)execute(new SearchTask.FindNavigation((Query<PageNavigation>)q)).getResult();
+ return (LazyPageList<T>)execute(new SearchTask.FindNavigation((Query<NavigationContainer.Page>)q)).getResult();
}
else if (PortletPreferences.class.equals(q.getClassType()))
{
Modified: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/DashboardTask.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/DashboardTask.java 2009-10-23 06:58:59 UTC (rev 409)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/DashboardTask.java 2009-10-23 13:56:49 UTC (rev 410)
@@ -62,6 +62,12 @@
{
return dashboard;
}
+
+ @Override
+ public String toString()
+ {
+ return "DashboardTask.Load[id=" + storageId + "]";
+ }
}
public static class Save extends DashboardTask
@@ -72,6 +78,14 @@
public Save(Dashboard dashboard)
{
+ if (dashboard == null)
+ {
+ throw new NullPointerException("No null dashboard accepted");
+ }
+ if (dashboard.getStorageId() == null)
+ {
+ throw new IllegalArgumentException("No dasbhoard with null storage id accepted");
+ }
this.dashboard = dashboard;
}
@@ -96,5 +110,11 @@
//
mapper.saveDashboard(dashboard, container);
}
+
+ @Override
+ public String toString()
+ {
+ return "DashboardTask.Save[id=" + dashboard.getStorageId() + "]";
+ }
}
}
Modified: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/PageNavigationTask.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/PageNavigationTask.java 2009-10-23 06:58:59 UTC (rev 409)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/PageNavigationTask.java 2009-10-23 13:56:49 UTC (rev 410)
@@ -19,10 +19,9 @@
package org.exoplatform.portal.pom.config.tasks;
-import static org.exoplatform.portal.pom.config.Utils.split;
+import org.exoplatform.portal.config.model.NavigationContainer;
import org.exoplatform.portal.config.model.Mapper;
-import org.exoplatform.portal.config.model.PageNavigation;
import org.exoplatform.portal.pom.config.AbstractPOMTask;
import org.exoplatform.portal.pom.config.POMSession;
import org.gatein.mop.api.workspace.Navigation;
@@ -38,9 +37,6 @@
{
/** . */
- protected final String owner;
-
- /** . */
protected final String ownerType;
/** . */
@@ -49,33 +45,32 @@
/** . */
protected final ObjectType<? extends Site> siteType;
- protected PageNavigationTask(String owner)
+ protected PageNavigationTask(NavigationContainer.Page page)
{
- String[] chunks = split("::", owner);
- if (chunks.length != 2)
- {
- throw new IllegalArgumentException("Wrong owner format should be ownerType::ownerId was " + owner);
- }
+ this.ownerType = page.getOwnerType();
+ this.ownerId = page.getOwnerId();
+ this.siteType = Mapper.parseSiteType(ownerType);
+ }
- //
- this.ownerType = chunks[0];
- this.ownerId = chunks[1];
+ protected PageNavigationTask(String ownerType, String ownerId)
+ {
+ this.ownerType = ownerType;
+ this.ownerId = ownerId;
this.siteType = Mapper.parseSiteType(ownerType);
- this.owner = owner;
}
public static class Load extends PageNavigationTask
{
/** . */
- private PageNavigation pageNav;
+ private NavigationContainer.Page pageNav;
- public Load(String owner)
+ public Load(String ownerType, String ownerId)
{
- super(owner);
+ super(ownerType, ownerId);
}
- public PageNavigation getPageNavigation()
+ public NavigationContainer.Page getPageNavigation()
{
return pageNav;
}
@@ -95,24 +90,30 @@
}
else
{
- System.out.println("Cannot load page navigation " + owner + " as the corresponding portal " + ownerId
+ System.out.println("Cannot load page navigation as the corresponding portal " + ownerId
+ " with type " + siteType + " does not exist");
}
}
+
+ @Override
+ public String toString()
+ {
+ return "PageNavigation.Load[ownerType=" + ownerType + ",ownerId=" + ownerId + "]";
+ }
}
public static class Save extends PageNavigationTask
{
/** . */
- private final PageNavigation pageNav;
+ private final NavigationContainer.Page pageNav;
/** . */
private final boolean overwrite;
- public Save(PageNavigation pageNav, boolean overwrite)
+ public Save(NavigationContainer.Page pageNav, boolean overwrite)
{
- super(pageNav.getOwner());
+ super(pageNav);
//
this.pageNav = pageNav;
@@ -125,7 +126,7 @@
Site site = workspace.getSite(siteType, ownerId);
if (site == null)
{
- throw new IllegalArgumentException("Cannot insert page navigation " + owner
+ throw new IllegalArgumentException("Cannot insert page navigation "
+ " as the corresponding portal " + ownerId + " with type " + siteType + " does not exist");
}
@@ -143,14 +144,19 @@
new Mapper(session).save(pageNav, defaultNav);
}
+ @Override
+ public String toString()
+ {
+ return "PageNavigation.Save[ownerType=" + ownerType + ",ownerId=" + ownerId + "]";
+ }
}
public static class Remove extends PageNavigationTask
{
- public Remove(PageNavigation pageNav)
+ public Remove(NavigationContainer.Page pageNav)
{
- super(pageNav.getOwner());
+ super(pageNav);
}
public void run(POMSession session) throws Exception
@@ -159,7 +165,7 @@
Site site = workspace.getSite(siteType, ownerId);
if (site == null)
{
- throw new IllegalArgumentException("Cannot insert page navigation " + owner
+ throw new IllegalArgumentException("Cannot insert page navigation "
+ " as the corresponding portal " + ownerId + " with type " + siteType + " does not exist");
}
@@ -173,5 +179,11 @@
defaultNav.destroy();
}
}
+
+ @Override
+ public String toString()
+ {
+ return "PageNavigation.Remove[ownerType=" + ownerType + ",ownerId=" + ownerId + "]";
+ }
}
}
\ No newline at end of file
Modified: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/PageTask.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/PageTask.java 2009-10-23 06:58:59 UTC (rev 409)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/PageTask.java 2009-10-23 13:56:49 UTC (rev 410)
@@ -239,6 +239,13 @@
{
return page;
}
+
+ @Override
+ public String toString()
+ {
+ return "PageTask.Clone[srcOwnerType=" + ownerType + ",srcOwnerId=" + ownerId + "srcName," + name +
+ "dstOwnerType=" + cloneOwnerType + ",dstOwnerId=" + cloneOwnerId + "dstName," + cloneName + "]";
+ }
}
public static class Remove extends PageTask
@@ -271,6 +278,12 @@
page.destroy();
}
}
+
+ @Override
+ public String toString()
+ {
+ return "PageTask.Remove[ownerType=" + ownerType + ",ownerId=" + ownerId + "name," + name + "]";
+ }
}
public static class Save extends PageTask
@@ -309,6 +322,12 @@
{
return changes;
}
+
+ @Override
+ public String toString()
+ {
+ return "PageTask.Save[ownerType=" + ownerType + ",ownerId=" + ownerId + "name," + name + "]";
+ }
}
public static class Load extends PageTask
@@ -342,5 +361,11 @@
}
}
}
+
+ @Override
+ public String toString()
+ {
+ return "PageTask.Load[ownerType=" + ownerType + ",ownerId=" + ownerId + "name," + name + "]";
+ }
}
}
Modified: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/PortalConfigTask.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/PortalConfigTask.java 2009-10-23 06:58:59 UTC (rev 409)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/PortalConfigTask.java 2009-10-23 13:56:49 UTC (rev 410)
@@ -42,10 +42,14 @@
/** . */
protected final ObjectType<? extends Site> type;
+ /** . */
+ protected final String ownerType;
+
protected PortalConfigTask(String type, String name)
{
this.type = Mapper.parseSiteType(type);
this.name = name;
+ this.ownerType = type;
}
public static class Remove extends PortalConfigTask
@@ -69,6 +73,12 @@
site.destroy();
}
}
+
+ @Override
+ public String toString()
+ {
+ return "PortalConfig.Remove[ownerType=" + ownerType + ",ownerId=" + name + "]";
+ }
}
public static class Save extends PortalConfigTask
@@ -115,6 +125,12 @@
}
new Mapper(session).save(config, site);
}
+
+ @Override
+ public String toString()
+ {
+ return "PortalConfig.Save[ownerType=" + ownerType + ",ownerId=" + name + "]";
+ }
}
public static class Load extends PortalConfigTask
@@ -142,5 +158,11 @@
this.config = new Mapper(session).load(site);
}
}
+
+ @Override
+ public String toString()
+ {
+ return "PortalConfig.Load[ownerType=" + ownerType + ",ownerId=" + name + "]";
+ }
}
}
Modified: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/PreferencesTask.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/PreferencesTask.java 2009-10-23 06:58:59 UTC (rev 409)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/PreferencesTask.java 2009-10-23 13:56:49 UTC (rev 410)
@@ -56,6 +56,12 @@
{
return prefs;
}
+
+ @Override
+ public String toString()
+ {
+ return "PreferencesTask.Load[state=" + state.getStorageId() + "]";
+ }
}
public static class Save<S> extends PreferencesTask<S>
@@ -89,5 +95,11 @@
customization.setState(null);
}
}
+
+ @Override
+ public String toString()
+ {
+ return "PreferencesTask.Save[state=" + state.getStorageId() + "]";
+ }
}
}
Modified: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/SearchTask.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/SearchTask.java 2009-10-23 06:58:59 UTC (rev 409)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/SearchTask.java 2009-10-23 13:56:49 UTC (rev 410)
@@ -24,6 +24,7 @@
import org.exoplatform.portal.application.PortletPreferences;
import org.exoplatform.portal.config.Query;
import org.exoplatform.portal.config.model.Mapper;
+import org.exoplatform.portal.config.model.NavigationContainer;
import org.exoplatform.portal.config.model.Page;
import org.exoplatform.portal.config.model.PageNavigation;
import org.exoplatform.portal.config.model.PortalConfig;
@@ -47,29 +48,6 @@
public abstract class SearchTask<T> extends AbstractPOMTask
{
- /*
- new Query<Page>(PortalConfig.GROUP_TYPE, groupId, Page.class);
- new Query<Page>(PortalConfig.GROUP_TYPE, groupId, Page.class);
- new Query<Page>(PortalConfig.USER_TYPE, userName, Page.class);
- new Query<Page>(PortalConfig.USER_TYPE, userName, Page.class);
- new Query<Page>(PortalConfig.PORTAL_TYPE, portalName, null, null, Page.class);
- new Query<Page>(null, null, null, null, Page.class);
-
- new Query<PortletPreferences>(PortalConfig.GROUP_TYPE, groupId, PortletPreferences.class);
- new Query<PortletPreferences>(PortalConfig.GROUP_TYPE, groupId, PortletPreferences.class);
- new Query<PortletPreferences>(PortalConfig.USER_TYPE, userName, PortletPreferences.class);
- new Query<PortletPreferences>(PortalConfig.PORTAL_TYPE, portalName, null, null, PortletPreferences.class);
-
- new Query<PageNavigation>(PortalConfig.GROUP_TYPE, null, PageNavigation.class);
- new Query<PageNavigation>(PortalConfig.GROUP_TYPE, null, PageNavigation.class);
- new Query<PageNavigation>(PortalConfig.GROUP_TYPE, null, PageNavigation.class);
-
- new Query<PortalConfig>(null, null, null, null, PortalConfig.class);
- new Query<PortalConfig>(null, null, null, null, PortalConfig.class);
- new Query<PortalConfig>(null, null, null, null, PortalConfig.class);
- new Query<PortalConfig>(null, null, null, null, PortalConfig.class);
- */
-
/** . */
protected final Query<T> q;
@@ -178,10 +156,10 @@
}
}
- public static class FindNavigation extends FindSiteObject<Navigation, PageNavigation>
+ public static class FindNavigation extends FindSiteObject<Navigation, NavigationContainer.Page>
{
- public FindNavigation(Query<PageNavigation> pageQuery)
+ public FindNavigation(Query<NavigationContainer.Page> pageQuery)
{
super(pageQuery);
}
@@ -192,12 +170,12 @@
return session.findObjects(ObjectType.NAVIGATION, siteType, q.getOwnerId(), q.getTitle());
}
- protected PageNavigation[] createT(int length)
+ protected NavigationContainer.Page[] createT(int length)
{
- return new PageNavigation[length];
+ return new NavigationContainer.Page[length];
}
- protected PageNavigation loadT(POMSession session, Navigation w)
+ protected NavigationContainer.Page loadT(POMSession session, Navigation w)
{
return new Mapper(session).load(w);
}
Modified: portal/branches/performance/component/portal/src/test/java/org/exoplatform/portal/config/TestDataStorage.java
===================================================================
--- portal/branches/performance/component/portal/src/test/java/org/exoplatform/portal/config/TestDataStorage.java 2009-10-23 06:58:59 UTC (rev 409)
+++ portal/branches/performance/component/portal/src/test/java/org/exoplatform/portal/config/TestDataStorage.java 2009-10-23 13:56:49 UTC (rev 410)
@@ -222,7 +222,7 @@
PageNavigation pageNavi = new PageNavigation();
pageNavi.setOwnerId(testPortal);
pageNavi.setOwnerType("portal");
- storage_.create(pageNavi);
+ storage_.create(pageNavi.buildNavigation());
}
public void testNavigationSave() throws Exception
@@ -230,14 +230,13 @@
testNavigationCreate();
//
- PageNavigation pageNavi = storage_.getPageNavigation("portal", testPortal);
- assertNotNull(pageNavi);
+ PageNavigation pageNavi = new PageNavigation(storage_.getPageNavigation("portal", testPortal));
String newModifier = "trong.tran";
pageNavi.setModifier(newModifier);
- storage_.save(pageNavi);
+ storage_.save(pageNavi.buildNavigation());
- PageNavigation newPageNavi = storage_.getPageNavigation(pageNavi.getOwnerType(), pageNavi.getOwnerId());
+ PageNavigation newPageNavi = new PageNavigation(storage_.getPageNavigation(pageNavi.getOwnerType(), pageNavi.getOwnerId()));
assertEquals(newModifier, newPageNavi.getModifier());
}
@@ -246,13 +245,12 @@
testNavigationSave();
//
- PageNavigation pageNavi = storage_.getPageNavigation("portal", testPortal);
+ PageNavigation pageNavi = new PageNavigation(storage_.getPageNavigation("portal", testPortal));
assertNotNull(pageNavi);
- storage_.remove(pageNavi);
+ storage_.remove(pageNavi.buildNavigation());
- pageNavi = storage_.getPageNavigation("portal", testPortal);
- // assertNull(pageNavi);
+ assertNull(storage_.getPageNavigation("portal", testPortal));
}
public void testPortletPreferencesCreate() throws Exception
Modified: portal/branches/performance/component/portal/src/test/java/org/exoplatform/portal/config/TestLoadedPOM.java
===================================================================
--- portal/branches/performance/component/portal/src/test/java/org/exoplatform/portal/config/TestLoadedPOM.java 2009-10-23 06:58:59 UTC (rev 409)
+++ portal/branches/performance/component/portal/src/test/java/org/exoplatform/portal/config/TestLoadedPOM.java 2009-10-23 13:56:49 UTC (rev 410)
@@ -24,6 +24,7 @@
import org.exoplatform.portal.config.model.Application;
import org.exoplatform.portal.config.model.Container;
import org.exoplatform.portal.config.model.ModelObject;
+import org.exoplatform.portal.config.model.NavigationContainer;
import org.exoplatform.portal.config.model.Page;
import org.exoplatform.portal.config.model.PageNavigation;
import org.exoplatform.portal.config.model.PageNode;
@@ -80,7 +81,7 @@
public void testLegacyGroupWithNormalizedName() throws Exception
{
- PageNavigation nav = storage.getPageNavigation("group::/platform/test/legacy");
+ PageNavigation nav = new PageNavigation(storage.getPageNavigation("group::/platform/test/legacy"));
assertNotNull(nav);
assertEquals("/platform/test/legacy", nav.getOwnerId());
PageNode node = nav.getNodes().get(0);
@@ -100,7 +101,7 @@
public void testGroupWithNormalizedName() throws Exception
{
- PageNavigation nav = storage.getPageNavigation("group::/platform/test/normalized");
+ PageNavigation nav = new PageNavigation(storage.getPageNavigation("group::/platform/test/normalized"));
assertNotNull(nav);
assertEquals("/platform/test/normalized", nav.getOwnerId());
PageNode node = nav.getNodes().get(0);
@@ -121,7 +122,7 @@
public void testNavigation() throws Exception
{
- PageNavigation nav = storage.getPageNavigation("portal::test");
+ PageNavigation nav = new PageNavigation(storage.getPageNavigation("portal::test"));
assertNotNull(nav);
//
@@ -237,11 +238,11 @@
public void testFindNavigation() throws Exception
{
- Query<PageNavigation> query = new Query<PageNavigation>("group", null, null, null, PageNavigation.class);
- List<PageNavigation> list = storage.find(query).getAll();
+ Query<NavigationContainer.Page> query = new Query<NavigationContainer.Page>("group", null, null, null, NavigationContainer.Page.class);
+ List<NavigationContainer.Page> list = storage.find(query).getAll();
assertEquals("Expected 6 results instead of " + list, 6, list.size());
Set<String> names = new HashSet<String>();
- for (PageNavigation navigation : list)
+ for (NavigationContainer.Page navigation : list)
{
assertEquals("group", navigation.getOwnerType());
names.add(navigation.getOwnerId());
Modified: portal/branches/performance/portlet/exoadmin/src/main/java/org/exoplatform/navigation/webui/component/UIGroupNavigationManagement.java
===================================================================
--- portal/branches/performance/portlet/exoadmin/src/main/java/org/exoplatform/navigation/webui/component/UIGroupNavigationManagement.java 2009-10-23 06:58:59 UTC (rev 409)
+++ portal/branches/performance/portlet/exoadmin/src/main/java/org/exoplatform/navigation/webui/component/UIGroupNavigationManagement.java 2009-10-23 13:56:49 UTC (rev 410)
@@ -94,26 +94,8 @@
public void loadNavigations() throws Exception
{
- navigations = new ArrayList<PageNavigation>();
- UserACL userACL = getApplicationComponent(UserACL.class);
- DataStorage dataStorage = getApplicationComponent(DataStorage.class);
- // load all navigation that user has edit permission
- Query<PageNavigation> query = new Query<PageNavigation>(PortalConfig.GROUP_TYPE, null, PageNavigation.class);
- List<PageNavigation> navis = dataStorage.find(query, new Comparator<PageNavigation>()
- {
- public int compare(PageNavigation pconfig1, PageNavigation pconfig2)
- {
- return pconfig1.getOwnerId().compareTo(pconfig2.getOwnerId());
- }
- }).getAll();
- for (PageNavigation ele : navis)
- {
- if (userACL.hasEditPermission(ele))
- {
- navigations.add(ele);
- }
- }
-
+ UserPortalConfigService userACL = getApplicationComponent(UserPortalConfigService.class);
+ navigations = userACL.loadEditableNavigations();
UIVirtualList virtualList = getChild(UIVirtualList.class);
virtualList.dataBind(new ObjectPageList<PageNavigation>(navigations, navigations.size()));
}
Modified: portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UIAddGroupNavigation.java
===================================================================
--- portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UIAddGroupNavigation.java 2009-10-23 06:58:59 UTC (rev 409)
+++ portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UIAddGroupNavigation.java 2009-10-23 13:56:49 UTC (rev 410)
@@ -22,7 +22,6 @@
import org.exoplatform.commons.utils.ObjectPageList;
import org.exoplatform.portal.application.PortalRequestContext;
import org.exoplatform.portal.config.DataStorage;
-import org.exoplatform.portal.config.Query;
import org.exoplatform.portal.config.UserACL;
import org.exoplatform.portal.config.UserPortalConfigService;
import org.exoplatform.portal.config.model.PageNavigation;
@@ -50,6 +49,7 @@
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
+import java.util.Set;
/*
* Created by The eXo Platform SAS
@@ -102,24 +102,14 @@
listGroup = dataService.getMakableNavigations(pContext.getRemoteUser());
}
- List<PageNavigation> navigations = new ArrayList<PageNavigation>();
- DataStorage dataStorage = getApplicationComponent(DataStorage.class);
- // get all group navigation that user have edit permission
- Query<PageNavigation> query = new Query<PageNavigation>(PortalConfig.GROUP_TYPE, null, PageNavigation.class);
- // filter, only get group don't have navigation
if (listGroup == null)
{
listGroup = new ArrayList<String>();
}
- List<PageNavigation> navis = dataStorage.find(query).getAll();
- for (PageNavigation ele : navis)
- {
- if (listGroup.contains(ele.getOwnerId()))
- {
- listGroup.remove(ele.getOwnerId());
- }
- }
+ UserPortalConfigService configService = getApplicationComponent(UserPortalConfigService.class);
+ Set<String> groupIdsWithNotNavigation = configService.findGroupWithoutNavigation();
+ listGroup.removeAll(groupIdsWithNotNavigation);
UIVirtualList virtualList = getChild(UIVirtualList.class);
virtualList.dataBind(new ObjectPageList<String>(listGroup, listGroup.size()));
Modified: portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UINavigationManagement.java
===================================================================
--- portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UINavigationManagement.java 2009-10-23 06:58:59 UTC (rev 409)
+++ portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UINavigationManagement.java 2009-10-23 13:56:49 UTC (rev 410)
@@ -56,14 +56,6 @@
addChild(UINavigationNodeSelector.class, null, null);
}
- public void loadNavigation(Query<PageNavigation> query) throws Exception
- {
- DataStorage service = getApplicationComponent(DataStorage.class);
- LazyPageList navis = service.find(query);
- UINavigationNodeSelector nodeSelector = getChild(UINavigationNodeSelector.class);
- nodeSelector.initNavigations(navis.getAll());
- }
-
public void setOwner(String owner)
{
this.owner = owner;
15 years, 11 months
gatein SVN: r409 - portal/trunk/web/eXoResources/src/main/webapp/skin/DefaultSkin/webui/component/UIPopup/UIPopupWindow.
by do-not-reply@jboss.org
Author: liem_nguyen
Date: 2009-10-23 02:58:59 -0400 (Fri, 23 Oct 2009)
New Revision: 409
Modified:
portal/trunk/web/eXoResources/src/main/webapp/skin/DefaultSkin/webui/component/UIPopup/UIPopupWindow/Stylesheet.css
Log:
GTNPORTAL-37 Page Editor resize grabber rendered outside of the popup
Modified: portal/trunk/web/eXoResources/src/main/webapp/skin/DefaultSkin/webui/component/UIPopup/UIPopupWindow/Stylesheet.css
===================================================================
--- portal/trunk/web/eXoResources/src/main/webapp/skin/DefaultSkin/webui/component/UIPopup/UIPopupWindow/Stylesheet.css 2009-10-23 04:52:50 UTC (rev 408)
+++ portal/trunk/web/eXoResources/src/main/webapp/skin/DefaultSkin/webui/component/UIPopup/UIPopupWindow/Stylesheet.css 2009-10-23 06:58:59 UTC (rev 409)
@@ -105,6 +105,7 @@
float: left; /* orientation=rt */
cursor: nw-resize; /* orientation=lt */
cursor: ne-resize; /* orientation=rt */
+ margin-top:-29px;
}
.UIPopupWindow .BottomLeftCornerDecorator {
@@ -246,6 +247,10 @@
height: 50px;
}
+.UIPortalComposer .BCPortalComposer .UIAction {
+ height: 50px;
+}
+
.UIPortalComposer .Bottom {
border-bottom: 1px solid #a2a3a9;
}
15 years, 11 months
gatein SVN: r408 - in portal/trunk/web/eXoResources/src/main/webapp/javascript/eXo: portal and 1 other directory.
by do-not-reply@jboss.org
Author: tan_pham_dinh
Date: 2009-10-23 00:52:50 -0400 (Fri, 23 Oct 2009)
New Revision: 408
Modified:
portal/trunk/web/eXoResources/src/main/webapp/javascript/eXo/core/DragDrop.js
portal/trunk/web/eXoResources/src/main/webapp/javascript/eXo/portal/PortalDragDrop.js
Log:
GTNPORTAL-40: Error in dragdrop and prevent scroll down to much
Modified: portal/trunk/web/eXoResources/src/main/webapp/javascript/eXo/core/DragDrop.js
===================================================================
--- portal/trunk/web/eXoResources/src/main/webapp/javascript/eXo/core/DragDrop.js 2009-10-23 03:41:35 UTC (rev 407)
+++ portal/trunk/web/eXoResources/src/main/webapp/javascript/eXo/core/DragDrop.js 2009-10-23 04:52:50 UTC (rev 408)
@@ -57,6 +57,7 @@
} ;
DragDrop.prototype.init = function(dropableTargets, clickObject, dragObject, evt) {
+ if(evt && evt.preventDefault) evt.preventDefault();
eXo.core.Mouse.init(evt) ;
this.dropableTargets = dropableTargets ;
Modified: portal/trunk/web/eXoResources/src/main/webapp/javascript/eXo/portal/PortalDragDrop.js
===================================================================
--- portal/trunk/web/eXoResources/src/main/webapp/javascript/eXo/portal/PortalDragDrop.js 2009-10-23 03:41:35 UTC (rev 407)
+++ portal/trunk/web/eXoResources/src/main/webapp/javascript/eXo/portal/PortalDragDrop.js 2009-10-23 04:52:50 UTC (rev 408)
@@ -332,8 +332,10 @@
};
PortalDragDrop.prototype.scrollOnDrag = function(dragObject, dndEvent) {
+ var workspaceHeight = document.getElementById("UIWorkingWorkspace").offsetHeight;
+ var browserHeight = eXo.core.Browser.getBrowserHeight() ;
+ if(workspaceHeight <= browserHeight) return;
var dragObjectTop = eXo.core.Browser.findPosY(dragObject) ;
- var browserHeight = eXo.core.Browser.getBrowserHeight() ;
var mouseY = eXo.core.Browser.findMouseYInClient(dndEvent.backupMouseEvent) ;
var deltaTopMouse = eXo.core.Browser.findMouseYInPage(dndEvent.backupMouseEvent) - mouseY ;
var deltaTop = mouseY - (Math.round(browserHeight * 5/6)) ;
15 years, 11 months
gatein SVN: r407 - in portal/trunk/webui: eXo/src/main/java/org/exoplatform/webui/organization and 1 other directory.
by do-not-reply@jboss.org
Author: liem_nguyen
Date: 2009-10-22 23:41:35 -0400 (Thu, 22 Oct 2009)
New Revision: 407
Modified:
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/lifecycle/UIFormLifecycle.java
portal/trunk/webui/eXo/src/main/java/org/exoplatform/webui/organization/UIListPermissionSelector.java
Log:
GTNPORTAL-54 Cancel button does not work correct in case Form has subComponnent
Modified: portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/lifecycle/UIFormLifecycle.java
===================================================================
--- portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/lifecycle/UIFormLifecycle.java 2009-10-23 03:32:18 UTC (rev 406)
+++ portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/lifecycle/UIFormLifecycle.java 2009-10-23 03:41:35 UTC (rev 407)
@@ -19,6 +19,9 @@
package org.exoplatform.webui.core.lifecycle;
+import java.util.ArrayList;
+import java.util.List;
+
import org.exoplatform.web.application.ApplicationMessage;
import org.exoplatform.webui.application.WebuiRequestContext;
import org.exoplatform.webui.core.UIApplication;
@@ -33,9 +36,6 @@
import org.exoplatform.webui.form.UIFormMultiValueInputSet;
import org.exoplatform.webui.form.validator.Validator;
-import java.util.ArrayList;
-import java.util.List;
-
/**
* Author : Nhu Dinh Thuan
* nhudinhthuan(a)yahoo.com
Modified: portal/trunk/webui/eXo/src/main/java/org/exoplatform/webui/organization/UIListPermissionSelector.java
===================================================================
--- portal/trunk/webui/eXo/src/main/java/org/exoplatform/webui/organization/UIListPermissionSelector.java 2009-10-23 03:32:18 UTC (rev 406)
+++ portal/trunk/webui/eXo/src/main/java/org/exoplatform/webui/organization/UIListPermissionSelector.java 2009-10-23 03:41:35 UTC (rev 407)
@@ -19,6 +19,11 @@
package org.exoplatform.webui.organization;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
import org.exoplatform.commons.utils.LazyPageList;
import org.exoplatform.portal.config.UserACL;
import org.exoplatform.portal.config.UserACL.Permission;
@@ -43,16 +48,11 @@
import org.exoplatform.webui.form.UIFormPopupWindow;
import org.exoplatform.webui.form.validator.Validator;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
/**
* Created by The eXo Platform SARL
* Author : Pham Dung Ha
* ha.pham(a)exoplatform.com
- * May 7, 2007
+ * May 7, 2007o
*/
@ComponentConfig(template = "system:/groovy/organization/webui/component/UIListPermissionSelector.gtmpl", events = {
@EventConfig(phase = Phase.DECODE, listeners = UIListPermissionSelector.DeleteActionListener.class, confirm = "UIAccessGroup.deleteAccessGroup"),
15 years, 11 months