Author: julien_viet
Date: 2009-10-22 15:40:46 -0400 (Thu, 22 Oct 2009)
New Revision: 401
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/ContainerData.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/serialize/AbstractHandler.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/serialize/ContainerHandler.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/serialize/OwnerContext.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/serialize/PageHandler.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/serialize/PageNavigationHandler.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/serialize/PortalConfigHandler.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/serialize/PortalLayoutHandler.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/org/exoplatform/portal/application/PortletPreferences.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/UserACL.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/Mapper.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/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/config/serialize/AbstractApplicationHandler.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMDataStorage.java
portal/branches/performance/component/portal/src/main/resources/binding.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/TestGadget.java
portal/branches/performance/component/portal/src/test/java/org/exoplatform/portal/config/TestJIBXXmlMapping.java
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/security/AbstractTestSharedPageACL.java
portal/branches/performance/component/portal/src/test/java/org/exoplatform/portal/config/security/TestUserPageACL.java
portal/branches/performance/portlet/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/UITabPaneDashboard.java
portal/branches/performance/portlet/exoadmin/src/main/java/org/exoplatform/toolbar/webui/component/UIUserToolBarDashboardPortlet.java
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIAddNewApplication.java
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UINavigationNodeSelector.java
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIDesktopPage.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/page/UIPageBrowser.java
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageCreationWizard.java
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageForm.java
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageNodeForm2.java
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalComponentActionListener.java
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/util/PortalDataMapper.java
Log:
start to make 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-22
18:47:45 UTC (rev 400)
+++
portal/branches/performance/component/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/UIDashboardContainer.java 2009-10-22
19:40:46 UTC (rev 401)
@@ -23,6 +23,7 @@
import org.exoplatform.application.registry.ApplicationRegistryService;
import org.exoplatform.portal.config.DataStorage;
import org.exoplatform.portal.config.model.Container;
+import org.exoplatform.portal.config.model.ContainerData;
import org.exoplatform.portal.config.model.Dashboard;
import org.exoplatform.portal.config.model.gadget.GadgetId;
import org.exoplatform.portal.pom.config.tasks.DashboardTask;
@@ -386,7 +387,11 @@
{
Container container = toContainer(item.getValue());
if (id != null)
- container.setId(id);
+ {
+ ContainerData data = container.buildData();
+ data.setId(id);
+ container = new Container(container, data);
+ }
return container;
}
}
@@ -452,12 +457,12 @@
// Get current ui portlet containing this dashboard
UIPortlet currentUIPortlet = UIPortlet.getCurrentUIPortlet();
+ // Assemble the dashboard
+ Container container = PortalDataMapper.toContainer(uiRoot);
+
// Build dashboard
- Dashboard dashboard = new Dashboard(currentUIPortlet.getStorageId());
+ Dashboard dashboard = new Dashboard(currentUIPortlet.getStorageId(),
container.buildData());
- // Assemble the dashboard
- PortalDataMapper.toContainer(dashboard, uiRoot);
-
// Get dashboard for merging
service.execute(new DashboardTask.Save(dashboard));
}
Modified:
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/application/PortletPreferences.java
===================================================================
---
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/application/PortletPreferences.java 2009-10-22
18:47:45 UTC (rev 400)
+++
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/application/PortletPreferences.java 2009-10-22
19:40:46 UTC (rev 401)
@@ -19,6 +19,8 @@
package org.exoplatform.portal.application;
+import org.exoplatform.portal.config.NewPortalConfigListener;
+
import java.util.ArrayList;
import java.util.ListIterator;
@@ -106,4 +108,9 @@
portlets = list;
}
}
+
+ // Called by JiBX
+ public void postSet() {
+ windowId = NewPortalConfigListener.fixInstanceIdOwnerName(windowId);
+ }
}
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-22
18:47:45 UTC (rev 400)
+++
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/GroupPortalConfigListener.java 2009-10-22
19:40:46 UTC (rev 401)
@@ -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.ContainerData;
import org.exoplatform.portal.config.model.PortalConfig;
import org.exoplatform.services.jcr.ext.registry.RegistryService;
import org.exoplatform.services.organization.Group;
@@ -126,7 +127,7 @@
if (cfg == null)
{
cfg = new PortalConfig(PortalConfig.GROUP_TYPE);
- cfg.setPortalLayout(new Container());
+ cfg.setPortalLayout(new Container(new ContainerData()));
cfg.setName(groupId);
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-22
18:47:45 UTC (rev 400)
+++
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/NewPortalConfigListener.java 2009-10-22
19:40:46 UTC (rev 401)
@@ -29,11 +29,13 @@
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.ContainerData;
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.serialize.OwnerContext;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
import org.jibx.runtime.BindingDirectory;
@@ -48,6 +50,7 @@
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
+import java.util.concurrent.Callable;
/**
* Created by The eXo Platform SARL Author : Tuan Nguyen
@@ -308,7 +311,7 @@
if (cfg == null)
{
cfg = new PortalConfig(type);
- cfg.setPortalLayout(new Container());
+ cfg.setPortalLayout(new Container(new ContainerData()));
cfg.setName(owner);
pdcService_.create(cfg);
}
@@ -330,15 +333,11 @@
pdcService_.save(pconfig);
}
}
- catch (JiBXException e)
+ catch (Exception e)
{
log.error(e.getMessage() + " file: " + path, e);
throw e;
}
- catch (IOException e)
- {
- log.error(e.getMessage() + " file: " + path);
- }
}
private void createPage(NewPortalConfig config, String owner) throws Exception
@@ -370,7 +369,7 @@
pdcService_.create(page);
}
}
- catch (JiBXException e)
+ catch (Exception e)
{
log.error(e.getMessage() + " file: " + path, e);
throw e;
@@ -409,7 +408,7 @@
pdcService_.save(navigation);
}
}
- catch (JiBXException e)
+ catch (Exception e)
{
log.error(e.getMessage() + " file: " + path, e);
throw e;
@@ -444,7 +443,7 @@
pdcService_.save(portlet);
}
}
- catch (JiBXException e)
+ catch (Exception e)
{
log.error(e.getMessage() + " file: " + path, e);
throw e;
@@ -501,12 +500,21 @@
// Deserializing code
- private <T> T fromXML(String ownerType, String owner, String xml, Class<T>
clazz) throws Exception
+ private <T> T fromXML(String ownerType, String ownerId, String xml, final
Class<T> clazz) throws Exception
{
- ByteArrayInputStream is = new
ByteArrayInputStream(xml.getBytes("UTF-8"));
+ final ByteArrayInputStream is = new
ByteArrayInputStream(xml.getBytes("UTF-8"));
IBindingFactory bfact = BindingDirectory.getFactory(clazz);
- IUnmarshallingContext uctx = bfact.createUnmarshallingContext();
- T o = clazz.cast(uctx.unmarshalDocument(is, "UTF-8"));
+ final IUnmarshallingContext uctx = bfact.createUnmarshallingContext();
+ ownerId = fixOwnerName(ownerType, ownerId);
+ OwnerContext owner = new OwnerContext(ownerType, ownerId);
+ return owner.execute(new Callable<T>()
+ {
+ public T call() throws Exception
+ {
+ return clazz.cast(uctx.unmarshalDocument(is, "UTF-8"));
+ }
+ });
+/*
if (o instanceof PageNavigation)
{
PageNavigation nav = (PageNavigation)o;
@@ -532,17 +540,15 @@
{
for (Page page : ((PageSet)o).getPages())
{
- page.setOwnerType(ownerType);
- page.setOwnerId(owner);
+// page.setOwnerType(ownerType);
+// page.setOwnerId(owner);
fixOwnerName(page);
- // The page will be created in the calling method
- // pdcService_.create(page);
}
}
- return o;
+*/
}
- private static String fixOwnerName(String type, String owner)
+ public static String fixOwnerName(String type, String owner)
{
if (type.equals(PortalConfig.GROUP_TYPE) &&
!owner.startsWith("/"))
{
@@ -571,64 +577,4 @@
}
return persistenceId;
}
-
- private static void fixOwnerName(PortalConfig config)
- {
- config.setName(fixOwnerName(config.getType(), config.getName()));
- fixOwnerName(config.getPortalLayout());
- }
-
- private static void fixOwnerName(Container container)
- {
- for (Object o : container.getChildren())
- {
- if (o instanceof Container)
- {
- fixOwnerName((Container)o);
- }
- }
- }
-
- private static void fixOwnerName(PageNavigation pageNav)
- {
- pageNav.setOwnerId(fixOwnerName(pageNav.getOwnerType(), pageNav.getOwnerId()));
- for (PageNode pageNode : pageNav.getNodes())
- {
- fixOwnerName(pageNode);
- }
- }
-
- private static void fixOwnerName(PageNode pageNode)
- {
- if (pageNode.getPageReference() != null)
- {
- String pageRef = pageNode.getPageReference();
- int pos1 = pageRef.indexOf("::");
- int pos2 = pageRef.indexOf("::", pos1 + 2);
- String type = pageRef.substring(0, pos1);
- String owner = pageRef.substring(pos1 + 2, pos2);
- String name = pageRef.substring(pos2 + 2);
- owner = fixOwnerName(type, owner);
- pageRef = type + "::" + owner + "::" + name;
- pageNode.setPageReference(pageRef);
- }
- if (pageNode.getChildren() != null)
- {
- for (PageNode childPageNode : pageNode.getChildren())
- {
- fixOwnerName(childPageNode);
- }
- }
- }
-
- private static void fixOwnerName(PortletPreferences prefs)
- {
- prefs.setWindowId(fixInstanceIdOwnerName(prefs.getWindowId()));
- }
-
- private static void fixOwnerName(Page page)
- {
- page.setOwnerId(fixOwnerName(page.getOwnerType(), page.getOwnerId()));
- fixOwnerName((Container)page);
- }
}
Modified:
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/UserACL.java
===================================================================
---
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/UserACL.java 2009-10-22
18:47:45 UTC (rev 400)
+++
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/UserACL.java 2009-10-22
19:40:46 UTC (rev 401)
@@ -357,21 +357,17 @@
{
if (page.getOwnerId().equals(identity.getUserId()))
{
- page.setModifiable(true);
return true;
}
}
if (superUser_.equals(identity.getUserId()))
{
- page.setModifiable(true);
return true;
}
if (hasEditPermission(identity, page))
{
- page.setModifiable(true);
return true;
}
- page.setModifiable(false);
String[] accessPerms = page.getAccessPermissions();
for (String per : accessPerms)
{
@@ -387,17 +383,14 @@
{
if (page.getOwnerId().equals(identity.getUserId()))
{
- page.setModifiable(true);
return true;
}
return false;
}
if (hasPermission(identity, page.getEditPermission()))
{
- page.setModifiable(true);
return true;
}
- page.setModifiable(false);
return false;
}
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-22
18:47:45 UTC (rev 400)
+++
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/UserPortalConfigListener.java 2009-10-22
19:40:46 UTC (rev 401)
@@ -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.ContainerData;
import org.exoplatform.portal.config.model.PageNavigation;
import org.exoplatform.portal.config.model.PageNode;
import org.exoplatform.portal.config.model.PortalConfig;
@@ -70,7 +71,7 @@
if (cfg == null)
{
cfg = new PortalConfig(PortalConfig.USER_TYPE);
- cfg.setPortalLayout(new Container());
+ cfg.setPortalLayout(new Container(new ContainerData()));
cfg.setName(userName);
dataStorage.create(cfg);
}
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-22
18:47:45 UTC (rev 400)
+++
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/UserPortalConfigService.java 2009-10-22
19:40:46 UTC (rev 401)
@@ -519,8 +519,8 @@
if (container instanceof Page)
{
Page page = (Page)container;
- page.setOwnerType(ownerType);
- page.setOwnerId(ownerId);
+// page.setOwnerType(ownerType);
+// page.setOwnerId(ownerId);
}
for (ModelObject child : container.getChildren())
{
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-22
18:47:45 UTC (rev 400)
+++
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/Application.java 2009-10-22
19:40:46 UTC (rev 401)
@@ -28,49 +28,93 @@
public abstract class Application<S, I> extends ModelObject
{
+ /** .*/
+ private static final ApplicationData DEFAULT_DATA = new ApplicationData();
+
/** The application state. */
- private ApplicationState<S> state;
+ private final ApplicationState<S> state;
/** The reference to the application. */
- private I ref;
+ private final I ref;
- private String id;
+ private final String id;
- private String title;
+ private final String title;
- private String icon;
+ private final String icon;
- private String description;
+ private final String description;
- private boolean showInfoBar = true;
+ private final boolean showInfoBar;
- private boolean showApplicationState = true;
+ private final boolean showApplicationState;
- private boolean showApplicationMode = true;
+ private final boolean showApplicationMode;
- private String theme;
+ private final String theme;
- private String width;
+ private final String width;
- private String height;
+ private final String height;
- private Properties properties;
+ private final Properties properties;
- private String[] accessPermissions;
+ private final String[] accessPermissions;
- private boolean isModifiable;
+ private final boolean isModifiable;
- public Application(String storageId, I ref)
+ public Application(String storageId, String storageName, I ref,
PersistentApplicationState<S> state, ApplicationData data)
{
- super(storageId);
+ super(storageId, storageName);
//
+ if (data == null) {
+ data = DEFAULT_DATA;
+ }
+
+ //
this.ref = ref;
+ this.state = state;
+ 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 = data.getProperties();
+ this.accessPermissions = data.getAccessPermissions();
+ this.isModifiable = data.isModifiable();
}
- public Application(I ref)
+ public Application(String storageName, I ref, TransientApplicationState<S>
state, ApplicationData data)
{
+ super(null, storageName);
+
+ //
+ if (data == null) {
+ data = DEFAULT_DATA;
+ }
+
+ //
this.ref = ref;
+ this.state = state;
+ 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 = data.getProperties();
+ this.accessPermissions = data.getAccessPermissions();
+ this.isModifiable = data.isModifiable();
}
public abstract ApplicationType<S, I> getType();
@@ -80,61 +124,31 @@
return width;
}
- public void setWidth(String s)
- {
- width = s;
- }
-
public String getHeight()
{
return height;
}
- public void setHeight(String s)
- {
- height = s;
- }
-
public String getId()
{
return id;
}
- public void setId(String value)
- {
- id = value;
- }
-
public String[] getAccessPermissions()
{
return accessPermissions;
}
- public void setAccessPermissions(String[] accessPermissions)
- {
- this.accessPermissions = accessPermissions;
- }
-
public boolean isModifiable()
{
return isModifiable;
}
- public void setModifiable(boolean modifiable)
- {
- isModifiable = modifiable;
- }
-
public ApplicationState<S> getState()
{
return state;
}
- public void setState(ApplicationState<S> value)
- {
- state = value;
- }
-
public I getRef()
{
return ref;
@@ -145,41 +159,21 @@
return showInfoBar;
}
- public void setShowInfoBar(boolean b)
- {
- showInfoBar = b;
- }
-
public boolean getShowApplicationState()
{
return showApplicationState;
}
- public void setShowApplicationState(boolean b)
- {
- showApplicationState = b;
- }
-
public boolean getShowApplicationMode()
{
return showApplicationMode;
}
- public void setShowApplicationMode(boolean b)
- {
- showApplicationMode = b;
- }
-
public String getIcon()
{
return icon;
}
- public void setIcon(String value)
- {
- icon = value;
- }
-
public abstract String getApplicationType();
public String getDescription()
@@ -187,41 +181,18 @@
return description;
}
- public void setDescription(String des)
- {
- description = des;
- }
-
public String getTitle()
{
return title;
}
- public void setTitle(String value)
- {
- title = value;
- }
-
public Properties getProperties()
{
- if (properties == null)
- properties = new Properties();
return properties;
}
- public void setProperties(Properties properties)
- {
- this.properties = properties;
- }
-
public String getTheme()
{
return theme;
}
-
- public void setTheme(String theme)
- {
- this.theme = theme;
- }
-
}
\ No newline at end of file
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-22
19:40:46 UTC (rev 401)
@@ -0,0 +1,194 @@
+/*
+ * 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 ApplicationData
+{
+
+ /** . */
+ private String id;
+
+ /** . */
+ private String title;
+
+ /** . */
+ private String icon;
+
+ /** . */
+ private String description;
+
+ /** . */
+ private boolean showInfoBar = true;
+
+ /** . */
+ private boolean showApplicationState = true;
+
+ /** . */
+ private boolean showApplicationMode = true;
+
+ /** . */
+ private String theme;
+
+ /** . */
+ private String width;
+
+ /** . */
+ private String height;
+
+ /** . */
+ private Properties properties = new Properties();
+
+ /** . */
+ private String[] accessPermissions;
+
+ /** . */
+ private boolean modifiable;
+
+ public String getId()
+ {
+ return id;
+ }
+
+ public void setId(String id)
+ {
+ this.id = id;
+ }
+
+ public String getTitle()
+ {
+ return title;
+ }
+
+ public void setTitle(String title)
+ {
+ this.title = title;
+ }
+
+ public String getIcon()
+ {
+ return icon;
+ }
+
+ public void setIcon(String icon)
+ {
+ this.icon = icon;
+ }
+
+ public String getDescription()
+ {
+ return description;
+ }
+
+ public void setDescription(String description)
+ {
+ this.description = description;
+ }
+
+ public boolean isShowInfoBar()
+ {
+ return showInfoBar;
+ }
+
+ public void setShowInfoBar(boolean showInfoBar)
+ {
+ this.showInfoBar = showInfoBar;
+ }
+
+ public boolean isShowApplicationState()
+ {
+ return showApplicationState;
+ }
+
+ public void setShowApplicationState(boolean showApplicationState)
+ {
+ this.showApplicationState = showApplicationState;
+ }
+
+ public boolean isShowApplicationMode()
+ {
+ return showApplicationMode;
+ }
+
+ public void setShowApplicationMode(boolean showApplicationMode)
+ {
+ this.showApplicationMode = showApplicationMode;
+ }
+
+ public String getTheme()
+ {
+ return theme;
+ }
+
+ public void setTheme(String theme)
+ {
+ this.theme = theme;
+ }
+
+ public String getWidth()
+ {
+ return width;
+ }
+
+ public void setWidth(String width)
+ {
+ this.width = width;
+ }
+
+ public String getHeight()
+ {
+ return height;
+ }
+
+ public void setHeight(String height)
+ {
+ this.height = height;
+ }
+
+ public Properties getProperties()
+ {
+ return properties;
+ }
+
+ public void setProperties(Properties properties)
+ {
+ this.properties = properties;
+ }
+
+ public String[] getAccessPermissions()
+ {
+ return accessPermissions;
+ }
+
+ public void setAccessPermissions(String[] accessPermissions)
+ {
+ this.accessPermissions = accessPermissions;
+ }
+
+ public boolean isModifiable()
+ {
+ return modifiable;
+ }
+
+ public void setModifiable(boolean modifiable)
+ {
+ this.modifiable = modifiable;
+ }
+}
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-22
18:47:45 UTC (rev 400)
+++
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/Container.java 2009-10-22
19:40:46 UTC (rev 401)
@@ -30,161 +30,136 @@
public class Container extends ModelObject
{
- protected String id;
+ protected final String id;
- protected String name;
+ protected final String name;
- protected String icon;
+ protected final String icon;
- protected String decorator;
+ protected final String decorator;
- protected String template;
+ protected final String template;
- protected String factoryId;
+ protected final String factoryId;
- protected String title;
+ protected final String title;
- protected String description;
+ protected final String description;
- protected String width;
+ protected final String width;
- protected String height;
+ protected final String height;
- private String[] accessPermissions;
+ protected final String[] accessPermissions;
- protected ArrayList<ModelObject> children;
+ protected final ArrayList<ModelObject> children;
- public Container()
+ public Container(Container container, ContainerData data) {
+ this(container.getStorageId(), data);
+ }
+
+ public Container(ContainerData data)
{
- children = new ArrayList<ModelObject>();
+ this((String)null, data);
}
- public Container(String storageId)
+ public Container(String storageId, ContainerData data)
{
- super(storageId);
+ super(storageId, null);
//
+ 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();
+
+ //
this.children = new ArrayList<ModelObject>();
}
+ public void populate(ContainerData data) {
+ data.setId(id);
+ data.setName(name);
+ data.setIcon(icon);
+ data.setDecorator(decorator);
+ data.setTemplate(template);
+ data.setFactoryId(factoryId);
+ data.setTitle(title);
+ data.setWidth(width);
+ data.setHeight(height);
+ data.setAccessPermissions(accessPermissions != null ? accessPermissions.clone() :
null);
+ }
+
+ public ContainerData buildData() {
+ ContainerData data = new ContainerData();
+ populate(data);
+ return data;
+ }
+
public String getId()
{
return id;
}
- public void setId(String s)
- {
- id = s;
- }
-
public String getName()
{
return name;
}
- public void setName(String s)
- {
- name = s;
- }
-
public String getIcon()
{
return icon;
}
- public void setIcon(String icon)
- {
- this.icon = icon;
- }
-
public ArrayList<ModelObject> getChildren()
{
return children;
}
- public void setChildren(ArrayList<ModelObject> children)
- {
- this.children = children;
- }
-
public String getHeight()
{
return height;
}
- public void setHeight(String height)
- {
- this.height = height;
- }
-
public String getWidth()
{
return width;
}
- public void setWidth(String width)
- {
- this.width = width;
- }
-
public String getDecorator()
{
return decorator;
}
- public void setDecorator(String s)
- {
- decorator = s;
- }
-
public String getDescription()
{
return description;
}
- public void setDescription(String des)
- {
- description = des;
- }
-
public String getTitle()
{
return title;
}
- public void setTitle(String title)
- {
- this.title = title;
- }
-
public String getFactoryId()
{
return factoryId;
}
- public void setFactoryId(String factoryId)
- {
- this.factoryId = factoryId;
- }
-
public String getTemplate()
{
return template;
}
- public void setTemplate(String template)
- {
- this.template = template;
- }
-
public String[] getAccessPermissions()
{
return accessPermissions;
}
-
- public void setAccessPermissions(String[] accessPermissions)
- {
- this.accessPermissions = accessPermissions;
- }
-
}
\ No newline at end of file
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-22
19:40:46 UTC (rev 401)
@@ -0,0 +1,168 @@
+/*
+ * 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 ContainerData
+{
+
+ /** . */
+ private String id;
+
+ /** . */
+ private String name;
+
+ /** . */
+ private String icon;
+
+ /** . */
+ private String decorator;
+
+ /** . */
+ private String template;
+
+ /** . */
+ private String factoryId;
+
+ /** . */
+ private String title;
+
+ /** . */
+ private String description;
+
+ /** . */
+ private String width;
+
+ /** . */
+ private String height;
+
+ /** . */
+ private String[] accessPermissions;
+
+ public String getId()
+ {
+ return id;
+ }
+
+ public void setId(String id)
+ {
+ this.id = id;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ public String getIcon()
+ {
+ return icon;
+ }
+
+ public void setIcon(String icon)
+ {
+ this.icon = icon;
+ }
+
+ public String getDecorator()
+ {
+ return decorator;
+ }
+
+ public void setDecorator(String decorator)
+ {
+ this.decorator = decorator;
+ }
+
+ public String getTemplate()
+ {
+ return template;
+ }
+
+ public void setTemplate(String template)
+ {
+ this.template = template;
+ }
+
+ public String getFactoryId()
+ {
+ return factoryId;
+ }
+
+ public void setFactoryId(String factoryId)
+ {
+ this.factoryId = factoryId;
+ }
+
+ public String getTitle()
+ {
+ return title;
+ }
+
+ public void setTitle(String title)
+ {
+ this.title = title;
+ }
+
+ public String getDescription()
+ {
+ return description;
+ }
+
+ public void setDescription(String description)
+ {
+ this.description = description;
+ }
+
+ public String getWidth()
+ {
+ return width;
+ }
+
+ public void setWidth(String width)
+ {
+ this.width = width;
+ }
+
+ public String getHeight()
+ {
+ return height;
+ }
+
+ public void setHeight(String height)
+ {
+ this.height = height;
+ }
+
+ public String[] getAccessPermissions()
+ {
+ return accessPermissions;
+ }
+
+ public void setAccessPermissions(String[] accessPermissions)
+ {
+ this.accessPermissions = accessPermissions;
+ }
+}
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-22
18:47:45 UTC (rev 400)
+++
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/Dashboard.java 2009-10-22
19:40:46 UTC (rev 401)
@@ -26,12 +26,13 @@
public class Dashboard extends Container
{
- public Dashboard()
+ public Dashboard(ContainerData data)
{
+ super(data);
}
- public Dashboard(String storageId)
+ public Dashboard(String storageId, ContainerData data)
{
- super(storageId);
+ super(storageId, data);
}
}
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-22
18:47:45 UTC (rev 400)
+++
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/Mapper.java 2009-10-22
19:40:46 UTC (rev 401)
@@ -19,6 +19,7 @@
package org.exoplatform.portal.config.model;
+import org.exoplatform.portal.config.model.gadget.GadgetId;
import static org.exoplatform.portal.pom.config.Utils.join;
import static org.exoplatform.portal.pom.config.Utils.split;
@@ -126,8 +127,8 @@
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.setShowPublicationDate(attrs.getValue(MappedAttributes.SHOW_PUBLICATION_DATE,
false));
+ dstNode.setVisible(attrs.getValue(MappedAttributes.VISIBLE, true));
dstNode.setChildren(new ArrayList<PageNode>());
Link link = src.getLink();
if (link instanceof PageLink)
@@ -272,11 +273,13 @@
//
org.gatein.mop.api.workspace.Page template =
src.getRootNavigation().getTemplate();
- Container dstLayout = new Container();
UIContainer srcLayout = template.getRootComponent();
+ ContainerData data = load(srcLayout);
//
- load(srcLayout, dstLayout);
+ Container dstLayout = new Container(srcLayout.getObjectId(), data);
+
+ //
loadChildren(srcLayout, dstLayout);
//
@@ -329,13 +332,9 @@
public Page load(org.gatein.mop.api.workspace.Page src)
{
- Page dst = new Page(src.getRootComponent().getObjectId());
- load(src, dst);
- return dst;
- }
+ UIContainer root = src.getRootComponent();
- 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();
@@ -344,20 +343,27 @@
//
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));
+ PageData data = new PageData();
+ data.setId(pageId);
+ data.setOwnerId(ownerId);
+ data.setOwnerType(ownerType);
+ data.setName(name);
+ data.setTitle(attrs.getValue(MappedAttributes.TITLE));
+ data.setShowMaxWindow(attrs.getValue(MappedAttributes.SHOW_MAX_WINDOW, false));
+ data.setCreator(attrs.getValue(MappedAttributes.CREATOR));
+ data.setModifier(attrs.getValue(MappedAttributes.MODIFIER));
+ data.setAccessPermissions(split("|",
attrs.getValue(MappedAttributes.ACCESS_PERMISSIONS)));
+ data.setEditPermission(attrs.getValue(MappedAttributes.EDIT_PERMISSION));
+ data.setFactoryId(attrs.getValue(MappedAttributes.FACTORY_ID));
//
+ Page dst = new Page(root.getObjectId(), data);
+
+ //
loadChildren(src.getRootComponent(), dst);
+
+ //
+ return dst;
}
public List<ModelChange> save(Page src, Site site, String name)
@@ -374,7 +380,6 @@
{
dst = pages.addChild(name);
changes.add(new ModelChange.Create(src));
- src.storageId = dst.getObjectId();
}
else
{
@@ -398,20 +403,26 @@
return changes;
}
- private void load(UIContainer src, Container dst)
+ private ContainerData load(UIContainer src)
{
+ ContainerData data = new ContainerData();
+
+ //
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));
+ data.setId(attrs.getValue(MappedAttributes.ID));
+ data.setName(attrs.getValue(MappedAttributes.NAME));
+ data.setTitle(attrs.getValue(MappedAttributes.TITLE));
+ data.setIcon(attrs.getValue(MappedAttributes.ICON));
+ data.setTemplate(attrs.getValue(MappedAttributes.TEMPLATE));
+ data.setAccessPermissions(split("|",
attrs.getValue(MappedAttributes.ACCESS_PERMISSIONS)));
+ data.setFactoryId(attrs.getValue(MappedAttributes.FACTORY_ID));
+ data.setDecorator(attrs.getValue(MappedAttributes.DECORATOR));
+ data.setDescription(attrs.getValue(MappedAttributes.DESCRIPTION));
+ data.setWidth(attrs.getValue(MappedAttributes.WIDTH));
+ data.setHeight(attrs.getValue(MappedAttributes.HEIGHT));
+
+ //
+ return data;
}
private void loadChildren(UIContainer src, Container dst)
@@ -428,22 +439,15 @@
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;
+ ApplicationData data = new ApplicationData();
+ data.setShowInfoBar(false);
+ data.setShowApplicationState(false);
+ mo = new PortletApplication(srcContainer.getObjectId(),
srcContainer.getName(), "dashboard", "DashboardPortlet", null, data);
}
else
{
- Container dstContainer = new Container(component.getObjectId());
- load(srcContainer, dstContainer);
+ ContainerData data = load(srcContainer);
+ Container dstContainer = new Container(component.getObjectId(), data);
loadChildren(srcContainer, dstContainer);
mo = dstContainer;
}
@@ -451,8 +455,7 @@
else if (component instanceof UIWindow)
{
UIWindow window = (UIWindow)component;
- Application application = load(window);
- mo = application;
+ mo = load(window);
}
else if (component instanceof UIBody)
{
@@ -463,9 +466,6 @@
throw new AssertionError();
}
- // Set the loaded name
- mo.storageName = component.getName();
-
// Add among children
dst.getChildren().add(mo);
}
@@ -578,19 +578,21 @@
if (app.storageId != null)
{
UIContainer dstDashboard =
session.findObjectById(ObjectType.CONTAINER, app.storageId);
- Dashboard srcDashboard = new Dashboard(app.storageId);
- load(dstDashboard, srcDashboard);
+ ContainerData dashboardData = load(dstDashboard);
+ Dashboard srcDashboard = new Dashboard(app.storageId,
dashboardData);
loadChildren(dstDashboard, srcDashboard);
srcChild = srcDashboard;
}
else
{
- Dashboard dashboard = new Dashboard();
-
dashboard.setTemplate("classpath:groovy/dashboard/webui/component/UIColumnContainer.gtmpl");
+ ContainerData dashboardData = new ContainerData();
+
dashboardData.setTemplate("classpath:groovy/dashboard/webui/component/UIColumnContainer.gtmpl");
+ Dashboard dashboard = new Dashboard(dashboardData);
for (int i = 0; i < 3; i++)
{
- Container row = new Container();
-
row.setTemplate("classpath:groovy/dashboard/webui/component/UIContainer.gtmpl");
+ ContainerData rowData = new ContainerData();
+
rowData.setTemplate("classpath:groovy/dashboard/webui/component/UIContainer.gtmpl");
+ Container row = new Container(rowData);
dashboard.getChildren().add(row);
}
srcChild = dashboard;
@@ -666,8 +668,6 @@
{
throw new AssertionError("Was not expecting child " +
srcChild);
}
- srcChild.storageId = dstChild.getObjectId();
- srcChild.storageName = name;
changes.add(new ModelChange.Create(srcChild));
}
@@ -746,6 +746,23 @@
String contentId = customization.getContentId();
//
+ ApplicationData data = new ApplicationData();
+ data.setTheme(attrs.getValue(MappedAttributes.THEME));
+ data.setTitle(attrs.getValue(MappedAttributes.TITLE));
+ data.setAccessPermissions(split("|",
attrs.getValue(MappedAttributes.ACCESS_PERMISSIONS)));
+ data.setShowInfoBar(attrs.getValue(MappedAttributes.SHOW_INFO_BAR));
+ data.setShowApplicationState(attrs.getValue(MappedAttributes.SHOW_STATE));
+ data.setShowApplicationMode(attrs.getValue(MappedAttributes.SHOW_MODE));
+ data.setDescription(attrs.getValue(MappedAttributes.DESCRIPTION));
+ data.setIcon(attrs.getValue(MappedAttributes.ICON));
+ data.setWidth(attrs.getValue(MappedAttributes.WIDTH));
+ data.setHeight(attrs.getValue(MappedAttributes.HEIGHT));
+ load(attrs, data.getProperties(), windowPropertiesBlackList);
+
+ //
+ PersistentApplicationState<S> instanceState = new
PersistentApplicationState<S>(customizationid);
+
+ //
Application<S, I> dst;
if (contentType == null || contentType == Preferences.CONTENT_TYPE)
{
@@ -754,20 +771,26 @@
String portletName = contentId.substring(pos + 1);
@SuppressWarnings("unchecked")
Application<S, I> application =
- (Application<S, I>)new PortletApplication(src.getObjectId(),
applicationName, portletName);
+ (Application<S, I>)new PortletApplication(
+ src.getObjectId(),
+ src.getName(),
+ applicationName,
+ portletName,
+ (PersistentApplicationState<Preferences>)instanceState,
+ data);
dst = application;
}
else if (contentType == Gadget.CONTENT_TYPE)
{
@SuppressWarnings("unchecked")
- Application<S, I> application = (Application<S, I>)new
GadgetApplication(src.getObjectId(), contentId);
+ Application<S, I> application = (Application<S, I>)new
GadgetApplication(src.getObjectId(), src.getName(), new GadgetId(contentId),
(PersistentApplicationState<Gadget>)instanceState, data);
dst = application;
}
else if (contentType == WSRPState.CONTENT_TYPE)
{
@SuppressWarnings("unchecked")
Application<S, I> application =
- (Application<S, I>)new WSRPApplication(src.getObjectId(), new
WSRPId(contentId));
+ (Application<S, I>)new WSRPApplication(src.getObjectId(),
src.getName(), new WSRPId(contentId),
(PersistentApplicationState<WSRPState>)instanceState, data);
dst = application;
}
else
@@ -776,25 +799,6 @@
}
//
- 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;
}
@@ -971,8 +975,8 @@
public Dashboard loadDashboard(UIContainer container)
{
- Dashboard dashboard = new Dashboard(container.getObjectId());
- load(container, dashboard);
+ ContainerData dashboardData = load(container);
+ Dashboard dashboard = new Dashboard(container.getObjectId(), dashboardData);
loadChildren(container, dashboard);
return dashboard;
}
@@ -1013,9 +1017,11 @@
public static void save(Properties src, Attributes dst)
{
- for (Map.Entry<String, String> property : src.entrySet())
- {
- dst.setString(property.getKey(), property.getValue());
+ if (src != null) {
+ for (Map.Entry<String, String> property : src.entrySet())
+ {
+ dst.setString(property.getKey(), property.getValue());
+ }
}
}
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-22
18:47:45 UTC (rev 400)
+++
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/ModelObject.java 2009-10-22
19:40:46 UTC (rev 401)
@@ -27,24 +27,27 @@
{
/** Storage id. */
- String storageId;
+ final String storageId;
/** The storage name that is unique among a container context. */
- String storageName;
+ final String storageName;
/**
* Create a new object.
*
- * @param storageId if the storage id is null
+ * @param storageId the storage name
+ * @param storageName the storage name
*/
- public ModelObject(String storageId)
+ public ModelObject(String storageId, String storageName)
{
this.storageId = storageId;
+ this.storageName = storageName;
}
protected ModelObject()
{
this.storageId = null;
+ this.storageName = null;
}
public String getStorageId()
@@ -56,10 +59,4 @@
{
return storageName;
}
-
- public void setStorageName(String storageName)
- {
- this.storageName = storageName;
- }
-
}
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-22
18:47:45 UTC (rev 400)
+++
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/Page.java 2009-10-22
19:40:46 UTC (rev 401)
@@ -31,59 +31,69 @@
final static public String DEFAULT_PAGE = "Default";
- private String ownerType;
+ private final String ownerType;
- private String ownerId;
+ private final String ownerId;
- private String[] accessPermissions;
+ private final String editPermission;
- private String editPermission;
+ private final boolean showMaxWindow;
- private boolean showMaxWindow = false;
+ private final String creator;
- private String creator;
+ private final String modifier;
- private String modifier;
-
- private transient boolean modifiable;
-
- public Page()
+ public Page(Page page, PageData data)
{
+ this(page.getStorageId(), data);
}
- public Page(String storageId)
+ public Page(PageData data)
{
- super(storageId);
+ this((String)null, data);
}
- public String getOwnerId()
+ public Page(String storageId, PageData data)
{
- return ownerId;
- }
+ super(storageId, data);
- public void setOwnerId(String ownerId)
- {
- this.ownerId = ownerId;
+ //
+ 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 String getOwnerType()
- {
- return ownerType;
+ public void populate(PageData data) {
+ super.populate(data);
+
+ //
+ data.setOwnerType(ownerType);
+ data.setOwnerId(ownerId);
+ data.setEditPermission(editPermission);
+ data.setShowMaxWindow(showMaxWindow);
+ data.setCreator(creator);
+ data.setModifier(modifier);
}
- public void setOwnerType(String ownerType)
+ @Override
+ public PageData buildData()
{
- this.ownerType = ownerType;
+ PageData data = new PageData();
+ populate(data);
+ return data;
}
- public String[] getAccessPermissions()
+ public String getOwnerId()
{
- return accessPermissions;
+ return ownerId;
}
- public void setAccessPermissions(String[] s)
+ public String getOwnerType()
{
- accessPermissions = s;
+ return ownerType;
}
public String getEditPermission()
@@ -91,21 +101,11 @@
return editPermission;
}
- public void setEditPermission(String editPermission)
- {
- this.editPermission = editPermission;
- }
-
public boolean isShowMaxWindow()
{
return showMaxWindow;
}
- public void setShowMaxWindow(Boolean showMaxWindow)
- {
- this.showMaxWindow = showMaxWindow.booleanValue();
- }
-
public String getPageId()
{
if (ownerType == null || ownerId == null || name == null)
@@ -118,57 +118,16 @@
}
}
- public void setPageId(String pageId)
- {
- if (pageId == null)
- {
- ownerType = null;
- ownerId = null;
- name = null;
- }
- else
- {
- int i1 = pageId.indexOf("::");
- int i2 = pageId.indexOf("::", i1 + 2);
- String ownerType = pageId.substring(0, i1);
- String ownerId = pageId.substring(i1 + 2, i2);
- String name = pageId.substring(i2 + 2);
- this.ownerType = ownerType;
- this.ownerId = ownerId;
- this.name = name;
- }
- }
-
- public boolean isModifiable()
- {
- return modifiable;
- }
-
- public void setModifiable(boolean b)
- {
- modifiable = b;
- }
-
public String getCreator()
{
return creator;
}
- public void setCreator(String s)
- {
- creator = s;
- }
-
public String getModifier()
{
return modifier;
}
- public void setModifier(String s)
- {
- modifier = s;
- }
-
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-22
18:47:45 UTC (rev 400)
+++
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PageBody.java 2009-10-22
19:40:46 UTC (rev 401)
@@ -28,7 +28,7 @@
public PageBody(String storageId)
{
- super(storageId);
+ super(storageId, null);
}
public PageBody()
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-22
19:40:46 UTC (rev 401)
@@ -0,0 +1,136 @@
+/*
+ * 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 PageData extends ContainerData
+{
+
+ /** . */
+ private String ownerType;
+
+ /** . */
+ private String ownerId;
+
+ /** . */
+ private String editPermission;
+
+ /** . */
+ private boolean showMaxWindow = false;
+
+ /** . */
+ private String creator;
+
+ /** . */
+ private String modifier;
+
+ public String getOwnerType()
+ {
+ return ownerType;
+ }
+
+ public void setOwnerType(String ownerType)
+ {
+ this.ownerType = ownerType;
+ }
+
+ public String getOwnerId()
+ {
+ return ownerId;
+ }
+
+ public void setOwnerId(String ownerId)
+ {
+ this.ownerId = ownerId;
+ }
+
+ public String getEditPermission()
+ {
+ return editPermission;
+ }
+
+ public void setEditPermission(String editPermission)
+ {
+ this.editPermission = editPermission;
+ }
+
+ public boolean isShowMaxWindow()
+ {
+ return showMaxWindow;
+ }
+
+ public void setShowMaxWindow(boolean showMaxWindow)
+ {
+ this.showMaxWindow = showMaxWindow;
+ }
+
+ public String getCreator()
+ {
+ return creator;
+ }
+
+ public void setCreator(String creator)
+ {
+ this.creator = creator;
+ }
+
+ public String getModifier()
+ {
+ return modifier;
+ }
+
+ public void setModifier(String modifier)
+ {
+ this.modifier = modifier;
+ }
+
+ public void setPageId(String pageId)
+ {
+ if (pageId == null)
+ {
+ ownerType = null;
+ ownerId = null;
+ setName(null);
+ }
+ else
+ {
+ int i1 = pageId.indexOf("::");
+ int i2 = pageId.indexOf("::", i1 + 2);
+ String ownerType = pageId.substring(0, i1);
+ String ownerId = pageId.substring(i1 + 2, i2);
+ String name = pageId.substring(i2 + 2);
+ this.ownerType = ownerType;
+ this.ownerId = ownerId;
+ setName(name);
+ }
+ }
+
+ public String getPageId()
+ {
+ if (ownerType == null || ownerId == null || getName() == null)
+ {
+ return null;
+ }
+ else
+ {
+ return ownerType + "::" + ownerId + "::" + getName();
+ }
+ }
+}
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-22
18:47:45 UTC (rev 400)
+++
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PageNode.java 2009-10-22
19:40:46 UTC (rev 401)
@@ -190,9 +190,9 @@
return visible;
}
- public void setVisible(Boolean b)
+ public void setVisible(boolean b)
{
- visible = b.booleanValue();
+ visible = b;
}
private boolean isInPublicationDate()
@@ -208,9 +208,9 @@
return false;
}
- public void setShowPublicationDate(Boolean show)
+ public void setShowPublicationDate(boolean show)
{
- showPublicationDate = show.booleanValue();
+ showPublicationDate = show;
}
public boolean isShowPublicationDate()
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-22
18:47:45 UTC (rev 400)
+++
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PageNodeContainer.java 2009-10-22
19:40:46 UTC (rev 401)
@@ -30,7 +30,7 @@
public PageNodeContainer(String storageId)
{
- super(storageId);
+ super(storageId, null);
}
public PageNodeContainer()
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-22
18:47:45 UTC (rev 400)
+++
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PortalConfig.java 2009-10-22
19:40:46 UTC (rev 401)
@@ -70,7 +70,7 @@
public PortalConfig(String type, String ownerId, String storageId)
{
- super(storageId);
+ super(storageId, null);
//
this.type = type;
@@ -82,12 +82,12 @@
this.type = type;
//
- setPortalLayout(new Container());
+ setPortalLayout(new Container(new ContainerData()));
}
PortalConfig(String storageId, String type)
{
- super(storageId);
+ super(storageId, null);
//
this.type = type;
@@ -291,10 +291,8 @@
*/
private static Container initDefaultLayout()
{
- Container container = new Container();
- ArrayList<ModelObject> children = new ArrayList<ModelObject>();
- children.add(new PageBody());
- container.setChildren(children);
+ Container container = new Container(new ContainerData());
+ container.getChildren().add(new PageBody());
return container;
}
}
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-22
18:47:45 UTC (rev 400)
+++
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/SiteBody.java 2009-10-22
19:40:46 UTC (rev 401)
@@ -24,7 +24,7 @@
public SiteBody(String storageId)
{
- super(storageId);
+ super(storageId, null);
}
public SiteBody()
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-22
18:47:45 UTC (rev 400)
+++
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/gadget/GadgetApplication.java 2009-10-22
19:40:46 UTC (rev 401)
@@ -20,7 +20,10 @@
package org.exoplatform.portal.config.model.gadget;
import org.exoplatform.portal.config.model.Application;
+import org.exoplatform.portal.config.model.ApplicationData;
import org.exoplatform.portal.config.model.ApplicationType;
+import org.exoplatform.portal.config.model.PersistentApplicationState;
+import org.exoplatform.portal.config.model.TransientApplicationState;
import org.exoplatform.portal.pom.spi.gadget.Gadget;
/**
@@ -30,26 +33,21 @@
public class GadgetApplication extends Application<Gadget, GadgetId>
{
- public GadgetApplication(String storageId, String gadgetName)
+ public GadgetApplication(String storageId, String storageName, GadgetId gadgetId,
PersistentApplicationState<Gadget> state, ApplicationData data)
{
- super(storageId, new GadgetId(gadgetName));
+ super(storageId, storageName, gadgetId, state, data);
}
- public GadgetApplication(String gadgetName)
+ public GadgetApplication(String storageName, GadgetId ref,
TransientApplicationState<Gadget> state, ApplicationData data)
{
- super(new GadgetId(gadgetName));
+ super(storageName, ref, state, data);
}
- public GadgetApplication(String storageId, GadgetId instanceId)
+ public GadgetApplication(GadgetId ref, TransientApplicationState<Gadget> state)
{
- super(storageId, instanceId);
+ super(null, ref, state, null);
}
- public GadgetApplication(GadgetId instanceId)
- {
- super(instanceId);
- }
-
public ApplicationType<Gadget, GadgetId> getType()
{
return ApplicationType.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-22
18:47:45 UTC (rev 400)
+++
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/portlet/PortletApplication.java 2009-10-22
19:40:46 UTC (rev 401)
@@ -20,7 +20,11 @@
package org.exoplatform.portal.config.model.portlet;
import org.exoplatform.portal.config.model.Application;
+import org.exoplatform.portal.config.model.ApplicationData;
+import org.exoplatform.portal.config.model.ApplicationState;
import org.exoplatform.portal.config.model.ApplicationType;
+import org.exoplatform.portal.config.model.PersistentApplicationState;
+import org.exoplatform.portal.config.model.TransientApplicationState;
import org.exoplatform.portal.pom.spi.portlet.Preferences;
/**
@@ -30,24 +34,35 @@
public class PortletApplication extends Application<Preferences, PortletId>
{
- public PortletApplication(String storageId, String applicationName, String
portletName)
+ public PortletApplication(
+ String storageId,
+ String storageName,
+ String applicationName,
+ String portletName,
+ PersistentApplicationState<Preferences> state,
+ ApplicationData data)
{
- super(storageId, new PortletId(applicationName, portletName));
+ super(storageId, storageName, new PortletId(applicationName, portletName), state,
data);
}
- public PortletApplication(String applicationName, String portletName)
+ public PortletApplication(
+ String storageId,
+ String storageName,
+ PortletId id,
+ PersistentApplicationState<Preferences> state,
+ ApplicationData data)
{
- super(new PortletId(applicationName, portletName));
+ super(storageId, storageName, id, state, data);
}
- public PortletApplication(String storageId, PortletId instanceId)
+ public PortletApplication(String storageName, PortletId ref,
TransientApplicationState<Preferences> state, ApplicationData data)
{
- super(storageId, instanceId);
+ super(storageName, ref, state, data);
}
- public PortletApplication(PortletId instanceId)
+ public PortletApplication(String applicationName, String portletName,
TransientApplicationState<Preferences> state)
{
- super(instanceId);
+ super(null, new PortletId(applicationName, portletName), state, null);
}
public ApplicationType<Preferences, PortletId> getType()
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-22
18:47:45 UTC (rev 400)
+++
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/wsrp/WSRPApplication.java 2009-10-22
19:40:46 UTC (rev 401)
@@ -20,7 +20,10 @@
package org.exoplatform.portal.config.model.wsrp;
import org.exoplatform.portal.config.model.Application;
+import org.exoplatform.portal.config.model.ApplicationData;
import org.exoplatform.portal.config.model.ApplicationType;
+import org.exoplatform.portal.config.model.PersistentApplicationState;
+import org.exoplatform.portal.config.model.TransientApplicationState;
import org.exoplatform.portal.pom.spi.wsrp.WSRPState;
/**
@@ -30,14 +33,14 @@
public class WSRPApplication extends Application<WSRPState, WSRPId>
{
- public WSRPApplication(String storageId, WSRPId id)
+ public WSRPApplication(String storageId, String storageName, WSRPId id,
PersistentApplicationState<WSRPState> state, ApplicationData data)
{
- super(storageId, id);
+ super(storageId, storageName, id, state, data);
}
- public WSRPApplication(WSRPId id)
+ public WSRPApplication(String storageName, WSRPId id,
TransientApplicationState<WSRPState> state, ApplicationData data)
{
- super(id);
+ super(storageName, id, state, data);
}
@Override
Modified:
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/serialize/AbstractApplicationHandler.java
===================================================================
---
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/serialize/AbstractApplicationHandler.java 2009-10-22
18:47:45 UTC (rev 400)
+++
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/serialize/AbstractApplicationHandler.java 2009-10-22
19:40:46 UTC (rev 401)
@@ -19,6 +19,8 @@
package org.exoplatform.portal.config.serialize;
+import org.exoplatform.portal.config.model.ApplicationData;
+import org.exoplatform.portal.config.model.portlet.PortletId;
import static org.exoplatform.portal.pom.config.Utils.split;
import org.exoplatform.portal.application.Preference;
@@ -40,45 +42,18 @@
* @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
* @version $Revision$
*/
-public class AbstractApplicationHandler implements IMarshaller, IUnmarshaller,
IAliasable
+public class AbstractApplicationHandler extends AbstractHandler
{
- private String m_uri;
-
- private int m_index;
-
- private String m_name;
-
public AbstractApplicationHandler()
{
}
public AbstractApplicationHandler(String m_uri, int m_index, String m_name)
{
- this.m_uri = m_uri;
- this.m_index = m_index;
- this.m_name = m_name;
+ super(m_uri, m_index, m_name);
}
- // IMarshaller implementation
-
- public boolean isExtension(String s)
- {
- throw new UnsupportedOperationException();
- }
-
- public void marshal(Object o, IMarshallingContext iMarshallingContext) throws
JiBXException
- {
- throw new UnsupportedOperationException();
- }
-
- // IUnmarshaller implementation
-
- public boolean isPresent(IUnmarshallingContext ctx) throws JiBXException
- {
- return ctx.isAt(m_uri, m_name);
- }
-
public Object unmarshal(Object obj, IUnmarshallingContext ictx) throws JiBXException
{
UnmarshallingContext ctx = (UnmarshallingContext)ictx;
@@ -100,7 +75,8 @@
ctx.parsePastStartTag(m_uri, m_name);
//
- PortletApplication app;
+ PortletId portletId;
+ TransientApplicationState<Preferences> state;
if ("application".equals(m_name))
{
String instanceId = ctx.parseElementText(m_uri, "instance-id");
@@ -111,7 +87,6 @@
String ownerId = instanceId.substring(i0 + 1, i1);
String persistenceid = instanceId.substring(i1 + 2);
String[] persistenceChunks = split("/", persistenceid);
- TransientApplicationState<Preferences> state;
if (persistenceChunks.length == 2)
{
state = new TransientApplicationState<Preferences>();
@@ -122,15 +97,14 @@
}
state.setOwnerType(ownerType);
state.setOwnerId(ownerId);
- app = new PortletApplication(persistenceChunks[0], persistenceChunks[1]);
- app.setState(state);
+ portletId = new PortletId(persistenceChunks[0], persistenceChunks[1]);
}
else
{
ctx.parsePastStartTag(m_uri, "portlet");
String applicationName = ctx.parseElementText(m_uri,
"application-ref");
String portletName = ctx.parseElementText(m_uri, "portlet-ref");
- TransientApplicationState<Preferences> state = new
TransientApplicationState<Preferences>();
+ state = new TransientApplicationState<Preferences>();
if (ctx.isAt(m_uri, "preferences"))
{
PreferencesBuilder builder = new PreferencesBuilder();
@@ -143,8 +117,7 @@
ctx.parsePastEndTag(m_uri, "preferences");
state.setContentState(builder.build());
}
- app = new PortletApplication(applicationName, portletName);
- app.setState(state);
+ portletId = new PortletId(applicationName, portletName);
ctx.parsePastEndTag(m_uri, "portlet");
}
@@ -172,51 +145,21 @@
ctx.parsePastEndTag(m_uri, m_name);
//
- app.setId(id);
- app.setTheme(theme);
- app.setTitle(title);
-
app.setAccessPermissions(JibxArraySerialize.deserializeStringArray(accessPermissions));
- app.setShowInfoBar(showInfoBar);
- app.setShowApplicationState(showApplicationState);
- app.setShowApplicationMode(showApplicationMode);
- app.setDescription(description);
- app.setIcon(icon);
- app.setWidth(width);
- app.setHeight(height);
- app.setProperties(properties);
+ ApplicationData data = new ApplicationData();
+ data.setId(id);
+ data.setTheme(theme);
+ data.setTitle(title);
+
data.setAccessPermissions(JibxArraySerialize.deserializeStringArray(accessPermissions));
+ data.setShowInfoBar(showInfoBar);
+ data.setShowApplicationState(showApplicationState);
+ data.setShowApplicationMode(showApplicationMode);
+ data.setDescription(description);
+ data.setIcon(icon);
+ data.setWidth(width);
+ data.setHeight(height);
+ data.setProperties(properties);
//
- return app;
+ return new PortletApplication(null, portletId, state, data);
}
-
- private String optionalAttribute(UnmarshallingContext ctx, String attrName) throws
JiBXException
- {
- String value = null;
- if (ctx.hasAttribute(m_uri, attrName))
- {
- value = ctx.attributeText(m_uri, attrName);
- }
- return value;
- }
-
- private String nextOptionalTag(UnmarshallingContext ctx, String tagName) throws
JiBXException
- {
- String value = null;
- if (ctx.isAt(m_uri, tagName))
- {
- value = ctx.parseElementText(m_uri, tagName);
- }
- return value;
- }
-
- private boolean nextOptionalBooleanTag(UnmarshallingContext ctx, String tagName,
boolean defaultValue)
- throws JiBXException
- {
- Boolean value = defaultValue;
- if (ctx.isAt(m_uri, tagName))
- {
- value = ctx.parseElementBoolean(m_uri, tagName);
- }
- return value;
- }
}
Added:
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/serialize/AbstractHandler.java
===================================================================
---
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/serialize/AbstractHandler.java
(rev 0)
+++
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/serialize/AbstractHandler.java 2009-10-22
19:40:46 UTC (rev 401)
@@ -0,0 +1,116 @@
+/*
+ * 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.serialize;
+
+import org.jibx.runtime.IAliasable;
+import org.jibx.runtime.IMarshaller;
+import org.jibx.runtime.IMarshallingContext;
+import org.jibx.runtime.IUnmarshaller;
+import org.jibx.runtime.IUnmarshallingContext;
+import org.jibx.runtime.JiBXException;
+import org.jibx.runtime.impl.UnmarshallingContext;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
+ * @version $Revision$
+ */
+public abstract class AbstractHandler implements IMarshaller, IUnmarshaller, IAliasable
+{
+
+ protected final String m_uri;
+
+ protected final int m_index;
+
+ protected final String m_name;
+
+ public AbstractHandler()
+ {
+ this.m_uri = null;
+ this.m_index = 0;
+ this.m_name = null;
+ }
+
+ public AbstractHandler(String m_uri, int m_index, String m_name)
+ {
+ this.m_uri = m_uri;
+ this.m_index = m_index;
+ this.m_name = m_name;
+ }
+
+ // IMarshaller implementation
+
+ public boolean isExtension(String s)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public void marshal(Object o, IMarshallingContext iMarshallingContext) throws
JiBXException
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ // IUnmarshaller implementation
+
+ public boolean isPresent(IUnmarshallingContext ctx) throws JiBXException
+ {
+ return ctx.isAt(m_uri, m_name);
+ }
+
+ // Utility
+
+ protected final String optionalAttribute(UnmarshallingContext ctx, String attrName)
throws JiBXException
+ {
+ String value = null;
+ if (ctx.hasAttribute(m_uri, attrName))
+ {
+ value = ctx.attributeText(m_uri, attrName);
+ }
+ return value;
+ }
+
+ protected final String nextOptionalTag(UnmarshallingContext ctx, String tagName)
throws JiBXException
+ {
+ String value = null;
+ if (ctx.isAt(m_uri, tagName))
+ {
+ value = ctx.parseElementText(m_uri, tagName);
+ }
+ return value;
+ }
+
+ protected final int nextOptionalIntTag(UnmarshallingContext ctx, String tagName, int
defaultValue)
+ throws JiBXException
+ {
+ Integer value = defaultValue;
+ if (ctx.isAt(m_uri, tagName))
+ {
+ value = ctx.parseElementInt(m_uri, tagName);
+ }
+ return value;
+ }
+
+ protected final boolean nextOptionalBooleanTag(UnmarshallingContext ctx, String
tagName, boolean defaultValue)
+ throws JiBXException
+ {
+ Boolean value = defaultValue;
+ if (ctx.isAt(m_uri, tagName))
+ {
+ value = ctx.parseElementBoolean(m_uri, tagName);
+ }
+ return value;
+ }
+}
Added:
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/serialize/ContainerHandler.java
===================================================================
---
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/serialize/ContainerHandler.java
(rev 0)
+++
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/serialize/ContainerHandler.java 2009-10-22
19:40:46 UTC (rev 401)
@@ -0,0 +1,104 @@
+/*
+ * 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.serialize;
+
+import org.exoplatform.portal.config.model.Container;
+import org.exoplatform.portal.config.model.ContainerData;
+import org.exoplatform.portal.config.model.ModelObject;
+import org.jibx.runtime.IUnmarshallingContext;
+import org.jibx.runtime.JiBXException;
+import org.jibx.runtime.impl.UnmarshallingContext;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
+ * @version $Revision$
+ */
+public class ContainerHandler extends AbstractHandler
+{
+
+ public ContainerHandler()
+ {
+ }
+
+ public ContainerHandler(String m_uri, int m_index, String m_name)
+ {
+ super(m_uri, m_index, m_name);
+ }
+
+ public Object unmarshal(Object o, IUnmarshallingContext ictx) throws JiBXException
+ {
+ UnmarshallingContext ctx = (UnmarshallingContext)ictx;
+ if (!ctx.isAt(m_uri, m_name))
+ {
+ ctx.throwStartTagNameError(m_uri, m_name);
+ }
+
+ //
+ String id = optionalAttribute(ctx, "id");
+ String template = optionalAttribute(ctx, "template");
+ String decorator = optionalAttribute(ctx, "decorator");
+ String width = optionalAttribute(ctx, "width");
+ String height = optionalAttribute(ctx, "height");
+
+ //
+ ctx.parsePastStartTag(m_uri, m_name);
+
+ //
+ String name = nextOptionalTag(ctx, "name");
+ String title = nextOptionalTag(ctx, "title");
+ String icon = nextOptionalTag(ctx, "icon");
+ String accessPermissions = nextOptionalTag(ctx, "access-permissions");
+ String factoryId = nextOptionalTag(ctx, "factory-id");
+ String description = nextOptionalTag(ctx, "description");
+
+ //
+ ContainerData data = new ContainerData();
+ data.setId(id);
+ data.setTemplate(template);
+ data.setDecorator(decorator);
+ data.setWidth(width);
+ data.setHeight(height);
+ data.setName(name);
+ data.setTitle(title);
+ data.setIcon(icon);
+ data.setFactoryId(factoryId);
+ data.setDescription(description);
+
+ //
+ if (accessPermissions != null) {
+ data.setAccessPermissions(new String[]{accessPermissions});
+ }
+
+ //
+ Container container = new Container(data);
+
+ //
+ while (true) {
+ if (ctx.isEnd()) {
+ break;
+ }
+ ModelObject child = (ModelObject)ctx.unmarshalElement();
+ container.getChildren().add(child);
+ }
+
+ //
+ ctx.parsePastEndTag(m_uri, m_name);
+
+ //
+ return container;
+ }
+}
Added:
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/serialize/OwnerContext.java
===================================================================
---
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/serialize/OwnerContext.java
(rev 0)
+++
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/serialize/OwnerContext.java 2009-10-22
19:40:46 UTC (rev 401)
@@ -0,0 +1,70 @@
+/*
+ * 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.serialize;
+
+import java.util.concurrent.Callable;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
+ * @version $Revision$
+ */
+public class OwnerContext
+{
+
+ /** . */
+ private static ThreadLocal<OwnerContext> current = new
ThreadLocal<OwnerContext>();
+
+ /** . */
+ private final String type;
+
+ /** . */
+ private final String id;
+
+ public OwnerContext(String type, String id)
+ {
+ this.type = type;
+ this.id = id;
+ }
+
+ public String getType()
+ {
+ return type;
+ }
+
+ public String getId()
+ {
+ return id;
+ }
+
+ public <V> V execute(Callable<V> callable) throws Exception
+ {
+ current.set(this);
+ try
+ {
+ return callable.call();
+ }
+ finally
+ {
+ current.set(null);
+ }
+ }
+
+ public static OwnerContext getCurrentContext()
+ {
+ return current.get();
+ }
+}
Added:
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/serialize/PageHandler.java
===================================================================
---
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/serialize/PageHandler.java
(rev 0)
+++
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/serialize/PageHandler.java 2009-10-22
19:40:46 UTC (rev 401)
@@ -0,0 +1,110 @@
+/*
+ * 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.serialize;
+
+import org.exoplatform.portal.config.model.Container;
+import org.exoplatform.portal.config.model.ContainerData;
+import org.exoplatform.portal.config.model.ModelObject;
+import org.exoplatform.portal.config.model.Page;
+import org.exoplatform.portal.config.model.PageData;
+import org.jibx.runtime.IUnmarshallingContext;
+import org.jibx.runtime.JiBXException;
+import org.jibx.runtime.impl.UnmarshallingContext;
+
+import java.util.List;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
+ * @version $Revision$
+ */
+public class PageHandler extends AbstractHandler
+{
+
+ public PageHandler()
+ {
+ }
+
+ public PageHandler(String m_uri, int m_index, String m_name)
+ {
+ super(m_uri, m_index, m_name);
+ }
+
+ public Object unmarshal(Object o, IUnmarshallingContext ictx) throws JiBXException
+ {
+ UnmarshallingContext ctx = (UnmarshallingContext)ictx;
+ if (!ctx.isAt(m_uri, m_name))
+ {
+ ctx.throwStartTagNameError(m_uri, m_name);
+ }
+
+ //
+ ctx.parsePastStartTag(m_uri, m_name);
+
+ //
+ nextOptionalTag(ctx, "page-id");
+ nextOptionalTag(ctx, "owner-type");
+ nextOptionalTag(ctx, "owner-id");
+ String name = nextOptionalTag(ctx, "name");
+ String title = nextOptionalTag(ctx, "title");
+ String factoryId = nextOptionalTag(ctx, "factory-id");
+ String accessPermissions = nextOptionalTag(ctx, "access-permissions");
+ String editPermission = nextOptionalTag(ctx, "edit-permission");
+ boolean showMaxWindow = nextOptionalBooleanTag(ctx, "show-max-window",
false);
+ String creator = nextOptionalTag(ctx, "creator");
+ String modifier = nextOptionalTag(ctx, "modifier");
+
+ //
+ PageData data = new PageData();
+ data.setName(name);
+ data.setTitle(title);
+ data.setFactoryId(factoryId);
+ data.setEditPermission(editPermission);
+ data.setShowMaxWindow(showMaxWindow);
+ data.setCreator(creator);
+ data.setModifier(modifier);
+
+ //
+ if (accessPermissions != null) {
+ data.setAccessPermissions(new String[]{accessPermissions});
+ }
+
+ //
+ OwnerContext owner = OwnerContext.getCurrentContext();
+ if (owner != null) {
+ data.setOwnerType(owner.getType());
+ data.setOwnerId(owner.getId());
+ }
+
+ //
+ Page page = new Page(data);
+
+ //
+ while (true) {
+ if (ctx.isEnd()) {
+ break;
+ }
+ ModelObject child = (ModelObject)ctx.unmarshalElement();
+ page.getChildren().add(child);
+ }
+
+ //
+ ctx.parsePastEndTag(m_uri, m_name);
+
+ //
+ return page;
+ }
+}
Added:
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/serialize/PageNavigationHandler.java
===================================================================
---
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/serialize/PageNavigationHandler.java
(rev 0)
+++
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/serialize/PageNavigationHandler.java 2009-10-22
19:40:46 UTC (rev 401)
@@ -0,0 +1,129 @@
+/*
+ * 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.serialize;
+
+import org.exoplatform.portal.config.NewPortalConfigListener;
+import org.exoplatform.portal.config.model.ModelObject;
+import org.exoplatform.portal.config.model.PageNavigation;
+import org.exoplatform.portal.config.model.PageNode;
+import org.jibx.runtime.IUnmarshallingContext;
+import org.jibx.runtime.JiBXException;
+import org.jibx.runtime.impl.UnmarshallingContext;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
+ * @version $Revision$
+ */
+public class PageNavigationHandler extends AbstractHandler
+{
+
+ public PageNavigationHandler()
+ {
+ }
+
+ public PageNavigationHandler(String m_uri, int m_index, String m_name)
+ {
+ super(m_uri, m_index, m_name);
+ }
+
+ public Object unmarshal(Object o, IUnmarshallingContext ictx) throws JiBXException
+ {
+ UnmarshallingContext ctx = (UnmarshallingContext)ictx;
+ if (!ctx.isAt(m_uri, m_name))
+ {
+ ctx.throwStartTagNameError(m_uri, m_name);
+ }
+
+ //
+ ctx.parsePastStartTag(m_uri, m_name);
+
+ //
+ nextOptionalTag(ctx, "owner-type");
+ nextOptionalTag(ctx, "owner-id");
+ int priority = nextOptionalIntTag(ctx, "priority", 1);
+ String creator = nextOptionalTag(ctx, "creator");
+ String modifier = nextOptionalTag(ctx, "modifier");
+ String description = nextOptionalTag(ctx, "description");
+
+ //
+ PageNavigation nav = new PageNavigation();
+ nav.setPriority(priority);
+ nav.setModifier(modifier);
+ nav.setDescription(description);
+ nav.setCreator(creator);
+
+ //
+ OwnerContext owner = OwnerContext.getCurrentContext();
+ if (owner != null) {
+ nav.setOwnerType(owner.getType());
+ nav.setOwnerId(owner.getId());
+ }
+
+ //
+ if (ctx.isAt(m_uri, "page-nodes")) {
+ ctx.parsePastStartTag(m_uri, "page-nodes");
+ while (true) {
+ if (ctx.isEnd()) {
+ break;
+ }
+ PageNode child = (PageNode)ctx.unmarshalElement();
+ nav.getNodes().add(child);
+ }
+ ctx.parsePastEndTag(m_uri, "page-nodes");
+ }
+
+ //
+ ctx.parsePastEndTag(m_uri, m_name);
+
+ //
+ fixOwnerName(nav);
+
+ //
+ return nav;
+ }
+
+ private static void fixOwnerName(PageNavigation pageNav)
+ {
+ for (PageNode pageNode : pageNav.getNodes())
+ {
+ fixOwnerName(pageNode);
+ }
+ }
+
+ private static void fixOwnerName(PageNode pageNode)
+ {
+ if (pageNode.getPageReference() != null)
+ {
+ String pageRef = pageNode.getPageReference();
+ int pos1 = pageRef.indexOf("::");
+ int pos2 = pageRef.indexOf("::", pos1 + 2);
+ String type = pageRef.substring(0, pos1);
+ String owner = pageRef.substring(pos1 + 2, pos2);
+ String name = pageRef.substring(pos2 + 2);
+ owner = NewPortalConfigListener.fixOwnerName(type, owner);
+ pageRef = type + "::" + owner + "::" + name;
+ pageNode.setPageReference(pageRef);
+ }
+ if (pageNode.getChildren() != null)
+ {
+ for (PageNode childPageNode : pageNode.getChildren())
+ {
+ fixOwnerName(childPageNode);
+ }
+ }
+ }
+}
Added:
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/serialize/PortalConfigHandler.java
===================================================================
---
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/serialize/PortalConfigHandler.java
(rev 0)
+++
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/serialize/PortalConfigHandler.java 2009-10-22
19:40:46 UTC (rev 401)
@@ -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.config.serialize;
+
+import org.exoplatform.portal.config.NewPortalConfigListener;
+import org.exoplatform.portal.config.model.Container;
+import org.exoplatform.portal.config.model.PortalConfig;
+import org.exoplatform.portal.config.model.Properties;
+import org.jibx.runtime.IUnmarshallingContext;
+import org.jibx.runtime.JiBXException;
+import org.jibx.runtime.impl.UnmarshallingContext;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
+ * @version $Revision$
+ */
+public class PortalConfigHandler extends AbstractHandler
+{
+
+ public PortalConfigHandler()
+ {
+ }
+
+ public PortalConfigHandler(String m_uri, int m_index, String m_name)
+ {
+ super(m_uri, m_index, m_name);
+ }
+
+ public Object unmarshal(Object o, IUnmarshallingContext ictx) throws JiBXException
+ {
+ UnmarshallingContext ctx = (UnmarshallingContext)ictx;
+ if (!ctx.isAt(m_uri, m_name))
+ {
+ ctx.throwStartTagNameError(m_uri, m_name);
+ }
+
+ //
+ ctx.parsePastStartTag(m_uri, m_name);
+
+ //
+ String name = nextOptionalTag(ctx, "portal-name");
+ String locale = ctx.parseElementText(m_uri, "locale");
+ String accessPermissions = nextOptionalTag(ctx, "access-permissions");
+ String editPermission = nextOptionalTag(ctx, "edit-permission");
+ String skin = nextOptionalTag(ctx, "skin");
+ String title = nextOptionalTag(ctx, "title");
+ String creator = nextOptionalTag(ctx, "creator");
+ String modifier = nextOptionalTag(ctx, "modifier");
+
+ //
+ PortalConfig portal = new PortalConfig();
+ portal.setName(name);
+ portal.setLocale(locale);
+ portal.setEditPermission(editPermission);
+ portal.setSkin(skin);
+ portal.setTitle(title);
+ portal.setCreator(creator);
+ portal.setModifier(modifier);
+
+ //
+ OwnerContext owner = OwnerContext.getCurrentContext();
+ if (owner != null) {
+ portal.setType(owner.getType());
+ portal.setName(owner.getId());
+// fixOwnerName(portal);
+ }
+
+ //
+ if (accessPermissions != null) {
+ portal.setAccessPermissions(new String[]{accessPermissions});
+ }
+
+ //
+ if (ctx.isAt(m_uri, "properties"))
+ {
+ Properties properties = (Properties)ctx.unmarshalElement();
+ portal.setProperties(properties);
+ }
+
+ //
+ if (ctx.isAt(m_uri, "portal-layout"))
+ {
+ Container container = (Container)ctx.unmarshalElement();
+ portal.setPortalLayout(container);
+ }
+
+ //
+ ctx.parsePastEndTag(m_uri, m_name);
+
+ //
+ return portal;
+ }
+
+/*
+ static void fixOwnerName(PortalConfig config)
+ {
+ config.setName(NewPortalConfigListener.fixOwnerName(config.getType(),
config.getName()));
+ fixOwnerName(config.getPortalLayout());
+ }
+
+ private static void fixOwnerName(Container container)
+ {
+ for (Object o : container.getChildren())
+ {
+ if (o instanceof Container)
+ {
+ fixOwnerName((Container)o);
+ }
+ }
+ }
+*/
+}
Added:
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/serialize/PortalLayoutHandler.java
===================================================================
---
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/serialize/PortalLayoutHandler.java
(rev 0)
+++
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/serialize/PortalLayoutHandler.java 2009-10-22
19:40:46 UTC (rev 401)
@@ -0,0 +1,34 @@
+/*
+ * 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.serialize;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
+ * @version $Revision$
+ */
+public class PortalLayoutHandler extends ContainerHandler
+{
+
+ public PortalLayoutHandler()
+ {
+ }
+
+ public PortalLayoutHandler(String m_uri, int m_index, String m_name)
+ {
+ super(m_uri, m_index, m_name);
+ }
+}
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-22
18:47:45 UTC (rev 400)
+++
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMDataStorage.java 2009-10-22
19:40:46 UTC (rev 401)
@@ -25,11 +25,9 @@
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.Page;
import org.exoplatform.portal.config.model.PageNavigation;
import org.exoplatform.portal.config.model.PersistentApplicationState;
@@ -48,7 +46,6 @@
import java.io.ByteArrayInputStream;
import java.util.Comparator;
import java.util.List;
-import java.util.UUID;
/**
* @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
@@ -225,10 +222,13 @@
}
}
- /**
+/*
+ */
+/**
* This is a hack and should be removed, it is only used temporarily.
* This is because the objects are loaded from files and don't have name.
- */
+ *//*
+
private void generateStorageName(ModelObject obj)
{
if (obj instanceof Container)
@@ -243,6 +243,7 @@
((Application)obj).setStorageName(UUID.randomUUID().toString());
}
}
+*/
public Container getSharedLayout() throws Exception
{
@@ -252,7 +253,7 @@
IBindingFactory bfact = BindingDirectory.getFactory(Container.class);
IUnmarshallingContext uctx = bfact.createUnmarshallingContext();
Container container = Container.class.cast(uctx.unmarshalDocument(is, null));
- generateStorageName(container);
+// generateStorageName(container);
return container;
}
}
Modified: portal/branches/performance/component/portal/src/main/resources/binding.xml
===================================================================
--- portal/branches/performance/component/portal/src/main/resources/binding.xml 2009-10-22
18:47:45 UTC (rev 400)
+++ portal/branches/performance/component/portal/src/main/resources/binding.xml 2009-10-22
19:40:46 UTC (rev 401)
@@ -34,28 +34,6 @@
class="org.exoplatform.portal.config.model.Application"
marshaller="org.exoplatform.portal.config.serialize.ApplicationHandler"
unmarshaller="org.exoplatform.portal.config.serialize.ApplicationHandler">
-<!--
- <value name="instance-id"
- field="instanceState"
-
deserializer="org.exoplatform.portal.config.serialize.JiBX.unserializePortletState"
-
serializer="org.exoplatform.portal.config.serialize.JiBX.serializePortletState"
- usage="optional"/>
--->
-<!--
- <value name="id" usage="optional" field="id"
style="attribute"/>
- <structure name="application-type" usage="optional"/>
- <value name="theme" usage="optional"
field="theme"/>
- <value name="title" usage="optional"
field="title"/>
- <value name="access-permissions" field="accessPermissions"
usage="optional"/>
- <value name="show-info-bar" field="showInfoBar"
usage="optional" />
- <value name="show-application-state"
field="showApplicationState" usage="optional" />
- <value name="show-application-mode"
field="showApplicationMode" usage="optional" />
- <value name="description" field="description"
usage="optional"/>
- <value name="icon" field="icon"
usage="optional"/>
- <value name="width" usage="optional" field="width"
/>
- <value name="height" usage="optional" field="height"
/>
- <structure field="properties" usage="optional"/>
--->
</mapping>
<mapping name="portlet-application"
@@ -63,97 +41,38 @@
class="org.exoplatform.portal.config.model.portlet.PortletApplication"
marshaller="org.exoplatform.portal.config.serialize.PortletApplicationHandler"
unmarshaller="org.exoplatform.portal.config.serialize.PortletApplicationHandler">
-<!--
- <structure
- get-method="getInstanceState"
- set-method="setInstanceState">
- </structure>
- <value name="theme" usage="optional"
get-method="getTheme" set-method="setTheme"/>
- <value name="title" usage="optional"
get-method="getTitle" set-method="setTitle"/>
- <value name="access-permissions"
get-method="getAccessPermissions" set-method="setAccessPermissions"
usage="optional"/>
- <value name="show-info-bar" get-method="getShowInfoBar"
set-method="setShowInfoBar" usage="optional"/>
- <value name="show-application-state"
get-method="getShowApplicationState"
set-method="setShowApplicationState" usage="optional"/>
- <value name="show-application-mode"
get-method="getShowApplicationMode"
set-method="setShowApplicationMode" usage="optional" />
- <value name="description" get-method="getDescription"
set-method="setDescription" usage="optional"/>
- <value name="icon" get-method="getIcon"
set-method="setIcon" usage="optional"/>
- <value name="width" get-method="getWidth"
set-method="setWidth" usage="optional"/>
- <value name="height" get-method="getHeight"
set-method="setHeight" usage="optional"/>
- <structure get-method="getProperties"
set-method="setProperties" usage="optional"/>
--->
</mapping>
-<!--
- <mapping
- abstract="true"
- class="org.exoplatform.portal.config.model.ApplicationState">
- <value name="application-ref" get-method="getApplicationName"
set-method="setApplicationName"/>
- <value name="portlet-ref" get-method="getPortletName"
set-method="setPortletName"/>
- </mapping>
-
- <mapping
- name="portlet"
- class="org.exoplatform.portal.config.model.TransientApplicationState"
- extends="org.exoplatform.portal.config.model.ApplicationState"
-
factory="org.exoplatform.portal.config.serialize.JiBX.createTransientApplicationState">
- <structure
map-as="org.exoplatform.portal.config.model.ApplicationState"/>
- <structure
- name="preferences"
- get-method="getState"
- set-method="setState"
-
marshaller="org.exoplatform.portal.config.serialize.PreferencesHandler"
-
unmarshaller="org.exoplatform.portal.config.serialize.PreferencesHandler"
- usage="optional"/>
- </mapping>
--->
-
<mapping name="page-body" label="pageBody"
class="org.exoplatform.portal.config.model.PageBody">
</mapping>
<mapping name="site-body" label="siteBody"
class="org.exoplatform.portal.config.model.SiteBody">
</mapping>
- <mapping name="container" label="container"
class="org.exoplatform.portal.config.model.Container">
- <value name="id" usage="optional" field="id"
style="attribute"/>
- <value name="name" usage="optional"
field="name"/>
- <value name="title" field="title"
usage="optional"/>
- <value name="icon" field="icon"
usage="optional"/>
- <value name="template" field="template"
usage="optional" style="attribute"/>
- <value name="access-permissions" field="accessPermissions"
usage="optional"/>
- <value name="factory-id" field="factoryId"
usage="optional"/>
- <value name="decorator" field="decorator"
usage="optional" style="attribute"/>
- <value name="description" field="description"
usage="optional"/>
- <value name="width" usage="optional" field="width"
style="attribute" />
- <value name="height" usage="optional" field="height"
style="attribute"/>
- <collection field="children" ordered="false">
- <structure map-as="org.exoplatform.portal.config.model.Container"
usage="optional"/>
- <structure map-as="org.exoplatform.portal.config.model.Application"
usage="optional"/>
- <structure map-as="org.exoplatform.portal.config.model.PageBody"
usage="optional"/>
- <structure map-as="org.exoplatform.portal.config.model.SiteBody"
usage="optional"/>
- <structure
map-as="org.exoplatform.portal.config.model.portlet.PortletApplication"
usage="optional"/>
- </collection>
+ <mapping name="container"
+ label="container"
+ class="org.exoplatform.portal.config.model.Container"
+
marshaller="org.exoplatform.portal.config.serialize.ContainerHandler"
+
unmarshaller="org.exoplatform.portal.config.serialize.ContainerHandler">
</mapping>
- <mapping name="page" label="page"
class="org.exoplatform.portal.config.model.Page">
- <structure name="page-id" usage="optional"/>
- <structure name="owner-type" usage="optional"/>
- <structure name="owner-id" usage="optional"/>
- <value name="name" field="name"/>
- <value name="title" field="title"
usage="optional"/>
- <value name="factory-id" field="factoryId"
usage="optional"/>
- <value name="access-permissions" field="accessPermissions"
usage="optional"/>
- <value name="edit-permission" field="editPermission"
usage="optional"/>
- <value name="show-max-window" field="showMaxWindow"
usage="optional"/>
- <value name="creator" field="creator"
usage="optional"/>
- <value name="modifier" field="modifier"
usage="optional"/>
- <collection field="children" ordered="false">
- <structure map-as="org.exoplatform.portal.config.model.Container"
usage="optional"/>
- <structure map-as="org.exoplatform.portal.config.model.Application"
usage="optional"/>
- <structure map-as="org.exoplatform.portal.config.model.PageBody"
usage="optional"/>
- <structure
map-as="org.exoplatform.portal.config.model.portlet.PortletApplication"
usage="optional"/>
- </collection>
+ <mapping name="page"
+ label="page"
+ class="org.exoplatform.portal.config.model.Page"
+ marshaller="org.exoplatform.portal.config.serialize.PageHandler"
+
unmarshaller="org.exoplatform.portal.config.serialize.PageHandler">
</mapping>
- <mapping name="node" label="node"
class="org.exoplatform.portal.config.model.PageNode">
+ <mapping name="portal-layout"
+ label="portal-layout"
+ class="java.lang.Object"
+
marshaller="org.exoplatform.portal.config.serialize.PortalLayoutHandler"
+
unmarshaller="org.exoplatform.portal.config.serialize.PortalLayoutHandler">
+ </mapping>
+
+ <mapping name="node"
+ label="node"
+ class="org.exoplatform.portal.config.model.PageNode">
<value name="uri" field="uri"/>
<value name="name" field="name"/>
<value name="label" field="label" usage="optional"
set-method="setLabel"/>
@@ -166,35 +85,23 @@
<collection field="children" usage="optional"
item-type="org.exoplatform.portal.config.model.PageNode"/>
</mapping>
- <mapping name="portal-config"
class="org.exoplatform.portal.config.model.PortalConfig"
ordered="false">
- <value name="portal-name" field="name"/>
- <value name="locale" field="locale"/>
- <value name="access-permissions" field="accessPermissions"
usage="optional"/>
- <value name="edit-permission" field="editPermission"
usage="optional"/>
- <value name="skin" field="skin"
usage="optional"/>
- <value name="title" field="title"
usage="optional"/>
- <value name="creator" field="creator"
usage="optional"/>
- <value name="modifier" field="modifier"
usage="optional"/>
- <structure field="properties" usage="optional"/>
- <structure name="portal-layout" using="container"
field="portalLayout" usage="optional"/>
+ <mapping name="portal-config"
+ class="org.exoplatform.portal.config.model.PortalConfig"
+ ordered="false"
+
marshaller="org.exoplatform.portal.config.serialize.PortalConfigHandler"
+
unmarshaller="org.exoplatform.portal.config.serialize.PortalConfigHandler">
</mapping>
<mapping name="page-set"
class="org.exoplatform.portal.config.model.Page$PageSet">
<collection field="pages"
item-type="org.exoplatform.portal.config.model.Page"/>
</mapping>
- <mapping name="node-navigation"
class="org.exoplatform.portal.config.model.PageNavigation">
- <structure name="owner-type" usage="optional"/>
- <structure name="owner-id" usage="optional"/>
- <value name="priority" field="priority"
usage="optional"/>
- <value name="creator" field="creator"
usage="optional"/>
- <value name="modifier" field="modifier"
usage="optional"/>
- <value name="description" field="description"
usage="optional"/>
- <collection name="page-nodes" field="pageNodes"
usage="optional"
- item-type="org.exoplatform.portal.config.model.PageNode"/>
+ <mapping name="node-navigation"
+ class="org.exoplatform.portal.config.model.PageNavigation"
+
marshaller="org.exoplatform.portal.config.serialize.PageNavigationHandler"
+
unmarshaller="org.exoplatform.portal.config.serialize.PageNavigationHandler">
</mapping>
-
-
+
<mapping name="portlet-preferences-set"
class="org.exoplatform.portal.application.PortletPreferences$PortletPreferencesSet">
<collection field="portlets"
@@ -210,7 +117,9 @@
</mapping>
<mapping class="org.exoplatform.portal.application.PortletPreferences"
- name="portlet-preferences"
label="portlet-preferences">
+ name="portlet-preferences"
+ label="portlet-preferences"
+ post-set="postSet">
<structure name="owner-type" usage="optional"/>
<structure name="owner-id" usage="optional"/>
<value name="window-id" field="windowId"/>
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-22
18:47:45 UTC (rev 400)
+++
portal/branches/performance/component/portal/src/test/java/org/exoplatform/portal/config/TestDataStorage.java 2009-10-22
19:40:46 UTC (rev 401)
@@ -19,6 +19,9 @@
package org.exoplatform.portal.config;
+import org.exoplatform.portal.config.model.ContainerData;
+import org.exoplatform.portal.config.model.PageData;
+import org.exoplatform.portal.config.model.gadget.GadgetId;
import static org.exoplatform.portal.pom.config.Utils.split;
import org.exoplatform.container.PortalContainer;
@@ -144,10 +147,11 @@
private void createPageConfig(String ownerType, String ownerId) throws Exception
{
- Page page = new Page();
- page.setName("testPage");
- page.setOwnerId("classic");
- page.setOwnerType("portal");
+ PageData data = new PageData();
+ data.setName("testPage");
+ data.setOwnerId("classic");
+ data.setOwnerType("portal");
+ Page page = new Page(data);
try
{
@@ -181,9 +185,14 @@
portalConfig.setAccessPermissions(new String[]{UserACL.EVERYONE});
storage_.create(portalConfig);
- page.setTitle("New Page Title");
- page.setOwnerId("customers");
- storage_.save(page);
+ PageData data = new PageData();
+ data.setTitle("New Page Title");
+ data.setOwnerId(page.getOwnerId());
+ data.setOwnerType(page.getOwnerType());
+ data.setName(page.getName());
+ Page newPage = new Page(page.getStorageId(), data);
+ newPage.getChildren().addAll(page.getChildren());
+ storage_.save(newPage);
Page returnPage = storage_.getPage(page.getPageId());
assertEquals("New Page Title", returnPage.getTitle());
@@ -294,12 +303,14 @@
public void testWindowScopedPortletPreferences() throws Exception
{
- Page page = new Page();
- page.setPageId("portal::test::foo");
+ PageData data = new PageData();
+ data.setOwnerType("portal");
+ data.setOwnerId("test");
+ data.setName("foo");
+ Page page = new Page(data);
TransientApplicationState<Preferences> state = new
TransientApplicationState<Preferences>();
state.setContentState(new PreferencesBuilder().add("template",
"bar").build());
- PortletApplication app = new PortletApplication("web",
"BannerPortlet");
- app.setState(state);
+ PortletApplication app = new PortletApplication("web",
"BannerPortlet", state);
page.getChildren().add(app);
storage_.save(page);
page = storage_.getPage(page.getPageId());
@@ -442,9 +453,12 @@
public void testDashboard() throws Exception
{
- Page page = new Page();
- page.setPageId("portal::test::foo");
- page.getChildren().add(new Dashboard());
+ PageData data = new PageData();
+ data.setOwnerType("portal");
+ data.setOwnerId("test");
+ data.setName("foo");
+ Page page = new Page(data);
+ page.getChildren().add(new Dashboard(new ContainerData()));
storage_.save(page);
//
@@ -458,10 +472,9 @@
assertEquals("DashboardPortlet",
dashboardPortlet.getRef().getPortletName());
// Configures the dashboard
- Dashboard dashboard = new Dashboard(dashboardId);
+ Dashboard dashboard = new Dashboard(dashboardId, new ContainerData());
TransientApplicationState<Preferences> state = new
TransientApplicationState<Preferences>();
- PortletApplication app = new PortletApplication("foo", "bar");
- app.setState(state);
+ PortletApplication app = new PortletApplication("foo", "bar",
state);
dashboard.getChildren().add(app);
// Attempt to save a dashboard with a portlet on it
@@ -483,13 +496,15 @@
public void testDashboardLayout() throws Exception
{
- PortletApplication dashboardPortlet = new PortletApplication("dashboard",
"DashboardPortlet");
- ApplicationState<Preferences> state = new
TransientApplicationState<Preferences>();
- dashboardPortlet.setState(state);
+ TransientApplicationState<Preferences> state = new
TransientApplicationState<Preferences>();
+ PortletApplication dashboardPortlet = new PortletApplication("dashboard",
"DashboardPortlet", state);
//
- Page page = new Page();
- page.setPageId("portal::test::foo");
+ PageData data = new PageData();
+ data.setOwnerType("portal");
+ data.setOwnerId("test");
+ data.setName("foo");
+ Page page = new Page(data);
page.getChildren().add(dashboardPortlet);
storage_.save(page);
@@ -511,9 +526,12 @@
public void testDashboardMoveRight() throws Exception
{
- Page page = new Page();
- page.setPageId("portal::test::foo");
- page.getChildren().add(new PortletApplication("dashboard",
"DashboardPortlet"));
+ PageData data = new PageData();
+ data.setOwnerType("portal");
+ data.setOwnerId("test");
+ data.setName("foo");
+ Page page = new Page(data);
+ page.getChildren().add(new PortletApplication("dashboard",
"DashboardPortlet", null));
storage_.save(page);
page = storage_.getPage("portal::test::foo");
String id = page.getChildren().get(0).getStorageId();
@@ -523,8 +541,7 @@
// Put a gadget in one container
Container row0 = (Container)dashboard.getChildren().get(0);
- GadgetApplication gadgetApp = new GadgetApplication("foo");
- gadgetApp.setState(new TransientApplicationState<Gadget>());
+ GadgetApplication gadgetApp = new GadgetApplication(new GadgetId("foo"),
new TransientApplicationState<Gadget>());
row0.getChildren().add(gadgetApp);
// Save the dashboard
@@ -553,9 +570,12 @@
public void testDashboardMoveLeft() throws Exception
{
- Page page = new Page();
- page.setPageId("portal::test::foo");
- page.getChildren().add(new PortletApplication("dashboard",
"DashboardPortlet"));
+ PageData data = new PageData();
+ data.setOwnerType("portal");
+ data.setOwnerId("test");
+ data.setName("foo");
+ Page page = new Page(data);
+ page.getChildren().add(new PortletApplication("dashboard",
"DashboardPortlet", null));
storage_.save(page);
page = storage_.getPage("portal::test::foo");
String id = page.getChildren().get(0).getStorageId();
@@ -565,8 +585,7 @@
// Put a gadget in one container
Container row1 = (Container)dashboard.getChildren().get(1);
- GadgetApplication gadgetApp = new GadgetApplication("foo");
- gadgetApp.setState(new TransientApplicationState<Gadget>());
+ GadgetApplication gadgetApp = new GadgetApplication(new GadgetId("foo"),
new TransientApplicationState<Gadget>());
row1.getChildren().add(gadgetApp);
// Save the dashboard
@@ -604,8 +623,7 @@
TransientApplicationState<Preferences> state = new
TransientApplicationState<Preferences>(persistenceChunks[2]);
state.setOwnerType(ownerType);
state.setOwnerId(ownerId);
- PortletApplication portletApp = new PortletApplication(persistenceChunks[0],
persistenceChunks[1]);
- portletApp.setState(state);
+ PortletApplication portletApp = new PortletApplication(persistenceChunks[0],
persistenceChunks[1], state);
return portletApp;
}
}
Modified:
portal/branches/performance/component/portal/src/test/java/org/exoplatform/portal/config/TestGadget.java
===================================================================
---
portal/branches/performance/component/portal/src/test/java/org/exoplatform/portal/config/TestGadget.java 2009-10-22
18:47:45 UTC (rev 400)
+++
portal/branches/performance/component/portal/src/test/java/org/exoplatform/portal/config/TestGadget.java 2009-10-22
19:40:46 UTC (rev 401)
@@ -21,8 +21,10 @@
import org.exoplatform.container.PortalContainer;
import org.exoplatform.portal.config.model.Page;
+import org.exoplatform.portal.config.model.PageData;
import org.exoplatform.portal.config.model.TransientApplicationState;
import org.exoplatform.portal.config.model.gadget.GadgetApplication;
+import org.exoplatform.portal.config.model.gadget.GadgetId;
import org.exoplatform.portal.pom.config.POMSession;
import org.exoplatform.portal.pom.config.POMSessionManager;
import org.exoplatform.portal.pom.spi.gadget.Gadget;
@@ -67,11 +69,13 @@
Gadget gadget = new Gadget();
gadget.setUserPref("user_pref");
state.setContentState(gadget);
- GadgetApplication gadgetApplication = new GadgetApplication("bar");
- gadgetApplication.setState(state);
+ GadgetApplication gadgetApplication = new GadgetApplication(new
GadgetId("bar"), state);
- Page container = new Page();
- container.setPageId("portal::test::gadget_page");
+ PageData data = new PageData();
+ data.setOwnerType("portal");
+ data.setOwnerId("test");
+ data.setName("gadget_page");
+ Page container = new Page(data);
container.getChildren().add(gadgetApplication);
storage_.create(container);
Modified:
portal/branches/performance/component/portal/src/test/java/org/exoplatform/portal/config/TestJIBXXmlMapping.java
===================================================================
---
portal/branches/performance/component/portal/src/test/java/org/exoplatform/portal/config/TestJIBXXmlMapping.java 2009-10-22
18:47:45 UTC (rev 400)
+++
portal/branches/performance/component/portal/src/test/java/org/exoplatform/portal/config/TestJIBXXmlMapping.java 2009-10-22
19:40:46 UTC (rev 401)
@@ -82,13 +82,6 @@
Object obj =
uctx.unmarshalDocument(new
FileInputStream("src/test/resources/portal/portal/classic/navigation.xml"),
null);
assertEquals(PageNavigation.class, obj.getClass());
-
- IMarshallingContext mctx = bfact.createMarshallingContext();
- mctx.setIndent(2);
- mctx.marshalDocument(obj, "UTF-8", null, new
FileOutputStream("target/navigation.xml"));
-
- obj = uctx.unmarshalDocument(new
FileInputStream("target/navigation.xml"), null);
- assertEquals(PageNavigation.class, obj.getClass());
}
public void testPortletPreferencesMapping() throws Exception
@@ -99,11 +92,6 @@
uctx.unmarshalDocument(
new
FileInputStream("src/test/resources/portal/portal/classic/portlet-preferences.xml"),
null);
assertEquals(PortletPreferencesSet.class, obj.getClass());
-
- IMarshallingContext mctx = bfact.createMarshallingContext();
- mctx.setIndent(2);
- mctx.marshalDocument(obj, "UTF-8", null, new
FileOutputStream("target/portlet-preferences.xml"));
- assertEquals(PortletPreferencesSet.class, obj.getClass());
}
public void testPortletApplicationMapping() throws Exception
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-22
18:47:45 UTC (rev 400)
+++
portal/branches/performance/component/portal/src/test/java/org/exoplatform/portal/config/TestUserPortalConfigService.java 2009-10-22
19:40:46 UTC (rev 401)
@@ -27,6 +27,7 @@
import org.exoplatform.portal.config.model.Container;
import org.exoplatform.portal.config.model.Page;
import org.exoplatform.portal.config.model.PageBody;
+import org.exoplatform.portal.config.model.PageData;
import org.exoplatform.portal.config.model.PageNavigation;
import org.exoplatform.portal.config.model.PortalConfig;
import org.exoplatform.portal.config.model.portlet.PortletApplication;
@@ -421,10 +422,11 @@
{
public void execute() throws Exception
{
- Page page = new Page();
- page.setOwnerType("group");
- page.setOwnerId("/platform/administrators");
- page.setName("newAccount");
+ PageData data = new PageData();
+ data.setOwnerType("group");
+ data.setOwnerId("/platform/administrators");
+ data.setName("newAccount");
+ Page page = new Page(data);
assertTrue(events.isEmpty());
userPortalConfigSer_.remove(page);
assertEquals(1, events.size());
@@ -445,10 +447,11 @@
{
public void execute() throws Exception
{
- Page page = new Page();
- page.setOwnerType("group");
- page.setOwnerId("/platform/administrators");
- page.setName("whatever");
+ PageData data = new PageData();
+ data.setOwnerType("group");
+ data.setOwnerId("/platform/administrators");
+ data.setName("whatever");
+ Page page = new Page(data);
assertTrue(events.isEmpty());
userPortalConfigSer_.create(page);
assertEquals(1, events.size());
@@ -469,11 +472,12 @@
{
public void execute() throws Exception
{
- Page page = new Page();
- page.setOwnerType("group");
- page.setOwnerId("/platform/administrators");
- page.setName("newAccount");
- page.setCreator("someone");
+ PageData data = new PageData();
+ data.setOwnerType("group");
+ data.setOwnerId("/platform/administrators");
+ data.setName("newAccount");
+ data.setCreator("someone");
+ Page page = new Page(data);
assertTrue(events.isEmpty());
userPortalConfigSer_.create(page);
assertEquals(1, events.size());
Modified:
portal/branches/performance/component/portal/src/test/java/org/exoplatform/portal/config/security/AbstractTestSharedPageACL.java
===================================================================
---
portal/branches/performance/component/portal/src/test/java/org/exoplatform/portal/config/security/AbstractTestSharedPageACL.java 2009-10-22
18:47:45 UTC (rev 400)
+++
portal/branches/performance/component/portal/src/test/java/org/exoplatform/portal/config/security/AbstractTestSharedPageACL.java 2009-10-22
19:40:46 UTC (rev 401)
@@ -20,6 +20,7 @@
package org.exoplatform.portal.config.security;
import org.exoplatform.portal.config.model.Page;
+import org.exoplatform.portal.config.model.PageData;
/**
* @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
@@ -32,10 +33,11 @@
public void testPage()
{
- Page page = new Page();
- page.setOwnerType("group");
- page.setOwnerId("foo");
- page.setAccessPermissions(new String[0]);
+ PageData data = new PageData();
+ data.setOwnerType("group");
+ data.setOwnerId("foo");
+ data.setAccessPermissions(new String[0]);
+ Page page = new Page(data);
//
assertTrue(root.hasPermission(page));
@@ -54,10 +56,11 @@
public void testPageAccessibleByEveryone()
{
- Page page = new Page();
- page.setOwnerType("group");
- page.setOwnerId("foo");
- page.setAccessPermissions(new String[]{"Everyone"});
+ PageData data = new PageData();
+ data.setOwnerType("group");
+ data.setOwnerId("foo");
+ data.setAccessPermissions(new String[]{"Everyone"});
+ Page page = new Page(data);
//
assertTrue(root.hasPermission(page));
@@ -76,11 +79,12 @@
public void testPageEditableByEveryone()
{
- Page page = new Page();
- page.setOwnerType("group");
- page.setOwnerId("foo");
- page.setAccessPermissions(new String[0]);
- page.setEditPermission("Everyone");
+ PageData data = new PageData();
+ data.setOwnerType("group");
+ data.setOwnerId("foo");
+ data.setAccessPermissions(new String[0]);
+ data.setEditPermission("Everyone");
+ Page page = new Page(data);
//
assertTrue(root.hasPermission(page));
@@ -99,10 +103,11 @@
public void testPageAccessibleByGuests()
{
- Page page = new Page();
- page.setOwnerType("group");
- page.setOwnerId("foo");
- page.setAccessPermissions(new String[]{"whatever:/platform/guests"});
+ PageData data = new PageData();
+ data.setOwnerType("group");
+ data.setOwnerId("foo");
+ data.setAccessPermissions(new String[]{"whatever:/platform/guests"});
+ Page page = new Page(data);
//
assertTrue(root.hasPermission(page));
@@ -121,11 +126,12 @@
public void testPageEditableByGuests()
{
- Page page = new Page();
- page.setOwnerType("group");
- page.setOwnerId("foo");
- page.setAccessPermissions(new String[0]);
- page.setEditPermission("whatever:/platform/guests");
+ PageData data = new PageData();
+ data.setOwnerType("group");
+ data.setOwnerId("foo");
+ data.setAccessPermissions(new String[0]);
+ data.setEditPermission("whatever:/platform/guests");
+ Page page = new Page(data);
//
assertTrue(root.hasPermission(page));
@@ -144,10 +150,11 @@
public void testPageAccessibleByEveryOneAndGuests()
{
- Page page = new Page();
- page.setOwnerType("group");
- page.setOwnerId("foo");
- page.setAccessPermissions(new String[]{"Everyone",
"whatever:/platform/guests"});
+ PageData data = new PageData();
+ data.setOwnerType("group");
+ data.setOwnerId("foo");
+ data.setAccessPermissions(new String[]{"Everyone",
"whatever:/platform/guests"});
+ Page page = new Page(data);
//
assertTrue(root.hasPermission(page));
@@ -166,10 +173,11 @@
public void testPageWithAccessPermission()
{
- Page page = new Page();
- page.setOwnerType("group");
- page.setOwnerId("foo");
- page.setAccessPermissions(new String[]{"manager:/manageable"});
+ PageData data = new PageData();
+ data.setOwnerType("group");
+ data.setOwnerId("foo");
+ data.setAccessPermissions(new String[]{"manager:/manageable"});
+ Page page = new Page(data);
//
assertTrue(root.hasPermission(page));
@@ -179,7 +187,8 @@
assertFalse(guest.hasPermission(page));
//
- page.setAccessPermissions(new String[]{"*:/manageable"});
+ data.setAccessPermissions(new String[]{"*:/manageable"});
+ page = new Page(data);
//
assertTrue(root.hasPermission(page));
@@ -191,11 +200,12 @@
public void testPageWithEditPermission()
{
- Page page = new Page();
- page.setOwnerType("group");
- page.setOwnerId("foo");
- page.setAccessPermissions(new String[0]);
- page.setEditPermission("manager:/manageable");
+ PageData data = new PageData();
+ data.setOwnerType("group");
+ data.setOwnerId("foo");
+ data.setAccessPermissions(new String[0]);
+ data.setEditPermission("manager:/manageable");
+ Page page = new Page(data);
//
assertTrue(root.hasPermission(page));
@@ -205,7 +215,8 @@
assertFalse(guest.hasPermission(page));
//
- page.setEditPermission("*:/manageable");
+ data.setEditPermission("*:/manageable");
+ page = new Page(data);
//
assertTrue(root.hasPermission(page));
Modified:
portal/branches/performance/component/portal/src/test/java/org/exoplatform/portal/config/security/TestUserPageACL.java
===================================================================
---
portal/branches/performance/component/portal/src/test/java/org/exoplatform/portal/config/security/TestUserPageACL.java 2009-10-22
18:47:45 UTC (rev 400)
+++
portal/branches/performance/component/portal/src/test/java/org/exoplatform/portal/config/security/TestUserPageACL.java 2009-10-22
19:40:46 UTC (rev 401)
@@ -20,6 +20,7 @@
package org.exoplatform.portal.config.security;
import org.exoplatform.portal.config.model.Page;
+import org.exoplatform.portal.config.model.PageData;
/**
* @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
@@ -29,10 +30,11 @@
{
public void testUserPageIsAlwaysUsableOnlyByItsOwner()
{
- Page page = new Page();
- page.setOwnerType("user");
- page.setOwnerId("user");
- page.setAccessPermissions(new String[0]);
+ PageData data = new PageData();
+ data.setOwnerType("user");
+ data.setOwnerId("user");
+ data.setAccessPermissions(new String[0]);
+ Page page = new Page(data);
assertTrue(root.hasPermission(page));
assertFalse(administrator.hasPermission(page));
assertFalse(manager.hasPermission(page));
@@ -45,10 +47,8 @@
assertFalse(guest.hasEditPermission(page));
//
- page = new Page();
- page.setOwnerType("user");
- page.setOwnerId("user");
- page.setAccessPermissions(new String[]{"manager:/manageable"});
+ data.setAccessPermissions(new String[]{"manager:/manageable"});
+ page = new Page(data);
assertTrue(root.hasPermission(page));
assertFalse(administrator.hasPermission(page));
assertTrue(manager.hasPermission(page));
@@ -61,11 +61,9 @@
assertFalse(guest.hasEditPermission(page));
//
- page = new Page();
- page.setOwnerType("user");
- page.setOwnerId("user");
- page.setAccessPermissions(new String[0]);
- page.setEditPermission("manager:/manageable");
+ data.setAccessPermissions(new String[0]);
+ data.setEditPermission("manager:/manageable");
+ page = new Page(data);
assertTrue(root.hasPermission(page));
assertFalse(administrator.hasPermission(page));
//assertTrue(manager.hasPermission(page));
@@ -79,10 +77,8 @@
assertFalse(guest.hasEditPermission(page));
//
- page = new Page();
- page.setOwnerType("user");
- page.setOwnerId("user");
- page.setAccessPermissions(new String[]{"Everyone"});
+ data.setAccessPermissions(new String[]{"Everyone"});
+ page = new Page(data);
assertTrue(root.hasPermission(page));
assertTrue(administrator.hasPermission(page));
assertTrue(manager.hasPermission(page));
@@ -95,11 +91,9 @@
assertFalse(guest.hasEditPermission(page));
//
- page = new Page();
- page.setOwnerType("user");
- page.setOwnerId("user");
- page.setAccessPermissions(new String[0]);
- page.setEditPermission("Everyone");
+ data.setAccessPermissions(new String[0]);
+ data.setEditPermission("Everyone");
+ page = new Page(data);
assertTrue(root.hasPermission(page));
//assertTrue(administrator.hasPermission(page));
//assertTrue(manager.hasPermission(page));
Modified:
portal/branches/performance/portlet/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/UITabPaneDashboard.java
===================================================================
---
portal/branches/performance/portlet/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/UITabPaneDashboard.java 2009-10-22
18:47:45 UTC (rev 400)
+++
portal/branches/performance/portlet/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/UITabPaneDashboard.java 2009-10-22
19:40:46 UTC (rev 401)
@@ -22,6 +22,7 @@
import org.exoplatform.portal.application.PortalRequestContext;
import org.exoplatform.portal.config.UserPortalConfigService;
import org.exoplatform.portal.config.model.Page;
+import org.exoplatform.portal.config.model.PageData;
import org.exoplatform.portal.config.model.PageNavigation;
import org.exoplatform.portal.config.model.PageNode;
import org.exoplatform.portal.config.model.PortalConfig;
@@ -179,7 +180,8 @@
Page page =
configService.createPageTemplate(UITabPaneDashboard.PAGE_TEMPLATE,
pageNavigation.getOwnerType(),
pageNavigation.getOwnerId());
- page.setTitle(nodeLabel);
+ PageData data = page.buildData();
+ data.setTitle(nodeLabel);
PageNode pageNode = new PageNode();
pageNode.setLabel(nodeLabel);
@@ -189,7 +191,7 @@
uniqueNodeName = uniqueNodeName + "_" +
System.currentTimeMillis();
}
- page.setName(uniqueNodeName);
+ data.setName(uniqueNodeName);
pageNode.setName(uniqueNodeName);
pageNode.setUri(uniqueNodeName);
pageNode.setPageReference(page.getPageId());
@@ -197,7 +199,7 @@
pageNavigation.addNode(pageNode);
uiPortal.setSelectedNode(pageNode);
- configService.create(page);
+ configService.create(new Page(page.getStorageId(), data));
configService.update(pageNavigation);
return uniqueNodeName;
Modified:
portal/branches/performance/portlet/exoadmin/src/main/java/org/exoplatform/toolbar/webui/component/UIUserToolBarDashboardPortlet.java
===================================================================
---
portal/branches/performance/portlet/exoadmin/src/main/java/org/exoplatform/toolbar/webui/component/UIUserToolBarDashboardPortlet.java 2009-10-22
18:47:45 UTC (rev 400)
+++
portal/branches/performance/portlet/exoadmin/src/main/java/org/exoplatform/toolbar/webui/component/UIUserToolBarDashboardPortlet.java 2009-10-22
19:40:46 UTC (rev 401)
@@ -22,6 +22,7 @@
import org.exoplatform.portal.application.PortalRequestContext;
import org.exoplatform.portal.config.UserPortalConfigService;
import org.exoplatform.portal.config.model.Page;
+import org.exoplatform.portal.config.model.PageData;
import org.exoplatform.portal.config.model.PageNavigation;
import org.exoplatform.portal.config.model.PageNode;
import org.exoplatform.portal.config.model.PortalConfig;
@@ -109,8 +110,9 @@
Page page =
_configService.createPageTemplate(PAGE_TEMPLATE,
_pageNavigation.getOwnerType(), _pageNavigation
.getOwnerId());
- page.setTitle(_nodeName);
- page.setName(_nodeName);
+ PageData data = page.buildData();
+ data.setTitle(_nodeName);
+ data.setName(_nodeName);
PageNode pageNode = new PageNode();
pageNode.setName(_nodeName);
@@ -120,7 +122,7 @@
pageNode.setPageReference(page.getPageId());
_pageNavigation.addNode(pageNode);
- _configService.create(page);
+ _configService.create(new Page(page, data));
_configService.update(_pageNavigation);
prContext.getResponse().sendRedirect(prContext.getPortalURI() + _nodeName);
Modified:
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIAddNewApplication.java
===================================================================
---
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIAddNewApplication.java 2009-10-22
18:47:45 UTC (rev 400)
+++
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIAddNewApplication.java 2009-10-22
19:40:46 UTC (rev 401)
@@ -254,10 +254,6 @@
{
Page page = (Page)PortalDataMapper.buildModelObject(uiPage);
UserPortalConfigService configService =
uiPortalApp.getApplicationComponent(UserPortalConfigService.class);
- if (page.getChildren() == null)
- {
- page.setChildren(new ArrayList<ModelObject>());
- }
configService.update(page);
}
Modified:
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UINavigationNodeSelector.java
===================================================================
---
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UINavigationNodeSelector.java 2009-10-22
18:47:45 UTC (rev 400)
+++
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UINavigationNodeSelector.java 2009-10-22
19:40:46 UTC (rev 401)
@@ -22,6 +22,7 @@
import org.exoplatform.portal.config.UserACL;
import org.exoplatform.portal.config.UserPortalConfigService;
import org.exoplatform.portal.config.model.Page;
+import org.exoplatform.portal.config.model.PageData;
import org.exoplatform.portal.config.model.PageNavigation;
import org.exoplatform.portal.config.model.PageNode;
import org.exoplatform.portal.config.model.PortalConfig;
@@ -430,11 +431,13 @@
// get selected page
Page selectPage = null;
selectPage = userService.getPage(selectedPageNode.getPageReference(),
context.getRemoteUser());
- selectPage.setModifier(context.getRemoteUser());
- selectPage.setTitle(selectedPageNode.getLabel());
+ PageData data = selectPage.buildData();
+ selectPage.populate(data);
+ data.setModifier(context.getRemoteUser());
+ data.setTitle(selectedPageNode.getLabel());
// convert Page to UIPage
- PortalDataMapper.toUIPage(uiPage, selectPage);
+ PortalDataMapper.toUIPage(uiPage, new Page(selectPage, data));
Util.getPortalRequestContext().addUIComponentToUpdateByAjax(uiWorkingWS);
Util.getPortalRequestContext().setFullRender(true);
Modified:
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIDesktopPage.java
===================================================================
---
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIDesktopPage.java 2009-10-22
18:47:45 UTC (rev 400)
+++
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIDesktopPage.java 2009-10-22
19:40:46 UTC (rev 401)
@@ -118,8 +118,6 @@
return;
Page page = (Page)PortalDataMapper.buildModelObject(uiPage);
UserPortalConfigService configService =
uiPage.getApplicationComponent(UserPortalConfigService.class);
- if (page.getChildren() == null)
- page.setChildren(new ArrayList<ModelObject>());
configService.update(page);
}
}
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-22
18:47:45 UTC (rev 400)
+++
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageActionListener.java 2009-10-22
19:40:46 UTC (rev 401)
@@ -24,7 +24,6 @@
import org.exoplatform.portal.config.UserPortalConfig;
import org.exoplatform.portal.config.UserPortalConfigService;
import org.exoplatform.portal.config.model.Container;
-import org.exoplatform.portal.config.model.ModelObject;
import org.exoplatform.portal.config.model.Page;
import org.exoplatform.portal.config.model.PageNavigation;
import org.exoplatform.portal.config.model.PageNode;
@@ -348,8 +347,6 @@
{
Page page = (Page)PortalDataMapper.buildModelObject(uiPage);
UserPortalConfigService configService =
uiPage.getApplicationComponent(UserPortalConfigService.class);
- if (page.getChildren() == null)
- page.setChildren(new ArrayList<ModelObject>());
configService.update(page);
}
break;
@@ -374,8 +371,6 @@
uiPage.removeChildById(id);
Page page = (Page)PortalDataMapper.buildModelObject(uiPage);
UserPortalConfigService configService =
uiPage.getApplicationComponent(UserPortalConfigService.class);
- if (page.getChildren() == null)
- page.setChildren(new ArrayList<ModelObject>());
configService.update(page);
pcontext.setFullRender(false);
pcontext.setResponseComplete(true);
Modified:
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageBrowser.java
===================================================================
---
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageBrowser.java 2009-10-22
18:47:45 UTC (rev 400)
+++
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageBrowser.java 2009-10-22
19:40:46 UTC (rev 401)
@@ -28,6 +28,7 @@
import org.exoplatform.portal.config.UserPortalConfigService;
import org.exoplatform.portal.config.model.ModelObject;
import org.exoplatform.portal.config.model.Page;
+import org.exoplatform.portal.config.model.PageData;
import org.exoplatform.portal.config.model.PortalConfig;
import org.exoplatform.portal.webui.application.UIPortlet;
import org.exoplatform.portal.webui.portal.UIPortalComposer;
@@ -62,6 +63,7 @@
import org.exoplatform.webui.form.UISearchForm;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.Comparator;
import java.util.List;
import java.util.ResourceBundle;
@@ -254,7 +256,9 @@
return;
}
Page page = service.getPage(id, pcontext.getRemoteUser());
- if (page == null || !page.isModifiable())
+ UserACL userACL = uiPageBrowser.getApplicationComponent(UserACL.class);
+ boolean modifiable = userACL.hasPermission(page);
+ if (page == null || !modifiable)
{
uiPortalApp.addMessage(new
ApplicationMessage("UIPageBrowser.msg.delete.NotDelete", new String[]{id}, 1));
pcontext.addUIComponentToUpdateByAjax(uiPortalApp.getUIPopupMessages());
@@ -388,8 +392,9 @@
UIPortalApplication uiPortalApp =
uiPageForm.getAncestorOfType(UIPortalApplication.class);
PortalRequestContext pcontext = Util.getPortalRequestContext();
UIPage uiPage = uiPageForm.getUIPage();
- Page page = new Page();
- uiPageForm.invokeSetBindingBean(page);
+ Page page = uiPageForm.invokeSetBindingBean(new Page(new PageData()));
+ List<ModelObject> children = new
ArrayList<ModelObject>(page.getChildren());
+ PageData data = page.buildData();
UserPortalConfigService configService =
uiPageForm.getApplicationComponent(UserPortalConfigService.class);
// create new page
if (uiPage == null)
@@ -402,16 +407,15 @@
pcontext.addUIComponentToUpdateByAjax(uiPortalApp.getUIPopupMessages());
return;
}
- page.setCreator(pcontext.getRemoteUser());
- page.setModifiable(true);
- if (page.getChildren() == null)
- page.setChildren(new ArrayList<ModelObject>());
+ data.setCreator(pcontext.getRemoteUser());
+ page = new Page(page, data);
+ page.getChildren().addAll(children);
configService.create(page);
postSave(uiPortalApp, pcontext);
return;
}
- page.setOwnerType(uiPage.getOwnerType());
+ data.setOwnerType(uiPage.getOwnerType());
List<UIPortlet> uiPortlets = new ArrayList<UIPortlet>();
findAllPortlet(uiPortlets, uiPage);
ArrayList<ModelObject> applications = new ArrayList<ModelObject>();
@@ -422,15 +426,16 @@
if (Page.DESKTOP_PAGE.equals(uiPage.getFactoryId()) &&
!Page.DESKTOP_PAGE.equals(page.getFactoryId()))
{
- page.setShowMaxWindow(false);
+ data.setShowMaxWindow(false);
uiPage.getChildren().clear();
- page.setChildren(applications);
- page.setModifier(pcontext.getRemoteUser());
+ children.clear();
+ children.addAll(applications);
+ data.setModifier(pcontext.getRemoteUser());
PortalDataMapper.toUIPage(uiPage, page);
// if (page.getTemplate() == null)
// page.setTemplate(uiPage.getTemplate());
- if (page.getChildren() == null)
- page.setChildren(new ArrayList<ModelObject>());
+ page = new Page(page, data);
+ page.getChildren().addAll(children);
configService.update(page);
postSave(uiPortalApp, pcontext);
return;
@@ -439,21 +444,20 @@
List<UIComponent> uiChildren = uiPage.getChildren();
if (uiChildren == null)
return;
- ArrayList<ModelObject> children = new ArrayList<ModelObject>();
+ children.clear();
for (UIComponent child : uiChildren)
{
ModelObject component = PortalDataMapper.buildModelObject(child);
if (component != null)
children.add(component);
}
- page.setChildren(children);
uiPage.getChildren().clear();
- page.setModifier(pcontext.getRemoteUser());
+ data.setModifier(pcontext.getRemoteUser());
+ page = new Page(page, data);
+ page.getChildren().addAll(children);
PortalDataMapper.toUIPage(uiPage, page);
// if (page.getTemplate() == null) page.setTemplate(uiPage.getTemplate());
- if (page.getChildren() == null)
- page.setChildren(new ArrayList<ModelObject>());
if (Page.DESKTOP_PAGE.equals(uiPage.getFactoryId()))
{
configService.update(page);
Modified:
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageCreationWizard.java
===================================================================
---
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageCreationWizard.java 2009-10-22
18:47:45 UTC (rev 400)
+++
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageCreationWizard.java 2009-10-22
19:40:46 UTC (rev 401)
@@ -23,6 +23,7 @@
import org.exoplatform.portal.config.UserACL;
import org.exoplatform.portal.config.UserPortalConfigService;
import org.exoplatform.portal.config.model.Page;
+import org.exoplatform.portal.config.model.PageData;
import org.exoplatform.portal.config.model.PageNavigation;
import org.exoplatform.portal.config.model.PageNode;
import org.exoplatform.portal.config.model.PortalConfig;
@@ -255,17 +256,17 @@
static public class ViewStep4ActionListener extends
EventListener<UIPageCreationWizard>
{
- private void setDefaultPermission(Page page, String ownerType, String ownerId)
+ private void setDefaultPermission(PageData data, String ownerType, String ownerId)
{
if (PortalConfig.PORTAL_TYPE.equals(ownerType))
{
- page.setAccessPermissions(new String[]{"Everyone"});
- page.setEditPermission("manager:/platform/administrators");
+ data.setAccessPermissions(new String[]{"Everyone"});
+ data.setEditPermission("manager:/platform/administrators");
}
else if (PortalConfig.GROUP_TYPE.equals(ownerType))
{
- page.setAccessPermissions(new String[]{"*:" + ownerId});
- page.setEditPermission("manager:" + ownerId);
+ data.setAccessPermissions(new String[]{"*:" + ownerId});
+ data.setEditPermission("manager:" + ownerId);
}
}
@@ -306,8 +307,9 @@
PageNode pageNode = uiPageInfo.getPageNode();
Page page = uiPageTemplateOptions.createPageFromSelectedOption(ownerType,
ownerId);
- page.setCreator(context.getRemoteUser());
- page.setName("page" + page.hashCode());
+ PageData data = page.buildData();
+ data.setCreator(context.getRemoteUser());
+ data.setName("page" + page.hashCode());
String pageId = pageNavi.getOwnerType() + "::" + pageNavi.getOwnerId()
+ "::" + page.getName();
DataStorage storage = uiWizard.getApplicationComponent(DataStorage.class);
if (storage.getPage(pageId) != null)
@@ -317,17 +319,16 @@
uiWizard.viewStep(2);
uiWizard.updateWizardComponent();
}
- page.setModifiable(true);
//Set default permissions on the page
- setDefaultPermission(page, ownerType, ownerId);
+ setDefaultPermission(data, ownerType, ownerId);
if (page.getTitle() == null || page.getTitle().trim().length() == 0)
- page.setTitle(pageNode.getName());
+ data.setTitle(pageNode.getName());
boolean isDesktopPage = Page.DESKTOP_PAGE.equals(page.getFactoryId());
if (isDesktopPage)
- page.setShowMaxWindow(true);
+ data.setShowMaxWindow(true);
UIPagePreview uiPagePreview = uiWizard.getChild(UIPagePreview.class);
UIPage uiPage;
@@ -340,7 +341,7 @@
uiPage = uiWizard.createUIComponent(context, UIPage.class, null, null);
}
- PortalDataMapper.toUIPage(uiPage, page);
+ PortalDataMapper.toUIPage(uiPage, new Page(page, data));
uiPagePreview.setUIComponent(uiPage);
if (isDesktopPage)
Modified:
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageForm.java
===================================================================
---
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageForm.java 2009-10-22
18:47:45 UTC (rev 400)
+++
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageForm.java 2009-10-22
19:40:46 UTC (rev 401)
@@ -27,6 +27,7 @@
import org.exoplatform.portal.config.UserPortalConfigService;
import org.exoplatform.portal.config.model.ModelObject;
import org.exoplatform.portal.config.model.Page;
+import org.exoplatform.portal.config.model.PageData;
import org.exoplatform.portal.config.model.PortalConfig;
import org.exoplatform.portal.webui.application.UIPortlet;
import org.exoplatform.portal.webui.container.UIContainer;
@@ -66,6 +67,7 @@
import
org.exoplatform.webui.organization.UIListPermissionSelector.EmptyIteratorValidator;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.List;
@ComponentConfigs({
@@ -206,7 +208,7 @@
}
- public void invokeSetBindingBean(Object bean) throws Exception
+ public Page invokeSetBindingBean(Page bean) throws Exception
{
String ownerType = getUIFormSelectBox("ownerType").getValue();
String ownerId = getUIStringInput("ownerId").getValue();
@@ -217,27 +219,27 @@
ownerId = "/" + ownerId;
}
- Page page = (Page)bean;
- page.setPageId(getUIStringInput("pageId").getValue());
- page.setOwnerType(ownerType);
- page.setOwnerId(ownerId);
- page.setName(getUIStringInput("name").getValue());
+ PageData data = bean.buildData();
+ data.setPageId(getUIStringInput("pageId").getValue());
+ data.setOwnerType(ownerType);
+ data.setOwnerId(ownerId);
+ data.setName(getUIStringInput("name").getValue());
String title = getUIStringInput("title").getValue();
if (title == null || title.trim().length() < 1)
- title = page.getName();
- page.setTitle(title);
+ title = data.getName();
+ data.setTitle(title);
- if (!page.isShowMaxWindow())
+ if (!data.isShowMaxWindow())
{
-
page.setShowMaxWindow((Boolean)getUIFormCheckBoxInput("showMaxWindow").getValue());
+
data.setShowMaxWindow((Boolean)getUIFormCheckBoxInput("showMaxWindow").getValue());
}
- if (!PortalConfig.USER_TYPE.equals(page.getOwnerType()))
+ if (!PortalConfig.USER_TYPE.equals(data.getOwnerType()))
{
-
page.setAccessPermissions(uiPermissionSetting.getChild(UIListPermissionSelector.class).getValue());
-
page.setEditPermission(uiPermissionSetting.getChild(UIPermissionSelector.class).getValue());
+
data.setAccessPermissions(uiPermissionSetting.getChild(UIListPermissionSelector.class).getValue());
+
data.setEditPermission(uiPermissionSetting.getChild(UIPermissionSelector.class).getValue());
}
UserACL userACL = getApplicationComponent(UserACL.class);
- userACL.hasPermission(page);
+ userACL.hasPermission(new Page(data));
UIFormInputItemSelector uiTemplate = getChildById("Template");
if (uiTemplate != null)
@@ -245,23 +247,39 @@
SelectItemOption<?> itemOption = uiTemplate.getSelectedItemOption();
if (itemOption != null)
{
- page.setFactoryId(itemOption.getIcon());
+ data.setFactoryId(itemOption.getIcon());
// page.setTemplate((String)itemOption.getValue());
- if (page.getFactoryId().equals(Page.DESKTOP_PAGE))
- page.setShowMaxWindow(true);
+ if (data.getFactoryId().equals(Page.DESKTOP_PAGE))
+ data.setShowMaxWindow(true);
}
}
+
+ //
+ Collection<ModelObject> children = new
ArrayList<ModelObject>(bean.getChildren());
+
+ //
UIPageTemplateOptions uiConfigOptions = getChild(UIPageTemplateOptions.class);
if (uiConfigOptions == null)
- return;
- Page selectedPage =
uiConfigOptions.createPageFromSelectedOption(page.getOwnerType(), page.getOwnerId());
- if (selectedPage == null)
- return;
- page.setChildren(selectedPage.getChildren());
- page.setFactoryId(selectedPage.getFactoryId());
- if (Page.DESKTOP_PAGE.equals(page.getFactoryId()))
- page.setShowMaxWindow(true);
+ {
+ Page selectedPage =
uiConfigOptions.createPageFromSelectedOption(data.getOwnerType(), data.getOwnerId());
+ if (selectedPage == null)
+ {
+ children.clear();
+ children.addAll(selectedPage.getChildren());
+ data.setFactoryId(selectedPage.getFactoryId());
+ if (Page.DESKTOP_PAGE.equals(data.getFactoryId()))
+ data.setShowMaxWindow(true);
+ }
+ }
+ //
+ Page newPage = new Page(bean, data);
+
+ //
+ newPage.getChildren().addAll(children);
+
+ //
+ return newPage;
}
static public class SaveActionListener extends EventListener<UIPageForm>
@@ -279,10 +297,10 @@
UIPage uiPage = uiPageForm.getUIPage();
if (uiPage == null)
return;
- Page page = new Page();
- page.setPageId(uiPage.getPageId());
- uiPageForm.invokeSetBindingBean(page);
- page.setOwnerType(uiPage.getOwnerType());
+ PageData data = new PageData();
+ data.setPageId(uiPage.getPageId());
+ uiPageForm.invokeSetBindingBean(data);
+ data.setOwnerType(uiPage.getOwnerType());
List<UIPortlet> uiPortlets = new ArrayList<UIPortlet>();
findAllPortlet(uiPortlets, uiPage);
ArrayList<ModelObject> applications = new ArrayList<ModelObject>();
@@ -291,17 +309,16 @@
applications.add(PortalDataMapper.buildModelObject(uiPortlet));
}
- if (Page.DESKTOP_PAGE.equals(uiPage.getFactoryId()) &&
!Page.DESKTOP_PAGE.equals(page.getFactoryId()))
+ Page page = new Page(data);
+ if (Page.DESKTOP_PAGE.equals(uiPage.getFactoryId()) &&
!Page.DESKTOP_PAGE.equals(data.getFactoryId()))
{
- page.setShowMaxWindow(false);
+ data.setShowMaxWindow(false);
uiPage.getChildren().clear();
- page.setChildren(applications);
+ page.getChildren().addAll(applications);
- page.setModifier(pcontext.getRemoteUser());
+ data.setModifier(pcontext.getRemoteUser());
PortalDataMapper.toUIPage(uiPage, page);
// if(page.getTemplate() == null)
page.setTemplate(uiPage.getTemplate()) ;
- if (page.getChildren() == null)
- page.setChildren(new ArrayList<ModelObject>());
// uiEditBar.setUIPage(uiPage);
// Class<?> [] childrenToRender = {UIPageEditBar.class,
@@ -315,16 +332,14 @@
return;
}
- if (Page.DESKTOP_PAGE.equals(page.getFactoryId()))
+ if (Page.DESKTOP_PAGE.equals(data.getFactoryId()))
{
uiPage.getChildren().clear();
- page.setChildren(applications);
+ page.getChildren().addAll(applications);
- page.setModifier(pcontext.getRemoteUser());
+ data.setModifier(pcontext.getRemoteUser());
PortalDataMapper.toUIPage(uiPage, page);
// if(page.getTemplate() == null)
page.setTemplate(uiPage.getTemplate()) ;
- if (page.getChildren() == null)
- page.setChildren(new ArrayList<ModelObject>());
UIPortalToolPanel toolPanel = Util.getUIPortalToolPanel();
toolPanel.setShowMaskLayer(true);
@@ -349,14 +364,14 @@
if (component != null)
children.add(component);
}
- page.setChildren(children);
+ page.getChildren().addAll(children);
uiPage.getChildren().clear();
- page.setModifier(pcontext.getRemoteUser());
+ data.setModifier(pcontext.getRemoteUser());
PortalDataMapper.toUIPage(uiPage, page);
// if(page.getTemplate() == null) page.setTemplate(uiPage.getTemplate()) ;
if (page.getChildren() == null)
- page.setChildren(new ArrayList<ModelObject>());
+ page.getChildren().clear();
}
protected void findAllPortlet(List<UIPortlet> list, UIContainer uiContainer)
Modified:
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageNodeForm2.java
===================================================================
---
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageNodeForm2.java 2009-10-22
18:47:45 UTC (rev 400)
+++
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageNodeForm2.java 2009-10-22
19:40:46 UTC (rev 401)
@@ -23,8 +23,8 @@
import org.exoplatform.portal.config.DataStorage;
import org.exoplatform.portal.config.UserACL;
import org.exoplatform.portal.config.UserPortalConfigService;
-import org.exoplatform.portal.config.model.ModelObject;
import org.exoplatform.portal.config.model.Page;
+import org.exoplatform.portal.config.model.PageData;
import org.exoplatform.portal.config.model.PageNavigation;
import org.exoplatform.portal.config.model.PageNode;
import org.exoplatform.portal.webui.navigation.PageNavigationUtils;
@@ -380,32 +380,30 @@
UIFormStringInput uiPageTitle = uiInputSet.getChildById("pageTitle");
- Page page = new Page();
- page.setOwnerType(uiForm.getOwnerType());
- page.setOwnerId(ownerId);
- page.setName(uiPageName.getValue());
- String title = uiPageTitle.getValue();;
+ PageData data = new PageData();
+ data.setOwnerType(uiForm.getOwnerType());
+ data.setOwnerId(ownerId);
+ data.setName(uiPageName.getValue());
+ String title = uiPageTitle.getValue();
if (title == null || title.trim().length() < 1)
- title = page.getName();
- page.setTitle(title);
+ title = data.getName();
+ data.setTitle(title);
- page.setShowMaxWindow(false);
+ data.setShowMaxWindow(false);
- page.setAccessPermissions(accessPermission);
- page.setEditPermission(editPermission);
+ data.setAccessPermissions(accessPermission);
+ data.setEditPermission(editPermission);
+ Page page = new Page(data);
userACL.hasPermission(page);
- page.setCreator(pcontext.getRemoteUser());
- page.setModifiable(true);
- if (page.getChildren() == null)
- page.setChildren(new ArrayList<ModelObject>());
+ data.setCreator(pcontext.getRemoteUser());
UserPortalConfigService service =
uiForm.getApplicationComponent(UserPortalConfigService.class);
// check page is exist
DataStorage dataStorage = uiForm.getApplicationComponent(DataStorage.class);
- Page existPage = dataStorage.getPage(page.getPageId());
+ Page existPage = dataStorage.getPage(data.getPageId());
if (existPage != null)
{
uiPortalApp.addMessage(new
ApplicationMessage("UIPageForm.msg.sameName", null));
Modified:
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalComponentActionListener.java
===================================================================
---
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalComponentActionListener.java 2009-10-22
18:47:45 UTC (rev 400)
+++
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalComponentActionListener.java 2009-10-22
19:40:46 UTC (rev 401)
@@ -24,6 +24,7 @@
import org.exoplatform.portal.config.UserACL;
import org.exoplatform.portal.config.model.ApplicationType;
import org.exoplatform.portal.config.model.Container;
+import org.exoplatform.portal.config.model.ContainerData;
import org.exoplatform.portal.config.model.TransientApplicationState;
import org.exoplatform.portal.config.model.gadget.GadgetId;
import org.exoplatform.portal.config.model.portlet.PortletId;
@@ -223,9 +224,10 @@
org.exoplatform.portal.webui.container.UIContainer uiContainer =
uiTarget.createUIComponent(org.exoplatform.portal.webui.container.UIContainer.class, null,
null);
Container container = uiContainerConfig.getContainer(sourceId);
- container.setId(String.valueOf(container.hashCode()));
+ ContainerData data = container.buildData();
+ data.setId(String.valueOf(container.hashCode()));
uiContainer.setStorageId(container.getStorageId());
- PortalDataMapper.toUIContainer(uiContainer, container);
+ PortalDataMapper.toUIContainer(uiContainer, new Container(container,
data));
String[] accessPers = uiContainer.getAccessPermissions();
for (String accessPer : accessPers)
{
Modified:
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/util/PortalDataMapper.java
===================================================================
---
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/util/PortalDataMapper.java 2009-10-22
18:47:45 UTC (rev 400)
+++
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/util/PortalDataMapper.java 2009-10-22
19:40:46 UTC (rev 401)
@@ -21,15 +21,20 @@
import org.exoplatform.portal.config.UserPortalConfig;
import org.exoplatform.portal.config.model.Application;
+import org.exoplatform.portal.config.model.ApplicationData;
import org.exoplatform.portal.config.model.ApplicationState;
import org.exoplatform.portal.config.model.ApplicationType;
import org.exoplatform.portal.config.model.Container;
+import org.exoplatform.portal.config.model.ContainerData;
import org.exoplatform.portal.config.model.Dashboard;
import org.exoplatform.portal.config.model.ModelObject;
import org.exoplatform.portal.config.model.Page;
import org.exoplatform.portal.config.model.PageBody;
+import org.exoplatform.portal.config.model.PageData;
+import org.exoplatform.portal.config.model.PersistentApplicationState;
import org.exoplatform.portal.config.model.PortalConfig;
import org.exoplatform.portal.config.model.SiteBody;
+import org.exoplatform.portal.config.model.TransientApplicationState;
import org.exoplatform.portal.config.model.gadget.GadgetApplication;
import org.exoplatform.portal.config.model.gadget.GadgetId;
import org.exoplatform.portal.config.model.portlet.PortletApplication;
@@ -37,6 +42,8 @@
import org.exoplatform.portal.config.model.wsrp.WSRPApplication;
import org.exoplatform.portal.config.model.wsrp.WSRPId;
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.exoplatform.portal.webui.application.PortletState;
import org.exoplatform.portal.webui.application.UIGadget;
import org.exoplatform.portal.webui.application.UIPortlet;
@@ -55,6 +62,8 @@
import org.gatein.pc.api.info.PortletInfo;
import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
import java.util.List;
import java.util.Set;
@@ -100,29 +109,29 @@
private static GadgetApplication toGadget(UIGadget uiGadget)
{
- GadgetApplication app = new GadgetApplication(uiGadget.getStorageId(),
uiGadget.getGadgetId());
- app.setState(uiGadget.getState());
- app.setProperties(uiGadget.getProperties());
- app.setStorageName(uiGadget.getStorageName());
+ ApplicationData data = new ApplicationData();
+ data.setProperties(uiGadget.getProperties());
+ GadgetApplication app = new GadgetApplication(uiGadget.getStorageId(),
uiGadget.getStorageName(), uiGadget.getGadgetId(),
(PersistentApplicationState<Gadget>)uiGadget.getState(), data);
return app;
}
- public static void toContainer(Container model, UIContainer uiContainer)
- {
- model.setId(uiContainer.getId());
- model.setName(uiContainer.getName());
- model.setTitle(uiContainer.getTitle());
- model.setIcon(uiContainer.getIcon());
- model.setDescription(uiContainer.getDescription());
- model.setHeight(uiContainer.getHeight());
- model.setWidth(uiContainer.getWidth());
- model.setTemplate(uiContainer.getTemplate());
- model.setFactoryId(uiContainer.getFactoryId());
- model.setAccessPermissions(uiContainer.getAccessPermissions());
+ private static void toContainerData(UIContainer uiContainer, ContainerData data) {
+ data.setId(uiContainer.getId());
+ data.setName(uiContainer.getName());
+ data.setTitle(uiContainer.getTitle());
+ data.setIcon(uiContainer.getIcon());
+ data.setDescription(uiContainer.getDescription());
+ data.setHeight(uiContainer.getHeight());
+ data.setWidth(uiContainer.getWidth());
+ data.setTemplate(uiContainer.getTemplate());
+ data.setFactoryId(uiContainer.getFactoryId());
+ data.setAccessPermissions(uiContainer.getAccessPermissions());
+ }
+ private static Collection<ModelObject> toContainerChildren(UIContainer
uiContainer) {
List<UIComponent> uiChildren = uiContainer.getChildren();
if (uiChildren == null)
- return;
+ return Collections.emptyList();
ArrayList<ModelObject> children = new ArrayList<ModelObject>();
for (UIComponent child : uiChildren)
{
@@ -130,26 +139,85 @@
if (component != null)
children.add(component);
}
- model.setChildren(children);
+ return children;
}
+ public static Container toContainer(UIContainer uiContainer)
+ {
+ ContainerData data = new ContainerData();
+
+ //
+ toContainerData(uiContainer, data);
+
+ //
+ Container model = new Container(uiContainer.getStorageId(), data);
+
+ //
+ Collection<ModelObject> children = toContainerChildren(uiContainer);
+
+ //
+ model.getChildren().addAll(children);
+
+ //
+ return model;
+ }
+
private static <S, I> Application<S, I> toPortletModel(UIPortlet<S, ?,
I> uiPortlet)
{
Application<S, I> model;
PortletState<S, I> state = uiPortlet.getState();
ApplicationType<S, I> type = state.getApplicationType();
I applicationId = state.getApplicationId();
+
+ //
+ ApplicationData data = new ApplicationData();
+ data.setTitle(uiPortlet.getTitle());
+ data.setWidth(uiPortlet.getWidth());
+ data.setHeight(uiPortlet.getHeight());
+ data.setDescription(uiPortlet.getDescription());
+ data.setShowInfoBar(uiPortlet.getShowInfoBar());
+ data.setShowApplicationState(uiPortlet.getShowWindowState());
+ data.setShowApplicationMode(uiPortlet.getShowPortletMode());
+ data.setDescription(uiPortlet.getDescription());
+ data.setIcon(uiPortlet.getIcon());
+ data.setProperties(uiPortlet.getProperties());
+ data.setTheme(uiPortlet.getTheme());
+ data.setAccessPermissions(uiPortlet.getAccessPermissions());
+ data.setModifiable(uiPortlet.isModifiable());
+
+ //
if (type == ApplicationType.PORTLET)
{
- model = (Application<S, I>)new
PortletApplication(uiPortlet.getStorageId(), (PortletId)applicationId);
+ if (uiPortlet.getStorageId() != null)
+ {
+ model = (Application<S, I>)new
PortletApplication(uiPortlet.getStorageId(), uiPortlet.getStorageName(),
(PortletId)applicationId,
(PersistentApplicationState<Preferences>)state.getApplicationState(), data);
+ }
+ else
+ {
+ model = (Application<S, I>)new
PortletApplication(uiPortlet.getStorageName(), (PortletId)applicationId,
(TransientApplicationState<Preferences>)state.getApplicationState(), data);
+ }
}
else if (type == ApplicationType.GADGET)
{
- model = (Application<S, I>)new GadgetApplication(uiPortlet.getStorageId(),
(GadgetId)applicationId);
+ if (uiPortlet.getStorageId() != null)
+ {
+ model = (Application<S, I>)new
GadgetApplication(uiPortlet.getStorageId(), uiPortlet.getStorageName(),
(GadgetId)applicationId,
(PersistentApplicationState<Gadget>)state.getApplicationState(), data);
+ }
+ else
+ {
+ model = (Application<S, I>)new
GadgetApplication(uiPortlet.getStorageName(), (GadgetId)applicationId,
(TransientApplicationState<Gadget>)state.getApplicationState(), data);
+ }
}
else if (type == ApplicationType.WSRP_PORTLET)
{
- model = (Application<S, I>)new WSRPApplication(uiPortlet.getStorageId(),
(WSRPId)applicationId);
+ if (uiPortlet.getStorageId() != null)
+ {
+ model = (Application<S, I>)new
WSRPApplication(uiPortlet.getStorageId(), uiPortlet.getStorageName(),
(WSRPId)applicationId,
(PersistentApplicationState<WSRPState>)state.getApplicationState(), data);
+ }
+ else
+ {
+ model = (Application<S, I>)new
WSRPApplication(uiPortlet.getStorageName(), (WSRPId)applicationId,
(TransientApplicationState<WSRPState>)state.getApplicationState(), data);
+ }
}
else
{
@@ -157,47 +225,36 @@
}
//
- model.setStorageName(uiPortlet.getStorageName());
- model.setState(state.getApplicationState());
- model.setTitle(uiPortlet.getTitle());
- model.setWidth(uiPortlet.getWidth());
- model.setHeight(uiPortlet.getHeight());
- model.setDescription(uiPortlet.getDescription());
- model.setShowInfoBar(uiPortlet.getShowInfoBar());
- model.setShowApplicationState(uiPortlet.getShowWindowState());
- model.setShowApplicationMode(uiPortlet.getShowPortletMode());
- model.setDescription(uiPortlet.getDescription());
- model.setIcon(uiPortlet.getIcon());
- model.setProperties(uiPortlet.getProperties());
- model.setTheme(uiPortlet.getTheme());
- model.setAccessPermissions(uiPortlet.getAccessPermissions());
- model.setModifiable(uiPortlet.isModifiable());
return model;
}
- private static Container toContainer(UIContainer uiContainer)
+ static private Page toPageModel(UIPage uiPage)
{
- Container model = new Container(uiContainer.getStorageId());
- toContainer(model, uiContainer);
- return model;
- }
+ PageData data = new PageData();
+ data.setCreator(uiPage.getCreator());
+ data.setModifier(uiPage.getModifier());
+ data.setOwnerId(uiPage.getOwnerId());
+ data.setOwnerType(uiPage.getOwnerType());
+ data.setIcon(uiPage.getIcon());
+ data.setTitle(uiPage.getTitle());
+ data.setAccessPermissions(uiPage.getAccessPermissions());
+ data.setEditPermission(uiPage.getEditPermission());
+ data.setFactoryId(uiPage.getFactoryId());
+ data.setShowMaxWindow(uiPage.isShowMaxWindow());
- static private Page toPageModel(UIPage uiPage)
- {
- Page model = new Page(uiPage.getStorageId());
- toContainer(model, uiPage);
- model.setCreator(uiPage.getCreator());
- model.setModifier(uiPage.getModifier());
- model.setOwnerId(uiPage.getOwnerId());
- model.setOwnerType(uiPage.getOwnerType());
- model.setIcon(uiPage.getIcon());
- model.setPageId(uiPage.getPageId());
- model.setTitle(uiPage.getTitle());
- model.setAccessPermissions(uiPage.getAccessPermissions());
- model.setEditPermission(uiPage.getEditPermission());
- model.setFactoryId(uiPage.getFactoryId());
- model.setShowMaxWindow(uiPage.isShowMaxWindow());
- model.setModifiable(uiPage.isModifiable());
+ //
+ toContainerData(uiPage, data);
+
+ //
+ Page model = new Page(uiPage.getStorageId(), data);
+
+ //
+ Collection<ModelObject> children = toContainerChildren(uiPage);
+
+ //
+ model.getChildren().addAll(children);
+
+ //
return model;
}
@@ -214,7 +271,7 @@
model.setModifiable(uiPortal.isModifiable());
model.setProperties(uiPortal.getProperties());
- model.setPortalLayout(new Container());
+ model.setPortalLayout(new Container(new ContainerData()));
List<UIComponent> children = uiPortal.getChildren();
if (children == null)
@@ -226,7 +283,7 @@
if (component != null)
newChildren.add(component);
}
- model.getPortalLayout().setChildren(newChildren);
+ model.getPortalLayout().getChildren().addAll(newChildren);
return model;
}
@@ -339,7 +396,6 @@
uiPage.setPageId(model.getPageId());
uiPage.setTitle(model.getTitle());
uiPage.setShowMaxWindow(model.isShowMaxWindow());
- uiPage.setModifiable(model.isModifiable());
List<UIPortlet> portlets = new ArrayList<UIPortlet>();
uiPage.findComponentOfType(portlets, UIPortlet.class);