Author: julien_viet
Date: 2010-01-18 07:31:08 -0500 (Mon, 18 Jan 2010)
New Revision: 1348
Added:
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/PortletExtraSerializer.java
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/LegacyPortalStateManager.java
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/ReplicatingStateManager.java
Removed:
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/ReplicatingStateManager.java
Modified:
portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/gadget/Gadget.java
portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/gadget/Source.java
portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/registry/Application.java
portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/registry/ApplicationCategory.java
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/ExtGroup.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/UserACL.java
portal/trunk/component/web/src/main/java/org/exoplatform/web/application/ApplicationMessage.java
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/UIAddGadget.java
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIApplicationForm.java
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIApplicationInfo.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/UIApplicationRegistryEditMode.java
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIApplicationRegistryPortlet.java
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/UICategorySelector.java
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIFormTableIteratorInputSet.java
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIGadgetEditor.java
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIGadgetInfo.java
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIGadgetManagement.java
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIPermissionForm.java
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIPortletInfo.java
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIPortletManagement.java
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/organization/webui/component/UIListMembershipType.java
portal/trunk/web/portal/src/main/webapp/WEB-INF/webui-configuration.xml
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/portlet/ParentAppStateManager.java
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/portlet/PortletApplication.java
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/model/TypeDomain.java
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/model/metadata/DomainMetaData.java
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/serial/ObjectWriter.java
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/bean/ReflectionDataMapping.java
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/UIApplication.java
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/UIBreadcumbs.java
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/UIComponent.java
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/UIComponentDecorator.java
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/UIContainer.java
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/UIGrid.java
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/UIPageIterator.java
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/UIPopupMessages.java
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/UIPopupWindow.java
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/UIPortletApplication.java
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/UITree.java
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/model/SelectItemOption.java
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIForm.java
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormCheckBoxInput.java
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormGrid.java
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormInputBase.java
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormInputContainer.java
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormInputInfo.java
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormInputSet.java
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormPageIterator.java
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormPopupWindow.java
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormRadioBoxInput.java
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormSelectBox.java
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormStringInput.java
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormTableInputSet.java
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormTextAreaInput.java
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/IdentifierValidator.java
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/MandatoryValidator.java
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/NameValidator.java
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/StringLengthValidator.java
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/URLValidator.java
portal/trunk/webui/eXo/src/main/java/org/exoplatform/webui/organization/UIGroupMembershipSelector.java
portal/trunk/webui/eXo/src/main/java/org/exoplatform/webui/organization/UIListPermissionSelector.java
portal/trunk/webui/eXo/src/main/java/org/exoplatform/webui/organization/UISelector.java
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/PortalRequestHandler.java
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/PortalStateManager.java
Log:
GTNPORTAL-523 : Serialization framework
GTNPORTAL-524 : Application Registry Portlet replication
Modified:
portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/gadget/Gadget.java
===================================================================
---
portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/gadget/Gadget.java 2010-01-18
12:02:11 UTC (rev 1347)
+++
portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/gadget/Gadget.java 2010-01-18
12:31:08 UTC (rev 1348)
@@ -19,13 +19,15 @@
package org.exoplatform.application.gadget;
+import java.io.Serializable;
+
/**
* Created by The eXo Platform SAS
* Author : Pham Thanh Tung
* thanhtungty(a)gmail.com
* Jul 28, 2008
*/
-public class Gadget
+public class Gadget implements Serializable
{
private String name;
Modified:
portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/gadget/Source.java
===================================================================
---
portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/gadget/Source.java 2010-01-18
12:02:11 UTC (rev 1347)
+++
portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/gadget/Source.java 2010-01-18
12:31:08 UTC (rev 1348)
@@ -19,6 +19,7 @@
package org.exoplatform.application.gadget;
+import java.io.Serializable;
import java.util.Calendar;
/**
@@ -27,7 +28,7 @@
* thanhtungty(a)gmail.com
* Oct 23, 2008
*/
-public class Source
+public class Source implements Serializable
{
private String name;
Modified:
portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/registry/Application.java
===================================================================
---
portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/registry/Application.java 2010-01-18
12:02:11 UTC (rev 1347)
+++
portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/registry/Application.java 2010-01-18
12:31:08 UTC (rev 1348)
@@ -21,6 +21,7 @@
import org.exoplatform.portal.config.model.ApplicationType;
+import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
@@ -30,7 +31,7 @@
* Date: 15 juin 2004
*
*/
-public class Application
+public class Application implements Serializable
{
private String categoryName;
Modified:
portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/registry/ApplicationCategory.java
===================================================================
---
portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/registry/ApplicationCategory.java 2010-01-18
12:02:11 UTC (rev 1347)
+++
portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/registry/ApplicationCategory.java 2010-01-18
12:31:08 UTC (rev 1348)
@@ -19,6 +19,7 @@
package org.exoplatform.application.registry;
+import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@@ -28,7 +29,7 @@
* User: Benjamin Mestrallet
* Date: 15 juin 2004
*/
-public class ApplicationCategory
+public class ApplicationCategory implements Serializable
{
private String name;
Modified:
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/ExtGroup.java
===================================================================
---
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/ExtGroup.java 2010-01-18
12:02:11 UTC (rev 1347)
+++
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/ExtGroup.java 2010-01-18
12:31:08 UTC (rev 1348)
@@ -24,7 +24,9 @@
import org.exoplatform.services.organization.Group;
-public class ExtGroup implements Group
+import java.io.Serializable;
+
+public class ExtGroup implements Group, Serializable
{
private String id;
Modified:
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/UserACL.java
===================================================================
---
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/UserACL.java 2010-01-18
12:02:11 UTC (rev 1347)
+++
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/UserACL.java 2010-01-18
12:31:08 UTC (rev 1348)
@@ -31,6 +31,7 @@
import org.exoplatform.services.security.Identity;
import org.exoplatform.services.security.MembershipEntry;
+import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
@@ -574,7 +575,7 @@
return result;
}
- static public class Permission
+ static public class Permission implements Serializable
{
private String name_;
Modified:
portal/trunk/component/web/src/main/java/org/exoplatform/web/application/ApplicationMessage.java
===================================================================
---
portal/trunk/component/web/src/main/java/org/exoplatform/web/application/ApplicationMessage.java 2010-01-18
12:02:11 UTC (rev 1347)
+++
portal/trunk/component/web/src/main/java/org/exoplatform/web/application/ApplicationMessage.java 2010-01-18
12:31:08 UTC (rev 1348)
@@ -19,13 +19,15 @@
package org.exoplatform.web.application;
+import java.io.Serializable;
+
/**
* Created by The eXo Platform SARL
* Author : Dang Van Minh
* minhdv81(a)yahoo.com
* Jun 7, 2006
*/
-public class ApplicationMessage
+public class ApplicationMessage implements Serializable
{
final public static int ERROR = 0, WARNING = 1, INFO = 2;
Added:
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/PortletExtraSerializer.java
===================================================================
---
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/PortletExtraSerializer.java
(rev 0)
+++
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/PortletExtraSerializer.java 2010-01-18
12:31:08 UTC (rev 1348)
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+
+package org.exoplatform.applicationregistry.webui.component;
+
+import org.exoplatform.container.ExoContainer;
+import org.exoplatform.container.ExoContainerContext;
+import org.exoplatform.webui.application.replication.api.TypeConverter;
+import org.gatein.pc.api.Portlet;
+import org.gatein.pc.api.PortletContext;
+import org.gatein.pc.api.PortletInvoker;
+import org.gatein.pc.federation.FederatingPortletInvoker;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
+ * @version $Revision$
+ */
+public class PortletExtraSerializer extends
TypeConverter<UIPortletManagement.PortletExtra, PortletContext>
+{
+
+ @Override
+ public PortletContext write(UIPortletManagement.PortletExtra input)
+ {
+ return input.context;
+ }
+
+ @Override
+ public UIPortletManagement.PortletExtra read(PortletContext output) throws Exception
+ {
+ ExoContainer manager = ExoContainerContext.getCurrentContainer();
+ FederatingPortletInvoker portletInvoker =
(FederatingPortletInvoker)manager.getComponentInstance(PortletInvoker.class);
+ Portlet portlet = portletInvoker.getPortlet(output);
+ return new UIPortletManagement.PortletExtra(portlet);
+ }
+}
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 2010-01-18
12:02:11 UTC (rev 1347)
+++
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIAddApplicationForm.java 2010-01-18
12:31:08 UTC (rev 1348)
@@ -26,11 +26,13 @@
import org.exoplatform.application.registry.ApplicationRegistryService;
import org.exoplatform.applicationregistry.webui.Util;
import org.exoplatform.commons.utils.LazyPageList;
+import org.exoplatform.commons.utils.SerializablePageList;
import org.exoplatform.container.ExoContainer;
import org.exoplatform.container.ExoContainerContext;
import org.exoplatform.portal.config.model.ApplicationType;
import org.exoplatform.web.application.ApplicationMessage;
import org.exoplatform.webui.application.WebuiRequestContext;
+import org.exoplatform.webui.application.replication.api.annotations.Serialized;
import org.exoplatform.webui.config.annotation.ComponentConfig;
import org.exoplatform.webui.config.annotation.EventConfig;
import org.exoplatform.webui.core.UIApplication;
@@ -66,6 +68,7 @@
@EventConfig(listeners = UIAddApplicationForm.ChangeTypeActionListener.class, phase =
Phase.DECODE),
@EventConfig(listeners = UIAddApplicationForm.AddActionListener.class),
@EventConfig(listeners = UIAddApplicationForm.CancelActionListener.class, phase =
Phase.DECODE)})
+@Serialized
public class UIAddApplicationForm extends UIForm
{
@@ -137,8 +140,7 @@
i++;
}
UIFormPageIterator uiIterator =
uiTableInputSet.getChild(UIFormPageIterator.class);
- LazyPageList<UIFormInputSet> pageList =
- new LazyPageList<UIFormInputSet>(new
FormInputSetListAccess(uiInputSetList), 10);
+ SerializablePageList<UIFormInputSet> pageList = new
SerializablePageList<UIFormInputSet>(UIFormInputSet.class, uiInputSetList, 10);
uiIterator.setPageList(pageList);
}
Modified:
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIAddGadget.java
===================================================================
---
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIAddGadget.java 2010-01-18
12:02:11 UTC (rev 1347)
+++
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIAddGadget.java 2010-01-18
12:31:08 UTC (rev 1348)
@@ -24,6 +24,7 @@
import org.exoplatform.portal.webui.application.GadgetUtil;
import org.exoplatform.web.application.ApplicationMessage;
import org.exoplatform.webui.application.WebuiRequestContext;
+import org.exoplatform.webui.application.replication.api.annotations.Serialized;
import org.exoplatform.webui.config.annotation.ComponentConfig;
import org.exoplatform.webui.config.annotation.EventConfig;
import org.exoplatform.webui.core.UIApplication;
@@ -48,6 +49,7 @@
@ComponentConfig(lifecycle = UIFormLifecycle.class, template =
"system:/groovy/webui/form/UIForm.gtmpl", events = {
@EventConfig(listeners = UIAddGadget.AddActionListener.class),
@EventConfig(listeners = UIAddGadget.CancelActionListener.class, phase =
Phase.DECODE)})
+@Serialized
public class UIAddGadget extends UIForm
{
Modified:
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIApplicationForm.java
===================================================================
---
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIApplicationForm.java 2010-01-18
12:02:11 UTC (rev 1347)
+++
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIApplicationForm.java 2010-01-18
12:31:08 UTC (rev 1348)
@@ -23,6 +23,7 @@
import org.exoplatform.application.registry.ApplicationRegistryService;
import org.exoplatform.web.application.ApplicationMessage;
import org.exoplatform.webui.application.WebuiRequestContext;
+import org.exoplatform.webui.application.replication.api.annotations.Serialized;
import org.exoplatform.webui.config.annotation.ComponentConfig;
import org.exoplatform.webui.config.annotation.EventConfig;
import org.exoplatform.webui.core.UIApplication;
@@ -48,6 +49,7 @@
@ComponentConfig(lifecycle = UIFormLifecycle.class, template =
"system:/groovy/webui/form/UIFormWithTitle.gtmpl", events = {
@EventConfig(listeners = UIApplicationForm.SaveActionListener.class),
@EventConfig(phase = Phase.DECODE, listeners =
UIApplicationForm.CancelActionListener.class)})
+@Serialized
public class UIApplicationForm extends UIForm
{
Modified:
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIApplicationInfo.java
===================================================================
---
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIApplicationInfo.java 2010-01-18
12:02:11 UTC (rev 1347)
+++
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIApplicationInfo.java 2010-01-18
12:31:08 UTC (rev 1348)
@@ -22,6 +22,7 @@
import org.exoplatform.application.registry.Application;
import org.exoplatform.application.registry.ApplicationCategory;
import org.exoplatform.webui.application.WebuiRequestContext;
+import org.exoplatform.webui.application.replication.api.annotations.Serialized;
import org.exoplatform.webui.config.annotation.ComponentConfig;
import org.exoplatform.webui.config.annotation.EventConfig;
import org.exoplatform.webui.core.UIContainer;
@@ -36,6 +37,7 @@
*/
@ComponentConfig(template =
"app:/groovy/applicationregistry/webui/component/UIApplicationInfo.gtmpl",
events = {@EventConfig(listeners =
UIApplicationInfo.EditApplicationActionListener.class)})
+@Serialized
public class UIApplicationInfo extends UIContainer
{
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 2010-01-18
12:02:11 UTC (rev 1347)
+++
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIApplicationOrganizer.java 2010-01-18
12:31:08 UTC (rev 1348)
@@ -31,6 +31,7 @@
import org.exoplatform.web.application.ApplicationMessage;
import org.exoplatform.webui.application.WebuiRequestContext;
import org.exoplatform.webui.application.portlet.PortletRequestContext;
+import org.exoplatform.webui.application.replication.api.annotations.Serialized;
import org.exoplatform.webui.config.annotation.ComponentConfig;
import org.exoplatform.webui.config.annotation.EventConfig;
import org.exoplatform.webui.core.UIApplication;
@@ -53,7 +54,8 @@
@EventConfig(listeners = UIApplicationOrganizer.EditCategoryActionListener.class),
@EventConfig(listeners = UIApplicationOrganizer.AddApplicationActionListener.class),
@EventConfig(listeners = UIApplicationOrganizer.RemoveApplicationActionListener.class,
confirm = "UIOrganizer.msg.deleteApplication")})
-public class UIApplicationOrganizer extends UIContainer
+@Serialized
+public class UIApplicationOrganizer extends UIContainer
{
private ApplicationCategory selectedCategory;
@@ -279,7 +281,8 @@
UIApplicationOrganizer uiOrganizer = event.getSource();
Application selectedApp = uiOrganizer.getApplication(appName);
ApplicationRegistryService service =
uiOrganizer.getApplicationComponent(ApplicationRegistryService.class);
- if (service.getApplication(selectedApp.getId()) == null)
+ String selectedAppId = selectedApp.getId();
+ if (service.getApplication(selectedAppId) == null)
{
UIApplication uiApp = ctx.getUIApplication();
uiApp.addMessage(new
ApplicationMessage("UIOrganizer.msg.applicationNoExist", null));
Modified:
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIApplicationRegistryEditMode.java
===================================================================
---
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIApplicationRegistryEditMode.java 2010-01-18
12:02:11 UTC (rev 1347)
+++
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIApplicationRegistryEditMode.java 2010-01-18
12:31:08 UTC (rev 1348)
@@ -22,6 +22,7 @@
import org.exoplatform.portal.webui.workspace.UIPortalApplication;
import org.exoplatform.webui.application.WebuiRequestContext;
import org.exoplatform.webui.application.portlet.PortletRequestContext;
+import org.exoplatform.webui.application.replication.api.annotations.Serialized;
import org.exoplatform.webui.config.annotation.ComponentConfig;
import org.exoplatform.webui.config.annotation.EventConfig;
import org.exoplatform.webui.core.lifecycle.UIFormLifecycle;
@@ -42,7 +43,7 @@
template = "system:/groovy/webui/form/UIFormWithTitle.gtmpl",
events = {@EventConfig(listeners =
UIApplicationRegistryEditMode.SaveActionListener.class)}
)
-
+@Serialized
public class UIApplicationRegistryEditMode extends UIForm
{
public static final String SHOW_IMPORT = "showImport";
Modified:
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIApplicationRegistryPortlet.java
===================================================================
---
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIApplicationRegistryPortlet.java 2010-01-18
12:02:11 UTC (rev 1347)
+++
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIApplicationRegistryPortlet.java 2010-01-18
12:31:08 UTC (rev 1348)
@@ -22,12 +22,14 @@
import
org.exoplatform.portal.webui.portal.UIPortalComponentActionListener.ViewChildActionListener;
import org.exoplatform.webui.application.WebuiApplication;
import org.exoplatform.webui.application.WebuiRequestContext;
+import org.exoplatform.webui.application.replication.api.annotations.Serialized;
import org.exoplatform.webui.config.annotation.ComponentConfig;
import org.exoplatform.webui.config.annotation.EventConfig;
import org.exoplatform.webui.core.UIPortletApplication;
import org.exoplatform.webui.core.lifecycle.UIApplicationLifecycle;
@ComponentConfig(lifecycle = UIApplicationLifecycle.class, template =
"app:/groovy/applicationregistry/webui/component/UIApplicationRegistryPortlet.gtmpl",
events = {@EventConfig(listeners = ViewChildActionListener.class)})
+@Serialized
public class UIApplicationRegistryPortlet extends UIPortletApplication
{
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 2010-01-18
12:02:11 UTC (rev 1347)
+++
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UICategoryForm.java 2010-01-18
12:31:08 UTC (rev 1348)
@@ -24,6 +24,7 @@
import org.exoplatform.application.registry.ApplicationRegistryService;
import org.exoplatform.web.application.ApplicationMessage;
import org.exoplatform.webui.application.WebuiRequestContext;
+import org.exoplatform.webui.application.replication.api.annotations.Serialized;
import org.exoplatform.webui.config.annotation.ComponentConfig;
import org.exoplatform.webui.config.annotation.EventConfig;
import org.exoplatform.webui.core.UIApplication;
@@ -49,6 +50,7 @@
@ComponentConfig(lifecycle = UIFormLifecycle.class, template =
"system:/groovy/webui/form/UIFormTabPane.gtmpl", events = {
@EventConfig(listeners = UICategoryForm.SaveActionListener.class),
@EventConfig(listeners = UICategoryForm.CancelActionListener.class, phase =
Phase.DECODE)})
+@Serialized
public class UICategoryForm extends UIFormTabPane
{
Modified:
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UICategorySelector.java
===================================================================
---
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UICategorySelector.java 2010-01-18
12:02:11 UTC (rev 1347)
+++
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UICategorySelector.java 2010-01-18
12:31:08 UTC (rev 1348)
@@ -4,6 +4,9 @@
import org.exoplatform.application.registry.ApplicationCategory;
import org.exoplatform.application.registry.ApplicationRegistryService;
import org.exoplatform.commons.utils.LazyPageList;
+import org.exoplatform.commons.utils.PageListAccess;
+import org.exoplatform.commons.utils.SerializablePageList;
+import org.exoplatform.webui.application.replication.api.annotations.Serialized;
import org.exoplatform.webui.config.annotation.ComponentConfig;
import org.exoplatform.webui.config.annotation.EventConfig;
import org.exoplatform.webui.core.lifecycle.UIFormLifecycle;
@@ -27,6 +30,7 @@
@ComponentConfig(template = "system:/groovy/webui/form/UIForm.gtmpl", lifecycle
= UIFormLifecycle.class, events = {
@EventConfig(listeners = UICategorySelector.SaveActionListener.class),
@EventConfig(listeners = UICategorySelector.CancelActionListener.class, phase =
Phase.DECODE)})
+@Serialized
public class UICategorySelector extends UIForm
{
private Application application;
@@ -72,6 +76,8 @@
UIFormInputSet uiInputSet;
UIFormCheckBoxInput<Boolean> checkBoxInput;
UIFormInputInfo uiInfo;
+
+ //
ApplicationRegistryService appRegService =
getApplicationComponent(ApplicationRegistryService.class);
List<ApplicationCategory> categories = getAllCategories();
List<UIFormInputSet> uiInputSetList = new ArrayList<UIFormInputSet>();
@@ -93,8 +99,9 @@
}
UIFormPageIterator uiIterator =
uiTableInputSet.getChild(UIFormPageIterator.class);
- LazyPageList<UIFormInputSet> pageList =
- new LazyPageList<UIFormInputSet>(new
FormInputSetListAccess(uiInputSetList), 5);
+ SerializablePageList<UIFormInputSet> pageList = new
SerializablePageList<UIFormInputSet>(
+ UIFormInputSet.class, uiInputSetList, 5
+ );
uiIterator.setPageList(pageList);
}
Modified:
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIFormTableIteratorInputSet.java
===================================================================
---
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIFormTableIteratorInputSet.java 2010-01-18
12:02:11 UTC (rev 1347)
+++
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIFormTableIteratorInputSet.java 2010-01-18
12:31:08 UTC (rev 1348)
@@ -20,6 +20,7 @@
package org.exoplatform.applicationregistry.webui.component;
import org.exoplatform.webui.application.WebuiRequestContext;
+import org.exoplatform.webui.application.replication.api.annotations.Serialized;
import org.exoplatform.webui.config.annotation.ComponentConfig;
import org.exoplatform.webui.core.UIComponent;
import org.exoplatform.webui.form.UIFormInputBase;
@@ -36,6 +37,7 @@
* Aug 20, 2007
*/
@ComponentConfig(template =
"app:/groovy/applicationregistry/webui/component/UIFormTableIteratorInputSet.gtmpl")
+@Serialized
public class UIFormTableIteratorInputSet extends UIFormTableInputSet
{
Modified:
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIGadgetEditor.java
===================================================================
---
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIGadgetEditor.java 2010-01-18
12:02:11 UTC (rev 1347)
+++
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIGadgetEditor.java 2010-01-18
12:31:08 UTC (rev 1348)
@@ -29,6 +29,7 @@
import org.exoplatform.portal.webui.application.GadgetUtil;
import org.exoplatform.web.application.ApplicationMessage;
import org.exoplatform.webui.application.WebuiRequestContext;
+import org.exoplatform.webui.application.replication.api.annotations.Serialized;
import org.exoplatform.webui.config.InitParams;
import org.exoplatform.webui.config.Param;
import org.exoplatform.webui.config.annotation.ComponentConfig;
@@ -46,6 +47,7 @@
import org.exoplatform.webui.form.validator.MandatoryValidator;
import org.exoplatform.webui.form.validator.Validator;
+import java.io.Serializable;
import java.util.Calendar;
/**
@@ -55,6 +57,7 @@
@ComponentConfig(lifecycle = UIFormLifecycle.class, template =
"system:/groovy/webui/form/UIForm.gtmpl", initParams = @ParamConfig(name =
"SampleGadget", value =
"app:/WEB-INF/conf/uiconf/applicationregistry/component/SampleGadget.groovy"),
events = {
@EventConfig(listeners = UIGadgetEditor.SaveActionListener.class),
@EventConfig(listeners = UIGadgetEditor.CancelActionListener.class, phase =
Phase.DECODE)})
+@Serialized
public class UIGadgetEditor extends UIForm
{
@@ -220,7 +223,7 @@
}
- public static class GadgetSpecValidator implements Validator
+ public static class GadgetSpecValidator implements Validator, Serializable
{
public void validate(UIFormInput uiInput) throws Exception
Modified:
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIGadgetInfo.java
===================================================================
---
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIGadgetInfo.java 2010-01-18
12:02:11 UTC (rev 1347)
+++
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIGadgetInfo.java 2010-01-18
12:31:08 UTC (rev 1348)
@@ -33,6 +33,7 @@
import org.exoplatform.web.application.ApplicationMessage;
import org.exoplatform.web.application.gadget.GadgetApplication;
import org.exoplatform.webui.application.WebuiRequestContext;
+import org.exoplatform.webui.application.replication.api.annotations.Serialized;
import org.exoplatform.webui.config.annotation.ComponentConfig;
import org.exoplatform.webui.config.annotation.EventConfig;
import org.exoplatform.webui.core.UIApplication;
@@ -58,6 +59,7 @@
@EventConfig(listeners = UIGadgetInfo.CopyActionListener.class),
@EventConfig(listeners = UIGadgetInfo.EditActionListener.class),
@EventConfig(listeners = UIGadgetInfo.ShowCategoriesActionListener.class)})
+@Serialized
public class UIGadgetInfo extends UIContainer
{
Modified:
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIGadgetManagement.java
===================================================================
---
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIGadgetManagement.java 2010-01-18
12:02:11 UTC (rev 1347)
+++
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIGadgetManagement.java 2010-01-18
12:31:08 UTC (rev 1348)
@@ -31,6 +31,7 @@
import org.exoplatform.web.application.ApplicationMessage;
import org.exoplatform.web.application.gadget.GadgetApplication;
import org.exoplatform.webui.application.WebuiRequestContext;
+import org.exoplatform.webui.application.replication.api.annotations.Serialized;
import org.exoplatform.webui.config.annotation.ComponentConfig;
import org.exoplatform.webui.config.annotation.EventConfig;
import org.exoplatform.webui.core.UIApplication;
@@ -52,6 +53,7 @@
@EventConfig(listeners = UIGadgetManagement.RemoveGadgetActionListener.class, confirm
= "UIGadgetManagement.msg.deleteGadget"),
@EventConfig(listeners = UIGadgetManagement.AddLocalGadgetActionListener.class),
@EventConfig(listeners = UIGadgetManagement.SelectGadgetActionListener.class)})
+@Serialized
public class UIGadgetManagement extends UIContainer
{
Modified:
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIPermissionForm.java
===================================================================
---
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIPermissionForm.java 2010-01-18
12:02:11 UTC (rev 1347)
+++
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIPermissionForm.java 2010-01-18
12:31:08 UTC (rev 1348)
@@ -23,6 +23,7 @@
import org.exoplatform.application.registry.ApplicationRegistryService;
import org.exoplatform.web.application.ApplicationMessage;
import org.exoplatform.webui.application.WebuiRequestContext;
+import org.exoplatform.webui.application.replication.api.annotations.Serialized;
import org.exoplatform.webui.config.annotation.ComponentConfig;
import org.exoplatform.webui.config.annotation.EventConfig;
import org.exoplatform.webui.core.UIApplication;
@@ -45,6 +46,7 @@
@EventConfig(listeners = UIPermissionForm.SelectMembershipActionListener.class),
@EventConfig(listeners = UIPermissionForm.DeleteActionListener.class),
@EventConfig(listeners = UIPermissionForm.ChangePublicModeActionListener.class)})
+@Serialized
public class UIPermissionForm extends UIForm
{
Modified:
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIPortletInfo.java
===================================================================
---
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIPortletInfo.java 2010-01-18
12:02:11 UTC (rev 1347)
+++
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIPortletInfo.java 2010-01-18
12:31:08 UTC (rev 1348)
@@ -20,6 +20,7 @@
package org.exoplatform.applicationregistry.webui.component;
import
org.exoplatform.applicationregistry.webui.component.UIPortletManagement.PortletExtra;
+import org.exoplatform.webui.application.replication.api.annotations.Serialized;
import org.exoplatform.webui.config.annotation.ComponentConfig;
import org.exoplatform.webui.core.UIComponent;
@@ -30,6 +31,7 @@
* Sep 11, 2008
*/
@ComponentConfig(template =
"app:/groovy/applicationregistry/webui/component/UIPortletInfo.gtmpl")
+@Serialized
public class UIPortletInfo extends UIComponent
{
Modified:
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIPortletManagement.java
===================================================================
---
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIPortletManagement.java 2010-01-18
12:02:11 UTC (rev 1347)
+++
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIPortletManagement.java 2010-01-18
12:31:08 UTC (rev 1348)
@@ -23,6 +23,8 @@
import org.exoplatform.container.ExoContainerContext;
import org.exoplatform.web.application.ApplicationMessage;
import org.exoplatform.webui.application.WebuiRequestContext;
+import org.exoplatform.webui.application.replication.api.annotations.Converted;
+import org.exoplatform.webui.application.replication.api.annotations.Serialized;
import org.exoplatform.webui.config.annotation.ComponentConfig;
import org.exoplatform.webui.config.annotation.EventConfig;
import org.exoplatform.webui.core.UIContainer;
@@ -30,6 +32,7 @@
import org.exoplatform.webui.event.EventListener;
import org.gatein.common.i18n.LocalizedString;
import org.gatein.pc.api.Portlet;
+import org.gatein.pc.api.PortletContext;
import org.gatein.pc.api.PortletInvoker;
import org.gatein.pc.api.info.MetaInfo;
import org.gatein.pc.api.info.PortletInfo;
@@ -53,6 +56,7 @@
@ComponentConfig(template =
"app:/groovy/applicationregistry/webui/component/UIPortletManagement.gtmpl",
events = {
@EventConfig(listeners = UIPortletManagement.SelectPortletActionListener.class),
@EventConfig(listeners = UIPortletManagement.SelectPortletType.class)})
+@Serialized
public class UIPortletManagement extends UIContainer
{
@@ -68,9 +72,21 @@
private String selectedType;
- private static final Comparator<WebApp> WEB_APP_COMPARATOR = new
WebAppComparator();
+ private static final Comparator<WebApp> WEB_APP_COMPARATOR = new
Comparator<WebApp>()
+ {
+ public int compare(WebApp app1, WebApp app2)
+ {
+ return app1.getName().compareToIgnoreCase(app2.getName());
+ }
+ };
- private static final Comparator<PortletExtra> PORTLET_EXTRA_COMPARATOR = new
PortletComparator();
+ private static final Comparator<PortletExtra> PORTLET_EXTRA_COMPARATOR = new
Comparator<PortletExtra>()
+ {
+ public int compare(PortletExtra portlet1, PortletExtra portlet2)
+ {
+ return portlet1.getName().compareToIgnoreCase(portlet2.getName());
+ }
+ };
public UIPortletManagement() throws Exception
{
@@ -80,6 +96,7 @@
private void initWebApps(String type) throws Exception
{
webApps = new LinkedList<WebApp>(); // LinkedList is more appropriate here
since we add lots of elements and sort
+ // julien : who said that LinkedList is appropriate for sorting ?
ExoContainer manager = ExoContainerContext.getCurrentContainer();
FederatingPortletInvoker portletInvoker =
@@ -104,7 +121,6 @@
for (Portlet portlet : portlets)
{
PortletInfo info = portlet.getInfo();
- String portletName = info.getName();
String appName = info.getApplicationName();
WebApp webApp = getWebApp(appName);
@@ -113,8 +129,7 @@
webApp = new WebApp(appName);
webApps.add(webApp);
}
- String portletId = appName + "/" + portletName;
- webApp.addPortlet(new PortletExtra(portletId, type, info));
+ webApp.addPortlet(new PortletExtra(portlet));
}
Collections.sort(webApps, WEB_APP_COMPARATOR);
@@ -232,6 +247,7 @@
}
+ @Converted(PortletExtraSerializer.class)
static public class PortletExtra
{
@@ -245,14 +261,24 @@
private PortletInfo portletInfo_;
- public PortletExtra(String id, String type, PortletInfo info)
+ final PortletContext context;
+
+ public PortletExtra(Portlet portlet)
{
- id_ = id;
- String[] fragments = id.split("/");
+ PortletInfo info = portlet.getInfo();
+ String portletName = info.getName();
+ String appName = info.getApplicationName();
+ String portletId = appName + "/" + portletName;
+ String type = portlet.isRemote() ? REMOTE : LOCAL;
+
+ //
+ id_ = portletId;
+ String[] fragments = portletId.split("/");
group_ = fragments[0];
name_ = fragments[1];
type_ = type;
portletInfo_ = info;
+ context = portlet.getContext();
}
public String getId()
@@ -277,18 +303,12 @@
public String getDisplayName()
{
- LocalizedString displayName =
portletInfo_.getMeta().getMetaValue(MetaInfo.DISPLAY_NAME);
- if (displayName == null || displayName.getDefaultString() == null)
- return name_;
- return displayName.getDefaultString();
+ return getMetaValue(MetaInfo.DISPLAY_NAME, name_);
}
public String getDescription()
{
- LocalizedString description =
portletInfo_.getMeta().getMetaValue(MetaInfo.DESCRIPTION);
- if (description == null || description.getDefaultString() == null)
- return name_;
- return description.getDefaultString();
+ return getMetaValue(MetaInfo.DESCRIPTION, name_);
}
public PreferencesInfo getPortletPreferences()
@@ -296,8 +316,16 @@
return portletInfo_.getPreferences();
}
+ private String getMetaValue(String metaKey, String defaultValue)
+ {
+ LocalizedString metaValue = portletInfo_.getMeta().getMetaValue(metaKey);
+ if (metaValue == null || metaValue.getDefaultString() == null)
+ return defaultValue;
+ return metaValue.getDefaultString();
+ }
}
+ @Serialized
static public class WebApp
{
@@ -305,6 +333,10 @@
List<PortletExtra> portlets_;
+ public WebApp()
+ {
+ }
+
public WebApp(String name)
{
name_ = name;
@@ -344,25 +376,4 @@
}
}
-
- static public class WebAppComparator implements Comparator<WebApp>
- {
-
- public int compare(WebApp app1, WebApp app2)
- {
- return app1.getName().compareToIgnoreCase(app2.getName());
- }
-
- }
-
- static public class PortletComparator implements Comparator<PortletExtra>
- {
-
- public int compare(PortletExtra portlet1, PortletExtra portlet2)
- {
- return portlet1.getName().compareToIgnoreCase(portlet2.getName());
- }
-
- }
-
}
Modified:
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/organization/webui/component/UIListMembershipType.java
===================================================================
---
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/organization/webui/component/UIListMembershipType.java 2010-01-18
12:02:11 UTC (rev 1347)
+++
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/organization/webui/component/UIListMembershipType.java 2010-01-18
12:31:08 UTC (rev 1348)
@@ -19,8 +19,7 @@
package org.exoplatform.organization.webui.component;
-import org.exoplatform.commons.utils.ObjectPageList;
-import org.exoplatform.commons.utils.PageList;
+import org.exoplatform.commons.utils.*;
import org.exoplatform.portal.config.UserACL;
import org.exoplatform.services.organization.MembershipType;
import org.exoplatform.services.organization.OrganizationService;
@@ -36,6 +35,7 @@
import org.exoplatform.webui.event.Event;
import org.exoplatform.webui.event.EventListener;
+import java.io.Serializable;
import java.io.Writer;
import java.util.List;
@@ -70,11 +70,17 @@
@SuppressWarnings("unchecked")
public void loadData() throws Exception
{
- OrganizationService service = getApplicationComponent(OrganizationService.class);
- List memberships = (List)service.getMembershipTypeHandler().findMembershipTypes();
- PageList pagelist = new ObjectPageList(memberships, 10);
- pagelist.setPageSize(5);
- getChild(UIGrid.class).getUIPageIterator().setPageList(pagelist);
+ StatelessPageList<MembershipType> pla = new
StatelessPageList<MembershipType>(5)
+ {
+ @Override
+ protected ListAccess<MembershipType> connect() throws Exception
+ {
+ OrganizationService service =
getApplicationComponent(OrganizationService.class);
+ List<MembershipType> memberships =
(List<MembershipType>)service.getMembershipTypeHandler().findMembershipTypes();
+ return new ListAccessImpl<MembershipType>(MembershipType.class,
memberships);
+ }
+ };
+ getChild(UIGrid.class).getUIPageIterator().setPageList(pla);
}
public void processRender(WebuiRequestContext context) throws Exception
Modified: portal/trunk/web/portal/src/main/webapp/WEB-INF/webui-configuration.xml
===================================================================
--- portal/trunk/web/portal/src/main/webapp/WEB-INF/webui-configuration.xml 2010-01-18
12:02:11 UTC (rev 1347)
+++ portal/trunk/web/portal/src/main/webapp/WEB-INF/webui-configuration.xml 2010-01-18
12:31:08 UTC (rev 1348)
@@ -30,7 +30,6 @@
<ui-component-root>org.exoplatform.portal.webui.workspace.UIPortalApplication</ui-component-root>
<state-manager>org.exoplatform.portal.application.PortalStateManager</state-manager>
-
<!--<state-manager>org.exoplatform.portal.application.ReplicatingStateManager</state-manager>-->
<application-lifecycle-listeners>
<listener>org.exoplatform.portal.application.PortalStatisticLifecycle</listener>
Modified:
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/portlet/ParentAppStateManager.java
===================================================================
---
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/portlet/ParentAppStateManager.java 2010-01-18
12:02:11 UTC (rev 1347)
+++
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/portlet/ParentAppStateManager.java 2010-01-18
12:31:08 UTC (rev 1348)
@@ -38,8 +38,10 @@
}
@SuppressWarnings("unused")
- public void storeUIRootComponent(WebuiRequestContext context)
+ public void storeUIRootComponent(WebuiRequestContext context) throws Exception
{
+ WebuiRequestContext pcontext =
(WebuiRequestContext)context.getParentAppRequestContext();
+ pcontext.getStateManager().storeUIRootComponent(context);
}
@SuppressWarnings("unused")
Modified:
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/portlet/PortletApplication.java
===================================================================
---
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/portlet/PortletApplication.java 2010-01-18
12:02:11 UTC (rev 1347)
+++
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/portlet/PortletApplication.java 2010-01-18
12:31:08 UTC (rev 1348)
@@ -27,6 +27,7 @@
import org.exoplatform.services.log.Log;
import org.exoplatform.web.application.ApplicationLifecycle;
import org.exoplatform.web.application.RequestContext;
+import org.exoplatform.webui.application.StateManager;
import org.exoplatform.webui.application.WebuiApplication;
import org.exoplatform.webui.application.WebuiRequestContext;
import org.exoplatform.webui.core.UIApplication;
@@ -159,13 +160,17 @@
{
lifecycle.onStartRequest(this, context);
}
- UIApplication uiApp = getStateManager().restoreUIRootComponent(context);
+ StateManager sm = getStateManager();
+ UIApplication uiApp = sm.restoreUIRootComponent(context);
context.setUIApplication(uiApp);
uiApp.processDecode(context);
if (!context.isResponseComplete() && !context.getProcessRender())
{
uiApp.processAction(context);
}
+
+ // Store ui root
+ sm.storeUIRootComponent(context);
}
finally
{
@@ -194,12 +199,16 @@
{
lifecycle.onStartRequest(this, context);
}
- UIApplication uiApp = getStateManager().restoreUIRootComponent(context);
+ StateManager sm = getStateManager();
+ UIApplication uiApp = sm.restoreUIRootComponent(context);
context.setUIApplication(uiApp);
javax.portlet.Event portletEvent = req.getEvent();
context.setAttribute(PORTLET_EVENT_VALUE, portletEvent.getValue());
Event<UIComponent> uiEvent = uiApp.createEvent(portletEvent.getName(),
Phase.PROCESS, context);
uiEvent.broadcast();
+
+ // Store ui root
+ sm.storeUIRootComponent(context);
}
finally
{
@@ -236,7 +245,8 @@
lifecycle.onStartRequest(this, context);
}
}
- UIApplication uiApp = getStateManager().restoreUIRootComponent(context);
+ StateManager sm = getStateManager();
+ UIApplication uiApp = sm.restoreUIRootComponent(context);
context.setUIApplication(uiApp);
if (!context.isResponseComplete())
{
@@ -244,6 +254,9 @@
uiPortletApp.processRender(this, context);
}
uiApp.setLastAccessApplication(System.currentTimeMillis());
+
+ // Store ui root
+ sm.storeUIRootComponent(context);
}
finally
{
Deleted:
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/ReplicatingStateManager.java
===================================================================
---
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/ReplicatingStateManager.java 2010-01-18
12:02:11 UTC (rev 1347)
+++
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/ReplicatingStateManager.java 2010-01-18
12:31:08 UTC (rev 1348)
@@ -1,50 +0,0 @@
-/*
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-
-package org.exoplatform.webui.application.replication;
-
-import org.exoplatform.webui.application.StateManager;
-import org.exoplatform.webui.application.WebuiApplication;
-import org.exoplatform.webui.application.WebuiRequestContext;
-import org.exoplatform.webui.core.UIApplication;
-
-/**
- * The basis is either {@link org.exoplatform.webui.core.UIPortletApplication} or
- * {@link org.exoplatform.portal.webui.workspace.UIPortalApplication}.
- *
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
- * @version $Revision$
- */
-public class ReplicatingStateManager extends StateManager {
-
- @Override
- public UIApplication restoreUIRootComponent(WebuiRequestContext context) throws
Exception {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public void storeUIRootComponent(WebuiRequestContext context) throws Exception {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public void expire(String sessionId, WebuiApplication app) throws Exception {
- throw new UnsupportedOperationException();
- }
-}
Modified:
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/model/TypeDomain.java
===================================================================
---
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/model/TypeDomain.java 2010-01-18
12:02:11 UTC (rev 1347)
+++
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/model/TypeDomain.java 2010-01-18
12:31:08 UTC (rev 1348)
@@ -163,7 +163,7 @@
typeModelMap.putAll(addedTypeModels);
//
- System.out.println("Added types " + addedTypeModels.values() + " to
replication domain");
+// System.out.println("Added types " + addedTypeModels.values() + "
to replication domain");
//
return model;
Modified:
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/model/metadata/DomainMetaData.java
===================================================================
---
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/model/metadata/DomainMetaData.java 2010-01-18
12:02:11 UTC (rev 1347)
+++
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/model/metadata/DomainMetaData.java 2010-01-18
12:31:08 UTC (rev 1348)
@@ -85,4 +85,22 @@
}
state.put(clazz.getName(), new ClassTypeMetaData(serialized));
}
+
+ public void addConvertedType(String name, Class<? extends TypeConverter<?,
?>> converterClass)
+ {
+ if (name == null)
+ {
+ throw new NullPointerException();
+ }
+ state.put(name, new ConvertedTypeMetaData(converterClass));
+ }
+
+ public void addClassType(String name, boolean serialized)
+ {
+ if (name == null)
+ {
+ throw new NullPointerException();
+ }
+ state.put(name, new ClassTypeMetaData(serialized));
+ }
}
Modified:
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/serial/ObjectWriter.java
===================================================================
---
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/serial/ObjectWriter.java 2010-01-18
12:02:11 UTC (rev 1347)
+++
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/serial/ObjectWriter.java 2010-01-18
12:31:08 UTC (rev 1348)
@@ -139,7 +139,7 @@
{
if (!fieldModel.isTransient())
{
- System.out.println("About to serialize field " +
fieldModel + " of type " + currentTypeModel);
+// System.out.println("About to serialize field " +
fieldModel + " of type " + currentTypeModel);
Object fieldValue = fieldModel.get(obj);
if (fieldValue == null)
{
Modified:
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/bean/ReflectionDataMapping.java
===================================================================
---
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/bean/ReflectionDataMapping.java 2010-01-18
12:02:11 UTC (rev 1347)
+++
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/bean/ReflectionDataMapping.java 2010-01-18
12:31:08 UTC (rev 1348)
@@ -20,6 +20,7 @@
package org.exoplatform.webui.bean;
import org.exoplatform.util.ReflectionUtil;
+import org.exoplatform.webui.application.replication.api.annotations.Converted;
import org.exoplatform.webui.core.UIComponent;
import org.exoplatform.webui.form.UIForm;
import org.exoplatform.webui.form.UIFormInput;
@@ -30,11 +31,25 @@
import java.util.List;
/**
+ * A stateless object that must be obtained via the {@link #getInstance()} method.
+ *
* Author : Nhu Dinh Thuan thuan.nhu(a)exoplatform.com Oct 13, 2006
*/
public class ReflectionDataMapping implements BeanDataMapping
{
+ /** . */
+ private static final ReflectionDataMapping instance = new ReflectionDataMapping();
+
+ public static ReflectionDataMapping getInstance()
+ {
+ return instance;
+ }
+
+ private ReflectionDataMapping()
+ {
+ }
+
public void mapBean(Object bean, UIForm uiForm) throws Exception
{
List<UIComponent> children = uiForm.getChildren();
Modified:
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/UIApplication.java
===================================================================
---
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/UIApplication.java 2010-01-18
12:02:11 UTC (rev 1347)
+++
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/UIApplication.java 2010-01-18
12:31:08 UTC (rev 1348)
@@ -23,6 +23,7 @@
import org.exoplatform.services.log.Log;
import org.exoplatform.web.application.ApplicationMessage;
import org.exoplatform.webui.application.WebuiRequestContext;
+import org.exoplatform.webui.application.replication.api.annotations.Serialized;
import org.exoplatform.webui.exception.MessageException;
import java.io.Writer;
@@ -31,6 +32,7 @@
* Created by The eXo Platform SAS
* May 8, 2006
*/
+@Serialized
abstract public class UIApplication extends UIContainer
{
Modified:
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/UIBreadcumbs.java
===================================================================
---
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/UIBreadcumbs.java 2010-01-18
12:02:11 UTC (rev 1347)
+++
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/UIBreadcumbs.java 2010-01-18
12:31:08 UTC (rev 1348)
@@ -21,6 +21,7 @@
import org.exoplatform.webui.application.WebuiRequestContext;
import org.exoplatform.webui.application.portlet.PortletRequestContext;
+import org.exoplatform.webui.application.replication.api.annotations.Serialized;
import org.exoplatform.webui.config.annotation.ComponentConfig;
import org.exoplatform.webui.config.annotation.EventConfig;
import org.exoplatform.webui.core.UIBreadcumbs.SelectPathActionListener;
@@ -28,6 +29,7 @@
import org.exoplatform.webui.event.EventListener;
import org.exoplatform.webui.form.UIForm;
+import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
@@ -39,6 +41,7 @@
*
*/
@ComponentConfig(events = @EventConfig(listeners = SelectPathActionListener.class))
+@Serialized
public class UIBreadcumbs extends UIComponent
{
/**
@@ -129,7 +132,7 @@
}
}
- static public class LocalPath
+ static public class LocalPath implements Serializable
{
private String label_;
Modified:
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/UIComponent.java
===================================================================
---
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/UIComponent.java 2010-01-18
12:02:11 UTC (rev 1347)
+++
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/UIComponent.java 2010-01-18
12:31:08 UTC (rev 1348)
@@ -25,6 +25,7 @@
import org.exoplatform.web.application.URLBuilder;
import org.exoplatform.webui.application.WebuiApplication;
import org.exoplatform.webui.application.WebuiRequestContext;
+import org.exoplatform.webui.application.replication.api.annotations.Serialized;
import org.exoplatform.webui.config.Component;
import org.exoplatform.webui.core.renderers.ValueRenderer;
import org.exoplatform.webui.core.renderers.ValueRendererRegistry;
@@ -37,6 +38,7 @@
import java.util.List;
/** Created by The eXo Platform SAS May 7, 2006 */
+@Serialized
abstract public class UIComponent
{
@@ -50,12 +52,14 @@
private boolean rendered = true;
- transient protected UIComponent uiparent;
+ protected UIComponent uiparent;
- transient protected Component config;
+ private String configId;
- transient private ValueRendererRegistry rendererRegistry = new
ValueRendererRegistry();
+ protected transient Component config;
+ private transient ValueRendererRegistry rendererRegistry = new
ValueRendererRegistry();
+
public String getId()
{
return this.id;
@@ -164,6 +168,7 @@
public void setComponentConfig(String componentId, Component config) throws Exception
{
this.config = config;
+ this.configId = config.getId();
if (componentId == null || componentId.length() == 0)
{
componentId = config.getId();
Modified:
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/UIComponentDecorator.java
===================================================================
---
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/UIComponentDecorator.java 2010-01-18
12:02:11 UTC (rev 1347)
+++
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/UIComponentDecorator.java 2010-01-18
12:31:08 UTC (rev 1348)
@@ -20,6 +20,7 @@
package org.exoplatform.webui.core;
import org.exoplatform.webui.application.WebuiRequestContext;
+import org.exoplatform.webui.application.replication.api.annotations.Serialized;
import org.exoplatform.webui.config.annotation.ComponentConfig;
import org.exoplatform.webui.core.lifecycle.Lifecycle;
@@ -34,6 +35,7 @@
* The decorator of a component
*/
@ComponentConfig(lifecycle = UIComponentDecorator.UIComponentDecoratorLifecycle.class)
+@Serialized
public class UIComponentDecorator extends UIComponent
{
/**
Modified:
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/UIContainer.java
===================================================================
---
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/UIContainer.java 2010-01-18
12:02:11 UTC (rev 1347)
+++
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/UIContainer.java 2010-01-18
12:31:08 UTC (rev 1348)
@@ -21,6 +21,7 @@
import org.exoplatform.webui.application.WebuiApplication;
import org.exoplatform.webui.application.WebuiRequestContext;
+import org.exoplatform.webui.application.replication.api.annotations.Serialized;
import org.exoplatform.webui.config.annotation.ComponentConfig;
import org.exoplatform.webui.core.lifecycle.UIContainerLifecycle;
import org.exoplatform.webui.event.Event;
@@ -31,6 +32,7 @@
/** Created by The eXo Platform SAS May 7, 2006 */
@ComponentConfig(lifecycle = UIContainerLifecycle.class)
+@Serialized
public class UIContainer extends UIComponent
{
Modified: portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/UIGrid.java
===================================================================
---
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/UIGrid.java 2010-01-18
12:02:11 UTC (rev 1347)
+++
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/UIGrid.java 2010-01-18
12:31:08 UTC (rev 1348)
@@ -20,6 +20,7 @@
package org.exoplatform.webui.core;
import org.exoplatform.util.ReflectionUtil;
+import org.exoplatform.webui.application.replication.api.annotations.Serialized;
import org.exoplatform.webui.config.annotation.ComponentConfig;
import java.lang.reflect.Method;
@@ -33,6 +34,7 @@
* @see UIPageIterator
*/
@ComponentConfig(template = "system:/groovy/webui/core/UIGrid.gtmpl")
+@Serialized
public class UIGrid extends UIComponent
{
/** The page iterator */
Modified:
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/UIPageIterator.java
===================================================================
---
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/UIPageIterator.java 2010-01-18
12:02:11 UTC (rev 1347)
+++
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/UIPageIterator.java 2010-01-18
12:31:08 UTC (rev 1348)
@@ -19,7 +19,9 @@
package org.exoplatform.webui.core;
+import org.exoplatform.commons.utils.EmptySerializablePageList;
import org.exoplatform.commons.utils.PageList;
+import org.exoplatform.webui.application.replication.api.annotations.Serialized;
import org.exoplatform.webui.config.annotation.ComponentConfig;
import org.exoplatform.webui.config.annotation.EventConfig;
import org.exoplatform.webui.event.Event;
@@ -32,12 +34,13 @@
*
*/
@ComponentConfig(template = "system:/groovy/webui/core/UIPageIterator.gtmpl",
events = @EventConfig(listeners = UIPageIterator.ShowPageActionListener.class))
+@Serialized
public class UIPageIterator extends UIComponent
{
/**
* The list of pages
*/
- private PageList pageList_ = PageList.EMPTY_LIST;
+ private PageList pageList_ = EmptySerializablePageList.get();
public UIPageIterator()
{
Modified:
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/UIPopupMessages.java
===================================================================
---
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/UIPopupMessages.java 2010-01-18
12:02:11 UTC (rev 1347)
+++
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/UIPopupMessages.java 2010-01-18
12:31:08 UTC (rev 1348)
@@ -21,6 +21,7 @@
import org.exoplatform.web.application.ApplicationMessage;
import org.exoplatform.webui.application.WebuiRequestContext;
+import org.exoplatform.webui.application.replication.api.annotations.Serialized;
import org.exoplatform.webui.config.annotation.ComponentConfig;
import org.exoplatform.webui.config.annotation.EventConfig;
import org.exoplatform.webui.event.Event;
@@ -39,6 +40,7 @@
* A component to display messages of different types, in a popup window
*/
@ComponentConfig(template = "system:/groovy/webui/core/UIPopupMessages.gtmpl",
events = @EventConfig(listeners = UIPopupMessages.CloseActionListener.class))
+@Serialized
public class UIPopupMessages extends UIPopupWindow
{
/**
Modified:
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/UIPopupWindow.java
===================================================================
---
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/UIPopupWindow.java 2010-01-18
12:02:11 UTC (rev 1347)
+++
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/UIPopupWindow.java 2010-01-18
12:31:08 UTC (rev 1348)
@@ -20,6 +20,7 @@
package org.exoplatform.webui.core;
import org.exoplatform.webui.application.WebuiRequestContext;
+import org.exoplatform.webui.application.replication.api.annotations.Serialized;
import org.exoplatform.webui.config.annotation.ComponentConfig;
import org.exoplatform.webui.config.annotation.EventConfig;
import org.exoplatform.webui.event.Event;
@@ -35,6 +36,7 @@
* A component that creates an empty popup window
*/
@ComponentConfig(template = "system:/groovy/webui/core/UIPopupWindow.gtmpl",
events = @EventConfig(listeners = UIPopupWindow.CloseActionListener.class, name =
"ClosePopup"))
+@Serialized
public class UIPopupWindow extends UIComponentDecorator
{
/**
Modified:
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/UIPortletApplication.java
===================================================================
---
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/UIPortletApplication.java 2010-01-18
12:02:11 UTC (rev 1347)
+++
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/UIPortletApplication.java 2010-01-18
12:31:08 UTC (rev 1348)
@@ -21,10 +21,12 @@
import org.exoplatform.webui.application.WebuiApplication;
import org.exoplatform.webui.application.WebuiRequestContext;
+import org.exoplatform.webui.application.replication.api.annotations.Serialized;
import java.io.Writer;
import java.util.Set;
+@Serialized
abstract public class UIPortletApplication extends UIApplication
{
private int minWidth = 300;
Modified: portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/UITree.java
===================================================================
---
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/UITree.java 2010-01-18
12:02:11 UTC (rev 1347)
+++
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/UITree.java 2010-01-18
12:31:08 UTC (rev 1348)
@@ -21,6 +21,7 @@
import org.exoplatform.util.ReflectionUtil;
import org.exoplatform.webui.application.WebuiRequestContext;
+import org.exoplatform.webui.application.replication.api.annotations.Serialized;
import org.exoplatform.webui.config.annotation.ComponentConfig;
import org.exoplatform.webui.config.annotation.EventConfig;
import org.exoplatform.webui.event.Event;
@@ -40,6 +41,7 @@
* @see UIRightClickPopupMenu
*/
@ComponentConfig(template = "system:/groovy/webui/core/UITree.gtmpl", events =
@EventConfig(listeners = UITree.ChangeNodeActionListener.class))
+@Serialized
public class UITree extends UIComponent
{
/**
Modified:
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/model/SelectItemOption.java
===================================================================
---
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/model/SelectItemOption.java 2010-01-18
12:02:11 UTC (rev 1347)
+++
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/model/SelectItemOption.java 2010-01-18
12:31:08 UTC (rev 1348)
@@ -19,6 +19,8 @@
package org.exoplatform.webui.core.model;
+import org.exoplatform.webui.application.replication.api.annotations.Serialized;
+
/**
* Created by The eXo Platform SARL
* Author : Tuan Nguyen
@@ -30,7 +32,8 @@
* @see SelectItemCategory
* @see org.exoplatform.webui.form.UIFormInputItemSelector
*/
-public class SelectItemOption<T extends Object>
+@Serialized
+public class SelectItemOption<T>
{
/**
* The label of the item
@@ -57,6 +60,10 @@
*/
protected String description_;
+ public SelectItemOption()
+ {
+ }
+
public SelectItemOption(String label, T value, String icon)
{
this(label, value, "", icon);
Modified: portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIForm.java
===================================================================
---
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIForm.java 2010-01-18
12:02:11 UTC (rev 1347)
+++
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIForm.java 2010-01-18
12:31:08 UTC (rev 1348)
@@ -21,6 +21,7 @@
import org.exoplatform.webui.application.WebuiRequestContext;
import org.exoplatform.webui.application.portlet.PortletRequestContext;
+import org.exoplatform.webui.application.replication.api.annotations.Serialized;
import org.exoplatform.webui.bean.BeanDataMapping;
import org.exoplatform.webui.bean.ReflectionDataMapping;
import org.exoplatform.webui.config.Event;
@@ -38,6 +39,7 @@
* minhdv81(a)yahoo.com
* Jun 6, 2006
*/
+@Serialized
public class UIForm extends UIContainer
{
@@ -53,7 +55,7 @@
private boolean multipart_ = false;
- private BeanDataMapping beanMapping = null;
+ private transient BeanDataMapping beanMapping = null;
public UIForm addUIFormInput(UIFormInput input)
{
@@ -151,14 +153,14 @@
public void invokeGetBindingBean(Object bean) throws Exception
{
if (beanMapping == null)
- beanMapping = new ReflectionDataMapping();
+ beanMapping = ReflectionDataMapping.getInstance();
beanMapping.mapField(this, bean);
}
public void invokeSetBindingBean(Object bean) throws Exception
{
if (beanMapping == null)
- beanMapping = new ReflectionDataMapping();
+ beanMapping = ReflectionDataMapping.getInstance();
beanMapping.mapBean(bean, this);
}
Modified:
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormCheckBoxInput.java
===================================================================
---
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormCheckBoxInput.java 2010-01-18
12:02:11 UTC (rev 1347)
+++
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormCheckBoxInput.java 2010-01-18
12:31:08 UTC (rev 1348)
@@ -20,6 +20,7 @@
package org.exoplatform.webui.form;
import org.exoplatform.webui.application.WebuiRequestContext;
+import org.exoplatform.webui.application.replication.api.annotations.Serialized;
import java.io.Writer;
@@ -28,6 +29,7 @@
* @param <T> The type of value that is expected
*/
@SuppressWarnings("hiding")
+@Serialized
public class UIFormCheckBoxInput<T> extends UIFormInputBase<T>
{
/**
@@ -42,6 +44,10 @@
private String componentEvent_ = null;
+ public UIFormCheckBoxInput()
+ {
+ }
+
@SuppressWarnings("unchecked")
public UIFormCheckBoxInput(String name, String bindingExpression, T value)
{
Modified:
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormGrid.java
===================================================================
---
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormGrid.java 2010-01-18
12:02:11 UTC (rev 1347)
+++
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormGrid.java 2010-01-18
12:31:08 UTC (rev 1348)
@@ -19,6 +19,7 @@
package org.exoplatform.webui.form;
+import org.exoplatform.webui.application.replication.api.annotations.Serialized;
import org.exoplatform.webui.config.annotation.ComponentConfig;
import org.exoplatform.webui.core.UIGrid;
@@ -29,6 +30,7 @@
* Jul 9, 2007
*/
@ComponentConfig(template = "system:/groovy/webui/core/UIGrid.gtmpl")
+@Serialized
public class UIFormGrid extends UIGrid
{
Modified:
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormInputBase.java
===================================================================
---
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormInputBase.java 2010-01-18
12:02:11 UTC (rev 1347)
+++
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormInputBase.java 2010-01-18
12:31:08 UTC (rev 1348)
@@ -20,6 +20,7 @@
package org.exoplatform.webui.form;
import org.exoplatform.webui.application.WebuiRequestContext;
+import org.exoplatform.webui.application.replication.api.annotations.Serialized;
import org.exoplatform.webui.core.UIComponent;
import org.exoplatform.webui.core.UIContainer;
import org.exoplatform.webui.event.Event;
@@ -39,6 +40,7 @@
* The base class to create form elements.
* Extend it to create your own elements.
*/
+@Serialized
abstract public class UIFormInputBase<T> extends UIContainer implements
UIFormInput<T>
{
@@ -97,6 +99,10 @@
setId(name);
}
+ protected UIFormInputBase()
+ {
+ }
+
public String getName()
{
return name;
Modified:
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormInputContainer.java
===================================================================
---
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormInputContainer.java 2010-01-18
12:02:11 UTC (rev 1347)
+++
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormInputContainer.java 2010-01-18
12:31:08 UTC (rev 1348)
@@ -19,6 +19,7 @@
package org.exoplatform.webui.form;
+import org.exoplatform.webui.application.replication.api.annotations.Serialized;
import org.exoplatform.webui.core.UIContainer;
import org.exoplatform.webui.form.validator.Validator;
@@ -34,6 +35,7 @@
*
* Represents an abstract container of elements, inside a form
*/
+@Serialized
abstract public class UIFormInputContainer<T> extends UIContainer implements
UIFormInput<T>
{
Modified:
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormInputInfo.java
===================================================================
---
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormInputInfo.java 2010-01-18
12:02:11 UTC (rev 1347)
+++
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormInputInfo.java 2010-01-18
12:31:08 UTC (rev 1348)
@@ -20,6 +20,7 @@
package org.exoplatform.webui.form;
import org.exoplatform.webui.application.WebuiRequestContext;
+import org.exoplatform.webui.application.replication.api.annotations.Serialized;
import java.io.Writer;
@@ -27,9 +28,14 @@
* Represents a info text element
*
*/
+@Serialized
public class UIFormInputInfo extends UIFormInputBase<String>
{
+ public UIFormInputInfo()
+ {
+ }
+
public UIFormInputInfo(String name, String bindingExpression, String value)
{
super(name, bindingExpression, String.class);
Modified:
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormInputSet.java
===================================================================
---
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormInputSet.java 2010-01-18
12:02:11 UTC (rev 1347)
+++
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormInputSet.java 2010-01-18
12:31:08 UTC (rev 1348)
@@ -20,6 +20,7 @@
package org.exoplatform.webui.form;
import org.exoplatform.webui.application.WebuiRequestContext;
+import org.exoplatform.webui.application.replication.api.annotations.Serialized;
import org.exoplatform.webui.bean.BeanDataMapping;
import org.exoplatform.webui.bean.ReflectionDataMapping;
import org.exoplatform.webui.core.UIComponent;
@@ -39,10 +40,11 @@
*
* Represents table containing several input fields
*/
+@Serialized
public class UIFormInputSet extends UIContainer
{
- private BeanDataMapping beanMapping = null;
+ private transient BeanDataMapping beanMapping = null;
private static String selectedCompId = "";
@@ -132,14 +134,14 @@
public void invokeGetBindingField(Object bean) throws Exception
{
if (beanMapping == null)
- beanMapping = new ReflectionDataMapping();
+ beanMapping = ReflectionDataMapping.getInstance();
beanMapping.mapField(this, bean);
}
public void invokeSetBindingField(Object bean) throws Exception
{
if (beanMapping == null)
- beanMapping = new ReflectionDataMapping();
+ beanMapping = ReflectionDataMapping.getInstance();
beanMapping.mapBean(bean, this);
}
Modified:
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormPageIterator.java
===================================================================
---
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormPageIterator.java 2010-01-18
12:02:11 UTC (rev 1347)
+++
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormPageIterator.java 2010-01-18
12:31:08 UTC (rev 1348)
@@ -28,6 +28,7 @@
* Represents a multi page iterator
*/
import org.exoplatform.webui.application.WebuiRequestContext;
+import org.exoplatform.webui.application.replication.api.annotations.Serialized;
import org.exoplatform.webui.config.annotation.ComponentConfig;
import org.exoplatform.webui.config.annotation.EventConfig;
import org.exoplatform.webui.core.UIComponent;
@@ -40,6 +41,7 @@
import java.util.List;
@ComponentConfig(template = "system:/groovy/webui/core/UIPageIterator.gtmpl",
events = @EventConfig(listeners = UIFormPageIterator.ShowPageActionListener.class, phase =
Phase.DECODE))
+@Serialized
public class UIFormPageIterator extends UIPageIterator implements
UIFormInput<Object>
{
Modified:
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormPopupWindow.java
===================================================================
---
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormPopupWindow.java 2010-01-18
12:02:11 UTC (rev 1347)
+++
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormPopupWindow.java 2010-01-18
12:31:08 UTC (rev 1348)
@@ -20,6 +20,7 @@
package org.exoplatform.webui.form;
import org.exoplatform.webui.application.WebuiRequestContext;
+import org.exoplatform.webui.application.replication.api.annotations.Serialized;
import org.exoplatform.webui.config.annotation.ComponentConfig;
import org.exoplatform.webui.config.annotation.EventConfig;
import org.exoplatform.webui.core.UIComponent;
@@ -37,6 +38,7 @@
* Nov 20, 2006
*/
@ComponentConfig(template = "system:/groovy/webui/core/UIPopupWindow.gtmpl",
events = @EventConfig(listeners = UIFormPopupWindow.CloseActionListener.class, name =
"CloseFormPopup", phase = Phase.DECODE))
+@Serialized
public class UIFormPopupWindow extends UIPopupWindow implements
UIFormInput<Object>
{
Modified:
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormRadioBoxInput.java
===================================================================
---
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormRadioBoxInput.java 2010-01-18
12:02:11 UTC (rev 1347)
+++
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormRadioBoxInput.java 2010-01-18
12:31:08 UTC (rev 1348)
@@ -20,6 +20,7 @@
package org.exoplatform.webui.form;
import org.exoplatform.webui.application.WebuiRequestContext;
+import org.exoplatform.webui.application.replication.api.annotations.Serialized;
import org.exoplatform.webui.core.model.SelectItemOption;
import java.io.Writer;
@@ -32,6 +33,7 @@
* Represents a radio box element
* The selected box value is stored in the value_ property of UIFormInputBase
*/
+@Serialized
public class UIFormRadioBoxInput extends UIFormInputBase<String>
{
@@ -51,6 +53,10 @@
private int topRender_ = 0;
+ public UIFormRadioBoxInput()
+ {
+ }
+
public UIFormRadioBoxInput(String name, String value)
{
this(name, value, new ArrayList<SelectItemOption<String>>());
Modified:
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormSelectBox.java
===================================================================
---
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormSelectBox.java 2010-01-18
12:02:11 UTC (rev 1347)
+++
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormSelectBox.java 2010-01-18
12:31:08 UTC (rev 1348)
@@ -20,6 +20,7 @@
package org.exoplatform.webui.form;
import org.exoplatform.webui.application.WebuiRequestContext;
+import org.exoplatform.webui.application.replication.api.annotations.Serialized;
import org.exoplatform.webui.core.UIComponent;
import org.exoplatform.webui.core.model.SelectItemOption;
@@ -33,6 +34,7 @@
* Represents a select element
*
*/
+@Serialized
public class UIFormSelectBox extends UIFormStringInput
{
@@ -56,6 +58,10 @@
*/
private String onchange_;
+ public UIFormSelectBox()
+ {
+ }
+
public UIFormSelectBox(String name, String bindingExpression,
List<SelectItemOption<String>> options)
{
super(name, bindingExpression, null);
Modified:
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormStringInput.java
===================================================================
---
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormStringInput.java 2010-01-18
12:02:11 UTC (rev 1347)
+++
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormStringInput.java 2010-01-18
12:31:08 UTC (rev 1348)
@@ -20,6 +20,7 @@
package org.exoplatform.webui.form;
import org.exoplatform.webui.application.WebuiRequestContext;
+import org.exoplatform.webui.application.replication.api.annotations.Serialized;
import java.io.Writer;
@@ -32,6 +33,7 @@
* Represents a input string field
* The value is stored in UIFormInputBase
*/
+@Serialized
public class UIFormStringInput extends UIFormInputBase<String>
{
/**
@@ -54,6 +56,10 @@
*/
private int maxLength = 0;
+ public UIFormStringInput()
+ {
+ }
+
public UIFormStringInput(String name, String bindingExpression, String value)
{
super(name, bindingExpression, String.class);
Modified:
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormTableInputSet.java
===================================================================
---
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormTableInputSet.java 2010-01-18
12:02:11 UTC (rev 1347)
+++
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormTableInputSet.java 2010-01-18
12:31:08 UTC (rev 1348)
@@ -20,6 +20,7 @@
package org.exoplatform.webui.form;
import org.exoplatform.webui.application.WebuiRequestContext;
+import org.exoplatform.webui.application.replication.api.annotations.Serialized;
import org.exoplatform.webui.config.annotation.ComponentConfig;
import org.exoplatform.webui.core.UIComponent;
@@ -30,6 +31,7 @@
* May 7, 2006
*/
@ComponentConfig(template =
"system:/groovy/webui/form/UIFormTableInputSet.gtmpl")
+@Serialized
public class UIFormTableInputSet extends UIFormInputSet
{
Modified:
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormTextAreaInput.java
===================================================================
---
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormTextAreaInput.java 2010-01-18
12:02:11 UTC (rev 1347)
+++
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormTextAreaInput.java 2010-01-18
12:31:08 UTC (rev 1348)
@@ -20,6 +20,7 @@
package org.exoplatform.webui.form;
import org.exoplatform.webui.application.WebuiRequestContext;
+import org.exoplatform.webui.application.replication.api.annotations.Serialized;
import java.io.Writer;
@@ -27,6 +28,7 @@
* Represents a textarea element
* The value is stored in UIFormInputBase
*/
+@Serialized
public class UIFormTextAreaInput extends UIFormInputBase<String>
{
/**
@@ -39,6 +41,10 @@
*/
private int columns = 30;
+ public UIFormTextAreaInput()
+ {
+ }
+
public UIFormTextAreaInput(String name, String bindingExpression, String value) {
super(name, bindingExpression, String.class);
this.value_ = value ;
Modified:
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/IdentifierValidator.java
===================================================================
---
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/IdentifierValidator.java 2010-01-18
12:02:11 UTC (rev 1347)
+++
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/IdentifierValidator.java 2010-01-18
12:31:08 UTC (rev 1348)
@@ -25,6 +25,8 @@
import org.exoplatform.webui.form.UIForm;
import org.exoplatform.webui.form.UIFormInput;
+import java.io.Serializable;
+
/**
* Created by The eXo Platform SARL
* Author : Dang Van Minh
@@ -33,7 +35,7 @@
*
* Validates whether the value is composed of letters, numbers or '_'
*/
-public class IdentifierValidator implements Validator
+public class IdentifierValidator implements Validator, Serializable
{
public void validate(UIFormInput uiInput) throws Exception
Modified:
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/MandatoryValidator.java
===================================================================
---
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/MandatoryValidator.java 2010-01-18
12:02:11 UTC (rev 1347)
+++
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/MandatoryValidator.java 2010-01-18
12:31:08 UTC (rev 1348)
@@ -25,6 +25,8 @@
import org.exoplatform.webui.form.UIForm;
import org.exoplatform.webui.form.UIFormInput;
+import java.io.Serializable;
+
/**
* Created by The eXo Platform SARL
* Author : Dang Van Minh
@@ -36,7 +38,7 @@
* is mandatory in your form, add it this validator. A '*' character will be
automatically added
* during the rendering phase to specify the user
*/
-public class MandatoryValidator implements Validator
+public class MandatoryValidator implements Validator, Serializable
{
public void validate(UIFormInput uiInput) throws Exception
Modified:
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/NameValidator.java
===================================================================
---
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/NameValidator.java 2010-01-18
12:02:11 UTC (rev 1347)
+++
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/NameValidator.java 2010-01-18
12:31:08 UTC (rev 1348)
@@ -25,6 +25,8 @@
import org.exoplatform.webui.form.UIForm;
import org.exoplatform.webui.form.UIFormInput;
+import java.io.Serializable;
+
/**
* Created by The eXo Platform SARL
* Author : Dang Van Minh
@@ -33,7 +35,7 @@
*
* Validates whether this value is composed of letters, numbers, '_',
'-', '.' or '*'
*/
-public class NameValidator implements Validator
+public class NameValidator implements Validator, Serializable
{
public void validate(UIFormInput uiInput) throws Exception
Modified:
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/StringLengthValidator.java
===================================================================
---
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/StringLengthValidator.java 2010-01-18
12:02:11 UTC (rev 1347)
+++
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/StringLengthValidator.java 2010-01-18
12:31:08 UTC (rev 1348)
@@ -25,6 +25,8 @@
import org.exoplatform.webui.form.UIForm;
import org.exoplatform.webui.form.UIFormInput;
+import java.io.Serializable;
+
/**
* Created by The eXo Platform SARL
* Author : Dang Van Minh
@@ -33,7 +35,7 @@
*
* Validates whether this value has a length between min and max
*/
-public class StringLengthValidator implements Validator
+public class StringLengthValidator implements Validator, Serializable
{
/**
* The minimum number of characters in this String
Modified:
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/URLValidator.java
===================================================================
---
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/URLValidator.java 2010-01-18
12:02:11 UTC (rev 1347)
+++
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/URLValidator.java 2010-01-18
12:31:08 UTC (rev 1348)
@@ -25,13 +25,15 @@
import org.exoplatform.webui.form.UIForm;
import org.exoplatform.webui.form.UIFormInput;
+import java.io.Serializable;
+
/**
* Created by The eXo Platform SAS
* Author : Tan Pham Dinh
* pdtanit(a)gmail.com
* Oct 30, 2008
*/
-public class URLValidator implements Validator
+public class URLValidator implements Validator, Serializable
{
static private final String IP_REGEX =
Modified:
portal/trunk/webui/eXo/src/main/java/org/exoplatform/webui/organization/UIGroupMembershipSelector.java
===================================================================
---
portal/trunk/webui/eXo/src/main/java/org/exoplatform/webui/organization/UIGroupMembershipSelector.java 2010-01-18
12:02:11 UTC (rev 1347)
+++
portal/trunk/webui/eXo/src/main/java/org/exoplatform/webui/organization/UIGroupMembershipSelector.java 2010-01-18
12:31:08 UTC (rev 1348)
@@ -24,6 +24,7 @@
import org.exoplatform.services.organization.OrganizationService;
import org.exoplatform.web.application.ApplicationMessage;
import org.exoplatform.webui.application.WebuiRequestContext;
+import org.exoplatform.webui.application.replication.api.annotations.Serialized;
import org.exoplatform.webui.config.annotation.ComponentConfig;
import org.exoplatform.webui.config.annotation.ComponentConfigs;
import org.exoplatform.webui.config.annotation.EventConfig;
@@ -51,6 +52,7 @@
@EventConfig(phase = Phase.DECODE, listeners =
UIGroupMembershipSelector.SelectPathActionListener.class)}),
@ComponentConfig(type = UITree.class, id = "UITreeGroupSelector", template =
"system:/groovy/webui/core/UITree.gtmpl", events = @EventConfig(phase =
Phase.DECODE, listeners = UITree.ChangeNodeActionListener.class)),
@ComponentConfig(type = UIBreadcumbs.class, id = "BreadcumbGroupSelector",
template = "system:/groovy/webui/core/UIBreadcumbs.gtmpl", events =
@EventConfig(phase = Phase.DECODE, listeners =
UIBreadcumbs.SelectPathActionListener.class))})
+@Serialized
public class UIGroupMembershipSelector extends UIContainer
{
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 2010-01-18
12:02:11 UTC (rev 1347)
+++
portal/trunk/webui/eXo/src/main/java/org/exoplatform/webui/organization/UIListPermissionSelector.java 2010-01-18
12:31:08 UTC (rev 1348)
@@ -19,16 +19,16 @@
package org.exoplatform.webui.organization;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
+import java.io.Serializable;
+import java.util.*;
import org.exoplatform.commons.utils.LazyPageList;
+import org.exoplatform.commons.utils.SerializablePageList;
import org.exoplatform.portal.config.UserACL;
import org.exoplatform.portal.config.UserACL.Permission;
import org.exoplatform.web.application.ApplicationMessage;
import org.exoplatform.webui.application.WebuiRequestContext;
+import org.exoplatform.webui.application.replication.api.annotations.Serialized;
import org.exoplatform.webui.config.annotation.ComponentConfig;
import org.exoplatform.webui.config.annotation.EventConfig;
import org.exoplatform.webui.core.UIBreadcumbs;
@@ -53,6 +53,7 @@
@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)})
+@Serialized
public class UIListPermissionSelector extends UISelector<String[]>
{
private boolean publicMode_ = false;
@@ -65,7 +66,7 @@
uiGrid.setLabel("UIListPermissionSelector");
uiGrid.configure("expression", new String[]{"groupId",
"membership"}, new String[]{"Delete"});
UIFormPageIterator uiIterator = (UIFormPageIterator)uiGrid.getUIPageIterator();
- uiIterator.setPageList(new LazyPageList(new PermissionListAccess(null), 10));
+ uiIterator.setPageList(new SerializablePageList(Permission.class,
Collections.emptyList(), 10));
addChild(uiIterator);
uiIterator.setRendered(false);
UIFormPopupWindow uiPopup = addChild(UIFormPopupWindow.class, null, null);
@@ -131,7 +132,7 @@
public UIListPermissionSelector setValue(String[] permissions) throws Exception
{
- List<Object> list = new ArrayList<Object>();
+ List<Permission> list = new ArrayList<Permission>();
setPublicMode(false);
for (String exp : permissions)
{
@@ -155,7 +156,7 @@
list.add(permission);
}
UIPageIterator uiIterator = getChild(UIGrid.class).getUIPageIterator();
- uiIterator.setPageList(new LazyPageList(new AccessGroupListAccess(list), 10));
+ uiIterator.setPageList(new SerializablePageList(Permission.class, list, 10));
return this;
}
@@ -292,7 +293,7 @@
}
- static public class EmptyIteratorValidator implements Validator
+ static public class EmptyIteratorValidator implements Validator, Serializable
{
public void validate(UIFormInput uiInput) throws Exception
{
Modified:
portal/trunk/webui/eXo/src/main/java/org/exoplatform/webui/organization/UISelector.java
===================================================================
---
portal/trunk/webui/eXo/src/main/java/org/exoplatform/webui/organization/UISelector.java 2010-01-18
12:02:11 UTC (rev 1347)
+++
portal/trunk/webui/eXo/src/main/java/org/exoplatform/webui/organization/UISelector.java 2010-01-18
12:31:08 UTC (rev 1348)
@@ -19,6 +19,7 @@
package org.exoplatform.webui.organization;
+import org.exoplatform.webui.application.replication.api.annotations.Serialized;
import org.exoplatform.webui.core.UIComponent;
import org.exoplatform.webui.event.Event;
import org.exoplatform.webui.event.EventListener;
@@ -31,6 +32,7 @@
* nhudinhthuan(a)exoplatform.com
* Jul 19, 2006
*/
+@Serialized
abstract class UISelector<T> extends UIFormInputContainer<T>
{
Added:
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/LegacyPortalStateManager.java
===================================================================
---
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/LegacyPortalStateManager.java
(rev 0)
+++
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/LegacyPortalStateManager.java 2010-01-18
12:31:08 UTC (rev 1348)
@@ -0,0 +1,213 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+
+package org.exoplatform.portal.application;
+
+import org.exoplatform.commons.utils.Safe;
+import org.exoplatform.container.ExoContainer;
+import org.exoplatform.container.SessionManagerContainer;
+import org.exoplatform.portal.config.UserPortalConfig;
+import org.exoplatform.portal.config.UserPortalConfigService;
+import org.exoplatform.portal.webui.workspace.UIPortalApplication;
+import org.exoplatform.services.log.ExoLogger;
+import org.exoplatform.services.log.Log;
+import org.exoplatform.webui.application.ConfigurationManager;
+import org.exoplatform.webui.application.StateManager;
+import org.exoplatform.webui.application.WebuiApplication;
+import org.exoplatform.webui.application.WebuiRequestContext;
+import org.exoplatform.webui.application.portlet.PortletRequestContext;
+import org.exoplatform.webui.core.UIApplication;
+
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+
+public class LegacyPortalStateManager extends StateManager
+{
+
+ protected static Log log =
ExoLogger.getLogger("portal:PortalStateManager");
+
+ /** ConcurrentMap<SessionId, HashMap<PortalName, PortalApplicationState>>
* */
+ private ConcurrentMap<String, HashMap<String, PortalApplicationState>>
uiApplications =
+ new ConcurrentHashMap<String, HashMap<String,
PortalApplicationState>>();
+
+ /**
+ * This method is used to restore the UI component tree either the current request
targets a portlet or the portal.
+ * <p/>
+ * In both cases, if the tree is not stored already it is created and then stored in a
local Map
+ */
+ @SuppressWarnings("unchecked")
+ public UIApplication restoreUIRootComponent(WebuiRequestContext context) throws
Exception
+ {
+ context.setStateManager(this);
+ WebuiApplication app = (WebuiApplication)context.getApplication();
+
+ /*
+ * If the request context is of type PortletRequestContext, we extract the parent
context which will
+ * allow to get access to the PortalApplicationState object thanks to the session
id used as the key for the
+ * synchronize Map uiApplications
+ */
+ if (context instanceof PortletRequestContext)
+ {
+ WebuiRequestContext preqContext =
(WebuiRequestContext)context.getParentAppRequestContext();
+ PortletRequestContext pcontext = (PortletRequestContext)context;
+ String key = pcontext.getApplication().getApplicationId() + "/" +
pcontext.getWindowId();
+ PortalApplicationState state = getApplicationState(preqContext);
+ UIApplication uiApplication = state.get(key);
+ if (uiApplication != null)
+ {
+ return uiApplication;
+ }
+ ConfigurationManager cmanager = app.getConfigurationManager();
+ String uirootClass = cmanager.getApplication().getUIRootComponent();
+ Class type =
Thread.currentThread().getContextClassLoader().loadClass(uirootClass);
+ uiApplication = (UIApplication)app.createUIComponent(type, null, null,
context);
+ state.put(key, uiApplication);
+ return uiApplication;
+ }
+
+ PortalRequestContext pcontext = (PortalRequestContext)context;
+ PortalApplicationState state = getApplicationState(pcontext);
+ if (state != null)
+ {
+ if (!Safe.equals(pcontext.getRemoteUser(), state.getUserName()))
+ {
+ clearSession(pcontext.getRequest().getSession());
+ state = null;
+ }
+ }
+ if (state == null)
+ {
+ ConfigurationManager cmanager = app.getConfigurationManager();
+ String uirootClass = cmanager.getApplication().getUIRootComponent();
+ Class type =
Thread.currentThread().getContextClassLoader().loadClass(uirootClass);
+ UserPortalConfig config = getUserPortalConfig(pcontext);
+ if (config == null)
+ {
+ HttpServletResponse response = pcontext.getResponse();
+ // if(pcontext.getRemoteUser() == null) {
+ // String portalName = pcontext.getPortalOwner() ;
+ // portalName = URLEncoder.encode(portalName, "UTF-8") ;
+ // String redirect = pcontext.getRequest().getContextPath() +
"/private/" + portalName + "/";
+ // response.sendRedirect(redirect);
+ // }
+ // else response.sendRedirect(pcontext.getRequest().getContextPath() +
"/portal-unavailable.jsp");
+ response.sendRedirect(pcontext.getRequest().getContextPath() +
"/portal-unavailable.jsp");
+ pcontext.setResponseComplete(true);
+ return null;
+ }
+ pcontext.setAttribute(UserPortalConfig.class, config);
+ UIPortalApplication uiApplication =
(UIPortalApplication)app.createUIComponent(type, null, null, context);
+ state = new PortalApplicationState(uiApplication, pcontext.getRemoteUser());
+ cacheApplicationState(pcontext.getSessionId(), pcontext.getPortalOwner(),
state);
+ SessionManagerContainer pcontainer =
(SessionManagerContainer)app.getApplicationServiceContainer();
+ pcontainer.createSessionContainer(context.getSessionId(),
uiApplication.getOwner());
+ }
+ return state.getUIPortalApplication();
+ }
+
+ @SuppressWarnings("unused")
+ public void storeUIRootComponent(WebuiRequestContext context)
+ {
+ }
+
+ public void expire(String sessionId, WebuiApplication app)
+ {
+ uiApplications.remove(sessionId);
+ SessionManagerContainer pcontainer =
(SessionManagerContainer)app.getApplicationServiceContainer();
+ pcontainer.removeSessionContainer(sessionId);
+ }
+
+ private PortalApplicationState getApplicationState(WebuiRequestContext context)
+ {
+ PortalRequestContext portalContext = null;
+ if (context instanceof PortalRequestContext)
+ {
+ portalContext = (PortalRequestContext)context;
+ }
+ else
+ {
+ portalContext = (PortalRequestContext)context.getParentAppRequestContext();
+ }
+ String portalName = portalContext.getPortalOwner();
+ String sessionId = portalContext.getSessionId();
+
+ HashMap<String, PortalApplicationState> appStates =
uiApplications.get(sessionId);
+ return (appStates == null) ? null : appStates.get(portalName);
+ }
+
+ private void cacheApplicationState(String sessionId, String portalName,
PortalApplicationState state)
+ {
+ HashMap<String, PortalApplicationState> appStates =
uiApplications.get(sessionId);
+ if (appStates == null)
+ {
+ appStates = new HashMap<String, PortalApplicationState>();
+ uiApplications.put(sessionId, appStates);
+ }
+ appStates.put(portalName, state);
+ }
+
+ private UserPortalConfig getUserPortalConfig(PortalRequestContext context) throws
Exception
+ {
+ ExoContainer appContainer =
context.getApplication().getApplicationServiceContainer();
+ UserPortalConfigService service_ =
+
(UserPortalConfigService)appContainer.getComponentInstanceOfType(UserPortalConfigService.class);
+ String remoteUser = context.getRemoteUser();
+ String ownerUser = context.getPortalOwner();
+ return service_.getUserPortalConfig(ownerUser, remoteUser);
+ }
+
+ private void clearSession(HttpSession session)
+ {
+ Enumeration<?> e = session.getAttributeNames();
+ while (e.hasMoreElements())
+ {
+ String name = (String)e.nextElement();
+ session.removeAttribute(name);
+ }
+ }
+
+ @SuppressWarnings("serial")
+ static public class PortalApplicationState extends HashMap<String,
UIApplication>
+ {
+
+ private final UIPortalApplication uiPortalApplication_;
+
+ private final String userName_;
+
+ public PortalApplicationState(UIPortalApplication uiPortalApplication, String
userName)
+ {
+ uiPortalApplication_ = uiPortalApplication;
+ userName_ = userName;
+ }
+
+ public String getUserName()
+ {
+ return userName_;
+ }
+
+ public UIPortalApplication getUIPortalApplication()
+ {
+ return uiPortalApplication_;
+ }
+ }
+}
\ No newline at end of file
Modified:
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/PortalRequestHandler.java
===================================================================
---
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/PortalRequestHandler.java 2010-01-18
12:02:11 UTC (rev 1347)
+++
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/PortalRequestHandler.java 2010-01-18
12:31:08 UTC (rev 1348)
@@ -110,6 +110,9 @@
if (uiApp != null)
uiApp.setLastAccessApplication(System.currentTimeMillis());
+
+ // Store ui root
+ app.getStateManager().storeUIRootComponent(context);
}
catch (Exception ex)
{
Modified:
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/PortalStateManager.java
===================================================================
---
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/PortalStateManager.java 2010-01-18
12:02:11 UTC (rev 1347)
+++
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/PortalStateManager.java 2010-01-18
12:31:08 UTC (rev 1348)
@@ -19,195 +19,48 @@
package org.exoplatform.portal.application;
-import org.exoplatform.commons.utils.Safe;
import org.exoplatform.container.ExoContainer;
-import org.exoplatform.container.SessionManagerContainer;
-import org.exoplatform.portal.config.UserPortalConfig;
-import org.exoplatform.portal.config.UserPortalConfigService;
-import org.exoplatform.portal.webui.workspace.UIPortalApplication;
-import org.exoplatform.services.log.ExoLogger;
-import org.exoplatform.services.log.Log;
-import org.exoplatform.webui.application.ConfigurationManager;
import org.exoplatform.webui.application.StateManager;
import org.exoplatform.webui.application.WebuiApplication;
import org.exoplatform.webui.application.WebuiRequestContext;
-import org.exoplatform.webui.application.portlet.PortletRequestContext;
import org.exoplatform.webui.core.UIApplication;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.http.HttpSession;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
-
public class PortalStateManager extends StateManager
{
- protected static Log log =
ExoLogger.getLogger("portal:PortalStateManager");
+ /** . */
+ private final StateManager impl;
- /** ConcurrentMap<SessionId, HashMap<PortalName, PortalApplicationState>>
* */
- private ConcurrentMap<String, HashMap<String, PortalApplicationState>>
uiApplications =
- new ConcurrentHashMap<String, HashMap<String,
PortalApplicationState>>();
-
- /**
- * This method is used to restore the UI component tree either the current request
targets a portlet or the portal.
- * <p/>
- * In both cases, if the tree is not stored already it is created and then stored in a
local Map
- */
- @SuppressWarnings("unchecked")
- public UIApplication restoreUIRootComponent(WebuiRequestContext context) throws
Exception
+ public PortalStateManager()
{
- context.setStateManager(this);
- WebuiApplication app = (WebuiApplication)context.getApplication();
+ boolean clustered = ExoContainer.getProfiles().contains("cluster");
- /*
- * If the request context is of type PortletRequestContext, we extract the parent
context which will
- * allow to get access to the PortalApplicationState object thanks to the session
id used as the key for the
- * synchronize Map uiApplications
- */
- if (context instanceof PortletRequestContext)
+ //
+ if (clustered)
{
- WebuiRequestContext preqContext =
(WebuiRequestContext)context.getParentAppRequestContext();
- PortletRequestContext pcontext = (PortletRequestContext)context;
- String key = pcontext.getApplication().getApplicationId() + "/" +
pcontext.getWindowId();
- PortalApplicationState state = getApplicationState(preqContext);
- UIApplication uiApplication = state.get(key);
- if (uiApplication != null)
- {
- return uiApplication;
- }
- ConfigurationManager cmanager = app.getConfigurationManager();
- String uirootClass = cmanager.getApplication().getUIRootComponent();
- Class type =
Thread.currentThread().getContextClassLoader().loadClass(uirootClass);
- uiApplication = (UIApplication)app.createUIComponent(type, null, null,
context);
- state.put(key, uiApplication);
- return uiApplication;
+ impl = new ReplicatingStateManager();
}
-
- PortalRequestContext pcontext = (PortalRequestContext)context;
- PortalApplicationState state = getApplicationState(pcontext);
- if (state != null)
- {
- if (!Safe.equals(pcontext.getRemoteUser(), state.getUserName()))
- {
- clearSession(pcontext.getRequest().getSession());
- state = null;
- }
- }
- if (state == null)
- {
- ConfigurationManager cmanager = app.getConfigurationManager();
- String uirootClass = cmanager.getApplication().getUIRootComponent();
- Class type =
Thread.currentThread().getContextClassLoader().loadClass(uirootClass);
- UserPortalConfig config = getUserPortalConfig(pcontext);
- if (config == null)
- {
- HttpServletResponse response = pcontext.getResponse();
- // if(pcontext.getRemoteUser() == null) {
- // String portalName = pcontext.getPortalOwner() ;
- // portalName = URLEncoder.encode(portalName, "UTF-8") ;
- // String redirect = pcontext.getRequest().getContextPath() +
"/private/" + portalName + "/";
- // response.sendRedirect(redirect);
- // }
- // else response.sendRedirect(pcontext.getRequest().getContextPath() +
"/portal-unavailable.jsp");
- response.sendRedirect(pcontext.getRequest().getContextPath() +
"/portal-unavailable.jsp");
- pcontext.setResponseComplete(true);
- return null;
- }
- pcontext.setAttribute(UserPortalConfig.class, config);
- UIPortalApplication uiApplication =
(UIPortalApplication)app.createUIComponent(type, null, null, context);
- state = new PortalApplicationState(uiApplication, pcontext.getRemoteUser());
- cacheApplicationState(pcontext.getSessionId(), pcontext.getPortalOwner(),
state);
- SessionManagerContainer pcontainer =
(SessionManagerContainer)app.getApplicationServiceContainer();
- pcontainer.createSessionContainer(context.getSessionId(),
uiApplication.getOwner());
- }
- return state.getUIPortalApplication();
- }
-
- @SuppressWarnings("unused")
- public void storeUIRootComponent(WebuiRequestContext context)
- {
- }
-
- public void expire(String sessionId, WebuiApplication app)
- {
- uiApplications.remove(sessionId);
- SessionManagerContainer pcontainer =
(SessionManagerContainer)app.getApplicationServiceContainer();
- pcontainer.removeSessionContainer(sessionId);
- }
-
- private PortalApplicationState getApplicationState(WebuiRequestContext context)
- {
- PortalRequestContext portalContext = null;
- if (context instanceof PortalRequestContext)
- {
- portalContext = (PortalRequestContext)context;
- }
else
{
- portalContext = (PortalRequestContext)context.getParentAppRequestContext();
+ impl = new LegacyPortalStateManager();
}
- String portalName = portalContext.getPortalOwner();
- String sessionId = portalContext.getSessionId();
-
- HashMap<String, PortalApplicationState> appStates =
uiApplications.get(sessionId);
- return (appStates == null) ? null : appStates.get(portalName);
}
- private void cacheApplicationState(String sessionId, String portalName,
PortalApplicationState state)
+ @Override
+ public UIApplication restoreUIRootComponent(WebuiRequestContext context) throws
Exception
{
- HashMap<String, PortalApplicationState> appStates =
uiApplications.get(sessionId);
- if (appStates == null)
- {
- appStates = new HashMap<String, PortalApplicationState>();
- uiApplications.put(sessionId, appStates);
- }
- appStates.put(portalName, state);
+ return impl.restoreUIRootComponent(context);
}
- private UserPortalConfig getUserPortalConfig(PortalRequestContext context) throws
Exception
+ @Override
+ public void storeUIRootComponent(WebuiRequestContext context) throws Exception
{
- ExoContainer appContainer =
context.getApplication().getApplicationServiceContainer();
- UserPortalConfigService service_ =
-
(UserPortalConfigService)appContainer.getComponentInstanceOfType(UserPortalConfigService.class);
- String remoteUser = context.getRemoteUser();
- String ownerUser = context.getPortalOwner();
- return service_.getUserPortalConfig(ownerUser, remoteUser);
+ impl.storeUIRootComponent(context);
}
- private void clearSession(HttpSession session)
+ @Override
+ public void expire(String sessionId, WebuiApplication app) throws Exception
{
- Enumeration<?> e = session.getAttributeNames();
- while (e.hasMoreElements())
- {
- String name = (String)e.nextElement();
- session.removeAttribute(name);
- }
+ impl.expire(sessionId, app);
}
-
- @SuppressWarnings("serial")
- static public class PortalApplicationState extends HashMap<String,
UIApplication>
- {
-
- private final UIPortalApplication uiPortalApplication_;
-
- private final String userName_;
-
- public PortalApplicationState(UIPortalApplication uiPortalApplication, String
userName)
- {
- uiPortalApplication_ = uiPortalApplication;
- userName_ = userName;
- }
-
- public String getUserName()
- {
- return userName_;
- }
-
- public UIPortalApplication getUIPortalApplication()
- {
- return uiPortalApplication_;
- }
- }
}
\ No newline at end of file
Copied:
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/ReplicatingStateManager.java
(from rev 1253,
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/ReplicatingStateManager.java)
===================================================================
---
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/ReplicatingStateManager.java
(rev 0)
+++
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/ReplicatingStateManager.java 2010-01-18
12:31:08 UTC (rev 1348)
@@ -0,0 +1,263 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+
+package org.exoplatform.portal.application;
+
+import org.exoplatform.commons.utils.LazyList;
+import org.exoplatform.commons.utils.LazyPageList;
+import org.exoplatform.commons.utils.PageList;
+import org.exoplatform.container.ExoContainer;
+import org.exoplatform.portal.config.UserPortalConfig;
+import org.exoplatform.portal.config.UserPortalConfigService;
+import org.exoplatform.webui.Util;
+import org.exoplatform.webui.application.ConfigurationManager;
+import org.exoplatform.webui.application.StateManager;
+import org.exoplatform.webui.application.WebuiApplication;
+import org.exoplatform.webui.application.WebuiRequestContext;
+import org.exoplatform.webui.application.portlet.PortletRequestContext;
+import org.exoplatform.webui.application.replication.SerializationContext;
+import org.exoplatform.webui.application.replication.api.annotations.Serialized;
+import org.exoplatform.webui.application.replication.api.factory.CreateException;
+import org.exoplatform.webui.application.replication.api.factory.ObjectFactory;
+import org.exoplatform.webui.application.replication.model.FieldModel;
+import org.exoplatform.webui.application.replication.model.TypeDomain;
+import org.exoplatform.webui.application.replication.model.metadata.DomainMetaData;
+import org.exoplatform.webui.application.replication.serial.ObjectWriter;
+import org.exoplatform.webui.config.Component;
+import org.exoplatform.webui.core.UIApplication;
+import org.exoplatform.webui.core.UIComponent;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+import java.io.ByteArrayOutputStream;
+import java.util.Map;
+
+/**
+ * The basis is either {@link org.exoplatform.webui.core.UIPortletApplication} or
+ * {@link org.exoplatform.portal.webui.workspace.UIPortalApplication}.
+ *
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
+ * @version $Revision$
+ */
+public class ReplicatingStateManager extends StateManager
+{
+
+ @Override
+ public UIApplication restoreUIRootComponent(WebuiRequestContext context) throws
Exception
+ {
+ context.setStateManager(this);
+
+ //
+ WebuiApplication app = (WebuiApplication)context.getApplication();
+
+ //
+ HttpSession session = getSession(context);
+ String key = getKey(context);
+
+ //
+ UIApplication uiapp = (UIApplication)session.getAttribute("bilto_" +
key);
+
+ // Looks like some necessary hacking
+ if (context instanceof PortalRequestContext)
+ {
+ PortalRequestContext portalRC = (PortalRequestContext)context;
+ UserPortalConfig config = getUserPortalConfig(portalRC);
+ if (config == null)
+ {
+ HttpServletResponse response = portalRC.getResponse();
+ response.sendRedirect(portalRC.getRequest().getContextPath() +
"/portal-unavailable.jsp");
+ portalRC.setResponseComplete(true);
+ return null;
+ }
+ portalRC.setAttribute(UserPortalConfig.class, config);
+// SessionManagerContainer pcontainer =
(SessionManagerContainer)app.getApplicationServiceContainer();
+// pcontainer.createSessionContainer(context.getSessionId(), uiapp.getOwner());
+ }
+
+ //
+ if (uiapp == null)
+ {
+ ConfigurationManager cmanager = app.getConfigurationManager();
+ String uirootClass = cmanager.getApplication().getUIRootComponent();
+ Class<? extends UIApplication> type = (Class<UIApplication>)
Thread.currentThread().getContextClassLoader().loadClass(uirootClass);
+ uiapp = app.createUIComponent(type, null, null, context);
+ }
+
+ //
+ return uiapp;
+ }
+
+ @Override
+ public void storeUIRootComponent(final WebuiRequestContext context) throws Exception
+ {
+ UIApplication uiapp = context.getUIApplication();
+
+ //
+ HttpSession session = getSession(context);
+
+ //
+ Class<? extends UIApplication> appClass = uiapp.getClass();
+ if (appClass.getAnnotation(Serialized.class) != null)
+ {
+ try
+ {
+ DomainMetaData domainMetaData = new DomainMetaData();
+/*
+ domainMetaData.addClassType(PageList.class, true);
+ domainMetaData.addClassType(LazyPageList.class, true);
+ domainMetaData.addClassType(LazyList.class, true);
+ domainMetaData.addClassType(LazyList.class.getName() + "$Batch",
true);
+*/
+
+ //
+ SerializationContext serializationContext =
(SerializationContext)session.getAttribute("SerializationContext");
+ if (serializationContext == null)
+ {
+ TypeDomain domain = new TypeDomain(domainMetaData, true);
+ serializationContext = new SerializationContext(domain);
+ session.setAttribute("SerializationContext",
serializationContext);
+ ObjectFactory<UIComponent> factory = new
ObjectFactory<UIComponent>()
+ {
+
+ private <S extends UIComponent> Object getFieldValue(String
fieldName, Map<FieldModel<? super S, ?>, ?> state)
+ {
+ for (Map.Entry<FieldModel<? super S, ?>, ?> entry :
state.entrySet())
+ {
+ FieldModel<? super S, ?> fieldModel = entry.getKey();
+ if (fieldModel.getOwner().getJavaType() == UIComponent.class
&& fieldModel.getName().equals(fieldName))
+ {
+ return entry.getValue();
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public <S extends UIComponent> S create(Class<S> type,
Map<FieldModel<? super S, ?>, ?> state) throws CreateException
+ {
+ // Get config id
+ String configId = (String)getFieldValue("configId",
state);
+ String id = (String)getFieldValue("id", state);
+
+ //
+ try
+ {
+ WebuiApplication webuiApp = (WebuiApplication)
context.getApplication();
+ ConfigurationManager configMgr =
webuiApp.getConfigurationManager();
+ Component config = configMgr.getComponentConfig(type, configId);
+
+ //
+ S instance;
+ if (config != null)
+ {
+ instance = Util.createObject(type, config.getInitParams());
+ instance.setComponentConfig(id, config);
+ }
+ else
+ {
+ instance = Util.createObject(type, null);
+ instance.setId(id);
+ }
+
+ // Now set state
+ for (Map.Entry<FieldModel<? super S, ?>, ?> entry :
state.entrySet())
+ {
+ FieldModel<? super S, ?> fieldModel = entry.getKey();
+ Object value = entry.getValue();
+ fieldModel.castAndSet(instance, value);
+ }
+
+ //
+ return instance;
+ }
+ catch (Exception e)
+ {
+ throw new CreateException(e);
+ }
+ }
+ };
+ serializationContext.addFactory(factory);
+ }
+
+ //
+
+ //
+ uiapp = serializationContext.clone(uiapp);
+ System.out.println("Cloned application");
+ }
+ catch (Exception e)
+ {
+ System.out.println("Could not clone application");
+ e.printStackTrace();
+ }
+ }
+
+
+ //
+ String key = getKey(context);
+ session.setAttribute("bilto_" + key, uiapp);
+ }
+
+ @Override
+ public void expire(String sessionId, WebuiApplication app) throws Exception
+ {
+ // For now do nothing....
+ }
+
+ private UserPortalConfig getUserPortalConfig(PortalRequestContext context) throws
Exception
+ {
+ ExoContainer appContainer =
context.getApplication().getApplicationServiceContainer();
+ UserPortalConfigService service_ =
(UserPortalConfigService)appContainer.getComponentInstanceOfType(UserPortalConfigService.class);
+ String remoteUser = context.getRemoteUser();
+ String ownerUser = context.getPortalOwner();
+ return service_.getUserPortalConfig(ownerUser, remoteUser);
+ }
+
+ private String getKey(WebuiRequestContext webuiRC)
+ {
+ if (webuiRC instanceof PortletRequestContext)
+ {
+ PortletRequestContext portletRC = (PortletRequestContext)webuiRC;
+ return portletRC.getApplication().getApplicationId() + "/" +
portletRC.getWindowId();
+ }
+ else
+ {
+ PortalRequestContext portalRC = (PortalRequestContext)webuiRC;
+ return "portal";
+ }
+ }
+
+ private HttpSession getSession(WebuiRequestContext webuiRC)
+ {
+ if (webuiRC instanceof PortletRequestContext)
+ {
+ PortletRequestContext portletRC = (PortletRequestContext)webuiRC;
+ PortalRequestContext portalRC = (PortalRequestContext)
portletRC.getParentAppRequestContext();
+ HttpServletRequest req = portalRC.getRequest();
+ return req.getSession();
+ }
+ else
+ {
+ PortalRequestContext portalRC = (PortalRequestContext)webuiRC;
+ HttpServletRequest req = portalRC.getRequest();
+ return req.getSession();
+ }
+ }
+}