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;