gatein SVN: r406 - in portal/trunk/webui: eXo/src/main/java/org/exoplatform/webui/organization and 1 other directories.
by do-not-reply@jboss.org
Author: liem_nguyen
Date: 2009-10-22 23:32:18 -0400 (Thu, 22 Oct 2009)
New Revision: 406
Modified:
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/lifecycle/UIFormLifecycle.java
portal/trunk/webui/eXo/src/main/java/org/exoplatform/webui/organization/UIListPermissionSelector.java
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIMaskWorkspace.java
Log:
GTNPORTAL-54 Cancel button does not work correct in case Form has subComponnent
Modified: portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/lifecycle/UIFormLifecycle.java
===================================================================
--- portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/lifecycle/UIFormLifecycle.java 2009-10-23 03:30:51 UTC (rev 405)
+++ portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/lifecycle/UIFormLifecycle.java 2009-10-23 03:32:18 UTC (rev 406)
@@ -69,6 +69,8 @@
}
UIComponent uiSubComponent = uicomponent.findComponentById(subComponentId);
Event<UIComponent> event = uiSubComponent.createEvent(action, Event.Phase.DECODE, context);
+ if (event == null)
+ event = uicomponent.createEvent(action, Event.Phase.DECODE, context);
if (event != null)
event.broadcast();
}
Modified: portal/trunk/webui/eXo/src/main/java/org/exoplatform/webui/organization/UIListPermissionSelector.java
===================================================================
--- portal/trunk/webui/eXo/src/main/java/org/exoplatform/webui/organization/UIListPermissionSelector.java 2009-10-23 03:30:51 UTC (rev 405)
+++ portal/trunk/webui/eXo/src/main/java/org/exoplatform/webui/organization/UIListPermissionSelector.java 2009-10-23 03:32:18 UTC (rev 406)
@@ -54,8 +54,7 @@
* ha.pham(a)exoplatform.com
* May 7, 2007
*/
-@ComponentConfig(template = "system:/groovy/organization/webui/component/UIListPermissionSelector.gtmpl", events = {
- @EventConfig(phase = Phase.DECODE, listeners = UIListPermissionSelector.CloseActionListener.class),
+@ComponentConfig(template = "system:/groovy/organization/webui/component/UIListPermissionSelector.gtmpl", events = {
@EventConfig(phase = Phase.DECODE, listeners = UIListPermissionSelector.DeleteActionListener.class, confirm = "UIAccessGroup.deleteAccessGroup"),
@EventConfig(phase = Phase.DECODE, listeners = UIPermissionSelector.SelectMembershipActionListener.class),
@EventConfig(phase = Phase.DECODE, listeners = UIListPermissionSelector.ChangePublicModeActionListener.class)})
@@ -279,19 +278,6 @@
}
}
-
- static public class CloseActionListener extends EventListener<UIListPermissionSelector>
- {
- public void execute(Event<UIListPermissionSelector> event) throws Exception
- {
- UIListPermissionSelector uicom = event.getSource();
- UIForm uiForm = uicom.getAncestorOfType(UIForm.class);
- if (uiForm != null)
- {
- uiForm.broadcast(event, event.getExecutionPhase());
- }
- }
- }
static public class EmptyIteratorValidator implements Validator
{
Modified: portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIMaskWorkspace.java
===================================================================
--- portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIMaskWorkspace.java 2009-10-23 03:30:51 UTC (rev 405)
+++ portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIMaskWorkspace.java 2009-10-23 03:32:18 UTC (rev 406)
@@ -25,12 +25,14 @@
import org.exoplatform.webui.core.UIComponentDecorator;
import org.exoplatform.webui.event.Event;
import org.exoplatform.webui.event.EventListener;
+import org.exoplatform.webui.event.Event.Phase;
/**
* Created by The eXo Platform SAS
* Mar 13, 2007
*/
-@ComponentConfig(id = "UIMaskWorkspace", template = "system:/groovy/portal/webui/workspace/UIMaskWorkspace.gtmpl", events = @EventConfig(listeners = UIMaskWorkspace.CloseActionListener.class))
+@ComponentConfig(id = "UIMaskWorkspace", template = "system:/groovy/portal/webui/workspace/UIMaskWorkspace.gtmpl",
+ events = @EventConfig(phase = Phase.DECODE, listeners = UIMaskWorkspace.CloseActionListener.class))
public class UIMaskWorkspace extends UIComponentDecorator
{
15 years, 2 months
gatein SVN: r405 - in portal/trunk: web/eXoResources/src/main/webapp/javascript/eXo/core and 1 other directory.
by do-not-reply@jboss.org
Author: truong.le
Date: 2009-10-22 23:30:51 -0400 (Thu, 22 Oct 2009)
New Revision: 405
Modified:
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/navigation/webui/component/UIGroupNavigationManagement.java
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/navigation/webui/component/UISiteManagement.java
portal/trunk/web/eXoResources/src/main/webapp/javascript/eXo/core/UIMaskLayer.js
Log:
GTNPORTAL-57: Unknown error when delete navigation which is being used by an other program
Modified: portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/navigation/webui/component/UIGroupNavigationManagement.java
===================================================================
--- portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/navigation/webui/component/UIGroupNavigationManagement.java 2009-10-23 03:15:19 UTC (rev 404)
+++ portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/navigation/webui/component/UIGroupNavigationManagement.java 2009-10-23 03:30:51 UTC (rev 405)
@@ -226,6 +226,7 @@
selector.removeChild(UIRightClickPopupMenu.class);
popUp.setUIComponent(pageManager);
popUp.setWindowSize(400, 400);
+ popUp.setShowMask(true);
popUp.setShow(true);
// prContext.addUIComponentToUpdateByAjax(workingWS);
}
@@ -256,6 +257,7 @@
pageNavigation.setPageNav(navigation);
popUp.setUIComponent(pageNavigation);
popUp.setWindowSize(600, 400);
+ popUp.setShowMask(true);
popUp.setShow(true);
}
}
Modified: portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/navigation/webui/component/UISiteManagement.java
===================================================================
--- portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/navigation/webui/component/UISiteManagement.java 2009-10-23 03:15:19 UTC (rev 404)
+++ portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/navigation/webui/component/UISiteManagement.java 2009-10-23 03:30:51 UTC (rev 405)
@@ -319,6 +319,7 @@
selector.initNavigations(list);
selector.removeChild(UIRightClickPopupMenu.class);
popUp.setUIComponent(naviManager);
+ popUp.setShowMask(true);
popUp.setShow(true);
}
Modified: portal/trunk/web/eXoResources/src/main/webapp/javascript/eXo/core/UIMaskLayer.js
===================================================================
--- portal/trunk/web/eXoResources/src/main/webapp/javascript/eXo/core/UIMaskLayer.js 2009-10-23 03:15:19 UTC (rev 404)
+++ portal/trunk/web/eXoResources/src/main/webapp/javascript/eXo/core/UIMaskLayer.js 2009-10-23 03:30:51 UTC (rev 405)
@@ -183,7 +183,7 @@
maskLayer.id = object.id + "MaskLayer" ;
maskLayer.maxZIndex = 3 ;
maskLayer.style.width = blockContainer.offsetWidth + "px" ;
- maskLayer.style.height = blockContainer.offsetHeight + "px" ;
+ maskLayer.style.height = blockContainer.offsetHeight + eXo.core.Browser.findPosY(blockContainer) + "px" ;
maskLayer.style.top = "0px" ;
maskLayer.style.left = "0px" ;
maskLayer.style.zIndex = maskLayer.maxZIndex ;
15 years, 2 months
gatein SVN: r404 - portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation.
by do-not-reply@jboss.org
Author: truong.le
Date: 2009-10-22 23:15:19 -0400 (Thu, 22 Oct 2009)
New Revision: 404
Modified:
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UINavigationNodeSelector.java
Log:
GTNPORTAL-56: NPE when edit node
Modified: portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UINavigationNodeSelector.java
===================================================================
--- portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UINavigationNodeSelector.java 2009-10-23 03:01:17 UTC (rev 403)
+++ portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UINavigationNodeSelector.java 2009-10-23 03:15:19 UTC (rev 404)
@@ -362,9 +362,8 @@
uiNodeForm.setSelectedParent(parent);
// set navigation owner, navigation type
- UINavigationManagement nodeManager = uiNodeSelector.getParent();
- uiNodeForm.setOwner(nodeManager.getOwner());
- uiNodeForm.setOwnerType(nodeManager.getOwnerType());
+ uiNodeForm.setOwner(uiNodeSelector.getSelectedNavigation().getOwnerId());
+ uiNodeForm.setOwnerType(uiNodeSelector.getSelectedNavigation().getOwnerType());
uiManagementPopup.setWindowSize(800, 500);
event.getRequestContext().addUIComponentToUpdateByAjax(uiManagementPopup.getParent());
@@ -469,6 +468,11 @@
UIPopupWindow uiManagementPopup = uiNodeSelector.getAncestorOfType(UIPopupWindow.class);
UIPageNodeForm2 uiNodeForm = uiApp.createUIComponent(UIPageNodeForm2.class, null, null);
uiManagementPopup.setUIComponent(uiNodeForm);
+
+ // set navigation owner, navigation type
+ uiNodeForm.setOwner(uiNodeSelector.getSelectedNavigation().getOwnerId());
+ uiNodeForm.setOwnerType(uiNodeSelector.getSelectedNavigation().getOwnerType());
+
uiNodeForm.setValues(selectedNode);
uiNodeForm.setSelectedParent(obj);
uiManagementPopup.setWindowSize(800, 500);
15 years, 2 months
gatein SVN: r403 - portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/portal.
by do-not-reply@jboss.org
Author: truong.le
Date: 2009-10-22 23:01:17 -0400 (Thu, 22 Oct 2009)
New Revision: 403
Modified:
portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/portal/application-registry-configuration.xml
Log:
GTNPORTAL-55: NPE when edit portlet in tab page config
Modified: portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/portal/application-registry-configuration.xml
===================================================================
--- portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/portal/application-registry-configuration.xml 2009-10-22 22:02:30 UTC (rev 402)
+++ portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/portal/application-registry-configuration.xml 2009-10-23 03:01:17 UTC (rev 403)
@@ -182,7 +182,7 @@
</field>
</object>
</value>
- <value>
+ <value>
<object type="org.exoplatform.application.registry.Application">
<field name="categoryName"><string>web</string></field>
<field name="applicationName"><string>SiteMapPortlet</string></field>
@@ -197,21 +197,6 @@
</field>
</object>
</value>
- <value>
- <object type="org.exoplatform.application.registry.Application">
- <field name="categoryName"><string>web</string></field>
- <field name="applicationName"><string>BrowserPortlet</string></field>
- <field name="displayName"><string>Web Explorer</string></field>
- <field name="description"><string>Web Explorer</string></field>
- <field name="applicationType"><string>portlet</string></field>
- <field name="applicationGroup"><string>web</string></field>
- <field name="accessPermissions">
- <collection type="java.util.ArrayList" item-type="java.lang.String">
- <value><string>*:/platform/users</string></value>
- </collection>
- </field>
- </object>
- </value>
</collection>
</field>
</object>
15 years, 2 months
gatein SVN: r402 - in portal/branches/performance: component/portal/src/main/java/org/exoplatform/portal/application and 17 other directories.
by do-not-reply@jboss.org
Author: julien_viet
Date: 2009-10-22 18:02:30 -0400 (Thu, 22 Oct 2009)
New Revision: 402
Removed:
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:
rolling back previous commit that is too intrusive
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 19:40:46 UTC (rev 401)
+++ portal/branches/performance/component/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/UIDashboardContainer.java 2009-10-22 22:02:30 UTC (rev 402)
@@ -23,7 +23,6 @@
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;
@@ -387,11 +386,7 @@
{
Container container = toContainer(item.getValue());
if (id != null)
- {
- ContainerData data = container.buildData();
- data.setId(id);
- container = new Container(container, data);
- }
+ container.setId(id);
return container;
}
}
@@ -457,12 +452,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(), container.buildData());
+ Dashboard dashboard = new Dashboard(currentUIPortlet.getStorageId());
+ // 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 19:40:46 UTC (rev 401)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/application/PortletPreferences.java 2009-10-22 22:02:30 UTC (rev 402)
@@ -19,8 +19,6 @@
package org.exoplatform.portal.application;
-import org.exoplatform.portal.config.NewPortalConfigListener;
-
import java.util.ArrayList;
import java.util.ListIterator;
@@ -108,9 +106,4 @@
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 19:40:46 UTC (rev 401)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/GroupPortalConfigListener.java 2009-10-22 22:02:30 UTC (rev 402)
@@ -22,7 +22,6 @@
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;
@@ -127,7 +126,7 @@
if (cfg == null)
{
cfg = new PortalConfig(PortalConfig.GROUP_TYPE);
- cfg.setPortalLayout(new Container(new ContainerData()));
+ cfg.setPortalLayout(new Container());
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 19:40:46 UTC (rev 401)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/NewPortalConfigListener.java 2009-10-22 22:02:30 UTC (rev 402)
@@ -29,13 +29,11 @@
import org.exoplatform.portal.application.PortletPreferences;
import org.exoplatform.portal.application.PortletPreferences.PortletPreferencesSet;
import org.exoplatform.portal.config.model.Container;
-import org.exoplatform.portal.config.model.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;
@@ -50,7 +48,6 @@
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
@@ -311,7 +308,7 @@
if (cfg == null)
{
cfg = new PortalConfig(type);
- cfg.setPortalLayout(new Container(new ContainerData()));
+ cfg.setPortalLayout(new Container());
cfg.setName(owner);
pdcService_.create(cfg);
}
@@ -333,11 +330,15 @@
pdcService_.save(pconfig);
}
}
- catch (Exception e)
+ catch (JiBXException 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
@@ -369,7 +370,7 @@
pdcService_.create(page);
}
}
- catch (Exception e)
+ catch (JiBXException e)
{
log.error(e.getMessage() + " file: " + path, e);
throw e;
@@ -408,7 +409,7 @@
pdcService_.save(navigation);
}
}
- catch (Exception e)
+ catch (JiBXException e)
{
log.error(e.getMessage() + " file: " + path, e);
throw e;
@@ -443,7 +444,7 @@
pdcService_.save(portlet);
}
}
- catch (Exception e)
+ catch (JiBXException e)
{
log.error(e.getMessage() + " file: " + path, e);
throw e;
@@ -500,21 +501,12 @@
// Deserializing code
- private <T> T fromXML(String ownerType, String ownerId, String xml, final Class<T> clazz) throws Exception
+ private <T> T fromXML(String ownerType, String owner, String xml, Class<T> clazz) throws Exception
{
- final ByteArrayInputStream is = new ByteArrayInputStream(xml.getBytes("UTF-8"));
+ ByteArrayInputStream is = new ByteArrayInputStream(xml.getBytes("UTF-8"));
IBindingFactory bfact = BindingDirectory.getFactory(clazz);
- 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"));
- }
- });
-/*
+ IUnmarshallingContext uctx = bfact.createUnmarshallingContext();
+ T o = clazz.cast(uctx.unmarshalDocument(is, "UTF-8"));
if (o instanceof PageNavigation)
{
PageNavigation nav = (PageNavigation)o;
@@ -540,15 +532,17 @@
{
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;
}
- public static String fixOwnerName(String type, String owner)
+ private static String fixOwnerName(String type, String owner)
{
if (type.equals(PortalConfig.GROUP_TYPE) && !owner.startsWith("/"))
{
@@ -577,4 +571,64 @@
}
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 19:40:46 UTC (rev 401)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/UserACL.java 2009-10-22 22:02:30 UTC (rev 402)
@@ -357,17 +357,21 @@
{
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)
{
@@ -383,14 +387,17 @@
{
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 19:40:46 UTC (rev 401)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/UserPortalConfigListener.java 2009-10-22 22:02:30 UTC (rev 402)
@@ -22,7 +22,6 @@
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;
@@ -71,7 +70,7 @@
if (cfg == null)
{
cfg = new PortalConfig(PortalConfig.USER_TYPE);
- cfg.setPortalLayout(new Container(new ContainerData()));
+ cfg.setPortalLayout(new Container());
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 19:40:46 UTC (rev 401)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/UserPortalConfigService.java 2009-10-22 22:02:30 UTC (rev 402)
@@ -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 19:40:46 UTC (rev 401)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/Application.java 2009-10-22 22:02:30 UTC (rev 402)
@@ -28,93 +28,49 @@
public abstract class Application<S, I> extends ModelObject
{
- /** .*/
- private static final ApplicationData DEFAULT_DATA = new ApplicationData();
-
/** The application state. */
- private final ApplicationState<S> state;
+ private ApplicationState<S> state;
/** The reference to the application. */
- private final I ref;
+ private I ref;
- private final String id;
+ private String id;
- private final String title;
+ private String title;
- private final String icon;
+ private String icon;
- private final String description;
+ private String description;
- private final boolean showInfoBar;
+ private boolean showInfoBar = true;
- private final boolean showApplicationState;
+ private boolean showApplicationState = true;
- private final boolean showApplicationMode;
+ private boolean showApplicationMode = true;
- private final String theme;
+ private String theme;
- private final String width;
+ private String width;
- private final String height;
+ private String height;
- private final Properties properties;
+ private Properties properties;
- private final String[] accessPermissions;
+ private String[] accessPermissions;
- private final boolean isModifiable;
+ private boolean isModifiable;
- public Application(String storageId, String storageName, I ref, PersistentApplicationState<S> state, ApplicationData data)
+ public Application(String storageId, I ref)
{
- super(storageId, storageName);
+ super(storageId);
//
- 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(String storageName, I ref, TransientApplicationState<S> state, ApplicationData data)
+ public Application(I ref)
{
- 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();
@@ -124,31 +80,61 @@
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;
@@ -159,21 +145,41 @@
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()
@@ -181,18 +187,41 @@
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
Deleted: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/ApplicationData.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/ApplicationData.java 2009-10-22 19:40:46 UTC (rev 401)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/ApplicationData.java 2009-10-22 22:02:30 UTC (rev 402)
@@ -1,194 +0,0 @@
-/*
- * Copyright (C) 2003-2007 eXo Platform SAS.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
- */
-package org.exoplatform.portal.config.model;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public class 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 19:40:46 UTC (rev 401)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/Container.java 2009-10-22 22:02:30 UTC (rev 402)
@@ -30,136 +30,161 @@
public class Container extends ModelObject
{
- protected final String id;
+ protected String id;
- protected final String name;
+ protected String name;
- protected final String icon;
+ protected String icon;
- protected final String decorator;
+ protected String decorator;
- protected final String template;
+ protected String template;
- protected final String factoryId;
+ protected String factoryId;
- protected final String title;
+ protected String title;
- protected final String description;
+ protected String description;
- protected final String width;
+ protected String width;
- protected final String height;
+ protected String height;
- protected final String[] accessPermissions;
+ private String[] accessPermissions;
- protected final ArrayList<ModelObject> children;
+ protected ArrayList<ModelObject> children;
- public Container(Container container, ContainerData data) {
- this(container.getStorageId(), data);
- }
-
- public Container(ContainerData data)
+ public Container()
{
- this((String)null, data);
+ children = new ArrayList<ModelObject>();
}
- public Container(String storageId, ContainerData data)
+ public Container(String storageId)
{
- super(storageId, null);
+ super(storageId);
//
- 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
Deleted: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/ContainerData.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/ContainerData.java 2009-10-22 19:40:46 UTC (rev 401)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/ContainerData.java 2009-10-22 22:02:30 UTC (rev 402)
@@ -1,168 +0,0 @@
-/*
- * Copyright (C) 2003-2007 eXo Platform SAS.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
- */
-package org.exoplatform.portal.config.model;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public class 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 19:40:46 UTC (rev 401)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/Dashboard.java 2009-10-22 22:02:30 UTC (rev 402)
@@ -26,13 +26,12 @@
public class Dashboard extends Container
{
- public Dashboard(ContainerData data)
+ public Dashboard()
{
- super(data);
}
- public Dashboard(String storageId, ContainerData data)
+ public Dashboard(String storageId)
{
- super(storageId, data);
+ super(storageId);
}
}
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 19:40:46 UTC (rev 401)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/Mapper.java 2009-10-22 22:02:30 UTC (rev 402)
@@ -19,7 +19,6 @@
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;
@@ -127,8 +126,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, false));
- dstNode.setVisible(attrs.getValue(MappedAttributes.VISIBLE, true));
+ dstNode.setShowPublicationDate(attrs.getValue(MappedAttributes.SHOW_PUBLICATION_DATE));
+ dstNode.setVisible(attrs.getValue(MappedAttributes.VISIBLE));
dstNode.setChildren(new ArrayList<PageNode>());
Link link = src.getLink();
if (link instanceof PageLink)
@@ -273,13 +272,11 @@
//
org.gatein.mop.api.workspace.Page template = src.getRootNavigation().getTemplate();
+ Container dstLayout = new Container();
UIContainer srcLayout = template.getRootComponent();
- ContainerData data = load(srcLayout);
//
- Container dstLayout = new Container(srcLayout.getObjectId(), data);
-
- //
+ load(srcLayout, dstLayout);
loadChildren(srcLayout, dstLayout);
//
@@ -332,9 +329,13 @@
public Page load(org.gatein.mop.api.workspace.Page src)
{
- UIContainer root = src.getRootComponent();
+ Page dst = new Page(src.getRootComponent().getObjectId());
+ load(src, dst);
+ return dst;
+ }
- //
+ private void load(org.gatein.mop.api.workspace.Page src, Page dst)
+ {
Site site = src.getSite();
String ownerType = getOwnerType(site.getObjectType());
String ownerId = site.getName();
@@ -343,27 +344,20 @@
//
Attributes attrs = src.getAttributes();
- 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));
+ 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));
//
- Page dst = new Page(root.getObjectId(), data);
-
- //
loadChildren(src.getRootComponent(), dst);
-
- //
- return dst;
}
public List<ModelChange> save(Page src, Site site, String name)
@@ -380,6 +374,7 @@
{
dst = pages.addChild(name);
changes.add(new ModelChange.Create(src));
+ src.storageId = dst.getObjectId();
}
else
{
@@ -403,26 +398,20 @@
return changes;
}
- private ContainerData load(UIContainer src)
+ private void load(UIContainer src, Container dst)
{
- ContainerData data = new ContainerData();
-
- //
Attributes attrs = src.getAttributes();
- 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;
+ dst.setId(attrs.getValue(MappedAttributes.ID));
+ dst.setName(attrs.getValue(MappedAttributes.NAME));
+ dst.setTitle(attrs.getValue(MappedAttributes.TITLE));
+ dst.setIcon(attrs.getValue(MappedAttributes.ICON));
+ dst.setTemplate(attrs.getValue(MappedAttributes.TEMPLATE));
+ dst.setAccessPermissions(split("|", attrs.getValue(MappedAttributes.ACCESS_PERMISSIONS)));
+ dst.setFactoryId(attrs.getValue(MappedAttributes.FACTORY_ID));
+ dst.setDecorator(attrs.getValue(MappedAttributes.DECORATOR));
+ dst.setDescription(attrs.getValue(MappedAttributes.DESCRIPTION));
+ dst.setWidth(attrs.getValue(MappedAttributes.WIDTH));
+ dst.setHeight(attrs.getValue(MappedAttributes.HEIGHT));
}
private void loadChildren(UIContainer src, Container dst)
@@ -439,15 +428,22 @@
String type = attrs.getValue(MappedAttributes.TYPE);
if ("dashboard".equals(type))
{
- ApplicationData data = new ApplicationData();
- data.setShowInfoBar(false);
- data.setShowApplicationState(false);
- mo = new PortletApplication(srcContainer.getObjectId(), srcContainer.getName(), "dashboard", "DashboardPortlet", null, data);
+ TransientApplicationState<Preferences> state = new TransientApplicationState<Preferences>();
+ Site owner = src.getPage().getSite();
+ state.setOwnerType(getOwnerType(owner.getObjectType()));
+ state.setOwnerId(owner.getName());
+ PortletApplication dashboardApp =
+ new PortletApplication(srcContainer.getObjectId(), "dashboard", "DashboardPortlet");
+ dashboardApp.setStorageName(component.getName());
+ dashboardApp.setState(state);
+ dashboardApp.setShowInfoBar(false);
+ dashboardApp.setShowApplicationState(false);
+ mo = dashboardApp;
}
else
{
- ContainerData data = load(srcContainer);
- Container dstContainer = new Container(component.getObjectId(), data);
+ Container dstContainer = new Container(component.getObjectId());
+ load(srcContainer, dstContainer);
loadChildren(srcContainer, dstContainer);
mo = dstContainer;
}
@@ -455,7 +451,8 @@
else if (component instanceof UIWindow)
{
UIWindow window = (UIWindow)component;
- mo = load(window);
+ Application application = load(window);
+ mo = application;
}
else if (component instanceof UIBody)
{
@@ -466,6 +463,9 @@
throw new AssertionError();
}
+ // Set the loaded name
+ mo.storageName = component.getName();
+
// Add among children
dst.getChildren().add(mo);
}
@@ -578,21 +578,19 @@
if (app.storageId != null)
{
UIContainer dstDashboard = session.findObjectById(ObjectType.CONTAINER, app.storageId);
- ContainerData dashboardData = load(dstDashboard);
- Dashboard srcDashboard = new Dashboard(app.storageId, dashboardData);
+ Dashboard srcDashboard = new Dashboard(app.storageId);
+ load(dstDashboard, srcDashboard);
loadChildren(dstDashboard, srcDashboard);
srcChild = srcDashboard;
}
else
{
- ContainerData dashboardData = new ContainerData();
- dashboardData.setTemplate("classpath:groovy/dashboard/webui/component/UIColumnContainer.gtmpl");
- Dashboard dashboard = new Dashboard(dashboardData);
+ Dashboard dashboard = new Dashboard();
+ dashboard.setTemplate("classpath:groovy/dashboard/webui/component/UIColumnContainer.gtmpl");
for (int i = 0; i < 3; i++)
{
- ContainerData rowData = new ContainerData();
- rowData.setTemplate("classpath:groovy/dashboard/webui/component/UIContainer.gtmpl");
- Container row = new Container(rowData);
+ Container row = new Container();
+ row.setTemplate("classpath:groovy/dashboard/webui/component/UIContainer.gtmpl");
dashboard.getChildren().add(row);
}
srcChild = dashboard;
@@ -668,6 +666,8 @@
{
throw new AssertionError("Was not expecting child " + srcChild);
}
+ srcChild.storageId = dstChild.getObjectId();
+ srcChild.storageName = name;
changes.add(new ModelChange.Create(srcChild));
}
@@ -746,23 +746,6 @@
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)
{
@@ -771,26 +754,20 @@
String portletName = contentId.substring(pos + 1);
@SuppressWarnings("unchecked")
Application<S, I> application =
- (Application<S, I>)new PortletApplication(
- src.getObjectId(),
- src.getName(),
- applicationName,
- portletName,
- (PersistentApplicationState<Preferences>)instanceState,
- data);
+ (Application<S, I>)new PortletApplication(src.getObjectId(), applicationName, portletName);
dst = application;
}
else if (contentType == Gadget.CONTENT_TYPE)
{
@SuppressWarnings("unchecked")
- Application<S, I> application = (Application<S, I>)new GadgetApplication(src.getObjectId(), src.getName(), new GadgetId(contentId), (PersistentApplicationState<Gadget>)instanceState, data);
+ Application<S, I> application = (Application<S, I>)new GadgetApplication(src.getObjectId(), contentId);
dst = application;
}
else if (contentType == WSRPState.CONTENT_TYPE)
{
@SuppressWarnings("unchecked")
Application<S, I> application =
- (Application<S, I>)new WSRPApplication(src.getObjectId(), src.getName(), new WSRPId(contentId), (PersistentApplicationState<WSRPState>)instanceState, data);
+ (Application<S, I>)new WSRPApplication(src.getObjectId(), new WSRPId(contentId));
dst = application;
}
else
@@ -799,6 +776,25 @@
}
//
+ 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;
}
@@ -975,8 +971,8 @@
public Dashboard loadDashboard(UIContainer container)
{
- ContainerData dashboardData = load(container);
- Dashboard dashboard = new Dashboard(container.getObjectId(), dashboardData);
+ Dashboard dashboard = new Dashboard(container.getObjectId());
+ load(container, dashboard);
loadChildren(container, dashboard);
return dashboard;
}
@@ -1017,11 +1013,9 @@
public static void save(Properties src, Attributes dst)
{
- if (src != null) {
- for (Map.Entry<String, String> property : src.entrySet())
- {
- dst.setString(property.getKey(), property.getValue());
- }
+ 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 19:40:46 UTC (rev 401)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/ModelObject.java 2009-10-22 22:02:30 UTC (rev 402)
@@ -27,27 +27,24 @@
{
/** Storage id. */
- final String storageId;
+ String storageId;
/** The storage name that is unique among a container context. */
- final String storageName;
+ String storageName;
/**
* Create a new object.
*
- * @param storageId the storage name
- * @param storageName the storage name
+ * @param storageId if the storage id is null
*/
- public ModelObject(String storageId, String storageName)
+ public ModelObject(String storageId)
{
this.storageId = storageId;
- this.storageName = storageName;
}
protected ModelObject()
{
this.storageId = null;
- this.storageName = null;
}
public String getStorageId()
@@ -59,4 +56,10 @@
{
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 19:40:46 UTC (rev 401)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/Page.java 2009-10-22 22:02:30 UTC (rev 402)
@@ -31,69 +31,59 @@
final static public String DEFAULT_PAGE = "Default";
- private final String ownerType;
+ private String ownerType;
- private final String ownerId;
+ private String ownerId;
- private final String editPermission;
+ private String[] accessPermissions;
- private final boolean showMaxWindow;
+ private String editPermission;
- private final String creator;
+ private boolean showMaxWindow = false;
- private final String modifier;
+ private String creator;
- public Page(Page page, PageData data)
+ private String modifier;
+
+ private transient boolean modifiable;
+
+ public Page()
{
- this(page.getStorageId(), data);
}
- public Page(PageData data)
+ public Page(String storageId)
{
- this((String)null, data);
+ super(storageId);
}
- public Page(String storageId, PageData data)
+ public String getOwnerId()
{
- super(storageId, data);
+ return 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 void setOwnerId(String ownerId)
+ {
+ this.ownerId = ownerId;
}
- 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 String getOwnerType()
+ {
+ return ownerType;
}
- @Override
- public PageData buildData()
+ public void setOwnerType(String ownerType)
{
- PageData data = new PageData();
- populate(data);
- return data;
+ this.ownerType = ownerType;
}
- public String getOwnerId()
+ public String[] getAccessPermissions()
{
- return ownerId;
+ return accessPermissions;
}
- public String getOwnerType()
+ public void setAccessPermissions(String[] s)
{
- return ownerType;
+ accessPermissions = s;
}
public String getEditPermission()
@@ -101,11 +91,21 @@
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,16 +118,57 @@
}
}
+ 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 19:40:46 UTC (rev 401)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PageBody.java 2009-10-22 22:02:30 UTC (rev 402)
@@ -28,7 +28,7 @@
public PageBody(String storageId)
{
- super(storageId, null);
+ super(storageId);
}
public PageBody()
Deleted: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PageData.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PageData.java 2009-10-22 19:40:46 UTC (rev 401)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PageData.java 2009-10-22 22:02:30 UTC (rev 402)
@@ -1,136 +0,0 @@
-/*
- * Copyright (C) 2003-2007 eXo Platform SAS.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
- */
-package org.exoplatform.portal.config.model;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public class 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 19:40:46 UTC (rev 401)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PageNode.java 2009-10-22 22:02:30 UTC (rev 402)
@@ -190,9 +190,9 @@
return visible;
}
- public void setVisible(boolean b)
+ public void setVisible(Boolean b)
{
- visible = b;
+ visible = b.booleanValue();
}
private boolean isInPublicationDate()
@@ -208,9 +208,9 @@
return false;
}
- public void setShowPublicationDate(boolean show)
+ public void setShowPublicationDate(Boolean show)
{
- showPublicationDate = show;
+ showPublicationDate = show.booleanValue();
}
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 19:40:46 UTC (rev 401)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PageNodeContainer.java 2009-10-22 22:02:30 UTC (rev 402)
@@ -30,7 +30,7 @@
public PageNodeContainer(String storageId)
{
- super(storageId, null);
+ super(storageId);
}
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 19:40:46 UTC (rev 401)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PortalConfig.java 2009-10-22 22:02:30 UTC (rev 402)
@@ -70,7 +70,7 @@
public PortalConfig(String type, String ownerId, String storageId)
{
- super(storageId, null);
+ super(storageId);
//
this.type = type;
@@ -82,12 +82,12 @@
this.type = type;
//
- setPortalLayout(new Container(new ContainerData()));
+ setPortalLayout(new Container());
}
PortalConfig(String storageId, String type)
{
- super(storageId, null);
+ super(storageId);
//
this.type = type;
@@ -291,8 +291,10 @@
*/
private static Container initDefaultLayout()
{
- Container container = new Container(new ContainerData());
- container.getChildren().add(new PageBody());
+ Container container = new Container();
+ ArrayList<ModelObject> children = new ArrayList<ModelObject>();
+ children.add(new PageBody());
+ container.setChildren(children);
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 19:40:46 UTC (rev 401)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/SiteBody.java 2009-10-22 22:02:30 UTC (rev 402)
@@ -24,7 +24,7 @@
public SiteBody(String storageId)
{
- super(storageId, null);
+ super(storageId);
}
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 19:40:46 UTC (rev 401)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/gadget/GadgetApplication.java 2009-10-22 22:02:30 UTC (rev 402)
@@ -20,10 +20,7 @@
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;
/**
@@ -33,21 +30,26 @@
public class GadgetApplication extends Application<Gadget, GadgetId>
{
- public GadgetApplication(String storageId, String storageName, GadgetId gadgetId, PersistentApplicationState<Gadget> state, ApplicationData data)
+ public GadgetApplication(String storageId, String gadgetName)
{
- super(storageId, storageName, gadgetId, state, data);
+ super(storageId, new GadgetId(gadgetName));
}
- public GadgetApplication(String storageName, GadgetId ref, TransientApplicationState<Gadget> state, ApplicationData data)
+ public GadgetApplication(String gadgetName)
{
- super(storageName, ref, state, data);
+ super(new GadgetId(gadgetName));
}
- public GadgetApplication(GadgetId ref, TransientApplicationState<Gadget> state)
+ public GadgetApplication(String storageId, GadgetId instanceId)
{
- super(null, ref, state, null);
+ super(storageId, instanceId);
}
+ 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 19:40:46 UTC (rev 401)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/portlet/PortletApplication.java 2009-10-22 22:02:30 UTC (rev 402)
@@ -20,11 +20,7 @@
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;
/**
@@ -34,35 +30,24 @@
public class PortletApplication extends Application<Preferences, PortletId>
{
- public PortletApplication(
- String storageId,
- String storageName,
- String applicationName,
- String portletName,
- PersistentApplicationState<Preferences> state,
- ApplicationData data)
+ public PortletApplication(String storageId, String applicationName, String portletName)
{
- super(storageId, storageName, new PortletId(applicationName, portletName), state, data);
+ super(storageId, new PortletId(applicationName, portletName));
}
- public PortletApplication(
- String storageId,
- String storageName,
- PortletId id,
- PersistentApplicationState<Preferences> state,
- ApplicationData data)
+ public PortletApplication(String applicationName, String portletName)
{
- super(storageId, storageName, id, state, data);
+ super(new PortletId(applicationName, portletName));
}
- public PortletApplication(String storageName, PortletId ref, TransientApplicationState<Preferences> state, ApplicationData data)
+ public PortletApplication(String storageId, PortletId instanceId)
{
- super(storageName, ref, state, data);
+ super(storageId, instanceId);
}
- public PortletApplication(String applicationName, String portletName, TransientApplicationState<Preferences> state)
+ public PortletApplication(PortletId instanceId)
{
- super(null, new PortletId(applicationName, portletName), state, null);
+ super(instanceId);
}
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 19:40:46 UTC (rev 401)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/wsrp/WSRPApplication.java 2009-10-22 22:02:30 UTC (rev 402)
@@ -20,10 +20,7 @@
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;
/**
@@ -33,14 +30,14 @@
public class WSRPApplication extends Application<WSRPState, WSRPId>
{
- public WSRPApplication(String storageId, String storageName, WSRPId id, PersistentApplicationState<WSRPState> state, ApplicationData data)
+ public WSRPApplication(String storageId, WSRPId id)
{
- super(storageId, storageName, id, state, data);
+ super(storageId, id);
}
- public WSRPApplication(String storageName, WSRPId id, TransientApplicationState<WSRPState> state, ApplicationData data)
+ public WSRPApplication(WSRPId id)
{
- super(storageName, id, state, data);
+ super(id);
}
@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 19:40:46 UTC (rev 401)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/serialize/AbstractApplicationHandler.java 2009-10-22 22:02:30 UTC (rev 402)
@@ -19,8 +19,6 @@
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;
@@ -42,18 +40,45 @@
* @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
* @version $Revision$
*/
-public class AbstractApplicationHandler extends AbstractHandler
+public class AbstractApplicationHandler implements IMarshaller, IUnmarshaller, IAliasable
{
+ 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)
{
- super(m_uri, m_index, 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);
+ }
+
public Object unmarshal(Object obj, IUnmarshallingContext ictx) throws JiBXException
{
UnmarshallingContext ctx = (UnmarshallingContext)ictx;
@@ -75,8 +100,7 @@
ctx.parsePastStartTag(m_uri, m_name);
//
- PortletId portletId;
- TransientApplicationState<Preferences> state;
+ PortletApplication app;
if ("application".equals(m_name))
{
String instanceId = ctx.parseElementText(m_uri, "instance-id");
@@ -87,6 +111,7 @@
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>();
@@ -97,14 +122,15 @@
}
state.setOwnerType(ownerType);
state.setOwnerId(ownerId);
- portletId = new PortletId(persistenceChunks[0], persistenceChunks[1]);
+ app = new PortletApplication(persistenceChunks[0], persistenceChunks[1]);
+ app.setState(state);
}
else
{
ctx.parsePastStartTag(m_uri, "portlet");
String applicationName = ctx.parseElementText(m_uri, "application-ref");
String portletName = ctx.parseElementText(m_uri, "portlet-ref");
- state = new TransientApplicationState<Preferences>();
+ TransientApplicationState<Preferences> state = new TransientApplicationState<Preferences>();
if (ctx.isAt(m_uri, "preferences"))
{
PreferencesBuilder builder = new PreferencesBuilder();
@@ -117,7 +143,8 @@
ctx.parsePastEndTag(m_uri, "preferences");
state.setContentState(builder.build());
}
- portletId = new PortletId(applicationName, portletName);
+ app = new PortletApplication(applicationName, portletName);
+ app.setState(state);
ctx.parsePastEndTag(m_uri, "portlet");
}
@@ -145,21 +172,51 @@
ctx.parsePastEndTag(m_uri, m_name);
//
- 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);
+ 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);
//
- return new PortletApplication(null, portletId, state, data);
+ return app;
}
+
+ 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;
+ }
}
Deleted: 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 2009-10-22 19:40:46 UTC (rev 401)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/serialize/AbstractHandler.java 2009-10-22 22:02:30 UTC (rev 402)
@@ -1,116 +0,0 @@
-/*
- * Copyright (C) 2003-2007 eXo Platform SAS.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
- */
-package org.exoplatform.portal.config.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;
- }
-}
Deleted: 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 2009-10-22 19:40:46 UTC (rev 401)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/serialize/ContainerHandler.java 2009-10-22 22:02:30 UTC (rev 402)
@@ -1,104 +0,0 @@
-/*
- * Copyright (C) 2003-2007 eXo Platform SAS.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
- */
-package org.exoplatform.portal.config.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;
- }
-}
Deleted: 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 2009-10-22 19:40:46 UTC (rev 401)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/serialize/OwnerContext.java 2009-10-22 22:02:30 UTC (rev 402)
@@ -1,70 +0,0 @@
-/*
- * Copyright (C) 2003-2007 eXo Platform SAS.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
- */
-package org.exoplatform.portal.config.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();
- }
-}
Deleted: 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 2009-10-22 19:40:46 UTC (rev 401)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/serialize/PageHandler.java 2009-10-22 22:02:30 UTC (rev 402)
@@ -1,110 +0,0 @@
-/*
- * Copyright (C) 2003-2007 eXo Platform SAS.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
- */
-package org.exoplatform.portal.config.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;
- }
-}
Deleted: 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 2009-10-22 19:40:46 UTC (rev 401)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/serialize/PageNavigationHandler.java 2009-10-22 22:02:30 UTC (rev 402)
@@ -1,129 +0,0 @@
-/*
- * Copyright (C) 2003-2007 eXo Platform SAS.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
- */
-package org.exoplatform.portal.config.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);
- }
- }
- }
-}
Deleted: 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 2009-10-22 19:40:46 UTC (rev 401)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/serialize/PortalConfigHandler.java 2009-10-22 22:02:30 UTC (rev 402)
@@ -1,126 +0,0 @@
-/*
- * Copyright (C) 2003-2007 eXo Platform SAS.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
- */
-package org.exoplatform.portal.config.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);
- }
- }
- }
-*/
-}
Deleted: 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 2009-10-22 19:40:46 UTC (rev 401)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/serialize/PortalLayoutHandler.java 2009-10-22 22:02:30 UTC (rev 402)
@@ -1,34 +0,0 @@
-/*
- * Copyright (C) 2003-2007 eXo Platform SAS.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
- */
-package org.exoplatform.portal.config.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 19:40:46 UTC (rev 401)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMDataStorage.java 2009-10-22 22:02:30 UTC (rev 402)
@@ -25,9 +25,11 @@
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;
@@ -46,6 +48,7 @@
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>
@@ -222,13 +225,10 @@
}
}
-/*
- */
-/**
+ /**
* 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,7 +243,6 @@
((Application)obj).setStorageName(UUID.randomUUID().toString());
}
}
-*/
public Container getSharedLayout() throws Exception
{
@@ -253,7 +252,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 19:40:46 UTC (rev 401)
+++ portal/branches/performance/component/portal/src/main/resources/binding.xml 2009-10-22 22:02:30 UTC (rev 402)
@@ -34,6 +34,28 @@
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"
@@ -41,38 +63,97 @@
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"
- marshaller="org.exoplatform.portal.config.serialize.ContainerHandler"
- unmarshaller="org.exoplatform.portal.config.serialize.ContainerHandler">
+ <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>
- <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 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>
- <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">
+ <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"/>
@@ -85,23 +166,35 @@
<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"
- marshaller="org.exoplatform.portal.config.serialize.PortalConfigHandler"
- unmarshaller="org.exoplatform.portal.config.serialize.PortalConfigHandler">
+ <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>
<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"
- marshaller="org.exoplatform.portal.config.serialize.PageNavigationHandler"
- unmarshaller="org.exoplatform.portal.config.serialize.PageNavigationHandler">
+ <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>
-
+
+
<mapping name="portlet-preferences-set"
class="org.exoplatform.portal.application.PortletPreferences$PortletPreferencesSet">
<collection field="portlets"
@@ -117,9 +210,7 @@
</mapping>
<mapping class="org.exoplatform.portal.application.PortletPreferences"
- name="portlet-preferences"
- label="portlet-preferences"
- post-set="postSet">
+ name="portlet-preferences" label="portlet-preferences">
<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 19:40:46 UTC (rev 401)
+++ portal/branches/performance/component/portal/src/test/java/org/exoplatform/portal/config/TestDataStorage.java 2009-10-22 22:02:30 UTC (rev 402)
@@ -19,9 +19,6 @@
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;
@@ -147,11 +144,10 @@
private void createPageConfig(String ownerType, String ownerId) throws Exception
{
- PageData data = new PageData();
- data.setName("testPage");
- data.setOwnerId("classic");
- data.setOwnerType("portal");
- Page page = new Page(data);
+ Page page = new Page();
+ page.setName("testPage");
+ page.setOwnerId("classic");
+ page.setOwnerType("portal");
try
{
@@ -185,14 +181,9 @@
portalConfig.setAccessPermissions(new String[]{UserACL.EVERYONE});
storage_.create(portalConfig);
- 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.setTitle("New Page Title");
+ page.setOwnerId("customers");
+ storage_.save(page);
Page returnPage = storage_.getPage(page.getPageId());
assertEquals("New Page Title", returnPage.getTitle());
@@ -303,14 +294,12 @@
public void testWindowScopedPortletPreferences() throws Exception
{
- PageData data = new PageData();
- data.setOwnerType("portal");
- data.setOwnerId("test");
- data.setName("foo");
- Page page = new Page(data);
+ Page page = new Page();
+ page.setPageId("portal::test::foo");
TransientApplicationState<Preferences> state = new TransientApplicationState<Preferences>();
state.setContentState(new PreferencesBuilder().add("template", "bar").build());
- PortletApplication app = new PortletApplication("web", "BannerPortlet", state);
+ PortletApplication app = new PortletApplication("web", "BannerPortlet");
+ app.setState(state);
page.getChildren().add(app);
storage_.save(page);
page = storage_.getPage(page.getPageId());
@@ -453,12 +442,9 @@
public void testDashboard() throws Exception
{
- 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()));
+ Page page = new Page();
+ page.setPageId("portal::test::foo");
+ page.getChildren().add(new Dashboard());
storage_.save(page);
//
@@ -472,9 +458,10 @@
assertEquals("DashboardPortlet", dashboardPortlet.getRef().getPortletName());
// Configures the dashboard
- Dashboard dashboard = new Dashboard(dashboardId, new ContainerData());
+ Dashboard dashboard = new Dashboard(dashboardId);
TransientApplicationState<Preferences> state = new TransientApplicationState<Preferences>();
- PortletApplication app = new PortletApplication("foo", "bar", state);
+ PortletApplication app = new PortletApplication("foo", "bar");
+ app.setState(state);
dashboard.getChildren().add(app);
// Attempt to save a dashboard with a portlet on it
@@ -496,15 +483,13 @@
public void testDashboardLayout() throws Exception
{
- TransientApplicationState<Preferences> state = new TransientApplicationState<Preferences>();
- PortletApplication dashboardPortlet = new PortletApplication("dashboard", "DashboardPortlet", state);
+ PortletApplication dashboardPortlet = new PortletApplication("dashboard", "DashboardPortlet");
+ ApplicationState<Preferences> state = new TransientApplicationState<Preferences>();
+ dashboardPortlet.setState(state);
//
- PageData data = new PageData();
- data.setOwnerType("portal");
- data.setOwnerId("test");
- data.setName("foo");
- Page page = new Page(data);
+ Page page = new Page();
+ page.setPageId("portal::test::foo");
page.getChildren().add(dashboardPortlet);
storage_.save(page);
@@ -526,12 +511,9 @@
public void testDashboardMoveRight() throws Exception
{
- 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));
+ Page page = new Page();
+ page.setPageId("portal::test::foo");
+ page.getChildren().add(new PortletApplication("dashboard", "DashboardPortlet"));
storage_.save(page);
page = storage_.getPage("portal::test::foo");
String id = page.getChildren().get(0).getStorageId();
@@ -541,7 +523,8 @@
// Put a gadget in one container
Container row0 = (Container)dashboard.getChildren().get(0);
- GadgetApplication gadgetApp = new GadgetApplication(new GadgetId("foo"), new TransientApplicationState<Gadget>());
+ GadgetApplication gadgetApp = new GadgetApplication("foo");
+ gadgetApp.setState(new TransientApplicationState<Gadget>());
row0.getChildren().add(gadgetApp);
// Save the dashboard
@@ -570,12 +553,9 @@
public void testDashboardMoveLeft() throws Exception
{
- 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));
+ Page page = new Page();
+ page.setPageId("portal::test::foo");
+ page.getChildren().add(new PortletApplication("dashboard", "DashboardPortlet"));
storage_.save(page);
page = storage_.getPage("portal::test::foo");
String id = page.getChildren().get(0).getStorageId();
@@ -585,7 +565,8 @@
// Put a gadget in one container
Container row1 = (Container)dashboard.getChildren().get(1);
- GadgetApplication gadgetApp = new GadgetApplication(new GadgetId("foo"), new TransientApplicationState<Gadget>());
+ GadgetApplication gadgetApp = new GadgetApplication("foo");
+ gadgetApp.setState(new TransientApplicationState<Gadget>());
row1.getChildren().add(gadgetApp);
// Save the dashboard
@@ -623,7 +604,8 @@
TransientApplicationState<Preferences> state = new TransientApplicationState<Preferences>(persistenceChunks[2]);
state.setOwnerType(ownerType);
state.setOwnerId(ownerId);
- PortletApplication portletApp = new PortletApplication(persistenceChunks[0], persistenceChunks[1], state);
+ PortletApplication portletApp = new PortletApplication(persistenceChunks[0], persistenceChunks[1]);
+ portletApp.setState(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 19:40:46 UTC (rev 401)
+++ portal/branches/performance/component/portal/src/test/java/org/exoplatform/portal/config/TestGadget.java 2009-10-22 22:02:30 UTC (rev 402)
@@ -21,10 +21,8 @@
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;
@@ -69,13 +67,11 @@
Gadget gadget = new Gadget();
gadget.setUserPref("user_pref");
state.setContentState(gadget);
- GadgetApplication gadgetApplication = new GadgetApplication(new GadgetId("bar"), state);
+ GadgetApplication gadgetApplication = new GadgetApplication("bar");
+ gadgetApplication.setState(state);
- PageData data = new PageData();
- data.setOwnerType("portal");
- data.setOwnerId("test");
- data.setName("gadget_page");
- Page container = new Page(data);
+ Page container = new Page();
+ container.setPageId("portal::test::gadget_page");
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 19:40:46 UTC (rev 401)
+++ portal/branches/performance/component/portal/src/test/java/org/exoplatform/portal/config/TestJIBXXmlMapping.java 2009-10-22 22:02:30 UTC (rev 402)
@@ -82,6 +82,13 @@
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
@@ -92,6 +99,11 @@
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 19:40:46 UTC (rev 401)
+++ portal/branches/performance/component/portal/src/test/java/org/exoplatform/portal/config/TestUserPortalConfigService.java 2009-10-22 22:02:30 UTC (rev 402)
@@ -27,7 +27,6 @@
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;
@@ -422,11 +421,10 @@
{
public void execute() throws Exception
{
- PageData data = new PageData();
- data.setOwnerType("group");
- data.setOwnerId("/platform/administrators");
- data.setName("newAccount");
- Page page = new Page(data);
+ Page page = new Page();
+ page.setOwnerType("group");
+ page.setOwnerId("/platform/administrators");
+ page.setName("newAccount");
assertTrue(events.isEmpty());
userPortalConfigSer_.remove(page);
assertEquals(1, events.size());
@@ -447,11 +445,10 @@
{
public void execute() throws Exception
{
- PageData data = new PageData();
- data.setOwnerType("group");
- data.setOwnerId("/platform/administrators");
- data.setName("whatever");
- Page page = new Page(data);
+ Page page = new Page();
+ page.setOwnerType("group");
+ page.setOwnerId("/platform/administrators");
+ page.setName("whatever");
assertTrue(events.isEmpty());
userPortalConfigSer_.create(page);
assertEquals(1, events.size());
@@ -472,12 +469,11 @@
{
public void execute() throws Exception
{
- PageData data = new PageData();
- data.setOwnerType("group");
- data.setOwnerId("/platform/administrators");
- data.setName("newAccount");
- data.setCreator("someone");
- Page page = new Page(data);
+ Page page = new Page();
+ page.setOwnerType("group");
+ page.setOwnerId("/platform/administrators");
+ page.setName("newAccount");
+ page.setCreator("someone");
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 19:40:46 UTC (rev 401)
+++ portal/branches/performance/component/portal/src/test/java/org/exoplatform/portal/config/security/AbstractTestSharedPageACL.java 2009-10-22 22:02:30 UTC (rev 402)
@@ -20,7 +20,6 @@
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>
@@ -33,11 +32,10 @@
public void testPage()
{
- PageData data = new PageData();
- data.setOwnerType("group");
- data.setOwnerId("foo");
- data.setAccessPermissions(new String[0]);
- Page page = new Page(data);
+ Page page = new Page();
+ page.setOwnerType("group");
+ page.setOwnerId("foo");
+ page.setAccessPermissions(new String[0]);
//
assertTrue(root.hasPermission(page));
@@ -56,11 +54,10 @@
public void testPageAccessibleByEveryone()
{
- PageData data = new PageData();
- data.setOwnerType("group");
- data.setOwnerId("foo");
- data.setAccessPermissions(new String[]{"Everyone"});
- Page page = new Page(data);
+ Page page = new Page();
+ page.setOwnerType("group");
+ page.setOwnerId("foo");
+ page.setAccessPermissions(new String[]{"Everyone"});
//
assertTrue(root.hasPermission(page));
@@ -79,12 +76,11 @@
public void testPageEditableByEveryone()
{
- PageData data = new PageData();
- data.setOwnerType("group");
- data.setOwnerId("foo");
- data.setAccessPermissions(new String[0]);
- data.setEditPermission("Everyone");
- Page page = new Page(data);
+ Page page = new Page();
+ page.setOwnerType("group");
+ page.setOwnerId("foo");
+ page.setAccessPermissions(new String[0]);
+ page.setEditPermission("Everyone");
//
assertTrue(root.hasPermission(page));
@@ -103,11 +99,10 @@
public void testPageAccessibleByGuests()
{
- PageData data = new PageData();
- data.setOwnerType("group");
- data.setOwnerId("foo");
- data.setAccessPermissions(new String[]{"whatever:/platform/guests"});
- Page page = new Page(data);
+ Page page = new Page();
+ page.setOwnerType("group");
+ page.setOwnerId("foo");
+ page.setAccessPermissions(new String[]{"whatever:/platform/guests"});
//
assertTrue(root.hasPermission(page));
@@ -126,12 +121,11 @@
public void testPageEditableByGuests()
{
- 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);
+ Page page = new Page();
+ page.setOwnerType("group");
+ page.setOwnerId("foo");
+ page.setAccessPermissions(new String[0]);
+ page.setEditPermission("whatever:/platform/guests");
//
assertTrue(root.hasPermission(page));
@@ -150,11 +144,10 @@
public void testPageAccessibleByEveryOneAndGuests()
{
- PageData data = new PageData();
- data.setOwnerType("group");
- data.setOwnerId("foo");
- data.setAccessPermissions(new String[]{"Everyone", "whatever:/platform/guests"});
- Page page = new Page(data);
+ Page page = new Page();
+ page.setOwnerType("group");
+ page.setOwnerId("foo");
+ page.setAccessPermissions(new String[]{"Everyone", "whatever:/platform/guests"});
//
assertTrue(root.hasPermission(page));
@@ -173,11 +166,10 @@
public void testPageWithAccessPermission()
{
- PageData data = new PageData();
- data.setOwnerType("group");
- data.setOwnerId("foo");
- data.setAccessPermissions(new String[]{"manager:/manageable"});
- Page page = new Page(data);
+ Page page = new Page();
+ page.setOwnerType("group");
+ page.setOwnerId("foo");
+ page.setAccessPermissions(new String[]{"manager:/manageable"});
//
assertTrue(root.hasPermission(page));
@@ -187,8 +179,7 @@
assertFalse(guest.hasPermission(page));
//
- data.setAccessPermissions(new String[]{"*:/manageable"});
- page = new Page(data);
+ page.setAccessPermissions(new String[]{"*:/manageable"});
//
assertTrue(root.hasPermission(page));
@@ -200,12 +191,11 @@
public void testPageWithEditPermission()
{
- PageData data = new PageData();
- data.setOwnerType("group");
- data.setOwnerId("foo");
- data.setAccessPermissions(new String[0]);
- data.setEditPermission("manager:/manageable");
- Page page = new Page(data);
+ Page page = new Page();
+ page.setOwnerType("group");
+ page.setOwnerId("foo");
+ page.setAccessPermissions(new String[0]);
+ page.setEditPermission("manager:/manageable");
//
assertTrue(root.hasPermission(page));
@@ -215,8 +205,7 @@
assertFalse(guest.hasPermission(page));
//
- data.setEditPermission("*:/manageable");
- page = new Page(data);
+ page.setEditPermission("*:/manageable");
//
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 19:40:46 UTC (rev 401)
+++ portal/branches/performance/component/portal/src/test/java/org/exoplatform/portal/config/security/TestUserPageACL.java 2009-10-22 22:02:30 UTC (rev 402)
@@ -20,7 +20,6 @@
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>
@@ -30,11 +29,10 @@
{
public void testUserPageIsAlwaysUsableOnlyByItsOwner()
{
- PageData data = new PageData();
- data.setOwnerType("user");
- data.setOwnerId("user");
- data.setAccessPermissions(new String[0]);
- Page page = new Page(data);
+ Page page = new Page();
+ page.setOwnerType("user");
+ page.setOwnerId("user");
+ page.setAccessPermissions(new String[0]);
assertTrue(root.hasPermission(page));
assertFalse(administrator.hasPermission(page));
assertFalse(manager.hasPermission(page));
@@ -47,8 +45,10 @@
assertFalse(guest.hasEditPermission(page));
//
- data.setAccessPermissions(new String[]{"manager:/manageable"});
- page = new Page(data);
+ page = new Page();
+ page.setOwnerType("user");
+ page.setOwnerId("user");
+ page.setAccessPermissions(new String[]{"manager:/manageable"});
assertTrue(root.hasPermission(page));
assertFalse(administrator.hasPermission(page));
assertTrue(manager.hasPermission(page));
@@ -61,9 +61,11 @@
assertFalse(guest.hasEditPermission(page));
//
- data.setAccessPermissions(new String[0]);
- data.setEditPermission("manager:/manageable");
- page = new Page(data);
+ page = new Page();
+ page.setOwnerType("user");
+ page.setOwnerId("user");
+ page.setAccessPermissions(new String[0]);
+ page.setEditPermission("manager:/manageable");
assertTrue(root.hasPermission(page));
assertFalse(administrator.hasPermission(page));
//assertTrue(manager.hasPermission(page));
@@ -77,8 +79,10 @@
assertFalse(guest.hasEditPermission(page));
//
- data.setAccessPermissions(new String[]{"Everyone"});
- page = new Page(data);
+ page = new Page();
+ page.setOwnerType("user");
+ page.setOwnerId("user");
+ page.setAccessPermissions(new String[]{"Everyone"});
assertTrue(root.hasPermission(page));
assertTrue(administrator.hasPermission(page));
assertTrue(manager.hasPermission(page));
@@ -91,9 +95,11 @@
assertFalse(guest.hasEditPermission(page));
//
- data.setAccessPermissions(new String[0]);
- data.setEditPermission("Everyone");
- page = new Page(data);
+ page = new Page();
+ page.setOwnerType("user");
+ page.setOwnerId("user");
+ page.setAccessPermissions(new String[0]);
+ page.setEditPermission("Everyone");
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 19:40:46 UTC (rev 401)
+++ portal/branches/performance/portlet/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/UITabPaneDashboard.java 2009-10-22 22:02:30 UTC (rev 402)
@@ -22,7 +22,6 @@
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;
@@ -180,8 +179,7 @@
Page page =
configService.createPageTemplate(UITabPaneDashboard.PAGE_TEMPLATE, pageNavigation.getOwnerType(),
pageNavigation.getOwnerId());
- PageData data = page.buildData();
- data.setTitle(nodeLabel);
+ page.setTitle(nodeLabel);
PageNode pageNode = new PageNode();
pageNode.setLabel(nodeLabel);
@@ -191,7 +189,7 @@
uniqueNodeName = uniqueNodeName + "_" + System.currentTimeMillis();
}
- data.setName(uniqueNodeName);
+ page.setName(uniqueNodeName);
pageNode.setName(uniqueNodeName);
pageNode.setUri(uniqueNodeName);
pageNode.setPageReference(page.getPageId());
@@ -199,7 +197,7 @@
pageNavigation.addNode(pageNode);
uiPortal.setSelectedNode(pageNode);
- configService.create(new Page(page.getStorageId(), data));
+ configService.create(page);
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 19:40:46 UTC (rev 401)
+++ portal/branches/performance/portlet/exoadmin/src/main/java/org/exoplatform/toolbar/webui/component/UIUserToolBarDashboardPortlet.java 2009-10-22 22:02:30 UTC (rev 402)
@@ -22,7 +22,6 @@
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;
@@ -110,9 +109,8 @@
Page page =
_configService.createPageTemplate(PAGE_TEMPLATE, _pageNavigation.getOwnerType(), _pageNavigation
.getOwnerId());
- PageData data = page.buildData();
- data.setTitle(_nodeName);
- data.setName(_nodeName);
+ page.setTitle(_nodeName);
+ page.setName(_nodeName);
PageNode pageNode = new PageNode();
pageNode.setName(_nodeName);
@@ -122,7 +120,7 @@
pageNode.setPageReference(page.getPageId());
_pageNavigation.addNode(pageNode);
- _configService.create(new Page(page, data));
+ _configService.create(page);
_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 19:40:46 UTC (rev 401)
+++ portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIAddNewApplication.java 2009-10-22 22:02:30 UTC (rev 402)
@@ -254,6 +254,10 @@
{
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 19:40:46 UTC (rev 401)
+++ portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UINavigationNodeSelector.java 2009-10-22 22:02:30 UTC (rev 402)
@@ -22,7 +22,6 @@
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;
@@ -431,13 +430,11 @@
// get selected page
Page selectPage = null;
selectPage = userService.getPage(selectedPageNode.getPageReference(), context.getRemoteUser());
- PageData data = selectPage.buildData();
- selectPage.populate(data);
- data.setModifier(context.getRemoteUser());
- data.setTitle(selectedPageNode.getLabel());
+ selectPage.setModifier(context.getRemoteUser());
+ selectPage.setTitle(selectedPageNode.getLabel());
// convert Page to UIPage
- PortalDataMapper.toUIPage(uiPage, new Page(selectPage, data));
+ PortalDataMapper.toUIPage(uiPage, selectPage);
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 19:40:46 UTC (rev 401)
+++ portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIDesktopPage.java 2009-10-22 22:02:30 UTC (rev 402)
@@ -118,6 +118,8 @@
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 19:40:46 UTC (rev 401)
+++ portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageActionListener.java 2009-10-22 22:02:30 UTC (rev 402)
@@ -24,6 +24,7 @@
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;
@@ -347,6 +348,8 @@
{
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;
@@ -371,6 +374,8 @@
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 19:40:46 UTC (rev 401)
+++ portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageBrowser.java 2009-10-22 22:02:30 UTC (rev 402)
@@ -28,7 +28,6 @@
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;
@@ -63,7 +62,6 @@
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;
@@ -256,9 +254,7 @@
return;
}
Page page = service.getPage(id, pcontext.getRemoteUser());
- UserACL userACL = uiPageBrowser.getApplicationComponent(UserACL.class);
- boolean modifiable = userACL.hasPermission(page);
- if (page == null || !modifiable)
+ if (page == null || !page.isModifiable())
{
uiPortalApp.addMessage(new ApplicationMessage("UIPageBrowser.msg.delete.NotDelete", new String[]{id}, 1));
pcontext.addUIComponentToUpdateByAjax(uiPortalApp.getUIPopupMessages());
@@ -392,9 +388,8 @@
UIPortalApplication uiPortalApp = uiPageForm.getAncestorOfType(UIPortalApplication.class);
PortalRequestContext pcontext = Util.getPortalRequestContext();
UIPage uiPage = uiPageForm.getUIPage();
- Page page = uiPageForm.invokeSetBindingBean(new Page(new PageData()));
- List<ModelObject> children = new ArrayList<ModelObject>(page.getChildren());
- PageData data = page.buildData();
+ Page page = new Page();
+ uiPageForm.invokeSetBindingBean(page);
UserPortalConfigService configService = uiPageForm.getApplicationComponent(UserPortalConfigService.class);
// create new page
if (uiPage == null)
@@ -407,15 +402,16 @@
pcontext.addUIComponentToUpdateByAjax(uiPortalApp.getUIPopupMessages());
return;
}
- data.setCreator(pcontext.getRemoteUser());
- page = new Page(page, data);
- page.getChildren().addAll(children);
+ page.setCreator(pcontext.getRemoteUser());
+ page.setModifiable(true);
+ if (page.getChildren() == null)
+ page.setChildren(new ArrayList<ModelObject>());
configService.create(page);
postSave(uiPortalApp, pcontext);
return;
}
- data.setOwnerType(uiPage.getOwnerType());
+ page.setOwnerType(uiPage.getOwnerType());
List<UIPortlet> uiPortlets = new ArrayList<UIPortlet>();
findAllPortlet(uiPortlets, uiPage);
ArrayList<ModelObject> applications = new ArrayList<ModelObject>();
@@ -426,16 +422,15 @@
if (Page.DESKTOP_PAGE.equals(uiPage.getFactoryId()) && !Page.DESKTOP_PAGE.equals(page.getFactoryId()))
{
- data.setShowMaxWindow(false);
+ page.setShowMaxWindow(false);
uiPage.getChildren().clear();
- children.clear();
- children.addAll(applications);
- data.setModifier(pcontext.getRemoteUser());
+ page.setChildren(applications);
+ page.setModifier(pcontext.getRemoteUser());
PortalDataMapper.toUIPage(uiPage, page);
// if (page.getTemplate() == null)
// page.setTemplate(uiPage.getTemplate());
- page = new Page(page, data);
- page.getChildren().addAll(children);
+ if (page.getChildren() == null)
+ page.setChildren(new ArrayList<ModelObject>());
configService.update(page);
postSave(uiPortalApp, pcontext);
return;
@@ -444,20 +439,21 @@
List<UIComponent> uiChildren = uiPage.getChildren();
if (uiChildren == null)
return;
- children.clear();
+ ArrayList<ModelObject> children = new ArrayList<ModelObject>();
for (UIComponent child : uiChildren)
{
ModelObject component = PortalDataMapper.buildModelObject(child);
if (component != null)
children.add(component);
}
+ page.setChildren(children);
uiPage.getChildren().clear();
- data.setModifier(pcontext.getRemoteUser());
- page = new Page(page, data);
- page.getChildren().addAll(children);
+ page.setModifier(pcontext.getRemoteUser());
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 19:40:46 UTC (rev 401)
+++ portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageCreationWizard.java 2009-10-22 22:02:30 UTC (rev 402)
@@ -23,7 +23,6 @@
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;
@@ -256,17 +255,17 @@
static public class ViewStep4ActionListener extends EventListener<UIPageCreationWizard>
{
- private void setDefaultPermission(PageData data, String ownerType, String ownerId)
+ private void setDefaultPermission(Page page, String ownerType, String ownerId)
{
if (PortalConfig.PORTAL_TYPE.equals(ownerType))
{
- data.setAccessPermissions(new String[]{"Everyone"});
- data.setEditPermission("manager:/platform/administrators");
+ page.setAccessPermissions(new String[]{"Everyone"});
+ page.setEditPermission("manager:/platform/administrators");
}
else if (PortalConfig.GROUP_TYPE.equals(ownerType))
{
- data.setAccessPermissions(new String[]{"*:" + ownerId});
- data.setEditPermission("manager:" + ownerId);
+ page.setAccessPermissions(new String[]{"*:" + ownerId});
+ page.setEditPermission("manager:" + ownerId);
}
}
@@ -307,9 +306,8 @@
PageNode pageNode = uiPageInfo.getPageNode();
Page page = uiPageTemplateOptions.createPageFromSelectedOption(ownerType, ownerId);
- PageData data = page.buildData();
- data.setCreator(context.getRemoteUser());
- data.setName("page" + page.hashCode());
+ page.setCreator(context.getRemoteUser());
+ page.setName("page" + page.hashCode());
String pageId = pageNavi.getOwnerType() + "::" + pageNavi.getOwnerId() + "::" + page.getName();
DataStorage storage = uiWizard.getApplicationComponent(DataStorage.class);
if (storage.getPage(pageId) != null)
@@ -319,16 +317,17 @@
uiWizard.viewStep(2);
uiWizard.updateWizardComponent();
}
+ page.setModifiable(true);
//Set default permissions on the page
- setDefaultPermission(data, ownerType, ownerId);
+ setDefaultPermission(page, ownerType, ownerId);
if (page.getTitle() == null || page.getTitle().trim().length() == 0)
- data.setTitle(pageNode.getName());
+ page.setTitle(pageNode.getName());
boolean isDesktopPage = Page.DESKTOP_PAGE.equals(page.getFactoryId());
if (isDesktopPage)
- data.setShowMaxWindow(true);
+ page.setShowMaxWindow(true);
UIPagePreview uiPagePreview = uiWizard.getChild(UIPagePreview.class);
UIPage uiPage;
@@ -341,7 +340,7 @@
uiPage = uiWizard.createUIComponent(context, UIPage.class, null, null);
}
- PortalDataMapper.toUIPage(uiPage, new Page(page, data));
+ PortalDataMapper.toUIPage(uiPage, page);
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 19:40:46 UTC (rev 401)
+++ portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageForm.java 2009-10-22 22:02:30 UTC (rev 402)
@@ -27,7 +27,6 @@
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;
@@ -67,7 +66,6 @@
import org.exoplatform.webui.organization.UIListPermissionSelector.EmptyIteratorValidator;
import java.util.ArrayList;
-import java.util.Collection;
import java.util.List;
@ComponentConfigs({
@@ -208,7 +206,7 @@
}
- public Page invokeSetBindingBean(Page bean) throws Exception
+ public void invokeSetBindingBean(Object bean) throws Exception
{
String ownerType = getUIFormSelectBox("ownerType").getValue();
String ownerId = getUIStringInput("ownerId").getValue();
@@ -219,27 +217,27 @@
ownerId = "/" + ownerId;
}
- PageData data = bean.buildData();
- data.setPageId(getUIStringInput("pageId").getValue());
- data.setOwnerType(ownerType);
- data.setOwnerId(ownerId);
- data.setName(getUIStringInput("name").getValue());
+ Page page = (Page)bean;
+ page.setPageId(getUIStringInput("pageId").getValue());
+ page.setOwnerType(ownerType);
+ page.setOwnerId(ownerId);
+ page.setName(getUIStringInput("name").getValue());
String title = getUIStringInput("title").getValue();
if (title == null || title.trim().length() < 1)
- title = data.getName();
- data.setTitle(title);
+ title = page.getName();
+ page.setTitle(title);
- if (!data.isShowMaxWindow())
+ if (!page.isShowMaxWindow())
{
- data.setShowMaxWindow((Boolean)getUIFormCheckBoxInput("showMaxWindow").getValue());
+ page.setShowMaxWindow((Boolean)getUIFormCheckBoxInput("showMaxWindow").getValue());
}
- if (!PortalConfig.USER_TYPE.equals(data.getOwnerType()))
+ if (!PortalConfig.USER_TYPE.equals(page.getOwnerType()))
{
- data.setAccessPermissions(uiPermissionSetting.getChild(UIListPermissionSelector.class).getValue());
- data.setEditPermission(uiPermissionSetting.getChild(UIPermissionSelector.class).getValue());
+ page.setAccessPermissions(uiPermissionSetting.getChild(UIListPermissionSelector.class).getValue());
+ page.setEditPermission(uiPermissionSetting.getChild(UIPermissionSelector.class).getValue());
}
UserACL userACL = getApplicationComponent(UserACL.class);
- userACL.hasPermission(new Page(data));
+ userACL.hasPermission(page);
UIFormInputItemSelector uiTemplate = getChildById("Template");
if (uiTemplate != null)
@@ -247,39 +245,23 @@
SelectItemOption<?> itemOption = uiTemplate.getSelectedItemOption();
if (itemOption != null)
{
- data.setFactoryId(itemOption.getIcon());
+ page.setFactoryId(itemOption.getIcon());
// page.setTemplate((String)itemOption.getValue());
- if (data.getFactoryId().equals(Page.DESKTOP_PAGE))
- data.setShowMaxWindow(true);
+ if (page.getFactoryId().equals(Page.DESKTOP_PAGE))
+ page.setShowMaxWindow(true);
}
}
-
- //
- Collection<ModelObject> children = new ArrayList<ModelObject>(bean.getChildren());
-
- //
UIPageTemplateOptions uiConfigOptions = getChild(UIPageTemplateOptions.class);
if (uiConfigOptions == null)
- {
- 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);
- }
- }
+ 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 newPage = new Page(bean, data);
-
- //
- newPage.getChildren().addAll(children);
-
- //
- return newPage;
}
static public class SaveActionListener extends EventListener<UIPageForm>
@@ -297,10 +279,10 @@
UIPage uiPage = uiPageForm.getUIPage();
if (uiPage == null)
return;
- PageData data = new PageData();
- data.setPageId(uiPage.getPageId());
- uiPageForm.invokeSetBindingBean(data);
- data.setOwnerType(uiPage.getOwnerType());
+ Page page = new Page();
+ page.setPageId(uiPage.getPageId());
+ uiPageForm.invokeSetBindingBean(page);
+ page.setOwnerType(uiPage.getOwnerType());
List<UIPortlet> uiPortlets = new ArrayList<UIPortlet>();
findAllPortlet(uiPortlets, uiPage);
ArrayList<ModelObject> applications = new ArrayList<ModelObject>();
@@ -309,16 +291,17 @@
applications.add(PortalDataMapper.buildModelObject(uiPortlet));
}
- Page page = new Page(data);
- if (Page.DESKTOP_PAGE.equals(uiPage.getFactoryId()) && !Page.DESKTOP_PAGE.equals(data.getFactoryId()))
+ if (Page.DESKTOP_PAGE.equals(uiPage.getFactoryId()) && !Page.DESKTOP_PAGE.equals(page.getFactoryId()))
{
- data.setShowMaxWindow(false);
+ page.setShowMaxWindow(false);
uiPage.getChildren().clear();
- page.getChildren().addAll(applications);
+ page.setChildren(applications);
- data.setModifier(pcontext.getRemoteUser());
+ page.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,
@@ -332,14 +315,16 @@
return;
}
- if (Page.DESKTOP_PAGE.equals(data.getFactoryId()))
+ if (Page.DESKTOP_PAGE.equals(page.getFactoryId()))
{
uiPage.getChildren().clear();
- page.getChildren().addAll(applications);
+ page.setChildren(applications);
- data.setModifier(pcontext.getRemoteUser());
+ page.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);
@@ -364,14 +349,14 @@
if (component != null)
children.add(component);
}
- page.getChildren().addAll(children);
+ page.setChildren(children);
uiPage.getChildren().clear();
- data.setModifier(pcontext.getRemoteUser());
+ page.setModifier(pcontext.getRemoteUser());
PortalDataMapper.toUIPage(uiPage, page);
// if(page.getTemplate() == null) page.setTemplate(uiPage.getTemplate()) ;
if (page.getChildren() == null)
- page.getChildren().clear();
+ page.setChildren(new ArrayList<ModelObject>());
}
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 19:40:46 UTC (rev 401)
+++ portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageNodeForm2.java 2009-10-22 22:02:30 UTC (rev 402)
@@ -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,30 +380,32 @@
UIFormStringInput uiPageTitle = uiInputSet.getChildById("pageTitle");
- PageData data = new PageData();
- data.setOwnerType(uiForm.getOwnerType());
- data.setOwnerId(ownerId);
- data.setName(uiPageName.getValue());
- String title = uiPageTitle.getValue();
+ Page page = new Page();
+ page.setOwnerType(uiForm.getOwnerType());
+ page.setOwnerId(ownerId);
+ page.setName(uiPageName.getValue());
+ String title = uiPageTitle.getValue();;
if (title == null || title.trim().length() < 1)
- title = data.getName();
- data.setTitle(title);
+ title = page.getName();
+ page.setTitle(title);
- data.setShowMaxWindow(false);
+ page.setShowMaxWindow(false);
- data.setAccessPermissions(accessPermission);
- data.setEditPermission(editPermission);
+ page.setAccessPermissions(accessPermission);
+ page.setEditPermission(editPermission);
- Page page = new Page(data);
userACL.hasPermission(page);
- data.setCreator(pcontext.getRemoteUser());
+ page.setCreator(pcontext.getRemoteUser());
+ page.setModifiable(true);
+ if (page.getChildren() == null)
+ page.setChildren(new ArrayList<ModelObject>());
UserPortalConfigService service = uiForm.getApplicationComponent(UserPortalConfigService.class);
// check page is exist
DataStorage dataStorage = uiForm.getApplicationComponent(DataStorage.class);
- Page existPage = dataStorage.getPage(data.getPageId());
+ Page existPage = dataStorage.getPage(page.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 19:40:46 UTC (rev 401)
+++ portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalComponentActionListener.java 2009-10-22 22:02:30 UTC (rev 402)
@@ -24,7 +24,6 @@
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;
@@ -224,10 +223,9 @@
org.exoplatform.portal.webui.container.UIContainer uiContainer =
uiTarget.createUIComponent(org.exoplatform.portal.webui.container.UIContainer.class, null, null);
Container container = uiContainerConfig.getContainer(sourceId);
- ContainerData data = container.buildData();
- data.setId(String.valueOf(container.hashCode()));
+ container.setId(String.valueOf(container.hashCode()));
uiContainer.setStorageId(container.getStorageId());
- PortalDataMapper.toUIContainer(uiContainer, new Container(container, data));
+ PortalDataMapper.toUIContainer(uiContainer, container);
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 19:40:46 UTC (rev 401)
+++ portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/util/PortalDataMapper.java 2009-10-22 22:02:30 UTC (rev 402)
@@ -21,20 +21,15 @@
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;
@@ -42,8 +37,6 @@
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;
@@ -62,8 +55,6 @@
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;
@@ -109,29 +100,29 @@
private static GadgetApplication toGadget(UIGadget uiGadget)
{
- ApplicationData data = new ApplicationData();
- data.setProperties(uiGadget.getProperties());
- GadgetApplication app = new GadgetApplication(uiGadget.getStorageId(), uiGadget.getStorageName(), uiGadget.getGadgetId(), (PersistentApplicationState<Gadget>)uiGadget.getState(), data);
+ GadgetApplication app = new GadgetApplication(uiGadget.getStorageId(), uiGadget.getGadgetId());
+ app.setState(uiGadget.getState());
+ app.setProperties(uiGadget.getProperties());
+ app.setStorageName(uiGadget.getStorageName());
return app;
}
- 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());
- }
+ 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 Collection<ModelObject> toContainerChildren(UIContainer uiContainer) {
List<UIComponent> uiChildren = uiContainer.getChildren();
if (uiChildren == null)
- return Collections.emptyList();
+ return;
ArrayList<ModelObject> children = new ArrayList<ModelObject>();
for (UIComponent child : uiChildren)
{
@@ -139,85 +130,26 @@
if (component != null)
children.add(component);
}
- return children;
+ model.setChildren(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)
{
- 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);
- }
+ model = (Application<S, I>)new PortletApplication(uiPortlet.getStorageId(), (PortletId)applicationId);
}
else if (type == ApplicationType.GADGET)
{
- 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);
- }
+ model = (Application<S, I>)new GadgetApplication(uiPortlet.getStorageId(), (GadgetId)applicationId);
}
else if (type == ApplicationType.WSRP_PORTLET)
{
- 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);
- }
+ model = (Application<S, I>)new WSRPApplication(uiPortlet.getStorageId(), (WSRPId)applicationId);
}
else
{
@@ -225,36 +157,47 @@
}
//
+ 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;
}
- static private Page toPageModel(UIPage uiPage)
+ private static Container toContainer(UIContainer uiContainer)
{
- 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());
+ Container model = new Container(uiContainer.getStorageId());
+ toContainer(model, uiContainer);
+ return model;
+ }
- //
- toContainerData(uiPage, data);
-
- //
- Page model = new Page(uiPage.getStorageId(), data);
-
- //
- Collection<ModelObject> children = toContainerChildren(uiPage);
-
- //
- model.getChildren().addAll(children);
-
- //
+ 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());
return model;
}
@@ -271,7 +214,7 @@
model.setModifiable(uiPortal.isModifiable());
model.setProperties(uiPortal.getProperties());
- model.setPortalLayout(new Container(new ContainerData()));
+ model.setPortalLayout(new Container());
List<UIComponent> children = uiPortal.getChildren();
if (children == null)
@@ -283,7 +226,7 @@
if (component != null)
newChildren.add(component);
}
- model.getPortalLayout().getChildren().addAll(newChildren);
+ model.getPortalLayout().setChildren(newChildren);
return model;
}
@@ -396,6 +339,7 @@
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);
15 years, 2 months
gatein SVN: r401 - in portal/branches/performance: component/portal/src/main/java/org/exoplatform/portal/application and 17 other directories.
by do-not-reply@jboss.org
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);
15 years, 2 months
gatein SVN: r400 - in portal/branches/wsrp-integration: webui/portal/src/main/java/org/exoplatform/portal/webui/application and 1 other directory.
by do-not-reply@jboss.org
Author: chris.laprun(a)jboss.com
Date: 2009-10-22 14:47:45 -0400 (Thu, 22 Oct 2009)
New Revision: 400
Modified:
portal/branches/wsrp-integration/component/wsrp/src/main/java/org/gatein/portal/wsrp/ExoKernelIntegration.java
portal/branches/wsrp-integration/webui/portal/src/main/java/org/exoplatform/portal/webui/application/ExoPortletInvocationContext.java
Log:
- Added output of window state, portlet mode and navigational state to URLs as it's needed in WSRP URL templates.
Would be nice if ContainerURL hierarchy was refactored so that common methods were shared?\226?\128?\166
Modified: portal/branches/wsrp-integration/component/wsrp/src/main/java/org/gatein/portal/wsrp/ExoKernelIntegration.java
===================================================================
--- portal/branches/wsrp-integration/component/wsrp/src/main/java/org/gatein/portal/wsrp/ExoKernelIntegration.java 2009-10-22 12:34:29 UTC (rev 399)
+++ portal/branches/wsrp-integration/component/wsrp/src/main/java/org/gatein/portal/wsrp/ExoKernelIntegration.java 2009-10-22 18:47:45 UTC (rev 400)
@@ -110,7 +110,8 @@
RegistrationManager registrationManager = new RegistrationManagerImpl();
registrationManager.setPersistenceManager(registrationPersistenceManager);
- // todo: this should be done at the producer configuration level but somehow this isn't currently done :(
+ // todo: the multiple instantiation of WSRP service causes the registration policy to not be properly initialized
+ // so we end up forcing its instantiation here.
DefaultRegistrationPolicy registrationPolicy = new DefaultRegistrationPolicy();
registrationPolicy.setValidator(new DefaultRegistrationPropertyValidator());
registrationManager.setPolicy(registrationPolicy);
Modified: portal/branches/wsrp-integration/webui/portal/src/main/java/org/exoplatform/portal/webui/application/ExoPortletInvocationContext.java
===================================================================
--- portal/branches/wsrp-integration/webui/portal/src/main/java/org/exoplatform/portal/webui/application/ExoPortletInvocationContext.java 2009-10-22 12:34:29 UTC (rev 399)
+++ portal/branches/wsrp-integration/webui/portal/src/main/java/org/exoplatform/portal/webui/application/ExoPortletInvocationContext.java 2009-10-22 18:47:45 UTC (rev 400)
@@ -1,16 +1,16 @@
/**
* Copyright (C) 2009 eXo Platform SAS.
- *
+ *
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
- *
+ *
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
@@ -34,10 +34,9 @@
import org.gatein.pc.api.cache.CacheLevel;
import org.gatein.pc.portlet.impl.spi.AbstractPortletInvocationContext;
-import java.util.Map;
-
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+import java.util.Map;
/**
* @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
@@ -49,9 +48,9 @@
private HttpServletResponse response;
private HttpServletRequest request;
-
+
private String portalRequestURI;
-
+
private String portletId;
public ExoPortletInvocationContext(PortalRequestContext portalRequestContext, UIPortlet portlet)
@@ -88,10 +87,10 @@
public String renderURL(ContainerURL containerURL, URLFormat format)
{
- StringBuilder baseURL =
- new StringBuilder(this.portalRequestURI).append("?").append(
- PortalRequestContext.UI_COMPONENT_ID).append("=").append(this.portletId);
-
+ // todo: shouldn't we be using URLFormat to decide on the path to use at the beginning of the URL?
+ StringBuilder baseURL = new StringBuilder(this.portalRequestURI).append("?")
+ .append(PortalRequestContext.UI_COMPONENT_ID).append("=").append(this.portletId);
+
String type;
if (containerURL instanceof RenderURL)
{
@@ -110,7 +109,8 @@
throw new Error("Unrecognized containerURL type");
}
- baseURL.append("&portal:type=").append(type).append("&portal:isSecure=").append(request.isSecure());
+ appendParameter(baseURL, "portal:type", type);
+ appendParameter(baseURL, "portal:isSecure", "" + format.getWantSecure());
if (containerURL instanceof ActionURL)
{
@@ -119,53 +119,77 @@
StateString state = actionURL.getInteractionState();
if (state != null)
{
- String value = state.getStringValue();
- if (value != null)
- {
- baseURL.append("&").append("interactionstate").append("=").append(value);
- }
+ appendParameter(baseURL, "interactionstate", state.getStringValue());
}
+
+ state = actionURL.getNavigationalState();
+ if (state != null)
+ {
+ appendParameter(baseURL, "navigationalstate", state.getStringValue());
+ }
+
+ WindowState windowState = actionURL.getWindowState();
+ if (windowState != null)
+ {
+ appendParameter(baseURL, Constants.WINDOW_STATE_PARAMETER, windowState.toString());
+ }
+
+ Mode mode = actionURL.getMode();
+ if (mode != null)
+ {
+ appendParameter(baseURL, Constants.PORTLET_MODE_PARAMETER, mode.toString());
+ }
}
else if (containerURL instanceof ResourceURL)
{
ResourceURL resourceURL = (ResourceURL)containerURL;
- String resourceId = resourceURL.getResourceId();
- if (resourceId != null)
- {
- baseURL.append("&").append(Constants.RESOURCE_ID_PARAMETER).append("=").append(resourceId);
- }
+ appendParameter(baseURL, Constants.RESOURCE_ID_PARAMETER, resourceURL.getResourceId());
CacheLevel cachability = resourceURL.getCacheability();
- if (cachability != null && cachability.name() != null)
+ if (cachability != null)
{
- baseURL.append("&").append(Constants.CACHELEVEL_PARAMETER).append("=").append(cachability.name());
+ appendParameter(baseURL, Constants.CACHELEVEL_PARAMETER, cachability.name());
}
StateString resourceState = resourceURL.getResourceState();
if (resourceState != null)
{
- String value = resourceState.getStringValue();
- if (value != null)
- {
- baseURL.append("&").append("resourcestate").append("=").append(value);
- }
+ appendParameter(baseURL, "resourcestate", resourceState.getStringValue());
}
+
+ resourceState = resourceURL.getNavigationalState();
+ if (resourceState != null)
+ {
+ appendParameter(baseURL, "navigationalstate", resourceState.getStringValue());
+ }
+
+ WindowState windowState = resourceURL.getWindowState();
+ if (windowState != null)
+ {
+ appendParameter(baseURL, Constants.WINDOW_STATE_PARAMETER, windowState.toString());
+ }
+
+ Mode mode = resourceURL.getMode();
+ if (mode != null)
+ {
+ appendParameter(baseURL, Constants.PORTLET_MODE_PARAMETER, mode.toString());
+ }
}
else
{
RenderURL renderURL = (RenderURL)containerURL;
WindowState windowState = renderURL.getWindowState();
- if (windowState != null && windowState.toString() != null)
+ if (windowState != null)
{
- baseURL.append("&").append(Constants.WINDOW_STATE_PARAMETER).append("=").append(windowState.toString());
+ appendParameter(baseURL, Constants.WINDOW_STATE_PARAMETER, windowState.toString());
}
Mode mode = renderURL.getMode();
- if (mode != null && mode.toString() != null)
+ if (mode != null)
{
- baseURL.append("&").append(Constants.PORTLET_MODE_PARAMETER).append("=").append(mode);
+ appendParameter(baseURL, Constants.PORTLET_MODE_PARAMETER, mode.toString());
}
Map<String, String[]> publicNSChanges = renderURL.getPublicNavigationalStateChanges();
@@ -176,12 +200,26 @@
String[] values = publicNSChanges.get(key);
for (String value : values)
{
- baseURL.append("&").append(key).append("=").append(value);
+ appendParameter(baseURL, key, value);
}
}
}
+
+ StateString state = renderURL.getNavigationalState();
+ if (state != null)
+ {
+ appendParameter(baseURL, "navigationalstate", state.getStringValue());
+ }
}
return baseURL.toString();
}
+
+ private void appendParameter(StringBuilder builder, String name, String value)
+ {
+ if (value != null)
+ {
+ builder.append("&").append(name).append("=").append(value);
+ }
+ }
}
15 years, 2 months
gatein SVN: r398 - portal/trunk/web/eXoResources/src/main/webapp/skin/DefaultSkin/webui/component/UIPopup/UIPopupWindow.
by do-not-reply@jboss.org
Author: tan_pham_dinh
Date: 2009-10-22 06:35:30 -0400 (Thu, 22 Oct 2009)
New Revision: 398
Modified:
portal/trunk/web/eXoResources/src/main/webapp/skin/DefaultSkin/webui/component/UIPopup/UIPopupWindow/Stylesheet.css
Log:
GTNPORTAL-39: wrong save icon when editing a page
Modified: portal/trunk/web/eXoResources/src/main/webapp/skin/DefaultSkin/webui/component/UIPopup/UIPopupWindow/Stylesheet.css
===================================================================
--- portal/trunk/web/eXoResources/src/main/webapp/skin/DefaultSkin/webui/component/UIPopup/UIPopupWindow/Stylesheet.css 2009-10-22 09:52:00 UTC (rev 397)
+++ portal/trunk/web/eXoResources/src/main/webapp/skin/DefaultSkin/webui/component/UIPopup/UIPopupWindow/Stylesheet.css 2009-10-22 10:35:30 UTC (rev 398)
@@ -179,8 +179,8 @@
}
.UIPortalComposer .SaveButton {
- background: transparent url(background/SaveIcon.gif) no-repeat scroll right bottom; /* orientation=lt */
- background: transparent url(background/SaveIcon-rt.gif) no-repeat scroll left bottom; /* orientation=rt */
+ background: transparent url(background/UnSaveIcon.gif) no-repeat scroll right bottom; /* orientation=lt */
+ background: transparent url(background/UnSaveIcon-rt.gif) no-repeat scroll left bottom; /* orientation=rt */
cursor: pointer;
float: right; /* orientation=lt */
float: left; /* orientation=rt */
@@ -190,8 +190,8 @@
}
.UIPortalComposer .EdittedSaveButton {
- background: transparent url(background/UnSaveIcon.gif) no-repeat scroll right bottom; /* orientation=lt */
- background: transparent url(background/UnSaveIcon-rt.gif) no-repeat scroll left bottom; /* orientation=rt */
+ background: transparent url(background/SaveIcon.gif) no-repeat scroll right bottom; /* orientation=lt */
+ background: transparent url(background/SaveIcon-rt.gif) no-repeat scroll left bottom; /* orientation=rt */
cursor: pointer;
float: right; /* orientation=lt */
float: left; /* orientation=rt */
15 years, 2 months
gatein SVN: r397 - portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/portal.
by do-not-reply@jboss.org
Author: tam_nguyen
Date: 2009-10-22 05:52:00 -0400 (Thu, 22 Oct 2009)
New Revision: 397
Modified:
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalComposer.java
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalForm.java
Log:
PORTAL-3635 Always keep the old permission of the portal has changed
Modified: portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalComposer.java
===================================================================
--- portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalComposer.java 2009-10-22 08:53:58 UTC (rev 396)
+++ portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalComposer.java 2009-10-22 09:52:00 UTC (rev 397)
@@ -147,7 +147,7 @@
PortalConfig portalConfig = (PortalConfig)PortalDataMapper.buildModelObject(editPortal);
UserPortalConfigService configService = getApplicationComponent(UserPortalConfigService.class);
- configService.update(portalConfig);
+ //configService.update(portalConfig);
uiPortalApp.getUserPortalConfig().setPortal(portalConfig);
String remoteUser = prContext.getRemoteUser();
String ownerUser = prContext.getPortalOwner();
Modified: portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalForm.java
===================================================================
--- portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalForm.java 2009-10-22 08:53:58 UTC (rev 396)
+++ portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalForm.java 2009-10-22 09:52:00 UTC (rev 397)
@@ -27,6 +27,7 @@
import org.exoplatform.portal.config.model.PortalConfig;
import org.exoplatform.portal.config.model.PortalProperties;
import org.exoplatform.portal.skin.SkinService;
+import org.exoplatform.portal.webui.util.PortalDataMapper;
import org.exoplatform.portal.webui.util.Util;
import org.exoplatform.portal.webui.workspace.UIMaskWorkspace;
import org.exoplatform.portal.webui.workspace.UIPortalApplication;
@@ -236,6 +237,9 @@
UIPortal uiPortal = Util.getUIPortal();
uiForm.invokeSetBindingBean(uiPortal);
// uiPortal.refreshNavigation(localeConfigService.getLocaleConfig(uiPortal.getLocale()).getLocale()) ;
+ PortalConfig portalConfig = (PortalConfig)PortalDataMapper.buildModelObject(uiPortal);
+ UserPortalConfigService configService = uiForm.getApplicationComponent(UserPortalConfigService.class);
+ configService.update(portalConfig);
UIMaskWorkspace uiMaskWorkspace = uiForm.getParent();
uiMaskWorkspace.setUIComponent(null);
event.getRequestContext().addUIComponentToUpdateByAjax(uiMaskWorkspace);
15 years, 2 months
gatein SVN: r396 - in portal/trunk/portlet/exoadmin/src/main: webapp/WEB-INF and 1 other directory.
by do-not-reply@jboss.org
Author: hoang_to
Date: 2009-10-22 04:53:58 -0400 (Thu, 22 Oct 2009)
New Revision: 396
Modified:
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIAddApplicationForm.java
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIApplicationOrganizer.java
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UICategoryForm.java
portal/trunk/portlet/exoadmin/src/main/webapp/WEB-INF/portlet.xml
Log:
GTNPORTAL-12: Recently deployed portlets not appearing in list of available portlets
Modified: portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIAddApplicationForm.java
===================================================================
--- portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIAddApplicationForm.java 2009-10-22 06:55:41 UTC (rev 395)
+++ portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIAddApplicationForm.java 2009-10-22 08:53:58 UTC (rev 396)
@@ -275,6 +275,7 @@
}
appRegService.save(selectedCate, app);
+ uiOrganizer.reload();
uiOrganizer.setSelectedCategory(selectedCate);
uiOrganizer.selectApplication(app.getApplicationName());
ctx.addUIComponentToUpdateByAjax(uiOrganizer);
Modified: portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIApplicationOrganizer.java
===================================================================
--- portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIApplicationOrganizer.java 2009-10-22 06:55:41 UTC (rev 395)
+++ portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIApplicationOrganizer.java 2009-10-22 08:53:58 UTC (rev 396)
@@ -362,7 +362,7 @@
service.remove(app);
}
String cateName = uiOrganizer.getSelectedCategory().getName();
- uiOrganizer.initApplicationCategories();
+ uiOrganizer.reload();
uiOrganizer.setSelectedCategory(cateName);
event.getRequestContext().addUIComponentToUpdateByAjax(uiOrganizer);
}
Modified: portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UICategoryForm.java
===================================================================
--- portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UICategoryForm.java 2009-10-22 06:55:41 UTC (rev 395)
+++ portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UICategoryForm.java 2009-10-22 08:53:58 UTC (rev 396)
@@ -178,7 +178,7 @@
}
service.save(category);
uiForm.setValue(null);
- uiOrganizer.initApplicationCategories();
+ uiOrganizer.reload();
uiOrganizer.setSelectedCategory(category.getName());
ctx.addUIComponentToUpdateByAjax(uiOrganizer);
}
Modified: portal/trunk/portlet/exoadmin/src/main/webapp/WEB-INF/portlet.xml
===================================================================
--- portal/trunk/portlet/exoadmin/src/main/webapp/WEB-INF/portlet.xml 2009-10-22 06:55:41 UTC (rev 395)
+++ portal/trunk/portlet/exoadmin/src/main/webapp/WEB-INF/portlet.xml 2009-10-22 08:53:58 UTC (rev 396)
@@ -79,7 +79,35 @@
<keywords>Administration</keywords>
</portlet-info>
</portlet>
+
+ <!--
+ <portlet>
+ <description xml:lang="EN">Register Portlet</description>
+ <portlet-name>RegisterPortlet</portlet-name>
+ <display-name xml:lang="EN">Register Portlet</display-name>
+ <portlet-class>org.exoplatform.webui.application.portlet.PortletApplicationController</portlet-class>
+
+ <init-param>
+ <name>webui.configuration</name>
+ <value>/WEB-INF/conf/portlet/exoadmin/RegisterPortlet/webui/configuration.xml</value>
+ </init-param>
+ <expiration-cache>0</expiration-cache>
+ <supports>
+ <mime-type>text/html</mime-type>
+ <portlet-mode>help</portlet-mode>
+ </supports>
+ <supported-locale>en</supported-locale>
+
+ <resource-bundle>locale.portlet.exoadmin.RegisterPortlet</resource-bundle>
+ <portlet-info>
+ <title>Register Portlet</title>
+ <short-title>Register Portlet</short-title>
+ <keywords>Administration</keywords>
+ </portlet-info>
+ </portlet>
+ -->
+
<portlet>
<description xml:lang="EN">Group Navigation Portlet</description>
<portlet-name>GroupNavigationPortlet</portlet-name>
15 years, 2 months