[gatein-commits] gatein SVN: r402 - in portal/branches/performance: component/portal/src/main/java/org/exoplatform/portal/application and 17 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Thu Oct 22 18:02:32 EDT 2009


Author: julien_viet
Date: 2009-10-22 18:02:30 -0400 (Thu, 22 Oct 2009)
New Revision: 402

Removed:
   portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/ApplicationData.java
   portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/ContainerData.java
   portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PageData.java
   portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/serialize/AbstractHandler.java
   portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/serialize/ContainerHandler.java
   portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/serialize/OwnerContext.java
   portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/serialize/PageHandler.java
   portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/serialize/PageNavigationHandler.java
   portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/serialize/PortalConfigHandler.java
   portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/serialize/PortalLayoutHandler.java
Modified:
   portal/branches/performance/component/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/UIDashboardContainer.java
   portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/application/PortletPreferences.java
   portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/GroupPortalConfigListener.java
   portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/NewPortalConfigListener.java
   portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/UserACL.java
   portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/UserPortalConfigListener.java
   portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/UserPortalConfigService.java
   portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/Application.java
   portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/Container.java
   portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/Dashboard.java
   portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/Mapper.java
   portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/ModelObject.java
   portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/Page.java
   portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PageBody.java
   portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PageNode.java
   portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PageNodeContainer.java
   portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PortalConfig.java
   portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/SiteBody.java
   portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/gadget/GadgetApplication.java
   portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/portlet/PortletApplication.java
   portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/wsrp/WSRPApplication.java
   portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/serialize/AbstractApplicationHandler.java
   portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMDataStorage.java
   portal/branches/performance/component/portal/src/main/resources/binding.xml
   portal/branches/performance/component/portal/src/test/java/org/exoplatform/portal/config/TestDataStorage.java
   portal/branches/performance/component/portal/src/test/java/org/exoplatform/portal/config/TestGadget.java
   portal/branches/performance/component/portal/src/test/java/org/exoplatform/portal/config/TestJIBXXmlMapping.java
   portal/branches/performance/component/portal/src/test/java/org/exoplatform/portal/config/TestUserPortalConfigService.java
   portal/branches/performance/component/portal/src/test/java/org/exoplatform/portal/config/security/AbstractTestSharedPageACL.java
   portal/branches/performance/component/portal/src/test/java/org/exoplatform/portal/config/security/TestUserPageACL.java
   portal/branches/performance/portlet/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/UITabPaneDashboard.java
   portal/branches/performance/portlet/exoadmin/src/main/java/org/exoplatform/toolbar/webui/component/UIUserToolBarDashboardPortlet.java
   portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIAddNewApplication.java
   portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UINavigationNodeSelector.java
   portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIDesktopPage.java
   portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageActionListener.java
   portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageBrowser.java
   portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageCreationWizard.java
   portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageForm.java
   portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageNodeForm2.java
   portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalComponentActionListener.java
   portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/util/PortalDataMapper.java
Log:
rolling back previous commit that is too intrusive


Modified: portal/branches/performance/component/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/UIDashboardContainer.java
===================================================================
--- portal/branches/performance/component/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/UIDashboardContainer.java	2009-10-22 19:40:46 UTC (rev 401)
+++ portal/branches/performance/component/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/UIDashboardContainer.java	2009-10-22 22:02:30 UTC (rev 402)
@@ -23,7 +23,6 @@
 import org.exoplatform.application.registry.ApplicationRegistryService;
 import org.exoplatform.portal.config.DataStorage;
 import org.exoplatform.portal.config.model.Container;
-import org.exoplatform.portal.config.model.ContainerData;
 import org.exoplatform.portal.config.model.Dashboard;
 import org.exoplatform.portal.config.model.gadget.GadgetId;
 import org.exoplatform.portal.pom.config.tasks.DashboardTask;
@@ -387,11 +386,7 @@
          {
             Container container = toContainer(item.getValue());
             if (id != null)
-            {
-               ContainerData data = container.buildData();
-               data.setId(id);
-               container = new Container(container, data);
-            }
+               container.setId(id);
             return container;
          }
       }
@@ -457,12 +452,12 @@
       // Get current ui portlet containing this dashboard
       UIPortlet currentUIPortlet = UIPortlet.getCurrentUIPortlet();
 
-      // Assemble the dashboard
-      Container container = PortalDataMapper.toContainer(uiRoot);
-
       // Build dashboard
-      Dashboard dashboard = new Dashboard(currentUIPortlet.getStorageId(), container.buildData());
+      Dashboard dashboard = new Dashboard(currentUIPortlet.getStorageId());
 
+      // Assemble the dashboard
+      PortalDataMapper.toContainer(dashboard, uiRoot);
+
       // Get dashboard for merging
       service.execute(new DashboardTask.Save(dashboard));
    }

Modified: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/application/PortletPreferences.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/application/PortletPreferences.java	2009-10-22 19:40:46 UTC (rev 401)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/application/PortletPreferences.java	2009-10-22 22:02:30 UTC (rev 402)
@@ -19,8 +19,6 @@
 
 package org.exoplatform.portal.application;
 
-import org.exoplatform.portal.config.NewPortalConfigListener;
-
 import java.util.ArrayList;
 import java.util.ListIterator;
 
@@ -108,9 +106,4 @@
          portlets = list;
       }
    }
-
-   // Called by JiBX
-   public void postSet() {
-      windowId = NewPortalConfigListener.fixInstanceIdOwnerName(windowId);
-   }
 }

Modified: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/GroupPortalConfigListener.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/GroupPortalConfigListener.java	2009-10-22 19:40:46 UTC (rev 401)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/GroupPortalConfigListener.java	2009-10-22 22:02:30 UTC (rev 402)
@@ -22,7 +22,6 @@
 import org.exoplatform.container.ExoContainer;
 import org.exoplatform.container.ExoContainerContext;
 import org.exoplatform.portal.config.model.Container;
-import org.exoplatform.portal.config.model.ContainerData;
 import org.exoplatform.portal.config.model.PortalConfig;
 import org.exoplatform.services.jcr.ext.registry.RegistryService;
 import org.exoplatform.services.organization.Group;
@@ -127,7 +126,7 @@
       if (cfg == null)
       {
          cfg = new PortalConfig(PortalConfig.GROUP_TYPE);
-         cfg.setPortalLayout(new Container(new ContainerData()));
+         cfg.setPortalLayout(new Container());
          cfg.setName(groupId);
          dataStorage.create(cfg);
       }

Modified: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/NewPortalConfigListener.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/NewPortalConfigListener.java	2009-10-22 19:40:46 UTC (rev 401)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/NewPortalConfigListener.java	2009-10-22 22:02:30 UTC (rev 402)
@@ -29,13 +29,11 @@
 import org.exoplatform.portal.application.PortletPreferences;
 import org.exoplatform.portal.application.PortletPreferences.PortletPreferencesSet;
 import org.exoplatform.portal.config.model.Container;
-import org.exoplatform.portal.config.model.ContainerData;
 import org.exoplatform.portal.config.model.Page;
 import org.exoplatform.portal.config.model.PageNavigation;
 import org.exoplatform.portal.config.model.PageNode;
 import org.exoplatform.portal.config.model.PortalConfig;
 import org.exoplatform.portal.config.model.Page.PageSet;
-import org.exoplatform.portal.config.serialize.OwnerContext;
 import org.exoplatform.services.log.ExoLogger;
 import org.exoplatform.services.log.Log;
 import org.jibx.runtime.BindingDirectory;
@@ -50,7 +48,6 @@
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
-import java.util.concurrent.Callable;
 
 /**
  * Created by The eXo Platform SARL Author : Tuan Nguyen
@@ -311,7 +308,7 @@
             if (cfg == null)
             {
                cfg = new PortalConfig(type);
-               cfg.setPortalLayout(new Container(new ContainerData()));
+               cfg.setPortalLayout(new Container());
                cfg.setName(owner);
                pdcService_.create(cfg);
             }
@@ -333,11 +330,15 @@
             pdcService_.save(pconfig);
          }
       }
-      catch (Exception e)
+      catch (JiBXException e)
       {
          log.error(e.getMessage() + " file: " + path, e);
          throw e;
       }
+      catch (IOException e)
+      {
+         log.error(e.getMessage() + " file: " + path);
+      }
    }
 
    private void createPage(NewPortalConfig config, String owner) throws Exception
@@ -369,7 +370,7 @@
             pdcService_.create(page);
          }
       }
-      catch (Exception e)
+      catch (JiBXException e)
       {
          log.error(e.getMessage() + " file: " + path, e);
          throw e;
@@ -408,7 +409,7 @@
             pdcService_.save(navigation);
          }
       }
-      catch (Exception e)
+      catch (JiBXException e)
       {
          log.error(e.getMessage() + " file: " + path, e);
          throw e;
@@ -443,7 +444,7 @@
             pdcService_.save(portlet);
          }
       }
-      catch (Exception e)
+      catch (JiBXException e)
       {
          log.error(e.getMessage() + " file: " + path, e);
          throw e;
@@ -500,21 +501,12 @@
 
    // Deserializing code
 
-   private <T> T fromXML(String ownerType, String ownerId, String xml, final Class<T> clazz) throws Exception
+   private <T> T fromXML(String ownerType, String owner, String xml, Class<T> clazz) throws Exception
    {
-      final ByteArrayInputStream is = new ByteArrayInputStream(xml.getBytes("UTF-8"));
+      ByteArrayInputStream is = new ByteArrayInputStream(xml.getBytes("UTF-8"));
       IBindingFactory bfact = BindingDirectory.getFactory(clazz);
-      final IUnmarshallingContext uctx = bfact.createUnmarshallingContext();
-      ownerId = fixOwnerName(ownerType, ownerId);
-      OwnerContext owner = new OwnerContext(ownerType, ownerId);
-      return owner.execute(new Callable<T>()
-      {
-         public T call() throws Exception
-         {
-            return clazz.cast(uctx.unmarshalDocument(is, "UTF-8"));
-         }
-      });
-/*
+      IUnmarshallingContext uctx = bfact.createUnmarshallingContext();
+      T o = clazz.cast(uctx.unmarshalDocument(is, "UTF-8"));
       if (o instanceof PageNavigation)
       {
          PageNavigation nav = (PageNavigation)o;
@@ -540,15 +532,17 @@
       {
          for (Page page : ((PageSet)o).getPages())
          {
-//            page.setOwnerType(ownerType);
-//            page.setOwnerId(owner);
+            page.setOwnerType(ownerType);
+            page.setOwnerId(owner);
             fixOwnerName(page);
+            // The page will be created in the calling method
+            //        pdcService_.create(page);
          }
       }
-*/
+      return o;
    }
 
-   public static String fixOwnerName(String type, String owner)
+   private static String fixOwnerName(String type, String owner)
    {
       if (type.equals(PortalConfig.GROUP_TYPE) && !owner.startsWith("/"))
       {
@@ -577,4 +571,64 @@
       }
       return persistenceId;
    }
+
+   private static void fixOwnerName(PortalConfig config)
+   {
+      config.setName(fixOwnerName(config.getType(), config.getName()));
+      fixOwnerName(config.getPortalLayout());
+   }
+
+   private static void fixOwnerName(Container container)
+   {
+      for (Object o : container.getChildren())
+      {
+         if (o instanceof Container)
+         {
+            fixOwnerName((Container)o);
+         }
+      }
+   }
+
+   private static void fixOwnerName(PageNavigation pageNav)
+   {
+      pageNav.setOwnerId(fixOwnerName(pageNav.getOwnerType(), pageNav.getOwnerId()));
+      for (PageNode pageNode : pageNav.getNodes())
+      {
+         fixOwnerName(pageNode);
+      }
+   }
+
+   private static void fixOwnerName(PageNode pageNode)
+   {
+      if (pageNode.getPageReference() != null)
+      {
+         String pageRef = pageNode.getPageReference();
+         int pos1 = pageRef.indexOf("::");
+         int pos2 = pageRef.indexOf("::", pos1 + 2);
+         String type = pageRef.substring(0, pos1);
+         String owner = pageRef.substring(pos1 + 2, pos2);
+         String name = pageRef.substring(pos2 + 2);
+         owner = fixOwnerName(type, owner);
+         pageRef = type + "::" + owner + "::" + name;
+         pageNode.setPageReference(pageRef);
+      }
+      if (pageNode.getChildren() != null)
+      {
+         for (PageNode childPageNode : pageNode.getChildren())
+         {
+            fixOwnerName(childPageNode);
+         }
+      }
+   }
+
+   private static void fixOwnerName(PortletPreferences prefs)
+   {
+      prefs.setWindowId(fixInstanceIdOwnerName(prefs.getWindowId()));
+   }
+
+   private static void fixOwnerName(Page page)
+   {
+      page.setOwnerId(fixOwnerName(page.getOwnerType(), page.getOwnerId()));
+      fixOwnerName((Container)page);
+   }
 }

Modified: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/UserACL.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/UserACL.java	2009-10-22 19:40:46 UTC (rev 401)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/UserACL.java	2009-10-22 22:02:30 UTC (rev 402)
@@ -357,17 +357,21 @@
       {
          if (page.getOwnerId().equals(identity.getUserId()))
          {
+            page.setModifiable(true);
             return true;
          }
       }
       if (superUser_.equals(identity.getUserId()))
       {
+         page.setModifiable(true);
          return true;
       }
       if (hasEditPermission(identity, page))
       {
+         page.setModifiable(true);
          return true;
       }
+      page.setModifiable(false);
       String[] accessPerms = page.getAccessPermissions();
       for (String per : accessPerms)
       {
@@ -383,14 +387,17 @@
       {
          if (page.getOwnerId().equals(identity.getUserId()))
          {
+            page.setModifiable(true);
             return true;
          }
          return false;
       }
       if (hasPermission(identity, page.getEditPermission()))
       {
+         page.setModifiable(true);
          return true;
       }
+      page.setModifiable(false);
       return false;
    }
 

Modified: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/UserPortalConfigListener.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/UserPortalConfigListener.java	2009-10-22 19:40:46 UTC (rev 401)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/UserPortalConfigListener.java	2009-10-22 22:02:30 UTC (rev 402)
@@ -22,7 +22,6 @@
 import org.exoplatform.container.ExoContainer;
 import org.exoplatform.container.ExoContainerContext;
 import org.exoplatform.portal.config.model.Container;
-import org.exoplatform.portal.config.model.ContainerData;
 import org.exoplatform.portal.config.model.PageNavigation;
 import org.exoplatform.portal.config.model.PageNode;
 import org.exoplatform.portal.config.model.PortalConfig;
@@ -71,7 +70,7 @@
       if (cfg == null)
       {
          cfg = new PortalConfig(PortalConfig.USER_TYPE);
-         cfg.setPortalLayout(new Container(new ContainerData()));
+         cfg.setPortalLayout(new Container());
          cfg.setName(userName);
          dataStorage.create(cfg);
       }

Modified: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/UserPortalConfigService.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/UserPortalConfigService.java	2009-10-22 19:40:46 UTC (rev 401)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/UserPortalConfigService.java	2009-10-22 22:02:30 UTC (rev 402)
@@ -519,8 +519,8 @@
          if (container instanceof Page)
          {
             Page page = (Page)container;
-//            page.setOwnerType(ownerType);
-//            page.setOwnerId(ownerId);
+            page.setOwnerType(ownerType);
+            page.setOwnerId(ownerId);
          }
          for (ModelObject child : container.getChildren())
          {

Modified: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/Application.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/Application.java	2009-10-22 19:40:46 UTC (rev 401)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/Application.java	2009-10-22 22:02:30 UTC (rev 402)
@@ -28,93 +28,49 @@
 public abstract class Application<S, I> extends ModelObject
 {
 
-   /** .*/
-   private static final ApplicationData DEFAULT_DATA = new ApplicationData();
-
    /** The application state. */
-   private final ApplicationState<S> state;
+   private ApplicationState<S> state;
 
    /** The reference to the application. */
-   private final I ref;
+   private I ref;
 
-   private final String id;
+   private String id;
 
-   private final String title;
+   private String title;
 
-   private final String icon;
+   private String icon;
 
-   private final String description;
+   private String description;
 
-   private final boolean showInfoBar;
+   private boolean showInfoBar = true;
 
-   private final boolean showApplicationState;
+   private boolean showApplicationState = true;
 
-   private final boolean showApplicationMode;
+   private boolean showApplicationMode = true;
 
-   private final String theme;
+   private String theme;
 
-   private final String width;
+   private String width;
 
-   private final String height;
+   private String height;
 
-   private final Properties properties;
+   private Properties properties;
 
-   private final String[] accessPermissions;
+   private String[] accessPermissions;
 
-   private final boolean isModifiable;
+   private boolean isModifiable;
 
-   public Application(String storageId, String storageName, I ref, PersistentApplicationState<S> state, ApplicationData data)
+   public Application(String storageId, I ref)
    {
-      super(storageId, storageName);
+      super(storageId);
 
       //
-      if (data == null) {
-         data = DEFAULT_DATA;
-      }
-
-      //
       this.ref = ref;
-      this.state = state;
-      this.id = data.getId();
-      this.title = data.getTitle();
-      this.icon = data.getIcon();
-      this.description = data.getDescription();
-      this.showInfoBar = data.isShowInfoBar();
-      this.showApplicationState = data.isShowApplicationState();
-      this.showApplicationMode = data.isShowApplicationMode();
-      this.theme = data.getTheme();
-      this.width = data.getWidth();
-      this.height = data.getHeight();
-      this.properties = data.getProperties();
-      this.accessPermissions = data.getAccessPermissions();
-      this.isModifiable = data.isModifiable();
    }
 
-   public Application(String storageName, I ref, TransientApplicationState<S> state, ApplicationData data)
+   public Application(I ref)
    {
-      super(null, storageName);
-
-      //
-      if (data == null) {
-         data = DEFAULT_DATA;
-      }
-
-      //
       this.ref = ref;
-      this.state = state;
-      this.id = data.getId();
-      this.title = data.getTitle();
-      this.icon = data.getIcon();
-      this.description = data.getDescription();
-      this.showInfoBar = data.isShowInfoBar();
-      this.showApplicationState = data.isShowApplicationState();
-      this.showApplicationMode = data.isShowApplicationMode();
-      this.theme = data.getTheme();
-      this.width = data.getWidth();
-      this.height = data.getHeight();
-      this.properties = data.getProperties();
-      this.accessPermissions = data.getAccessPermissions();
-      this.isModifiable = data.isModifiable();
    }
 
    public abstract ApplicationType<S, I> getType();
@@ -124,31 +80,61 @@
       return width;
    }
 
+   public void setWidth(String s)
+   {
+      width = s;
+   }
+
    public String getHeight()
    {
       return height;
    }
 
+   public void setHeight(String s)
+   {
+      height = s;
+   }
+
    public String getId()
    {
       return id;
    }
 
+   public void setId(String value)
+   {
+      id = value;
+   }
+
    public String[] getAccessPermissions()
    {
       return accessPermissions;
    }
 
+   public void setAccessPermissions(String[] accessPermissions)
+   {
+      this.accessPermissions = accessPermissions;
+   }
+
    public boolean isModifiable()
    {
       return isModifiable;
    }
 
+   public void setModifiable(boolean modifiable)
+   {
+      isModifiable = modifiable;
+   }
+
    public ApplicationState<S> getState()
    {
       return state;
    }
 
+   public void setState(ApplicationState<S> value)
+   {
+      state = value;
+   }
+
    public I getRef()
    {
       return ref;
@@ -159,21 +145,41 @@
       return showInfoBar;
    }
 
+   public void setShowInfoBar(boolean b)
+   {
+      showInfoBar = b;
+   }
+
    public boolean getShowApplicationState()
    {
       return showApplicationState;
    }
 
+   public void setShowApplicationState(boolean b)
+   {
+      showApplicationState = b;
+   }
+
    public boolean getShowApplicationMode()
    {
       return showApplicationMode;
    }
 
+   public void setShowApplicationMode(boolean b)
+   {
+      showApplicationMode = b;
+   }
+
    public String getIcon()
    {
       return icon;
    }
 
+   public void setIcon(String value)
+   {
+      icon = value;
+   }
+
    public abstract String getApplicationType();
 
    public String getDescription()
@@ -181,18 +187,41 @@
       return description;
    }
 
+   public void setDescription(String des)
+   {
+      description = des;
+   }
+
    public String getTitle()
    {
       return title;
    }
 
+   public void setTitle(String value)
+   {
+      title = value;
+   }
+
    public Properties getProperties()
    {
+      if (properties == null)
+         properties = new Properties();
       return properties;
    }
 
+   public void setProperties(Properties properties)
+   {
+      this.properties = properties;
+   }
+
    public String getTheme()
    {
       return theme;
    }
+
+   public void setTheme(String theme)
+   {
+      this.theme = theme;
+   }
+
 }
\ No newline at end of file

Deleted: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/ApplicationData.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/ApplicationData.java	2009-10-22 19:40:46 UTC (rev 401)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/ApplicationData.java	2009-10-22 22:02:30 UTC (rev 402)
@@ -1,194 +0,0 @@
-/*
- * Copyright (C) 2003-2007 eXo Platform SAS.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
- */
-package org.exoplatform.portal.config.model;
-
-/**
- * @author <a href="mailto:julien.viet at exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public class ApplicationData
-{
-
-   /** . */
-   private String id;
-
-   /** . */
-   private String title;
-
-   /** . */
-   private String icon;
-
-   /** . */
-   private String description;
-
-   /** . */
-   private boolean showInfoBar = true;
-
-   /** . */
-   private boolean showApplicationState = true;
-
-   /** . */
-   private boolean showApplicationMode = true;
-
-   /** . */
-   private String theme;
-
-   /** . */
-   private String width;
-
-   /** . */
-   private String height;
-
-   /** . */
-   private Properties properties = new Properties();
-
-   /** . */
-   private String[] accessPermissions;
-
-   /** . */
-   private boolean modifiable;
-
-   public String getId()
-   {
-      return id;
-   }
-
-   public void setId(String id)
-   {
-      this.id = id;
-   }
-
-   public String getTitle()
-   {
-      return title;
-   }
-
-   public void setTitle(String title)
-   {
-      this.title = title;
-   }
-
-   public String getIcon()
-   {
-      return icon;
-   }
-
-   public void setIcon(String icon)
-   {
-      this.icon = icon;
-   }
-
-   public String getDescription()
-   {
-      return description;
-   }
-
-   public void setDescription(String description)
-   {
-      this.description = description;
-   }
-
-   public boolean isShowInfoBar()
-   {
-      return showInfoBar;
-   }
-
-   public void setShowInfoBar(boolean showInfoBar)
-   {
-      this.showInfoBar = showInfoBar;
-   }
-
-   public boolean isShowApplicationState()
-   {
-      return showApplicationState;
-   }
-
-   public void setShowApplicationState(boolean showApplicationState)
-   {
-      this.showApplicationState = showApplicationState;
-   }
-
-   public boolean isShowApplicationMode()
-   {
-      return showApplicationMode;
-   }
-
-   public void setShowApplicationMode(boolean showApplicationMode)
-   {
-      this.showApplicationMode = showApplicationMode;
-   }
-
-   public String getTheme()
-   {
-      return theme;
-   }
-
-   public void setTheme(String theme)
-   {
-      this.theme = theme;
-   }
-
-   public String getWidth()
-   {
-      return width;
-   }
-
-   public void setWidth(String width)
-   {
-      this.width = width;
-   }
-
-   public String getHeight()
-   {
-      return height;
-   }
-
-   public void setHeight(String height)
-   {
-      this.height = height;
-   }
-
-   public Properties getProperties()
-   {
-      return properties;
-   }
-
-   public void setProperties(Properties properties)
-   {
-      this.properties = properties;
-   }
-
-   public String[] getAccessPermissions()
-   {
-      return accessPermissions;
-   }
-
-   public void setAccessPermissions(String[] accessPermissions)
-   {
-      this.accessPermissions = accessPermissions;
-   }
-
-   public boolean isModifiable()
-   {
-      return modifiable;
-   }
-
-   public void setModifiable(boolean modifiable)
-   {
-      this.modifiable = modifiable;
-   }
-}

Modified: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/Container.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/Container.java	2009-10-22 19:40:46 UTC (rev 401)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/Container.java	2009-10-22 22:02:30 UTC (rev 402)
@@ -30,136 +30,161 @@
 public class Container extends ModelObject
 {
 
-   protected final String id;
+   protected String id;
 
-   protected final String name;
+   protected String name;
 
-   protected final String icon;
+   protected String icon;
 
-   protected final String decorator;
+   protected String decorator;
 
-   protected final String template;
+   protected String template;
 
-   protected final String factoryId;
+   protected String factoryId;
 
-   protected final String title;
+   protected String title;
 
-   protected final String description;
+   protected String description;
 
-   protected final String width;
+   protected String width;
 
-   protected final String height;
+   protected String height;
 
-   protected final String[] accessPermissions;
+   private String[] accessPermissions;
 
-   protected final ArrayList<ModelObject> children;
+   protected ArrayList<ModelObject> children;
 
-   public Container(Container container, ContainerData data) {
-      this(container.getStorageId(), data);
-   }
-
-   public Container(ContainerData data)
+   public Container()
    {
-      this((String)null, data);
+      children = new ArrayList<ModelObject>();
    }
 
-   public Container(String storageId, ContainerData data)
+   public Container(String storageId)
    {
-      super(storageId, null);
+      super(storageId);
 
       //
-      this.id = data.getId();
-      this.name = data.getName();
-      this.icon = data.getIcon();
-      this.decorator = data.getDecorator();
-      this.template = data.getTemplate();
-      this.factoryId = data.getFactoryId();
-      this.title = data.getTitle();
-      this.description = data.getDescription();
-      this.width = data.getWidth();
-      this.height = data.getHeight();
-      this.accessPermissions = data.getAccessPermissions();
-
-      //
       this.children = new ArrayList<ModelObject>();
    }
 
-   public void populate(ContainerData data) {
-      data.setId(id);
-      data.setName(name);
-      data.setIcon(icon);
-      data.setDecorator(decorator);
-      data.setTemplate(template);
-      data.setFactoryId(factoryId);
-      data.setTitle(title);
-      data.setWidth(width);
-      data.setHeight(height);
-      data.setAccessPermissions(accessPermissions != null ? accessPermissions.clone() : null);
-   }
-
-   public ContainerData buildData() {
-      ContainerData data = new ContainerData();
-      populate(data);
-      return data;
-   }
-
    public String getId()
    {
       return id;
    }
 
+   public void setId(String s)
+   {
+      id = s;
+   }
+
    public String getName()
    {
       return name;
    }
 
+   public void setName(String s)
+   {
+      name = s;
+   }
+
    public String getIcon()
    {
       return icon;
    }
 
+   public void setIcon(String icon)
+   {
+      this.icon = icon;
+   }
+
    public ArrayList<ModelObject> getChildren()
    {
       return children;
    }
 
+   public void setChildren(ArrayList<ModelObject> children)
+   {
+      this.children = children;
+   }
+
    public String getHeight()
    {
       return height;
    }
 
+   public void setHeight(String height)
+   {
+      this.height = height;
+   }
+
    public String getWidth()
    {
       return width;
    }
 
+   public void setWidth(String width)
+   {
+      this.width = width;
+   }
+
    public String getDecorator()
    {
       return decorator;
    }
 
+   public void setDecorator(String s)
+   {
+      decorator = s;
+   }
+
    public String getDescription()
    {
       return description;
    }
 
+   public void setDescription(String des)
+   {
+      description = des;
+   }
+
    public String getTitle()
    {
       return title;
    }
 
+   public void setTitle(String title)
+   {
+      this.title = title;
+   }
+
    public String getFactoryId()
    {
       return factoryId;
    }
 
+   public void setFactoryId(String factoryId)
+   {
+      this.factoryId = factoryId;
+   }
+
    public String getTemplate()
    {
       return template;
    }
 
+   public void setTemplate(String template)
+   {
+      this.template = template;
+   }
+
    public String[] getAccessPermissions()
    {
       return accessPermissions;
    }
+
+   public void setAccessPermissions(String[] accessPermissions)
+   {
+      this.accessPermissions = accessPermissions;
+   }
+
 }
\ No newline at end of file

Deleted: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/ContainerData.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/ContainerData.java	2009-10-22 19:40:46 UTC (rev 401)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/ContainerData.java	2009-10-22 22:02:30 UTC (rev 402)
@@ -1,168 +0,0 @@
-/*
- * Copyright (C) 2003-2007 eXo Platform SAS.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
- */
-package org.exoplatform.portal.config.model;
-
-/**
- * @author <a href="mailto:julien.viet at exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public class ContainerData
-{
-
-   /** . */
-   private String id;
-
-   /** . */
-   private String name;
-
-   /** . */
-   private String icon;
-
-   /** . */
-   private String decorator;
-
-   /** . */
-   private String template;
-
-   /** . */
-   private String factoryId;
-
-   /** . */
-   private String title;
-
-   /** . */
-   private String description;
-
-   /** . */
-   private String width;
-
-   /** . */
-   private String height;
-
-   /** . */
-   private String[] accessPermissions;
-
-   public String getId()
-   {
-      return id;
-   }
-
-   public void setId(String id)
-   {
-      this.id = id;
-   }
-
-   public String getName()
-   {
-      return name;
-   }
-
-   public void setName(String name)
-   {
-      this.name = name;
-   }
-
-   public String getIcon()
-   {
-      return icon;
-   }
-
-   public void setIcon(String icon)
-   {
-      this.icon = icon;
-   }
-
-   public String getDecorator()
-   {
-      return decorator;
-   }
-
-   public void setDecorator(String decorator)
-   {
-      this.decorator = decorator;
-   }
-
-   public String getTemplate()
-   {
-      return template;
-   }
-
-   public void setTemplate(String template)
-   {
-      this.template = template;
-   }
-
-   public String getFactoryId()
-   {
-      return factoryId;
-   }
-
-   public void setFactoryId(String factoryId)
-   {
-      this.factoryId = factoryId;
-   }
-
-   public String getTitle()
-   {
-      return title;
-   }
-
-   public void setTitle(String title)
-   {
-      this.title = title;
-   }
-
-   public String getDescription()
-   {
-      return description;
-   }
-
-   public void setDescription(String description)
-   {
-      this.description = description;
-   }
-
-   public String getWidth()
-   {
-      return width;
-   }
-
-   public void setWidth(String width)
-   {
-      this.width = width;
-   }
-
-   public String getHeight()
-   {
-      return height;
-   }
-
-   public void setHeight(String height)
-   {
-      this.height = height;
-   }
-
-   public String[] getAccessPermissions()
-   {
-      return accessPermissions;
-   }
-
-   public void setAccessPermissions(String[] accessPermissions)
-   {
-      this.accessPermissions = accessPermissions;
-   }
-}

Modified: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/Dashboard.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/Dashboard.java	2009-10-22 19:40:46 UTC (rev 401)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/Dashboard.java	2009-10-22 22:02:30 UTC (rev 402)
@@ -26,13 +26,12 @@
 public class Dashboard extends Container
 {
 
-   public Dashboard(ContainerData data)
+   public Dashboard()
    {
-      super(data);
    }
 
-   public Dashboard(String storageId, ContainerData data)
+   public Dashboard(String storageId)
    {
-      super(storageId, data);
+      super(storageId);
    }
 }

Modified: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/Mapper.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/Mapper.java	2009-10-22 19:40:46 UTC (rev 401)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/Mapper.java	2009-10-22 22:02:30 UTC (rev 402)
@@ -19,7 +19,6 @@
 
 package org.exoplatform.portal.config.model;
 
-import org.exoplatform.portal.config.model.gadget.GadgetId;
 import static org.exoplatform.portal.pom.config.Utils.join;
 import static org.exoplatform.portal.pom.config.Utils.split;
 
@@ -127,8 +126,8 @@
          dstNode.setUri(attrs.getValue(MappedAttributes.URI));
          dstNode.setStartPublicationDate(attrs.getValue(MappedAttributes.START_PUBLICATION_DATE));
          dstNode.setEndPublicationDate(attrs.getValue(MappedAttributes.END_PUBLICATION_DATE));
-         dstNode.setShowPublicationDate(attrs.getValue(MappedAttributes.SHOW_PUBLICATION_DATE, false));
-         dstNode.setVisible(attrs.getValue(MappedAttributes.VISIBLE, true));
+         dstNode.setShowPublicationDate(attrs.getValue(MappedAttributes.SHOW_PUBLICATION_DATE));
+         dstNode.setVisible(attrs.getValue(MappedAttributes.VISIBLE));
          dstNode.setChildren(new ArrayList<PageNode>());
          Link link = src.getLink();
          if (link instanceof PageLink)
@@ -273,13 +272,11 @@
 
       //
       org.gatein.mop.api.workspace.Page template = src.getRootNavigation().getTemplate();
+      Container dstLayout = new Container();
       UIContainer srcLayout = template.getRootComponent();
-      ContainerData data = load(srcLayout);
 
       //
-      Container dstLayout = new Container(srcLayout.getObjectId(), data);
-
-      //
+      load(srcLayout, dstLayout);
       loadChildren(srcLayout, dstLayout);
 
       //
@@ -332,9 +329,13 @@
 
    public Page load(org.gatein.mop.api.workspace.Page src)
    {
-      UIContainer root = src.getRootComponent();
+      Page dst = new Page(src.getRootComponent().getObjectId());
+      load(src, dst);
+      return dst;
+   }
 
-      //
+   private void load(org.gatein.mop.api.workspace.Page src, Page dst)
+   {
       Site site = src.getSite();
       String ownerType = getOwnerType(site.getObjectType());
       String ownerId = site.getName();
@@ -343,27 +344,20 @@
 
       //
       Attributes attrs = src.getAttributes();
-      PageData data = new PageData();
-      data.setId(pageId);
-      data.setOwnerId(ownerId);
-      data.setOwnerType(ownerType);
-      data.setName(name);
-      data.setTitle(attrs.getValue(MappedAttributes.TITLE));
-      data.setShowMaxWindow(attrs.getValue(MappedAttributes.SHOW_MAX_WINDOW, false));
-      data.setCreator(attrs.getValue(MappedAttributes.CREATOR));
-      data.setModifier(attrs.getValue(MappedAttributes.MODIFIER));
-      data.setAccessPermissions(split("|", attrs.getValue(MappedAttributes.ACCESS_PERMISSIONS)));
-      data.setEditPermission(attrs.getValue(MappedAttributes.EDIT_PERMISSION));
-      data.setFactoryId(attrs.getValue(MappedAttributes.FACTORY_ID));
+      dst.setId(pageId);
+      dst.setOwnerId(ownerId);
+      dst.setOwnerType(ownerType);
+      dst.setName(name);
+      dst.setTitle(attrs.getValue(MappedAttributes.TITLE));
+      dst.setShowMaxWindow(attrs.getValue(MappedAttributes.SHOW_MAX_WINDOW, false));
+      dst.setCreator(attrs.getValue(MappedAttributes.CREATOR));
+      dst.setModifier(attrs.getValue(MappedAttributes.MODIFIER));
+      dst.setAccessPermissions(split("|", attrs.getValue(MappedAttributes.ACCESS_PERMISSIONS)));
+      dst.setEditPermission(attrs.getValue(MappedAttributes.EDIT_PERMISSION));
+      dst.setFactoryId(attrs.getValue(MappedAttributes.FACTORY_ID));
 
       //
-      Page dst = new Page(root.getObjectId(), data);
-
-      //
       loadChildren(src.getRootComponent(), dst);
-
-      //
-      return dst;
    }
 
    public List<ModelChange> save(Page src, Site site, String name)
@@ -380,6 +374,7 @@
       {
          dst = pages.addChild(name);
          changes.add(new ModelChange.Create(src));
+         src.storageId = dst.getObjectId();
       }
       else
       {
@@ -403,26 +398,20 @@
       return changes;
    }
 
-   private ContainerData load(UIContainer src)
+   private void load(UIContainer src, Container dst)
    {
-      ContainerData data = new ContainerData();
-
-      //
       Attributes attrs = src.getAttributes();
-      data.setId(attrs.getValue(MappedAttributes.ID));
-      data.setName(attrs.getValue(MappedAttributes.NAME));
-      data.setTitle(attrs.getValue(MappedAttributes.TITLE));
-      data.setIcon(attrs.getValue(MappedAttributes.ICON));
-      data.setTemplate(attrs.getValue(MappedAttributes.TEMPLATE));
-      data.setAccessPermissions(split("|", attrs.getValue(MappedAttributes.ACCESS_PERMISSIONS)));
-      data.setFactoryId(attrs.getValue(MappedAttributes.FACTORY_ID));
-      data.setDecorator(attrs.getValue(MappedAttributes.DECORATOR));
-      data.setDescription(attrs.getValue(MappedAttributes.DESCRIPTION));
-      data.setWidth(attrs.getValue(MappedAttributes.WIDTH));
-      data.setHeight(attrs.getValue(MappedAttributes.HEIGHT));
-
-      //
-      return data;
+      dst.setId(attrs.getValue(MappedAttributes.ID));
+      dst.setName(attrs.getValue(MappedAttributes.NAME));
+      dst.setTitle(attrs.getValue(MappedAttributes.TITLE));
+      dst.setIcon(attrs.getValue(MappedAttributes.ICON));
+      dst.setTemplate(attrs.getValue(MappedAttributes.TEMPLATE));
+      dst.setAccessPermissions(split("|", attrs.getValue(MappedAttributes.ACCESS_PERMISSIONS)));
+      dst.setFactoryId(attrs.getValue(MappedAttributes.FACTORY_ID));
+      dst.setDecorator(attrs.getValue(MappedAttributes.DECORATOR));
+      dst.setDescription(attrs.getValue(MappedAttributes.DESCRIPTION));
+      dst.setWidth(attrs.getValue(MappedAttributes.WIDTH));
+      dst.setHeight(attrs.getValue(MappedAttributes.HEIGHT));
    }
 
    private void loadChildren(UIContainer src, Container dst)
@@ -439,15 +428,22 @@
             String type = attrs.getValue(MappedAttributes.TYPE);
             if ("dashboard".equals(type))
             {
-               ApplicationData data = new ApplicationData();
-               data.setShowInfoBar(false);
-               data.setShowApplicationState(false);
-               mo = new PortletApplication(srcContainer.getObjectId(), srcContainer.getName(), "dashboard", "DashboardPortlet", null, data);
+               TransientApplicationState<Preferences> state = new TransientApplicationState<Preferences>();
+               Site owner = src.getPage().getSite();
+               state.setOwnerType(getOwnerType(owner.getObjectType()));
+               state.setOwnerId(owner.getName());
+               PortletApplication dashboardApp =
+                  new PortletApplication(srcContainer.getObjectId(), "dashboard", "DashboardPortlet");
+               dashboardApp.setStorageName(component.getName());
+               dashboardApp.setState(state);
+               dashboardApp.setShowInfoBar(false);
+               dashboardApp.setShowApplicationState(false);
+               mo = dashboardApp;
             }
             else
             {
-               ContainerData data = load(srcContainer);
-               Container dstContainer = new Container(component.getObjectId(), data);
+               Container dstContainer = new Container(component.getObjectId());
+               load(srcContainer, dstContainer);
                loadChildren(srcContainer, dstContainer);
                mo = dstContainer;
             }
@@ -455,7 +451,8 @@
          else if (component instanceof UIWindow)
          {
             UIWindow window = (UIWindow)component;
-            mo = load(window);
+            Application application = load(window);
+            mo = application;
          }
          else if (component instanceof UIBody)
          {
@@ -466,6 +463,9 @@
             throw new AssertionError();
          }
 
+         // Set the loaded name
+         mo.storageName = component.getName();
+
          // Add among children
          dst.getChildren().add(mo);
       }
@@ -578,21 +578,19 @@
                   if (app.storageId != null)
                   {
                      UIContainer dstDashboard = session.findObjectById(ObjectType.CONTAINER, app.storageId);
-                     ContainerData dashboardData = load(dstDashboard);
-                     Dashboard srcDashboard = new Dashboard(app.storageId, dashboardData);
+                     Dashboard srcDashboard = new Dashboard(app.storageId);
+                     load(dstDashboard, srcDashboard);
                      loadChildren(dstDashboard, srcDashboard);
                      srcChild = srcDashboard;
                   }
                   else
                   {
-                     ContainerData dashboardData = new ContainerData();
-                     dashboardData.setTemplate("classpath:groovy/dashboard/webui/component/UIColumnContainer.gtmpl");
-                     Dashboard dashboard = new Dashboard(dashboardData);
+                     Dashboard dashboard = new Dashboard();
+                     dashboard.setTemplate("classpath:groovy/dashboard/webui/component/UIColumnContainer.gtmpl");
                      for (int i = 0; i < 3; i++)
                      {
-                        ContainerData rowData = new ContainerData();
-                        rowData.setTemplate("classpath:groovy/dashboard/webui/component/UIContainer.gtmpl");
-                        Container row = new Container(rowData);
+                        Container row = new Container();
+                        row.setTemplate("classpath:groovy/dashboard/webui/component/UIContainer.gtmpl");
                         dashboard.getChildren().add(row);
                      }
                      srcChild = dashboard;
@@ -668,6 +666,8 @@
             {
                throw new AssertionError("Was not expecting child " + srcChild);
             }
+            srcChild.storageId = dstChild.getObjectId();
+            srcChild.storageName = name;
             changes.add(new ModelChange.Create(srcChild));
          }
 
@@ -746,23 +746,6 @@
       String contentId = customization.getContentId();
 
       //
-      ApplicationData data = new ApplicationData();
-      data.setTheme(attrs.getValue(MappedAttributes.THEME));
-      data.setTitle(attrs.getValue(MappedAttributes.TITLE));
-      data.setAccessPermissions(split("|", attrs.getValue(MappedAttributes.ACCESS_PERMISSIONS)));
-      data.setShowInfoBar(attrs.getValue(MappedAttributes.SHOW_INFO_BAR));
-      data.setShowApplicationState(attrs.getValue(MappedAttributes.SHOW_STATE));
-      data.setShowApplicationMode(attrs.getValue(MappedAttributes.SHOW_MODE));
-      data.setDescription(attrs.getValue(MappedAttributes.DESCRIPTION));
-      data.setIcon(attrs.getValue(MappedAttributes.ICON));
-      data.setWidth(attrs.getValue(MappedAttributes.WIDTH));
-      data.setHeight(attrs.getValue(MappedAttributes.HEIGHT));
-      load(attrs, data.getProperties(), windowPropertiesBlackList);
-
-      //
-      PersistentApplicationState<S> instanceState = new PersistentApplicationState<S>(customizationid);
-
-      //
       Application<S, I> dst;
       if (contentType == null || contentType == Preferences.CONTENT_TYPE)
       {
@@ -771,26 +754,20 @@
          String portletName = contentId.substring(pos + 1);
          @SuppressWarnings("unchecked")
          Application<S, I> application =
-            (Application<S, I>)new PortletApplication(
-               src.getObjectId(),
-               src.getName(),
-               applicationName,
-               portletName,
-               (PersistentApplicationState<Preferences>)instanceState,
-               data);
+            (Application<S, I>)new PortletApplication(src.getObjectId(), applicationName, portletName);
          dst = application;
       }
       else if (contentType == Gadget.CONTENT_TYPE)
       {
          @SuppressWarnings("unchecked")
-         Application<S, I> application = (Application<S, I>)new GadgetApplication(src.getObjectId(), src.getName(), new GadgetId(contentId), (PersistentApplicationState<Gadget>)instanceState, data);
+         Application<S, I> application = (Application<S, I>)new GadgetApplication(src.getObjectId(), contentId);
          dst = application;
       }
       else if (contentType == WSRPState.CONTENT_TYPE)
       {
          @SuppressWarnings("unchecked")
          Application<S, I> application =
-            (Application<S, I>)new WSRPApplication(src.getObjectId(), src.getName(), new WSRPId(contentId), (PersistentApplicationState<WSRPState>)instanceState, data);
+            (Application<S, I>)new WSRPApplication(src.getObjectId(), new WSRPId(contentId));
          dst = application;
       }
       else
@@ -799,6 +776,25 @@
       }
 
       //
+      dst.setTheme(attrs.getValue(MappedAttributes.THEME));
+      dst.setTitle(attrs.getValue(MappedAttributes.TITLE));
+      dst.setAccessPermissions(split("|", attrs.getValue(MappedAttributes.ACCESS_PERMISSIONS)));
+      dst.setShowInfoBar(attrs.getValue(MappedAttributes.SHOW_INFO_BAR));
+      dst.setShowApplicationState(attrs.getValue(MappedAttributes.SHOW_STATE));
+      dst.setShowApplicationMode(attrs.getValue(MappedAttributes.SHOW_MODE));
+      dst.setDescription(attrs.getValue(MappedAttributes.DESCRIPTION));
+      dst.setIcon(attrs.getValue(MappedAttributes.ICON));
+      dst.setWidth(attrs.getValue(MappedAttributes.WIDTH));
+      dst.setHeight(attrs.getValue(MappedAttributes.HEIGHT));
+      load(attrs, dst.getProperties(), windowPropertiesBlackList);
+
+      //
+      PersistentApplicationState<S> instanceState = new PersistentApplicationState<S>(customizationid);
+
+      //
+      dst.setState(instanceState);
+
+      //
       return dst;
    }
 
@@ -975,8 +971,8 @@
 
    public Dashboard loadDashboard(UIContainer container)
    {
-      ContainerData dashboardData = load(container);
-      Dashboard dashboard = new Dashboard(container.getObjectId(), dashboardData);
+      Dashboard dashboard = new Dashboard(container.getObjectId());
+      load(container, dashboard);
       loadChildren(container, dashboard);
       return dashboard;
    }
@@ -1017,11 +1013,9 @@
 
    public static void save(Properties src, Attributes dst)
    {
-      if (src != null) {
-         for (Map.Entry<String, String> property : src.entrySet())
-         {
-            dst.setString(property.getKey(), property.getValue());
-         }
+      for (Map.Entry<String, String> property : src.entrySet())
+      {
+         dst.setString(property.getKey(), property.getValue());
       }
    }
 

Modified: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/ModelObject.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/ModelObject.java	2009-10-22 19:40:46 UTC (rev 401)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/ModelObject.java	2009-10-22 22:02:30 UTC (rev 402)
@@ -27,27 +27,24 @@
 {
 
    /** Storage id. */
-   final String storageId;
+   String storageId;
 
    /** The storage name that is unique among a container context. */
-   final String storageName;
+   String storageName;
 
    /**
     * Create a new object.
     *
-    * @param storageId the storage name
-    * @param storageName the storage name
+    * @param storageId if the storage id is null
     */
-   public ModelObject(String storageId, String storageName)
+   public ModelObject(String storageId)
    {
       this.storageId = storageId;
-      this.storageName = storageName;
    }
 
    protected ModelObject()
    {
       this.storageId = null;
-      this.storageName = null;
    }
 
    public String getStorageId()
@@ -59,4 +56,10 @@
    {
       return storageName;
    }
+
+   public void setStorageName(String storageName)
+   {
+      this.storageName = storageName;
+   }
+
 }

Modified: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/Page.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/Page.java	2009-10-22 19:40:46 UTC (rev 401)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/Page.java	2009-10-22 22:02:30 UTC (rev 402)
@@ -31,69 +31,59 @@
 
    final static public String DEFAULT_PAGE = "Default";
 
-   private final String ownerType;
+   private String ownerType;
 
-   private final String ownerId;
+   private String ownerId;
 
-   private final String editPermission;
+   private String[] accessPermissions;
 
-   private final boolean showMaxWindow;
+   private String editPermission;
 
-   private final String creator;
+   private boolean showMaxWindow = false;
 
-   private final String modifier;
+   private String creator;
 
-   public Page(Page page, PageData data)
+   private String modifier;
+
+   private transient boolean modifiable;
+
+   public Page()
    {
-      this(page.getStorageId(), data);
    }
 
-   public Page(PageData data)
+   public Page(String storageId)
    {
-      this((String)null, data);
+      super(storageId);
    }
 
-   public Page(String storageId, PageData data)
+   public String getOwnerId()
    {
-      super(storageId, data);
+      return ownerId;
+   }
 
-      //
-      this.ownerType = data.getOwnerType();
-      this.ownerId = data.getOwnerId();
-      this.editPermission = data.getEditPermission();
-      this.showMaxWindow = data.isShowMaxWindow();
-      this.creator = data.getCreator();
-      this.modifier = data.getModifier();
+   public void setOwnerId(String ownerId)
+   {
+      this.ownerId = ownerId;
    }
 
-   public void populate(PageData data) {
-      super.populate(data);
-
-      //
-      data.setOwnerType(ownerType);
-      data.setOwnerId(ownerId);
-      data.setEditPermission(editPermission);
-      data.setShowMaxWindow(showMaxWindow);
-      data.setCreator(creator);
-      data.setModifier(modifier);
+   public String getOwnerType()
+   {
+      return ownerType;
    }
 
-   @Override
-   public PageData buildData()
+   public void setOwnerType(String ownerType)
    {
-      PageData data = new PageData();
-      populate(data);
-      return data;
+      this.ownerType = ownerType;
    }
 
-   public String getOwnerId()
+   public String[] getAccessPermissions()
    {
-      return ownerId;
+      return accessPermissions;
    }
 
-   public String getOwnerType()
+   public void setAccessPermissions(String[] s)
    {
-      return ownerType;
+      accessPermissions = s;
    }
 
    public String getEditPermission()
@@ -101,11 +91,21 @@
       return editPermission;
    }
 
+   public void setEditPermission(String editPermission)
+   {
+      this.editPermission = editPermission;
+   }
+
    public boolean isShowMaxWindow()
    {
       return showMaxWindow;
    }
 
+   public void setShowMaxWindow(Boolean showMaxWindow)
+   {
+      this.showMaxWindow = showMaxWindow.booleanValue();
+   }
+
    public String getPageId()
    {
       if (ownerType == null || ownerId == null || name == null)
@@ -118,16 +118,57 @@
       }
    }
 
+   public void setPageId(String pageId)
+   {
+      if (pageId == null)
+      {
+         ownerType = null;
+         ownerId = null;
+         name = null;
+      }
+      else
+      {
+         int i1 = pageId.indexOf("::");
+         int i2 = pageId.indexOf("::", i1 + 2);
+         String ownerType = pageId.substring(0, i1);
+         String ownerId = pageId.substring(i1 + 2, i2);
+         String name = pageId.substring(i2 + 2);
+         this.ownerType = ownerType;
+         this.ownerId = ownerId;
+         this.name = name;
+      }
+   }
+
+   public boolean isModifiable()
+   {
+      return modifiable;
+   }
+
+   public void setModifiable(boolean b)
+   {
+      modifiable = b;
+   }
+
    public String getCreator()
    {
       return creator;
    }
 
+   public void setCreator(String s)
+   {
+      creator = s;
+   }
+
    public String getModifier()
    {
       return modifier;
    }
 
+   public void setModifier(String s)
+   {
+      modifier = s;
+   }
+
    static public class PageSet
    {
       private ArrayList<Page> pages;

Modified: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PageBody.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PageBody.java	2009-10-22 19:40:46 UTC (rev 401)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PageBody.java	2009-10-22 22:02:30 UTC (rev 402)
@@ -28,7 +28,7 @@
 
    public PageBody(String storageId)
    {
-      super(storageId, null);
+      super(storageId);
    }
 
    public PageBody()

Deleted: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PageData.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PageData.java	2009-10-22 19:40:46 UTC (rev 401)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PageData.java	2009-10-22 22:02:30 UTC (rev 402)
@@ -1,136 +0,0 @@
-/*
- * Copyright (C) 2003-2007 eXo Platform SAS.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
- */
-package org.exoplatform.portal.config.model;
-
-/**
- * @author <a href="mailto:julien.viet at exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public class PageData extends ContainerData
-{
-
-   /** . */
-   private String ownerType;
-
-   /** . */
-   private String ownerId;
-
-   /** . */
-   private String editPermission;
-
-   /** . */
-   private boolean showMaxWindow = false;
-
-   /** . */
-   private String creator;
-
-   /** . */
-   private String modifier;
-
-   public String getOwnerType()
-   {
-      return ownerType;
-   }
-
-   public void setOwnerType(String ownerType)
-   {
-      this.ownerType = ownerType;
-   }
-
-   public String getOwnerId()
-   {
-      return ownerId;
-   }
-
-   public void setOwnerId(String ownerId)
-   {
-      this.ownerId = ownerId;
-   }
-
-   public String getEditPermission()
-   {
-      return editPermission;
-   }
-
-   public void setEditPermission(String editPermission)
-   {
-      this.editPermission = editPermission;
-   }
-
-   public boolean isShowMaxWindow()
-   {
-      return showMaxWindow;
-   }
-
-   public void setShowMaxWindow(boolean showMaxWindow)
-   {
-      this.showMaxWindow = showMaxWindow;
-   }
-
-   public String getCreator()
-   {
-      return creator;
-   }
-
-   public void setCreator(String creator)
-   {
-      this.creator = creator;
-   }
-
-   public String getModifier()
-   {
-      return modifier;
-   }
-
-   public void setModifier(String modifier)
-   {
-      this.modifier = modifier;
-   }
-
-   public void setPageId(String pageId)
-   {
-      if (pageId == null)
-      {
-         ownerType = null;
-         ownerId = null;
-         setName(null);
-      }
-      else
-      {
-         int i1 = pageId.indexOf("::");
-         int i2 = pageId.indexOf("::", i1 + 2);
-         String ownerType = pageId.substring(0, i1);
-         String ownerId = pageId.substring(i1 + 2, i2);
-         String name = pageId.substring(i2 + 2);
-         this.ownerType = ownerType;
-         this.ownerId = ownerId;
-         setName(name);
-      }
-   }
-
-   public String getPageId()
-   {
-      if (ownerType == null || ownerId == null || getName() == null)
-      {
-         return null;
-      }
-      else
-      {
-         return ownerType + "::" + ownerId + "::" + getName();
-      }
-   }
-}

Modified: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PageNode.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PageNode.java	2009-10-22 19:40:46 UTC (rev 401)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PageNode.java	2009-10-22 22:02:30 UTC (rev 402)
@@ -190,9 +190,9 @@
       return visible;
    }
 
-   public void setVisible(boolean b)
+   public void setVisible(Boolean b)
    {
-      visible = b;
+      visible = b.booleanValue();
    }
 
    private boolean isInPublicationDate()
@@ -208,9 +208,9 @@
       return false;
    }
 
-   public void setShowPublicationDate(boolean show)
+   public void setShowPublicationDate(Boolean show)
    {
-      showPublicationDate = show;
+      showPublicationDate = show.booleanValue();
    }
 
    public boolean isShowPublicationDate()

Modified: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PageNodeContainer.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PageNodeContainer.java	2009-10-22 19:40:46 UTC (rev 401)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PageNodeContainer.java	2009-10-22 22:02:30 UTC (rev 402)
@@ -30,7 +30,7 @@
 
    public PageNodeContainer(String storageId)
    {
-      super(storageId, null);
+      super(storageId);
    }
 
    public PageNodeContainer()

Modified: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PortalConfig.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PortalConfig.java	2009-10-22 19:40:46 UTC (rev 401)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PortalConfig.java	2009-10-22 22:02:30 UTC (rev 402)
@@ -70,7 +70,7 @@
 
    public PortalConfig(String type, String ownerId, String storageId)
    {
-      super(storageId, null);
+      super(storageId);
 
       //
       this.type = type;
@@ -82,12 +82,12 @@
       this.type = type;
 
       //
-      setPortalLayout(new Container(new ContainerData()));
+      setPortalLayout(new Container());
    }
 
    PortalConfig(String storageId, String type)
    {
-      super(storageId, null);
+      super(storageId);
 
       //
       this.type = type;
@@ -291,8 +291,10 @@
     */
    private static Container initDefaultLayout()
    {
-      Container container = new Container(new ContainerData());
-      container.getChildren().add(new PageBody());
+      Container container = new Container();
+      ArrayList<ModelObject> children = new ArrayList<ModelObject>();
+      children.add(new PageBody());
+      container.setChildren(children);
       return container;
    }
 }

Modified: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/SiteBody.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/SiteBody.java	2009-10-22 19:40:46 UTC (rev 401)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/SiteBody.java	2009-10-22 22:02:30 UTC (rev 402)
@@ -24,7 +24,7 @@
 
    public SiteBody(String storageId)
    {
-      super(storageId, null);
+      super(storageId);
    }
 
    public SiteBody()

Modified: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/gadget/GadgetApplication.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/gadget/GadgetApplication.java	2009-10-22 19:40:46 UTC (rev 401)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/gadget/GadgetApplication.java	2009-10-22 22:02:30 UTC (rev 402)
@@ -20,10 +20,7 @@
 package org.exoplatform.portal.config.model.gadget;
 
 import org.exoplatform.portal.config.model.Application;
-import org.exoplatform.portal.config.model.ApplicationData;
 import org.exoplatform.portal.config.model.ApplicationType;
-import org.exoplatform.portal.config.model.PersistentApplicationState;
-import org.exoplatform.portal.config.model.TransientApplicationState;
 import org.exoplatform.portal.pom.spi.gadget.Gadget;
 
 /**
@@ -33,21 +30,26 @@
 public class GadgetApplication extends Application<Gadget, GadgetId>
 {
 
-   public GadgetApplication(String storageId, String storageName, GadgetId gadgetId, PersistentApplicationState<Gadget> state, ApplicationData data)
+   public GadgetApplication(String storageId, String gadgetName)
    {
-      super(storageId, storageName, gadgetId, state, data);
+      super(storageId, new GadgetId(gadgetName));
    }
 
-   public GadgetApplication(String storageName, GadgetId ref, TransientApplicationState<Gadget> state, ApplicationData data)
+   public GadgetApplication(String gadgetName)
    {
-      super(storageName, ref, state, data);
+      super(new GadgetId(gadgetName));
    }
 
-   public GadgetApplication(GadgetId ref, TransientApplicationState<Gadget> state)
+   public GadgetApplication(String storageId, GadgetId instanceId)
    {
-      super(null, ref, state, null);
+      super(storageId, instanceId);
    }
 
+   public GadgetApplication(GadgetId instanceId)
+   {
+      super(instanceId);
+   }
+
    public ApplicationType<Gadget, GadgetId> getType()
    {
       return ApplicationType.GADGET;

Modified: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/portlet/PortletApplication.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/portlet/PortletApplication.java	2009-10-22 19:40:46 UTC (rev 401)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/portlet/PortletApplication.java	2009-10-22 22:02:30 UTC (rev 402)
@@ -20,11 +20,7 @@
 package org.exoplatform.portal.config.model.portlet;
 
 import org.exoplatform.portal.config.model.Application;
-import org.exoplatform.portal.config.model.ApplicationData;
-import org.exoplatform.portal.config.model.ApplicationState;
 import org.exoplatform.portal.config.model.ApplicationType;
-import org.exoplatform.portal.config.model.PersistentApplicationState;
-import org.exoplatform.portal.config.model.TransientApplicationState;
 import org.exoplatform.portal.pom.spi.portlet.Preferences;
 
 /**
@@ -34,35 +30,24 @@
 public class PortletApplication extends Application<Preferences, PortletId>
 {
 
-   public PortletApplication(
-      String storageId,
-      String storageName,
-      String applicationName,
-      String portletName,
-      PersistentApplicationState<Preferences> state,
-      ApplicationData data)
+   public PortletApplication(String storageId, String applicationName, String portletName)
    {
-      super(storageId, storageName, new PortletId(applicationName, portletName), state, data);
+      super(storageId, new PortletId(applicationName, portletName));
    }
 
-   public PortletApplication(
-      String storageId,
-      String storageName,
-      PortletId id,
-      PersistentApplicationState<Preferences> state,
-      ApplicationData data)
+   public PortletApplication(String applicationName, String portletName)
    {
-      super(storageId, storageName, id, state, data);
+      super(new PortletId(applicationName, portletName));
    }
 
-   public PortletApplication(String storageName, PortletId ref, TransientApplicationState<Preferences> state, ApplicationData data)
+   public PortletApplication(String storageId, PortletId instanceId)
    {
-      super(storageName, ref, state, data);
+      super(storageId, instanceId);
    }
 
-   public PortletApplication(String applicationName, String portletName, TransientApplicationState<Preferences> state)
+   public PortletApplication(PortletId instanceId)
    {
-      super(null, new PortletId(applicationName, portletName), state, null);
+      super(instanceId);
    }
 
    public ApplicationType<Preferences, PortletId> getType()

Modified: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/wsrp/WSRPApplication.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/wsrp/WSRPApplication.java	2009-10-22 19:40:46 UTC (rev 401)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/wsrp/WSRPApplication.java	2009-10-22 22:02:30 UTC (rev 402)
@@ -20,10 +20,7 @@
 package org.exoplatform.portal.config.model.wsrp;
 
 import org.exoplatform.portal.config.model.Application;
-import org.exoplatform.portal.config.model.ApplicationData;
 import org.exoplatform.portal.config.model.ApplicationType;
-import org.exoplatform.portal.config.model.PersistentApplicationState;
-import org.exoplatform.portal.config.model.TransientApplicationState;
 import org.exoplatform.portal.pom.spi.wsrp.WSRPState;
 
 /**
@@ -33,14 +30,14 @@
 public class WSRPApplication extends Application<WSRPState, WSRPId>
 {
 
-   public WSRPApplication(String storageId, String storageName, WSRPId id, PersistentApplicationState<WSRPState> state, ApplicationData data)
+   public WSRPApplication(String storageId, WSRPId id)
    {
-      super(storageId, storageName, id, state, data);
+      super(storageId, id);
    }
 
-   public WSRPApplication(String storageName, WSRPId id, TransientApplicationState<WSRPState> state, ApplicationData data)
+   public WSRPApplication(WSRPId id)
    {
-      super(storageName, id, state, data);
+      super(id);
    }
 
    @Override

Modified: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/serialize/AbstractApplicationHandler.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/serialize/AbstractApplicationHandler.java	2009-10-22 19:40:46 UTC (rev 401)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/serialize/AbstractApplicationHandler.java	2009-10-22 22:02:30 UTC (rev 402)
@@ -19,8 +19,6 @@
 
 package org.exoplatform.portal.config.serialize;
 
-import org.exoplatform.portal.config.model.ApplicationData;
-import org.exoplatform.portal.config.model.portlet.PortletId;
 import static org.exoplatform.portal.pom.config.Utils.split;
 
 import org.exoplatform.portal.application.Preference;
@@ -42,18 +40,45 @@
  * @author <a href="mailto:julien.viet at exoplatform.com">Julien Viet</a>
  * @version $Revision$
  */
-public class AbstractApplicationHandler extends AbstractHandler
+public class AbstractApplicationHandler implements IMarshaller, IUnmarshaller, IAliasable
 {
 
+   private String m_uri;
+
+   private int m_index;
+
+   private String m_name;
+
    public AbstractApplicationHandler()
    {
    }
 
    public AbstractApplicationHandler(String m_uri, int m_index, String m_name)
    {
-      super(m_uri, m_index, m_name);
+      this.m_uri = m_uri;
+      this.m_index = m_index;
+      this.m_name = m_name;
    }
 
+   // IMarshaller implementation
+
+   public boolean isExtension(String s)
+   {
+      throw new UnsupportedOperationException();
+   }
+
+   public void marshal(Object o, IMarshallingContext iMarshallingContext) throws JiBXException
+   {
+      throw new UnsupportedOperationException();
+   }
+
+   // IUnmarshaller implementation
+
+   public boolean isPresent(IUnmarshallingContext ctx) throws JiBXException
+   {
+      return ctx.isAt(m_uri, m_name);
+   }
+
    public Object unmarshal(Object obj, IUnmarshallingContext ictx) throws JiBXException
    {
       UnmarshallingContext ctx = (UnmarshallingContext)ictx;
@@ -75,8 +100,7 @@
       ctx.parsePastStartTag(m_uri, m_name);
 
       //
-      PortletId portletId;
-      TransientApplicationState<Preferences> state;
+      PortletApplication app;
       if ("application".equals(m_name))
       {
          String instanceId = ctx.parseElementText(m_uri, "instance-id");
@@ -87,6 +111,7 @@
          String ownerId = instanceId.substring(i0 + 1, i1);
          String persistenceid = instanceId.substring(i1 + 2);
          String[] persistenceChunks = split("/", persistenceid);
+         TransientApplicationState<Preferences> state;
          if (persistenceChunks.length == 2)
          {
             state = new TransientApplicationState<Preferences>();
@@ -97,14 +122,15 @@
          }
          state.setOwnerType(ownerType);
          state.setOwnerId(ownerId);
-         portletId = new PortletId(persistenceChunks[0], persistenceChunks[1]);
+         app = new PortletApplication(persistenceChunks[0], persistenceChunks[1]);
+         app.setState(state);
       }
       else
       {
          ctx.parsePastStartTag(m_uri, "portlet");
          String applicationName = ctx.parseElementText(m_uri, "application-ref");
          String portletName = ctx.parseElementText(m_uri, "portlet-ref");
-         state = new TransientApplicationState<Preferences>();
+         TransientApplicationState<Preferences> state = new TransientApplicationState<Preferences>();
          if (ctx.isAt(m_uri, "preferences"))
          {
             PreferencesBuilder builder = new PreferencesBuilder();
@@ -117,7 +143,8 @@
             ctx.parsePastEndTag(m_uri, "preferences");
             state.setContentState(builder.build());
          }
-         portletId = new PortletId(applicationName, portletName);
+         app = new PortletApplication(applicationName, portletName);
+         app.setState(state);
          ctx.parsePastEndTag(m_uri, "portlet");
       }
 
@@ -145,21 +172,51 @@
       ctx.parsePastEndTag(m_uri, m_name);
 
       //
-      ApplicationData data = new ApplicationData();
-      data.setId(id);
-      data.setTheme(theme);
-      data.setTitle(title);
-      data.setAccessPermissions(JibxArraySerialize.deserializeStringArray(accessPermissions));
-      data.setShowInfoBar(showInfoBar);
-      data.setShowApplicationState(showApplicationState);
-      data.setShowApplicationMode(showApplicationMode);
-      data.setDescription(description);
-      data.setIcon(icon);
-      data.setWidth(width);
-      data.setHeight(height);
-      data.setProperties(properties);
+      app.setId(id);
+      app.setTheme(theme);
+      app.setTitle(title);
+      app.setAccessPermissions(JibxArraySerialize.deserializeStringArray(accessPermissions));
+      app.setShowInfoBar(showInfoBar);
+      app.setShowApplicationState(showApplicationState);
+      app.setShowApplicationMode(showApplicationMode);
+      app.setDescription(description);
+      app.setIcon(icon);
+      app.setWidth(width);
+      app.setHeight(height);
+      app.setProperties(properties);
 
       //
-      return new PortletApplication(null, portletId, state, data);
+      return app;
    }
+
+   private String optionalAttribute(UnmarshallingContext ctx, String attrName) throws JiBXException
+   {
+      String value = null;
+      if (ctx.hasAttribute(m_uri, attrName))
+      {
+         value = ctx.attributeText(m_uri, attrName);
+      }
+      return value;
+   }
+
+   private String nextOptionalTag(UnmarshallingContext ctx, String tagName) throws JiBXException
+   {
+      String value = null;
+      if (ctx.isAt(m_uri, tagName))
+      {
+         value = ctx.parseElementText(m_uri, tagName);
+      }
+      return value;
+   }
+
+   private boolean nextOptionalBooleanTag(UnmarshallingContext ctx, String tagName, boolean defaultValue)
+      throws JiBXException
+   {
+      Boolean value = defaultValue;
+      if (ctx.isAt(m_uri, tagName))
+      {
+         value = ctx.parseElementBoolean(m_uri, tagName);
+      }
+      return value;
+   }
 }

Deleted: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/serialize/AbstractHandler.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/serialize/AbstractHandler.java	2009-10-22 19:40:46 UTC (rev 401)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/serialize/AbstractHandler.java	2009-10-22 22:02:30 UTC (rev 402)
@@ -1,116 +0,0 @@
-/*
- * Copyright (C) 2003-2007 eXo Platform SAS.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
- */
-package org.exoplatform.portal.config.serialize;
-
-import org.jibx.runtime.IAliasable;
-import org.jibx.runtime.IMarshaller;
-import org.jibx.runtime.IMarshallingContext;
-import org.jibx.runtime.IUnmarshaller;
-import org.jibx.runtime.IUnmarshallingContext;
-import org.jibx.runtime.JiBXException;
-import org.jibx.runtime.impl.UnmarshallingContext;
-
-/**
- * @author <a href="mailto:julien.viet at exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public abstract class AbstractHandler implements IMarshaller, IUnmarshaller, IAliasable
-{
-
-   protected final String m_uri;
-
-   protected final int m_index;
-
-   protected final String m_name;
-
-   public AbstractHandler()
-   {
-      this.m_uri = null;
-      this.m_index = 0;
-      this.m_name = null;
-   }
-
-   public AbstractHandler(String m_uri, int m_index, String m_name)
-   {
-      this.m_uri = m_uri;
-      this.m_index = m_index;
-      this.m_name = m_name;
-   }
-
-   // IMarshaller implementation
-
-   public boolean isExtension(String s)
-   {
-      throw new UnsupportedOperationException();
-   }
-
-   public void marshal(Object o, IMarshallingContext iMarshallingContext) throws JiBXException
-   {
-      throw new UnsupportedOperationException();
-   }
-
-   // IUnmarshaller implementation
-
-   public boolean isPresent(IUnmarshallingContext ctx) throws JiBXException
-   {
-      return ctx.isAt(m_uri, m_name);
-   }
-
-   // Utility
-
-   protected final String optionalAttribute(UnmarshallingContext ctx, String attrName) throws JiBXException
-   {
-      String value = null;
-      if (ctx.hasAttribute(m_uri, attrName))
-      {
-         value = ctx.attributeText(m_uri, attrName);
-      }
-      return value;
-   }
-
-   protected final String nextOptionalTag(UnmarshallingContext ctx, String tagName) throws JiBXException
-   {
-      String value = null;
-      if (ctx.isAt(m_uri, tagName))
-      {
-         value = ctx.parseElementText(m_uri, tagName);
-      }
-      return value;
-   }
-
-   protected final int nextOptionalIntTag(UnmarshallingContext ctx, String tagName, int defaultValue)
-      throws JiBXException
-   {
-      Integer value = defaultValue;
-      if (ctx.isAt(m_uri, tagName))
-      {
-         value = ctx.parseElementInt(m_uri, tagName);
-      }
-      return value;
-   }
-
-   protected final boolean nextOptionalBooleanTag(UnmarshallingContext ctx, String tagName, boolean defaultValue)
-      throws JiBXException
-   {
-      Boolean value = defaultValue;
-      if (ctx.isAt(m_uri, tagName))
-      {
-         value = ctx.parseElementBoolean(m_uri, tagName);
-      }
-      return value;
-   }
-}

Deleted: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/serialize/ContainerHandler.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/serialize/ContainerHandler.java	2009-10-22 19:40:46 UTC (rev 401)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/serialize/ContainerHandler.java	2009-10-22 22:02:30 UTC (rev 402)
@@ -1,104 +0,0 @@
-/*
- * Copyright (C) 2003-2007 eXo Platform SAS.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
- */
-package org.exoplatform.portal.config.serialize;
-
-import org.exoplatform.portal.config.model.Container;
-import org.exoplatform.portal.config.model.ContainerData;
-import org.exoplatform.portal.config.model.ModelObject;
-import org.jibx.runtime.IUnmarshallingContext;
-import org.jibx.runtime.JiBXException;
-import org.jibx.runtime.impl.UnmarshallingContext;
-
-/**
- * @author <a href="mailto:julien.viet at exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public class ContainerHandler extends AbstractHandler
-{
-
-   public ContainerHandler()
-   {
-   }
-
-   public ContainerHandler(String m_uri, int m_index, String m_name)
-   {
-      super(m_uri, m_index, m_name);
-   }
-
-   public Object unmarshal(Object o, IUnmarshallingContext ictx) throws JiBXException
-   {
-      UnmarshallingContext ctx = (UnmarshallingContext)ictx;
-      if (!ctx.isAt(m_uri, m_name))
-      {
-         ctx.throwStartTagNameError(m_uri, m_name);
-      }
-
-      //
-      String id = optionalAttribute(ctx, "id");
-      String template = optionalAttribute(ctx, "template");
-      String decorator = optionalAttribute(ctx, "decorator");
-      String width = optionalAttribute(ctx, "width");
-      String height = optionalAttribute(ctx, "height");
-
-      //
-      ctx.parsePastStartTag(m_uri, m_name);
-
-      //
-      String name = nextOptionalTag(ctx, "name");
-      String title = nextOptionalTag(ctx, "title");
-      String icon = nextOptionalTag(ctx, "icon");
-      String accessPermissions = nextOptionalTag(ctx, "access-permissions");
-      String factoryId = nextOptionalTag(ctx, "factory-id");
-      String description = nextOptionalTag(ctx, "description");
-
-      //
-      ContainerData data = new ContainerData();
-      data.setId(id);
-      data.setTemplate(template);
-      data.setDecorator(decorator);
-      data.setWidth(width);
-      data.setHeight(height);
-      data.setName(name);
-      data.setTitle(title);
-      data.setIcon(icon);
-      data.setFactoryId(factoryId);
-      data.setDescription(description);
-
-      //
-      if (accessPermissions != null) {
-         data.setAccessPermissions(new String[]{accessPermissions});
-      }
-
-      //
-      Container container = new Container(data);
-
-      //
-      while (true) {
-         if (ctx.isEnd()) {
-            break;
-         }
-         ModelObject child = (ModelObject)ctx.unmarshalElement();
-         container.getChildren().add(child);
-      }
-
-      //
-      ctx.parsePastEndTag(m_uri, m_name);
-
-      //
-      return container;
-   }
-}

Deleted: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/serialize/OwnerContext.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/serialize/OwnerContext.java	2009-10-22 19:40:46 UTC (rev 401)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/serialize/OwnerContext.java	2009-10-22 22:02:30 UTC (rev 402)
@@ -1,70 +0,0 @@
-/*
- * Copyright (C) 2003-2007 eXo Platform SAS.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
- */
-package org.exoplatform.portal.config.serialize;
-
-import java.util.concurrent.Callable;
-
-/**
- * @author <a href="mailto:julien.viet at exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public class OwnerContext
-{
-
-   /** . */
-   private static ThreadLocal<OwnerContext> current = new ThreadLocal<OwnerContext>();
-
-   /** . */
-   private final String type;
-
-   /** . */
-   private final String id;
-
-   public OwnerContext(String type, String id)
-   {
-      this.type = type;
-      this.id = id;
-   }
-
-   public String getType()
-   {
-      return type;
-   }
-
-   public String getId()
-   {
-      return id;
-   }
-
-   public <V> V execute(Callable<V> callable) throws Exception
-   {
-      current.set(this);
-      try
-      {
-         return callable.call();
-      }
-      finally
-      {
-         current.set(null);
-      }
-   }
-
-   public static OwnerContext getCurrentContext()
-   {
-      return current.get();
-   }
-}

Deleted: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/serialize/PageHandler.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/serialize/PageHandler.java	2009-10-22 19:40:46 UTC (rev 401)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/serialize/PageHandler.java	2009-10-22 22:02:30 UTC (rev 402)
@@ -1,110 +0,0 @@
-/*
- * Copyright (C) 2003-2007 eXo Platform SAS.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
- */
-package org.exoplatform.portal.config.serialize;
-
-import org.exoplatform.portal.config.model.Container;
-import org.exoplatform.portal.config.model.ContainerData;
-import org.exoplatform.portal.config.model.ModelObject;
-import org.exoplatform.portal.config.model.Page;
-import org.exoplatform.portal.config.model.PageData;
-import org.jibx.runtime.IUnmarshallingContext;
-import org.jibx.runtime.JiBXException;
-import org.jibx.runtime.impl.UnmarshallingContext;
-
-import java.util.List;
-
-/**
- * @author <a href="mailto:julien.viet at exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public class PageHandler extends AbstractHandler
-{
-
-   public PageHandler()
-   {
-   }
-
-   public PageHandler(String m_uri, int m_index, String m_name)
-   {
-      super(m_uri, m_index, m_name);
-   }
-
-   public Object unmarshal(Object o, IUnmarshallingContext ictx) throws JiBXException
-   {
-      UnmarshallingContext ctx = (UnmarshallingContext)ictx;
-      if (!ctx.isAt(m_uri, m_name))
-      {
-         ctx.throwStartTagNameError(m_uri, m_name);
-      }
-
-      //
-      ctx.parsePastStartTag(m_uri, m_name);
-
-      //
-      nextOptionalTag(ctx, "page-id");
-      nextOptionalTag(ctx, "owner-type");
-      nextOptionalTag(ctx, "owner-id");
-      String name = nextOptionalTag(ctx, "name");
-      String title = nextOptionalTag(ctx, "title");
-      String factoryId = nextOptionalTag(ctx, "factory-id");
-      String accessPermissions = nextOptionalTag(ctx, "access-permissions");
-      String editPermission = nextOptionalTag(ctx, "edit-permission");
-      boolean showMaxWindow = nextOptionalBooleanTag(ctx, "show-max-window", false);
-      String creator = nextOptionalTag(ctx, "creator");
-      String modifier = nextOptionalTag(ctx, "modifier");
-
-      //
-      PageData data = new PageData();
-      data.setName(name);
-      data.setTitle(title);
-      data.setFactoryId(factoryId);
-      data.setEditPermission(editPermission);
-      data.setShowMaxWindow(showMaxWindow);
-      data.setCreator(creator);
-      data.setModifier(modifier);
-
-      //
-      if (accessPermissions != null) {
-         data.setAccessPermissions(new String[]{accessPermissions});
-      }
-
-      //
-      OwnerContext owner = OwnerContext.getCurrentContext();
-      if (owner != null) {
-         data.setOwnerType(owner.getType());
-         data.setOwnerId(owner.getId());
-      }
-
-      //
-      Page page = new Page(data);
-
-      //
-      while (true) {
-         if (ctx.isEnd()) {
-            break;
-         }
-         ModelObject child = (ModelObject)ctx.unmarshalElement();
-         page.getChildren().add(child);
-      }
-
-      //
-      ctx.parsePastEndTag(m_uri, m_name);
-
-      //
-      return page;
-   }
-}

Deleted: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/serialize/PageNavigationHandler.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/serialize/PageNavigationHandler.java	2009-10-22 19:40:46 UTC (rev 401)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/serialize/PageNavigationHandler.java	2009-10-22 22:02:30 UTC (rev 402)
@@ -1,129 +0,0 @@
-/*
- * Copyright (C) 2003-2007 eXo Platform SAS.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
- */
-package org.exoplatform.portal.config.serialize;
-
-import org.exoplatform.portal.config.NewPortalConfigListener;
-import org.exoplatform.portal.config.model.ModelObject;
-import org.exoplatform.portal.config.model.PageNavigation;
-import org.exoplatform.portal.config.model.PageNode;
-import org.jibx.runtime.IUnmarshallingContext;
-import org.jibx.runtime.JiBXException;
-import org.jibx.runtime.impl.UnmarshallingContext;
-
-/**
- * @author <a href="mailto:julien.viet at exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public class PageNavigationHandler extends AbstractHandler
-{
-
-   public PageNavigationHandler()
-   {
-   }
-
-   public PageNavigationHandler(String m_uri, int m_index, String m_name)
-   {
-      super(m_uri, m_index, m_name);
-   }
-
-   public Object unmarshal(Object o, IUnmarshallingContext ictx) throws JiBXException
-   {
-      UnmarshallingContext ctx = (UnmarshallingContext)ictx;
-      if (!ctx.isAt(m_uri, m_name))
-      {
-         ctx.throwStartTagNameError(m_uri, m_name);
-      }
-
-      //
-      ctx.parsePastStartTag(m_uri, m_name);
-
-      //
-      nextOptionalTag(ctx, "owner-type");
-      nextOptionalTag(ctx, "owner-id");
-      int priority = nextOptionalIntTag(ctx, "priority", 1);
-      String creator = nextOptionalTag(ctx, "creator");
-      String modifier = nextOptionalTag(ctx, "modifier");
-      String description = nextOptionalTag(ctx, "description");
-
-      //
-      PageNavigation nav = new PageNavigation();
-      nav.setPriority(priority);
-      nav.setModifier(modifier);
-      nav.setDescription(description);
-      nav.setCreator(creator);
-
-      //
-      OwnerContext owner = OwnerContext.getCurrentContext();
-      if (owner != null) {
-         nav.setOwnerType(owner.getType());
-         nav.setOwnerId(owner.getId());
-      }
-
-      //
-      if (ctx.isAt(m_uri, "page-nodes")) {
-         ctx.parsePastStartTag(m_uri, "page-nodes");
-         while (true) {
-            if (ctx.isEnd()) {
-               break;
-            }
-            PageNode child = (PageNode)ctx.unmarshalElement();
-            nav.getNodes().add(child);
-         }
-         ctx.parsePastEndTag(m_uri, "page-nodes");
-      }
-
-      //
-      ctx.parsePastEndTag(m_uri, m_name);
-
-      //
-      fixOwnerName(nav);
-
-      //
-      return nav;
-   }
-
-   private static void fixOwnerName(PageNavigation pageNav)
-   {
-      for (PageNode pageNode : pageNav.getNodes())
-      {
-         fixOwnerName(pageNode);
-      }
-   }
-
-   private static void fixOwnerName(PageNode pageNode)
-   {
-      if (pageNode.getPageReference() != null)
-      {
-         String pageRef = pageNode.getPageReference();
-         int pos1 = pageRef.indexOf("::");
-         int pos2 = pageRef.indexOf("::", pos1 + 2);
-         String type = pageRef.substring(0, pos1);
-         String owner = pageRef.substring(pos1 + 2, pos2);
-         String name = pageRef.substring(pos2 + 2);
-         owner = NewPortalConfigListener.fixOwnerName(type, owner);
-         pageRef = type + "::" + owner + "::" + name;
-         pageNode.setPageReference(pageRef);
-      }
-      if (pageNode.getChildren() != null)
-      {
-         for (PageNode childPageNode : pageNode.getChildren())
-         {
-            fixOwnerName(childPageNode);
-         }
-      }
-   }
-}

Deleted: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/serialize/PortalConfigHandler.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/serialize/PortalConfigHandler.java	2009-10-22 19:40:46 UTC (rev 401)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/serialize/PortalConfigHandler.java	2009-10-22 22:02:30 UTC (rev 402)
@@ -1,126 +0,0 @@
-/*
- * Copyright (C) 2003-2007 eXo Platform SAS.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
- */
-package org.exoplatform.portal.config.serialize;
-
-import org.exoplatform.portal.config.NewPortalConfigListener;
-import org.exoplatform.portal.config.model.Container;
-import org.exoplatform.portal.config.model.PortalConfig;
-import org.exoplatform.portal.config.model.Properties;
-import org.jibx.runtime.IUnmarshallingContext;
-import org.jibx.runtime.JiBXException;
-import org.jibx.runtime.impl.UnmarshallingContext;
-
-/**
- * @author <a href="mailto:julien.viet at exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public class PortalConfigHandler extends AbstractHandler
-{
-
-   public PortalConfigHandler()
-   {
-   }
-
-   public PortalConfigHandler(String m_uri, int m_index, String m_name)
-   {
-      super(m_uri, m_index, m_name);
-   }
-
-   public Object unmarshal(Object o, IUnmarshallingContext ictx) throws JiBXException
-   {
-      UnmarshallingContext ctx = (UnmarshallingContext)ictx;
-      if (!ctx.isAt(m_uri, m_name))
-      {
-         ctx.throwStartTagNameError(m_uri, m_name);
-      }
-
-      //
-      ctx.parsePastStartTag(m_uri, m_name);
-
-      //
-      String name = nextOptionalTag(ctx, "portal-name");
-      String locale = ctx.parseElementText(m_uri, "locale");
-      String accessPermissions = nextOptionalTag(ctx, "access-permissions");
-      String editPermission = nextOptionalTag(ctx, "edit-permission");
-      String skin = nextOptionalTag(ctx, "skin");
-      String title = nextOptionalTag(ctx, "title");
-      String creator = nextOptionalTag(ctx, "creator");
-      String modifier = nextOptionalTag(ctx, "modifier");
-
-      //
-      PortalConfig portal = new PortalConfig();
-      portal.setName(name);
-      portal.setLocale(locale);
-      portal.setEditPermission(editPermission);
-      portal.setSkin(skin);
-      portal.setTitle(title);
-      portal.setCreator(creator);
-      portal.setModifier(modifier);
-
-      //
-      OwnerContext owner = OwnerContext.getCurrentContext();
-      if (owner != null) {
-         portal.setType(owner.getType());
-         portal.setName(owner.getId());
-//         fixOwnerName(portal);
-      }
-
-      //
-      if (accessPermissions != null) {
-         portal.setAccessPermissions(new String[]{accessPermissions});
-      }
-
-      //
-      if (ctx.isAt(m_uri, "properties"))
-      {
-         Properties properties = (Properties)ctx.unmarshalElement();
-         portal.setProperties(properties);
-      }
-
-      //
-      if (ctx.isAt(m_uri, "portal-layout"))
-      {
-         Container container = (Container)ctx.unmarshalElement();
-         portal.setPortalLayout(container);
-      }
-
-      //
-      ctx.parsePastEndTag(m_uri, m_name);
-
-      //
-      return portal;
-   }
-
-/*
-   static void fixOwnerName(PortalConfig config)
-   {
-      config.setName(NewPortalConfigListener.fixOwnerName(config.getType(), config.getName()));
-      fixOwnerName(config.getPortalLayout());
-   }
-
-   private static void fixOwnerName(Container container)
-   {
-      for (Object o : container.getChildren())
-      {
-         if (o instanceof Container)
-         {
-            fixOwnerName((Container)o);
-         }
-      }
-   }
-*/
-}

Deleted: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/serialize/PortalLayoutHandler.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/serialize/PortalLayoutHandler.java	2009-10-22 19:40:46 UTC (rev 401)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/serialize/PortalLayoutHandler.java	2009-10-22 22:02:30 UTC (rev 402)
@@ -1,34 +0,0 @@
-/*
- * Copyright (C) 2003-2007 eXo Platform SAS.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
- */
-package org.exoplatform.portal.config.serialize;
-
-/**
- * @author <a href="mailto:julien.viet at exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public class PortalLayoutHandler extends ContainerHandler
-{
-
-   public PortalLayoutHandler()
-   {
-   }
-
-   public PortalLayoutHandler(String m_uri, int m_index, String m_name)
-   {
-      super(m_uri, m_index, m_name);
-   }
-}

Modified: portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMDataStorage.java
===================================================================
--- portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMDataStorage.java	2009-10-22 19:40:46 UTC (rev 401)
+++ portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMDataStorage.java	2009-10-22 22:02:30 UTC (rev 402)
@@ -25,9 +25,11 @@
 import org.exoplatform.portal.application.PortletPreferences;
 import org.exoplatform.portal.config.DataStorage;
 import org.exoplatform.portal.config.Query;
+import org.exoplatform.portal.config.model.Application;
 import org.exoplatform.portal.config.model.ApplicationState;
 import org.exoplatform.portal.config.model.Container;
 import org.exoplatform.portal.config.model.ModelChange;
+import org.exoplatform.portal.config.model.ModelObject;
 import org.exoplatform.portal.config.model.Page;
 import org.exoplatform.portal.config.model.PageNavigation;
 import org.exoplatform.portal.config.model.PersistentApplicationState;
@@ -46,6 +48,7 @@
 import java.io.ByteArrayInputStream;
 import java.util.Comparator;
 import java.util.List;
+import java.util.UUID;
 
 /**
  * @author <a href="mailto:julien.viet at exoplatform.com">Julien Viet</a>
@@ -222,13 +225,10 @@
       }
    }
 
-/*
-   */
-/**
+   /**
     * This is a hack and should be removed, it is only used temporarily.
     * This is because the objects are loaded from files and don't have name.
-    *//*
-
+    */
    private void generateStorageName(ModelObject obj)
    {
       if (obj instanceof Container)
@@ -243,7 +243,6 @@
          ((Application)obj).setStorageName(UUID.randomUUID().toString());
       }
    }
-*/
 
    public Container getSharedLayout() throws Exception
    {
@@ -253,7 +252,7 @@
       IBindingFactory bfact = BindingDirectory.getFactory(Container.class);
       IUnmarshallingContext uctx = bfact.createUnmarshallingContext();
       Container container = Container.class.cast(uctx.unmarshalDocument(is, null));
-//      generateStorageName(container);
+      generateStorageName(container);
       return container;
    }
 }

Modified: portal/branches/performance/component/portal/src/main/resources/binding.xml
===================================================================
--- portal/branches/performance/component/portal/src/main/resources/binding.xml	2009-10-22 19:40:46 UTC (rev 401)
+++ portal/branches/performance/component/portal/src/main/resources/binding.xml	2009-10-22 22:02:30 UTC (rev 402)
@@ -34,6 +34,28 @@
       class="org.exoplatform.portal.config.model.Application"
       marshaller="org.exoplatform.portal.config.serialize.ApplicationHandler"
       unmarshaller="org.exoplatform.portal.config.serialize.ApplicationHandler">
+<!--
+    <value name="instance-id"
+           field="instanceState"
+           deserializer="org.exoplatform.portal.config.serialize.JiBX.unserializePortletState"
+           serializer="org.exoplatform.portal.config.serialize.JiBX.serializePortletState"
+           usage="optional"/>
+-->
+<!--
+    <value name="id" usage="optional" field="id" style="attribute"/>
+    <structure name="application-type" usage="optional"/>
+    <value name="theme" usage="optional" field="theme"/>
+    <value name="title" usage="optional" field="title"/>
+    <value name="access-permissions" field="accessPermissions" usage="optional"/>
+    <value name="show-info-bar" field="showInfoBar" usage="optional" />
+    <value name="show-application-state" field="showApplicationState" usage="optional" />
+    <value name="show-application-mode" field="showApplicationMode" usage="optional" />
+    <value name="description" field="description" usage="optional"/>
+    <value name="icon" field="icon" usage="optional"/>
+    <value name="width" usage="optional" field="width"  />
+    <value name="height" usage="optional" field="height" />
+    <structure field="properties" usage="optional"/>
+-->
   </mapping>
 
   <mapping name="portlet-application"
@@ -41,38 +63,97 @@
            class="org.exoplatform.portal.config.model.portlet.PortletApplication"
            marshaller="org.exoplatform.portal.config.serialize.PortletApplicationHandler"
            unmarshaller="org.exoplatform.portal.config.serialize.PortletApplicationHandler">
+<!--
+    <structure
+        get-method="getInstanceState"
+        set-method="setInstanceState">
+    </structure>
+    <value name="theme" usage="optional" get-method="getTheme" set-method="setTheme"/>
+    <value name="title" usage="optional" get-method="getTitle" set-method="setTitle"/>
+    <value name="access-permissions" get-method="getAccessPermissions" set-method="setAccessPermissions" usage="optional"/>
+    <value name="show-info-bar" get-method="getShowInfoBar" set-method="setShowInfoBar" usage="optional"/>
+    <value name="show-application-state" get-method="getShowApplicationState" set-method="setShowApplicationState" usage="optional"/>
+    <value name="show-application-mode" get-method="getShowApplicationMode" set-method="setShowApplicationMode" usage="optional" />
+    <value name="description" get-method="getDescription" set-method="setDescription" usage="optional"/>
+    <value name="icon" get-method="getIcon" set-method="setIcon" usage="optional"/>
+    <value name="width" get-method="getWidth"  set-method="setWidth" usage="optional"/>
+    <value name="height" get-method="getHeight" set-method="setHeight" usage="optional"/>
+    <structure get-method="getProperties" set-method="setProperties" usage="optional"/>
+-->
   </mapping>
 
+<!--
+  <mapping
+      abstract="true"
+      class="org.exoplatform.portal.config.model.ApplicationState">
+    <value name="application-ref" get-method="getApplicationName" set-method="setApplicationName"/>
+    <value name="portlet-ref" get-method="getPortletName" set-method="setPortletName"/>
+  </mapping>
+
+  <mapping
+      name="portlet"
+      class="org.exoplatform.portal.config.model.TransientApplicationState"
+      extends="org.exoplatform.portal.config.model.ApplicationState"
+      factory="org.exoplatform.portal.config.serialize.JiBX.createTransientApplicationState">
+    <structure map-as="org.exoplatform.portal.config.model.ApplicationState"/>
+    <structure
+        name="preferences"
+        get-method="getState"
+        set-method="setState"
+        marshaller="org.exoplatform.portal.config.serialize.PreferencesHandler"
+        unmarshaller="org.exoplatform.portal.config.serialize.PreferencesHandler"
+        usage="optional"/>
+  </mapping>
+-->
+
   <mapping name="page-body" label="pageBody" class="org.exoplatform.portal.config.model.PageBody">
   </mapping>
 	
   <mapping name="site-body" label="siteBody" class="org.exoplatform.portal.config.model.SiteBody">
   </mapping>
   
-  <mapping name="container"
-           label="container"
-           class="org.exoplatform.portal.config.model.Container"
-           marshaller="org.exoplatform.portal.config.serialize.ContainerHandler"
-           unmarshaller="org.exoplatform.portal.config.serialize.ContainerHandler">
+  <mapping name="container" label="container" class="org.exoplatform.portal.config.model.Container">
+    <value name="id" usage="optional" field="id" style="attribute"/>
+    <value name="name" usage="optional" field="name"/>
+    <value name="title" field="title" usage="optional"/>
+    <value name="icon" field="icon" usage="optional"/>
+    <value name="template" field="template" usage="optional" style="attribute"/>
+    <value name="access-permissions" field="accessPermissions" usage="optional"/>
+    <value name="factory-id" field="factoryId" usage="optional"/>
+    <value name="decorator" field="decorator" usage="optional" style="attribute"/>
+    <value name="description" field="description" usage="optional"/>
+    <value name="width" usage="optional" field="width" style="attribute" />
+    <value name="height" usage="optional" field="height" style="attribute"/>
+    <collection field="children" ordered="false">
+      <structure map-as="org.exoplatform.portal.config.model.Container" usage="optional"/>
+      <structure map-as="org.exoplatform.portal.config.model.Application" usage="optional"/>
+      <structure map-as="org.exoplatform.portal.config.model.PageBody" usage="optional"/>
+			<structure map-as="org.exoplatform.portal.config.model.SiteBody" usage="optional"/>
+			<structure map-as="org.exoplatform.portal.config.model.portlet.PortletApplication" usage="optional"/>
+    </collection>
   </mapping>
   
-  <mapping name="page"
-           label="page"
-           class="org.exoplatform.portal.config.model.Page"
-           marshaller="org.exoplatform.portal.config.serialize.PageHandler"
-           unmarshaller="org.exoplatform.portal.config.serialize.PageHandler">
+  <mapping name="page" label="page" class="org.exoplatform.portal.config.model.Page">
+    <structure name="page-id" usage="optional"/>
+    <structure name="owner-type" usage="optional"/>
+    <structure name="owner-id" usage="optional"/>
+    <value name="name" field="name"/>
+    <value name="title" field="title" usage="optional"/>
+    <value name="factory-id" field="factoryId" usage="optional"/>
+    <value name="access-permissions" field="accessPermissions" usage="optional"/>
+    <value name="edit-permission" field="editPermission" usage="optional"/>
+    <value name="show-max-window" field="showMaxWindow" usage="optional"/>
+    <value name="creator" field="creator" usage="optional"/>
+    <value name="modifier" field="modifier" usage="optional"/> 
+    <collection field="children" ordered="false">
+      <structure map-as="org.exoplatform.portal.config.model.Container" usage="optional"/>
+      <structure map-as="org.exoplatform.portal.config.model.Application" usage="optional"/>
+      <structure map-as="org.exoplatform.portal.config.model.PageBody" usage="optional"/>
+      <structure map-as="org.exoplatform.portal.config.model.portlet.PortletApplication" usage="optional"/>
+    </collection>
   </mapping>
   
-    <mapping name="portal-layout"
-             label="portal-layout"
-             class="java.lang.Object"
-             marshaller="org.exoplatform.portal.config.serialize.PortalLayoutHandler"
-             unmarshaller="org.exoplatform.portal.config.serialize.PortalLayoutHandler">
-    </mapping>
-
-   <mapping name="node"
-            label="node"
-            class="org.exoplatform.portal.config.model.PageNode">
+   <mapping name="node" label="node" class="org.exoplatform.portal.config.model.PageNode">
     <value name="uri" field="uri"/>
     <value name="name" field="name"/>
     <value name="label" field="label" usage="optional" set-method="setLabel"/>
@@ -85,23 +166,35 @@
     <collection field="children" usage="optional" item-type="org.exoplatform.portal.config.model.PageNode"/>
   </mapping>
   
-  <mapping name="portal-config"
-           class="org.exoplatform.portal.config.model.PortalConfig"
-           ordered="false"
-           marshaller="org.exoplatform.portal.config.serialize.PortalConfigHandler"
-           unmarshaller="org.exoplatform.portal.config.serialize.PortalConfigHandler">
+  <mapping name="portal-config" class="org.exoplatform.portal.config.model.PortalConfig" ordered="false">
+    <value name="portal-name" field="name"/>
+    <value name="locale" field="locale"/>    
+    <value name="access-permissions" field="accessPermissions" usage="optional"/>
+    <value name="edit-permission" field="editPermission" usage="optional"/>
+    <value name="skin" field="skin" usage="optional"/>
+    <value name="title" field="title" usage="optional"/>
+    <value name="creator" field="creator" usage="optional"/>
+    <value name="modifier" field="modifier" usage="optional"/>
+    <structure field="properties" usage="optional"/>
+    <structure name="portal-layout" using="container" field="portalLayout" usage="optional"/>
   </mapping>
 
   <mapping name="page-set" class="org.exoplatform.portal.config.model.Page$PageSet">
     <collection field="pages" item-type="org.exoplatform.portal.config.model.Page"/>
   </mapping>
 
-  <mapping name="node-navigation"
-           class="org.exoplatform.portal.config.model.PageNavigation"
-           marshaller="org.exoplatform.portal.config.serialize.PageNavigationHandler"
-           unmarshaller="org.exoplatform.portal.config.serialize.PageNavigationHandler">
+  <mapping name="node-navigation" class="org.exoplatform.portal.config.model.PageNavigation">
+    <structure name="owner-type" usage="optional"/>
+    <structure name="owner-id" usage="optional"/>
+    <value name="priority" field="priority" usage="optional"/>
+    <value name="creator" field="creator" usage="optional"/>
+    <value name="modifier" field="modifier" usage="optional"/>
+    <value name="description" field="description" usage="optional"/>
+    <collection name="page-nodes" field="pageNodes" usage="optional"
+                item-type="org.exoplatform.portal.config.model.PageNode"/>
   </mapping>
-
+  
+  
   <mapping name="portlet-preferences-set"
           class="org.exoplatform.portal.application.PortletPreferences$PortletPreferencesSet">
     <collection field="portlets" 
@@ -117,9 +210,7 @@
   </mapping>
 
   <mapping class="org.exoplatform.portal.application.PortletPreferences" 
-           name="portlet-preferences"
-           label="portlet-preferences"
-           post-set="postSet">
+           name="portlet-preferences" label="portlet-preferences">
     <structure name="owner-type" usage="optional"/>
     <structure name="owner-id" usage="optional"/>
     <value name="window-id" field="windowId"/>

Modified: portal/branches/performance/component/portal/src/test/java/org/exoplatform/portal/config/TestDataStorage.java
===================================================================
--- portal/branches/performance/component/portal/src/test/java/org/exoplatform/portal/config/TestDataStorage.java	2009-10-22 19:40:46 UTC (rev 401)
+++ portal/branches/performance/component/portal/src/test/java/org/exoplatform/portal/config/TestDataStorage.java	2009-10-22 22:02:30 UTC (rev 402)
@@ -19,9 +19,6 @@
 
 package org.exoplatform.portal.config;
 
-import org.exoplatform.portal.config.model.ContainerData;
-import org.exoplatform.portal.config.model.PageData;
-import org.exoplatform.portal.config.model.gadget.GadgetId;
 import static org.exoplatform.portal.pom.config.Utils.split;
 
 import org.exoplatform.container.PortalContainer;
@@ -147,11 +144,10 @@
 
    private void createPageConfig(String ownerType, String ownerId) throws Exception
    {
-      PageData data = new PageData();
-      data.setName("testPage");
-      data.setOwnerId("classic");
-      data.setOwnerType("portal");
-      Page page = new Page(data);
+      Page page = new Page();
+      page.setName("testPage");
+      page.setOwnerId("classic");
+      page.setOwnerType("portal");
 
       try
       {
@@ -185,14 +181,9 @@
       portalConfig.setAccessPermissions(new String[]{UserACL.EVERYONE});
       storage_.create(portalConfig);
 
-      PageData data = new PageData();
-      data.setTitle("New Page Title");
-      data.setOwnerId(page.getOwnerId());
-      data.setOwnerType(page.getOwnerType());
-      data.setName(page.getName());
-      Page newPage = new Page(page.getStorageId(), data);
-      newPage.getChildren().addAll(page.getChildren());
-      storage_.save(newPage);
+      page.setTitle("New Page Title");
+      page.setOwnerId("customers");
+      storage_.save(page);
 
       Page returnPage = storage_.getPage(page.getPageId());
       assertEquals("New Page Title", returnPage.getTitle());
@@ -303,14 +294,12 @@
 
    public void testWindowScopedPortletPreferences() throws Exception
    {
-      PageData data = new PageData();
-      data.setOwnerType("portal");
-      data.setOwnerId("test");
-      data.setName("foo");
-      Page page = new Page(data);
+      Page page = new Page();
+      page.setPageId("portal::test::foo");
       TransientApplicationState<Preferences> state = new TransientApplicationState<Preferences>();
       state.setContentState(new PreferencesBuilder().add("template", "bar").build());
-      PortletApplication app = new PortletApplication("web", "BannerPortlet", state);
+      PortletApplication app = new PortletApplication("web", "BannerPortlet");
+      app.setState(state);
       page.getChildren().add(app);
       storage_.save(page);
       page = storage_.getPage(page.getPageId());
@@ -453,12 +442,9 @@
 
    public void testDashboard() throws Exception
    {
-      PageData data = new PageData();
-      data.setOwnerType("portal");
-      data.setOwnerId("test");
-      data.setName("foo");
-      Page page = new Page(data);
-      page.getChildren().add(new Dashboard(new ContainerData()));
+      Page page = new Page();
+      page.setPageId("portal::test::foo");
+      page.getChildren().add(new Dashboard());
       storage_.save(page);
 
       //
@@ -472,9 +458,10 @@
       assertEquals("DashboardPortlet", dashboardPortlet.getRef().getPortletName());
 
       // Configures the dashboard
-      Dashboard dashboard = new Dashboard(dashboardId, new ContainerData());
+      Dashboard dashboard = new Dashboard(dashboardId);
       TransientApplicationState<Preferences> state = new TransientApplicationState<Preferences>();
-      PortletApplication app = new PortletApplication("foo", "bar", state);
+      PortletApplication app = new PortletApplication("foo", "bar");
+      app.setState(state);
       dashboard.getChildren().add(app);
 
       // Attempt to save a dashboard with a portlet on it
@@ -496,15 +483,13 @@
 
    public void testDashboardLayout() throws Exception
    {
-      TransientApplicationState<Preferences> state = new TransientApplicationState<Preferences>();
-      PortletApplication dashboardPortlet = new PortletApplication("dashboard", "DashboardPortlet", state);
+      PortletApplication dashboardPortlet = new PortletApplication("dashboard", "DashboardPortlet");
+      ApplicationState<Preferences> state = new TransientApplicationState<Preferences>();
+      dashboardPortlet.setState(state);
 
       //
-      PageData data = new PageData();
-      data.setOwnerType("portal");
-      data.setOwnerId("test");
-      data.setName("foo");
-      Page page = new Page(data);
+      Page page = new Page();
+      page.setPageId("portal::test::foo");
       page.getChildren().add(dashboardPortlet);
       storage_.save(page);
 
@@ -526,12 +511,9 @@
 
    public void testDashboardMoveRight() throws Exception
    {
-      PageData data = new PageData();
-      data.setOwnerType("portal");
-      data.setOwnerId("test");
-      data.setName("foo");
-      Page page = new Page(data);
-      page.getChildren().add(new PortletApplication("dashboard", "DashboardPortlet", null));
+      Page page = new Page();
+      page.setPageId("portal::test::foo");
+      page.getChildren().add(new PortletApplication("dashboard", "DashboardPortlet"));
       storage_.save(page);
       page = storage_.getPage("portal::test::foo");
       String id = page.getChildren().get(0).getStorageId();
@@ -541,7 +523,8 @@
 
       // Put a gadget in one container
       Container row0 = (Container)dashboard.getChildren().get(0);
-      GadgetApplication gadgetApp = new GadgetApplication(new GadgetId("foo"), new TransientApplicationState<Gadget>());
+      GadgetApplication gadgetApp = new GadgetApplication("foo");
+      gadgetApp.setState(new TransientApplicationState<Gadget>());
       row0.getChildren().add(gadgetApp);
 
       // Save the dashboard
@@ -570,12 +553,9 @@
 
    public void testDashboardMoveLeft() throws Exception
    {
-      PageData data = new PageData();
-      data.setOwnerType("portal");
-      data.setOwnerId("test");
-      data.setName("foo");
-      Page page = new Page(data);
-      page.getChildren().add(new PortletApplication("dashboard", "DashboardPortlet", null));
+      Page page = new Page();
+      page.setPageId("portal::test::foo");
+      page.getChildren().add(new PortletApplication("dashboard", "DashboardPortlet"));
       storage_.save(page);
       page = storage_.getPage("portal::test::foo");
       String id = page.getChildren().get(0).getStorageId();
@@ -585,7 +565,8 @@
 
       // Put a gadget in one container
       Container row1 = (Container)dashboard.getChildren().get(1);
-      GadgetApplication gadgetApp = new GadgetApplication(new GadgetId("foo"), new TransientApplicationState<Gadget>());
+      GadgetApplication gadgetApp = new GadgetApplication("foo");
+      gadgetApp.setState(new TransientApplicationState<Gadget>());
       row1.getChildren().add(gadgetApp);
 
       // Save the dashboard
@@ -623,7 +604,8 @@
       TransientApplicationState<Preferences> state = new TransientApplicationState<Preferences>(persistenceChunks[2]);
       state.setOwnerType(ownerType);
       state.setOwnerId(ownerId);
-      PortletApplication portletApp = new PortletApplication(persistenceChunks[0], persistenceChunks[1], state);
+      PortletApplication portletApp = new PortletApplication(persistenceChunks[0], persistenceChunks[1]);
+      portletApp.setState(state);
       return portletApp;
    }
 }

Modified: portal/branches/performance/component/portal/src/test/java/org/exoplatform/portal/config/TestGadget.java
===================================================================
--- portal/branches/performance/component/portal/src/test/java/org/exoplatform/portal/config/TestGadget.java	2009-10-22 19:40:46 UTC (rev 401)
+++ portal/branches/performance/component/portal/src/test/java/org/exoplatform/portal/config/TestGadget.java	2009-10-22 22:02:30 UTC (rev 402)
@@ -21,10 +21,8 @@
 
 import org.exoplatform.container.PortalContainer;
 import org.exoplatform.portal.config.model.Page;
-import org.exoplatform.portal.config.model.PageData;
 import org.exoplatform.portal.config.model.TransientApplicationState;
 import org.exoplatform.portal.config.model.gadget.GadgetApplication;
-import org.exoplatform.portal.config.model.gadget.GadgetId;
 import org.exoplatform.portal.pom.config.POMSession;
 import org.exoplatform.portal.pom.config.POMSessionManager;
 import org.exoplatform.portal.pom.spi.gadget.Gadget;
@@ -69,13 +67,11 @@
       Gadget gadget = new Gadget();
       gadget.setUserPref("user_pref");
       state.setContentState(gadget);
-      GadgetApplication gadgetApplication = new GadgetApplication(new GadgetId("bar"), state);
+      GadgetApplication gadgetApplication = new GadgetApplication("bar");
+      gadgetApplication.setState(state);
 
-      PageData data = new PageData();
-      data.setOwnerType("portal");
-      data.setOwnerId("test");
-      data.setName("gadget_page");
-      Page container = new Page(data);
+      Page container = new Page();
+      container.setPageId("portal::test::gadget_page");
       container.getChildren().add(gadgetApplication);
 
       storage_.create(container);

Modified: portal/branches/performance/component/portal/src/test/java/org/exoplatform/portal/config/TestJIBXXmlMapping.java
===================================================================
--- portal/branches/performance/component/portal/src/test/java/org/exoplatform/portal/config/TestJIBXXmlMapping.java	2009-10-22 19:40:46 UTC (rev 401)
+++ portal/branches/performance/component/portal/src/test/java/org/exoplatform/portal/config/TestJIBXXmlMapping.java	2009-10-22 22:02:30 UTC (rev 402)
@@ -82,6 +82,13 @@
       Object obj =
          uctx.unmarshalDocument(new FileInputStream("src/test/resources/portal/portal/classic/navigation.xml"), null);
       assertEquals(PageNavigation.class, obj.getClass());
+
+      IMarshallingContext mctx = bfact.createMarshallingContext();
+      mctx.setIndent(2);
+      mctx.marshalDocument(obj, "UTF-8", null, new FileOutputStream("target/navigation.xml"));
+
+      obj = uctx.unmarshalDocument(new FileInputStream("target/navigation.xml"), null);
+      assertEquals(PageNavigation.class, obj.getClass());
    }
 
    public void testPortletPreferencesMapping() throws Exception
@@ -92,6 +99,11 @@
          uctx.unmarshalDocument(
             new FileInputStream("src/test/resources/portal/portal/classic/portlet-preferences.xml"), null);
       assertEquals(PortletPreferencesSet.class, obj.getClass());
+
+      IMarshallingContext mctx = bfact.createMarshallingContext();
+      mctx.setIndent(2);
+      mctx.marshalDocument(obj, "UTF-8", null, new FileOutputStream("target/portlet-preferences.xml"));
+      assertEquals(PortletPreferencesSet.class, obj.getClass());
    }
 
    public void testPortletApplicationMapping() throws Exception

Modified: portal/branches/performance/component/portal/src/test/java/org/exoplatform/portal/config/TestUserPortalConfigService.java
===================================================================
--- portal/branches/performance/component/portal/src/test/java/org/exoplatform/portal/config/TestUserPortalConfigService.java	2009-10-22 19:40:46 UTC (rev 401)
+++ portal/branches/performance/component/portal/src/test/java/org/exoplatform/portal/config/TestUserPortalConfigService.java	2009-10-22 22:02:30 UTC (rev 402)
@@ -27,7 +27,6 @@
 import org.exoplatform.portal.config.model.Container;
 import org.exoplatform.portal.config.model.Page;
 import org.exoplatform.portal.config.model.PageBody;
-import org.exoplatform.portal.config.model.PageData;
 import org.exoplatform.portal.config.model.PageNavigation;
 import org.exoplatform.portal.config.model.PortalConfig;
 import org.exoplatform.portal.config.model.portlet.PortletApplication;
@@ -422,11 +421,10 @@
       {
          public void execute() throws Exception
          {
-            PageData data = new PageData();
-            data.setOwnerType("group");
-            data.setOwnerId("/platform/administrators");
-            data.setName("newAccount");
-            Page page = new Page(data);
+            Page page = new Page();
+            page.setOwnerType("group");
+            page.setOwnerId("/platform/administrators");
+            page.setName("newAccount");
             assertTrue(events.isEmpty());
             userPortalConfigSer_.remove(page);
             assertEquals(1, events.size());
@@ -447,11 +445,10 @@
       {
          public void execute() throws Exception
          {
-            PageData data = new PageData();
-            data.setOwnerType("group");
-            data.setOwnerId("/platform/administrators");
-            data.setName("whatever");
-            Page page = new Page(data);
+            Page page = new Page();
+            page.setOwnerType("group");
+            page.setOwnerId("/platform/administrators");
+            page.setName("whatever");
             assertTrue(events.isEmpty());
             userPortalConfigSer_.create(page);
             assertEquals(1, events.size());
@@ -472,12 +469,11 @@
       {
          public void execute() throws Exception
          {
-            PageData data = new PageData();
-            data.setOwnerType("group");
-            data.setOwnerId("/platform/administrators");
-            data.setName("newAccount");
-            data.setCreator("someone");
-            Page page = new Page(data);
+            Page page = new Page();
+            page.setOwnerType("group");
+            page.setOwnerId("/platform/administrators");
+            page.setName("newAccount");
+            page.setCreator("someone");
             assertTrue(events.isEmpty());
             userPortalConfigSer_.create(page);
             assertEquals(1, events.size());

Modified: portal/branches/performance/component/portal/src/test/java/org/exoplatform/portal/config/security/AbstractTestSharedPageACL.java
===================================================================
--- portal/branches/performance/component/portal/src/test/java/org/exoplatform/portal/config/security/AbstractTestSharedPageACL.java	2009-10-22 19:40:46 UTC (rev 401)
+++ portal/branches/performance/component/portal/src/test/java/org/exoplatform/portal/config/security/AbstractTestSharedPageACL.java	2009-10-22 22:02:30 UTC (rev 402)
@@ -20,7 +20,6 @@
 package org.exoplatform.portal.config.security;
 
 import org.exoplatform.portal.config.model.Page;
-import org.exoplatform.portal.config.model.PageData;
 
 /**
  * @author <a href="mailto:julien.viet at exoplatform.com">Julien Viet</a>
@@ -33,11 +32,10 @@
 
    public void testPage()
    {
-      PageData data = new PageData(); 
-      data.setOwnerType("group");
-      data.setOwnerId("foo");
-      data.setAccessPermissions(new String[0]);
-      Page page = new Page(data);
+      Page page = new Page();
+      page.setOwnerType("group");
+      page.setOwnerId("foo");
+      page.setAccessPermissions(new String[0]);
 
       //
       assertTrue(root.hasPermission(page));
@@ -56,11 +54,10 @@
 
    public void testPageAccessibleByEveryone()
    {
-      PageData data = new PageData(); 
-      data.setOwnerType("group");
-      data.setOwnerId("foo");
-      data.setAccessPermissions(new String[]{"Everyone"});
-      Page page = new Page(data);
+      Page page = new Page();
+      page.setOwnerType("group");
+      page.setOwnerId("foo");
+      page.setAccessPermissions(new String[]{"Everyone"});
 
       //
       assertTrue(root.hasPermission(page));
@@ -79,12 +76,11 @@
 
    public void testPageEditableByEveryone()
    {
-      PageData data = new PageData(); 
-      data.setOwnerType("group");
-      data.setOwnerId("foo");
-      data.setAccessPermissions(new String[0]);
-      data.setEditPermission("Everyone");
-      Page page = new Page(data);
+      Page page = new Page();
+      page.setOwnerType("group");
+      page.setOwnerId("foo");
+      page.setAccessPermissions(new String[0]);
+      page.setEditPermission("Everyone");
 
       //
       assertTrue(root.hasPermission(page));
@@ -103,11 +99,10 @@
 
    public void testPageAccessibleByGuests()
    {
-      PageData data = new PageData(); 
-      data.setOwnerType("group");
-      data.setOwnerId("foo");
-      data.setAccessPermissions(new String[]{"whatever:/platform/guests"});
-      Page page = new Page(data);
+      Page page = new Page();
+      page.setOwnerType("group");
+      page.setOwnerId("foo");
+      page.setAccessPermissions(new String[]{"whatever:/platform/guests"});
 
       //
       assertTrue(root.hasPermission(page));
@@ -126,12 +121,11 @@
 
    public void testPageEditableByGuests()
    {
-      PageData data = new PageData(); 
-      data.setOwnerType("group");
-      data.setOwnerId("foo");
-      data.setAccessPermissions(new String[0]);
-      data.setEditPermission("whatever:/platform/guests");
-      Page page = new Page(data);
+      Page page = new Page();
+      page.setOwnerType("group");
+      page.setOwnerId("foo");
+      page.setAccessPermissions(new String[0]);
+      page.setEditPermission("whatever:/platform/guests");
 
       //
       assertTrue(root.hasPermission(page));
@@ -150,11 +144,10 @@
 
    public void testPageAccessibleByEveryOneAndGuests()
    {
-      PageData data = new PageData();
-      data.setOwnerType("group");
-      data.setOwnerId("foo");
-      data.setAccessPermissions(new String[]{"Everyone", "whatever:/platform/guests"});
-      Page page = new Page(data);
+      Page page = new Page();
+      page.setOwnerType("group");
+      page.setOwnerId("foo");
+      page.setAccessPermissions(new String[]{"Everyone", "whatever:/platform/guests"});
 
       //
       assertTrue(root.hasPermission(page));
@@ -173,11 +166,10 @@
 
    public void testPageWithAccessPermission()
    {
-      PageData data = new PageData(); 
-      data.setOwnerType("group");
-      data.setOwnerId("foo");
-      data.setAccessPermissions(new String[]{"manager:/manageable"});
-      Page page = new Page(data);
+      Page page = new Page();
+      page.setOwnerType("group");
+      page.setOwnerId("foo");
+      page.setAccessPermissions(new String[]{"manager:/manageable"});
 
       //
       assertTrue(root.hasPermission(page));
@@ -187,8 +179,7 @@
       assertFalse(guest.hasPermission(page));
 
       //
-      data.setAccessPermissions(new String[]{"*:/manageable"});
-      page = new Page(data);
+      page.setAccessPermissions(new String[]{"*:/manageable"});
 
       //
       assertTrue(root.hasPermission(page));
@@ -200,12 +191,11 @@
 
    public void testPageWithEditPermission()
    {
-      PageData data = new PageData(); 
-      data.setOwnerType("group");
-      data.setOwnerId("foo");
-      data.setAccessPermissions(new String[0]);
-      data.setEditPermission("manager:/manageable");
-      Page page = new Page(data);
+      Page page = new Page();
+      page.setOwnerType("group");
+      page.setOwnerId("foo");
+      page.setAccessPermissions(new String[0]);
+      page.setEditPermission("manager:/manageable");
 
       //
       assertTrue(root.hasPermission(page));
@@ -215,8 +205,7 @@
       assertFalse(guest.hasPermission(page));
 
       //
-      data.setEditPermission("*:/manageable");
-      page = new Page(data);
+      page.setEditPermission("*:/manageable");
 
       //
       assertTrue(root.hasPermission(page));

Modified: portal/branches/performance/component/portal/src/test/java/org/exoplatform/portal/config/security/TestUserPageACL.java
===================================================================
--- portal/branches/performance/component/portal/src/test/java/org/exoplatform/portal/config/security/TestUserPageACL.java	2009-10-22 19:40:46 UTC (rev 401)
+++ portal/branches/performance/component/portal/src/test/java/org/exoplatform/portal/config/security/TestUserPageACL.java	2009-10-22 22:02:30 UTC (rev 402)
@@ -20,7 +20,6 @@
 package org.exoplatform.portal.config.security;
 
 import org.exoplatform.portal.config.model.Page;
-import org.exoplatform.portal.config.model.PageData;
 
 /**
  * @author <a href="mailto:julien.viet at exoplatform.com">Julien Viet</a>
@@ -30,11 +29,10 @@
 {
    public void testUserPageIsAlwaysUsableOnlyByItsOwner()
    {
-      PageData data = new PageData();
-      data.setOwnerType("user");
-      data.setOwnerId("user");
-      data.setAccessPermissions(new String[0]);
-      Page page = new Page(data);
+      Page page = new Page();
+      page.setOwnerType("user");
+      page.setOwnerId("user");
+      page.setAccessPermissions(new String[0]);
       assertTrue(root.hasPermission(page));
       assertFalse(administrator.hasPermission(page));
       assertFalse(manager.hasPermission(page));
@@ -47,8 +45,10 @@
       assertFalse(guest.hasEditPermission(page));
 
       //
-      data.setAccessPermissions(new String[]{"manager:/manageable"});
-      page = new Page(data);
+      page = new Page();
+      page.setOwnerType("user");
+      page.setOwnerId("user");
+      page.setAccessPermissions(new String[]{"manager:/manageable"});
       assertTrue(root.hasPermission(page));
       assertFalse(administrator.hasPermission(page));
       assertTrue(manager.hasPermission(page));
@@ -61,9 +61,11 @@
       assertFalse(guest.hasEditPermission(page));
 
       //
-      data.setAccessPermissions(new String[0]);
-      data.setEditPermission("manager:/manageable");
-      page = new Page(data);
+      page = new Page();
+      page.setOwnerType("user");
+      page.setOwnerId("user");
+      page.setAccessPermissions(new String[0]);
+      page.setEditPermission("manager:/manageable");
       assertTrue(root.hasPermission(page));
       assertFalse(administrator.hasPermission(page));
       //assertTrue(manager.hasPermission(page));
@@ -77,8 +79,10 @@
       assertFalse(guest.hasEditPermission(page));
 
       //
-      data.setAccessPermissions(new String[]{"Everyone"});
-      page = new Page(data);
+      page = new Page();
+      page.setOwnerType("user");
+      page.setOwnerId("user");
+      page.setAccessPermissions(new String[]{"Everyone"});
       assertTrue(root.hasPermission(page));
       assertTrue(administrator.hasPermission(page));
       assertTrue(manager.hasPermission(page));
@@ -91,9 +95,11 @@
       assertFalse(guest.hasEditPermission(page));
 
       //
-      data.setAccessPermissions(new String[0]);
-      data.setEditPermission("Everyone");
-      page = new Page(data);
+      page = new Page();
+      page.setOwnerType("user");
+      page.setOwnerId("user");
+      page.setAccessPermissions(new String[0]);
+      page.setEditPermission("Everyone");
       assertTrue(root.hasPermission(page));
       //assertTrue(administrator.hasPermission(page));
       //assertTrue(manager.hasPermission(page));

Modified: portal/branches/performance/portlet/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/UITabPaneDashboard.java
===================================================================
--- portal/branches/performance/portlet/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/UITabPaneDashboard.java	2009-10-22 19:40:46 UTC (rev 401)
+++ portal/branches/performance/portlet/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/UITabPaneDashboard.java	2009-10-22 22:02:30 UTC (rev 402)
@@ -22,7 +22,6 @@
 import org.exoplatform.portal.application.PortalRequestContext;
 import org.exoplatform.portal.config.UserPortalConfigService;
 import org.exoplatform.portal.config.model.Page;
-import org.exoplatform.portal.config.model.PageData;
 import org.exoplatform.portal.config.model.PageNavigation;
 import org.exoplatform.portal.config.model.PageNode;
 import org.exoplatform.portal.config.model.PortalConfig;
@@ -180,8 +179,7 @@
          Page page =
             configService.createPageTemplate(UITabPaneDashboard.PAGE_TEMPLATE, pageNavigation.getOwnerType(),
                pageNavigation.getOwnerId());
-         PageData data = page.buildData();
-         data.setTitle(nodeLabel);
+         page.setTitle(nodeLabel);
 
          PageNode pageNode = new PageNode();
          pageNode.setLabel(nodeLabel);
@@ -191,7 +189,7 @@
             uniqueNodeName = uniqueNodeName + "_" + System.currentTimeMillis();
          }
 
-         data.setName(uniqueNodeName);
+         page.setName(uniqueNodeName);
          pageNode.setName(uniqueNodeName);
          pageNode.setUri(uniqueNodeName);
          pageNode.setPageReference(page.getPageId());
@@ -199,7 +197,7 @@
          pageNavigation.addNode(pageNode);
          uiPortal.setSelectedNode(pageNode);
 
-         configService.create(new Page(page.getStorageId(), data));
+         configService.create(page);
          configService.update(pageNavigation);
 
          return uniqueNodeName;

Modified: portal/branches/performance/portlet/exoadmin/src/main/java/org/exoplatform/toolbar/webui/component/UIUserToolBarDashboardPortlet.java
===================================================================
--- portal/branches/performance/portlet/exoadmin/src/main/java/org/exoplatform/toolbar/webui/component/UIUserToolBarDashboardPortlet.java	2009-10-22 19:40:46 UTC (rev 401)
+++ portal/branches/performance/portlet/exoadmin/src/main/java/org/exoplatform/toolbar/webui/component/UIUserToolBarDashboardPortlet.java	2009-10-22 22:02:30 UTC (rev 402)
@@ -22,7 +22,6 @@
 import org.exoplatform.portal.application.PortalRequestContext;
 import org.exoplatform.portal.config.UserPortalConfigService;
 import org.exoplatform.portal.config.model.Page;
-import org.exoplatform.portal.config.model.PageData;
 import org.exoplatform.portal.config.model.PageNavigation;
 import org.exoplatform.portal.config.model.PageNode;
 import org.exoplatform.portal.config.model.PortalConfig;
@@ -110,9 +109,8 @@
             Page page =
                _configService.createPageTemplate(PAGE_TEMPLATE, _pageNavigation.getOwnerType(), _pageNavigation
                   .getOwnerId());
-            PageData data = page.buildData();
-            data.setTitle(_nodeName);
-            data.setName(_nodeName);
+            page.setTitle(_nodeName);
+            page.setName(_nodeName);
 
             PageNode pageNode = new PageNode();
             pageNode.setName(_nodeName);
@@ -122,7 +120,7 @@
             pageNode.setPageReference(page.getPageId());
 
             _pageNavigation.addNode(pageNode);
-            _configService.create(new Page(page, data));
+            _configService.create(page);
             _configService.update(_pageNavigation);
 
             prContext.getResponse().sendRedirect(prContext.getPortalURI() + _nodeName);

Modified: portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIAddNewApplication.java
===================================================================
--- portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIAddNewApplication.java	2009-10-22 19:40:46 UTC (rev 401)
+++ portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIAddNewApplication.java	2009-10-22 22:02:30 UTC (rev 402)
@@ -254,6 +254,10 @@
       {
          Page page = (Page)PortalDataMapper.buildModelObject(uiPage);
          UserPortalConfigService configService = uiPortalApp.getApplicationComponent(UserPortalConfigService.class);
+         if (page.getChildren() == null)
+         {
+            page.setChildren(new ArrayList<ModelObject>());
+         }
          configService.update(page);
       }
 

Modified: portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UINavigationNodeSelector.java
===================================================================
--- portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UINavigationNodeSelector.java	2009-10-22 19:40:46 UTC (rev 401)
+++ portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UINavigationNodeSelector.java	2009-10-22 22:02:30 UTC (rev 402)
@@ -22,7 +22,6 @@
 import org.exoplatform.portal.config.UserACL;
 import org.exoplatform.portal.config.UserPortalConfigService;
 import org.exoplatform.portal.config.model.Page;
-import org.exoplatform.portal.config.model.PageData;
 import org.exoplatform.portal.config.model.PageNavigation;
 import org.exoplatform.portal.config.model.PageNode;
 import org.exoplatform.portal.config.model.PortalConfig;
@@ -431,13 +430,11 @@
          // get selected page
          Page selectPage = null;
          selectPage = userService.getPage(selectedPageNode.getPageReference(), context.getRemoteUser());
-         PageData data = selectPage.buildData();
-         selectPage.populate(data);
-         data.setModifier(context.getRemoteUser());
-         data.setTitle(selectedPageNode.getLabel());
+         selectPage.setModifier(context.getRemoteUser());
+         selectPage.setTitle(selectedPageNode.getLabel());
 
          // convert Page to UIPage
-         PortalDataMapper.toUIPage(uiPage, new Page(selectPage, data));
+         PortalDataMapper.toUIPage(uiPage, selectPage);
          Util.getPortalRequestContext().addUIComponentToUpdateByAjax(uiWorkingWS);
          Util.getPortalRequestContext().setFullRender(true);
 

Modified: portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIDesktopPage.java
===================================================================
--- portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIDesktopPage.java	2009-10-22 19:40:46 UTC (rev 401)
+++ portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIDesktopPage.java	2009-10-22 22:02:30 UTC (rev 402)
@@ -118,6 +118,8 @@
             return;
          Page page = (Page)PortalDataMapper.buildModelObject(uiPage);
          UserPortalConfigService configService = uiPage.getApplicationComponent(UserPortalConfigService.class);
+         if (page.getChildren() == null)
+            page.setChildren(new ArrayList<ModelObject>());
          configService.update(page);
       }
    }

Modified: portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageActionListener.java
===================================================================
--- portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageActionListener.java	2009-10-22 19:40:46 UTC (rev 401)
+++ portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageActionListener.java	2009-10-22 22:02:30 UTC (rev 402)
@@ -24,6 +24,7 @@
 import org.exoplatform.portal.config.UserPortalConfig;
 import org.exoplatform.portal.config.UserPortalConfigService;
 import org.exoplatform.portal.config.model.Container;
+import org.exoplatform.portal.config.model.ModelObject;
 import org.exoplatform.portal.config.model.Page;
 import org.exoplatform.portal.config.model.PageNavigation;
 import org.exoplatform.portal.config.model.PageNode;
@@ -347,6 +348,8 @@
                {
                   Page page = (Page)PortalDataMapper.buildModelObject(uiPage);
                   UserPortalConfigService configService = uiPage.getApplicationComponent(UserPortalConfigService.class);
+                  if (page.getChildren() == null)
+                     page.setChildren(new ArrayList<ModelObject>());
                   configService.update(page);
                }
                break;
@@ -371,6 +374,8 @@
             uiPage.removeChildById(id);
             Page page = (Page)PortalDataMapper.buildModelObject(uiPage);
             UserPortalConfigService configService = uiPage.getApplicationComponent(UserPortalConfigService.class);
+            if (page.getChildren() == null)
+               page.setChildren(new ArrayList<ModelObject>());
             configService.update(page);
             pcontext.setFullRender(false);
             pcontext.setResponseComplete(true);

Modified: portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageBrowser.java
===================================================================
--- portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageBrowser.java	2009-10-22 19:40:46 UTC (rev 401)
+++ portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageBrowser.java	2009-10-22 22:02:30 UTC (rev 402)
@@ -28,7 +28,6 @@
 import org.exoplatform.portal.config.UserPortalConfigService;
 import org.exoplatform.portal.config.model.ModelObject;
 import org.exoplatform.portal.config.model.Page;
-import org.exoplatform.portal.config.model.PageData;
 import org.exoplatform.portal.config.model.PortalConfig;
 import org.exoplatform.portal.webui.application.UIPortlet;
 import org.exoplatform.portal.webui.portal.UIPortalComposer;
@@ -63,7 +62,6 @@
 import org.exoplatform.webui.form.UISearchForm;
 
 import java.util.ArrayList;
-import java.util.Collection;
 import java.util.Comparator;
 import java.util.List;
 import java.util.ResourceBundle;
@@ -256,9 +254,7 @@
             return;
          }
          Page page = service.getPage(id, pcontext.getRemoteUser());
-         UserACL userACL = uiPageBrowser.getApplicationComponent(UserACL.class);
-         boolean modifiable = userACL.hasPermission(page);
-         if (page == null || !modifiable)
+         if (page == null || !page.isModifiable())
          {
             uiPortalApp.addMessage(new ApplicationMessage("UIPageBrowser.msg.delete.NotDelete", new String[]{id}, 1));
             pcontext.addUIComponentToUpdateByAjax(uiPortalApp.getUIPopupMessages());
@@ -392,9 +388,8 @@
          UIPortalApplication uiPortalApp = uiPageForm.getAncestorOfType(UIPortalApplication.class);
          PortalRequestContext pcontext = Util.getPortalRequestContext();
          UIPage uiPage = uiPageForm.getUIPage();
-         Page page = uiPageForm.invokeSetBindingBean(new Page(new PageData()));
-         List<ModelObject> children = new ArrayList<ModelObject>(page.getChildren());
-         PageData data = page.buildData();
+         Page page = new Page();
+         uiPageForm.invokeSetBindingBean(page);
          UserPortalConfigService configService = uiPageForm.getApplicationComponent(UserPortalConfigService.class);
          // create new page
          if (uiPage == null)
@@ -407,15 +402,16 @@
                pcontext.addUIComponentToUpdateByAjax(uiPortalApp.getUIPopupMessages());
                return;
             }
-            data.setCreator(pcontext.getRemoteUser());
-            page = new Page(page, data);
-            page.getChildren().addAll(children);
+            page.setCreator(pcontext.getRemoteUser());
+            page.setModifiable(true);
+            if (page.getChildren() == null)
+               page.setChildren(new ArrayList<ModelObject>());
             configService.create(page);
             postSave(uiPortalApp, pcontext);
             return;
          }
 
-         data.setOwnerType(uiPage.getOwnerType());
+         page.setOwnerType(uiPage.getOwnerType());
          List<UIPortlet> uiPortlets = new ArrayList<UIPortlet>();
          findAllPortlet(uiPortlets, uiPage);
          ArrayList<ModelObject> applications = new ArrayList<ModelObject>();
@@ -426,16 +422,15 @@
 
          if (Page.DESKTOP_PAGE.equals(uiPage.getFactoryId()) && !Page.DESKTOP_PAGE.equals(page.getFactoryId()))
          {
-            data.setShowMaxWindow(false);
+            page.setShowMaxWindow(false);
             uiPage.getChildren().clear();
-            children.clear();
-            children.addAll(applications);
-            data.setModifier(pcontext.getRemoteUser());
+            page.setChildren(applications);
+            page.setModifier(pcontext.getRemoteUser());
             PortalDataMapper.toUIPage(uiPage, page);
             // if (page.getTemplate() == null)
             // page.setTemplate(uiPage.getTemplate());
-            page = new Page(page, data);
-            page.getChildren().addAll(children);
+            if (page.getChildren() == null)
+               page.setChildren(new ArrayList<ModelObject>());
             configService.update(page);
             postSave(uiPortalApp, pcontext);
             return;
@@ -444,20 +439,21 @@
          List<UIComponent> uiChildren = uiPage.getChildren();
          if (uiChildren == null)
             return;
-         children.clear();
+         ArrayList<ModelObject> children = new ArrayList<ModelObject>();
          for (UIComponent child : uiChildren)
          {
             ModelObject component = PortalDataMapper.buildModelObject(child);
             if (component != null)
                children.add(component);
          }
+         page.setChildren(children);
          uiPage.getChildren().clear();
 
-         data.setModifier(pcontext.getRemoteUser());
-         page = new Page(page, data);
-         page.getChildren().addAll(children);
+         page.setModifier(pcontext.getRemoteUser());
          PortalDataMapper.toUIPage(uiPage, page);
          // if (page.getTemplate() == null) page.setTemplate(uiPage.getTemplate());
+         if (page.getChildren() == null)
+            page.setChildren(new ArrayList<ModelObject>());
          if (Page.DESKTOP_PAGE.equals(uiPage.getFactoryId()))
          {
             configService.update(page);

Modified: portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageCreationWizard.java
===================================================================
--- portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageCreationWizard.java	2009-10-22 19:40:46 UTC (rev 401)
+++ portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageCreationWizard.java	2009-10-22 22:02:30 UTC (rev 402)
@@ -23,7 +23,6 @@
 import org.exoplatform.portal.config.UserACL;
 import org.exoplatform.portal.config.UserPortalConfigService;
 import org.exoplatform.portal.config.model.Page;
-import org.exoplatform.portal.config.model.PageData;
 import org.exoplatform.portal.config.model.PageNavigation;
 import org.exoplatform.portal.config.model.PageNode;
 import org.exoplatform.portal.config.model.PortalConfig;
@@ -256,17 +255,17 @@
    static public class ViewStep4ActionListener extends EventListener<UIPageCreationWizard>
    {
 
-      private void setDefaultPermission(PageData data, String ownerType, String ownerId)
+      private void setDefaultPermission(Page page, String ownerType, String ownerId)
       {
          if (PortalConfig.PORTAL_TYPE.equals(ownerType))
          {
-            data.setAccessPermissions(new String[]{"Everyone"});
-            data.setEditPermission("manager:/platform/administrators");
+            page.setAccessPermissions(new String[]{"Everyone"});
+            page.setEditPermission("manager:/platform/administrators");
          }
          else if (PortalConfig.GROUP_TYPE.equals(ownerType))
          {
-            data.setAccessPermissions(new String[]{"*:" + ownerId});
-            data.setEditPermission("manager:" + ownerId);
+            page.setAccessPermissions(new String[]{"*:" + ownerId});
+            page.setEditPermission("manager:" + ownerId);
          }
       }
 
@@ -307,9 +306,8 @@
 
          PageNode pageNode = uiPageInfo.getPageNode();
          Page page = uiPageTemplateOptions.createPageFromSelectedOption(ownerType, ownerId);
-         PageData data = page.buildData();
-         data.setCreator(context.getRemoteUser());
-         data.setName("page" + page.hashCode());
+         page.setCreator(context.getRemoteUser());
+         page.setName("page" + page.hashCode());
          String pageId = pageNavi.getOwnerType() + "::" + pageNavi.getOwnerId() + "::" + page.getName();
          DataStorage storage = uiWizard.getApplicationComponent(DataStorage.class);
          if (storage.getPage(pageId) != null)
@@ -319,16 +317,17 @@
             uiWizard.viewStep(2);
             uiWizard.updateWizardComponent();
          }
+         page.setModifiable(true);
 
          //Set default permissions on the page
-         setDefaultPermission(data, ownerType, ownerId);
+         setDefaultPermission(page, ownerType, ownerId);
 
          if (page.getTitle() == null || page.getTitle().trim().length() == 0)
-            data.setTitle(pageNode.getName());
+            page.setTitle(pageNode.getName());
 
          boolean isDesktopPage = Page.DESKTOP_PAGE.equals(page.getFactoryId());
          if (isDesktopPage)
-            data.setShowMaxWindow(true);
+            page.setShowMaxWindow(true);
 
          UIPagePreview uiPagePreview = uiWizard.getChild(UIPagePreview.class);
          UIPage uiPage;
@@ -341,7 +340,7 @@
             uiPage = uiWizard.createUIComponent(context, UIPage.class, null, null);
          }
 
-         PortalDataMapper.toUIPage(uiPage, new Page(page, data));
+         PortalDataMapper.toUIPage(uiPage, page);
          uiPagePreview.setUIComponent(uiPage);
 
          if (isDesktopPage)

Modified: portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageForm.java
===================================================================
--- portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageForm.java	2009-10-22 19:40:46 UTC (rev 401)
+++ portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageForm.java	2009-10-22 22:02:30 UTC (rev 402)
@@ -27,7 +27,6 @@
 import org.exoplatform.portal.config.UserPortalConfigService;
 import org.exoplatform.portal.config.model.ModelObject;
 import org.exoplatform.portal.config.model.Page;
-import org.exoplatform.portal.config.model.PageData;
 import org.exoplatform.portal.config.model.PortalConfig;
 import org.exoplatform.portal.webui.application.UIPortlet;
 import org.exoplatform.portal.webui.container.UIContainer;
@@ -67,7 +66,6 @@
 import org.exoplatform.webui.organization.UIListPermissionSelector.EmptyIteratorValidator;
 
 import java.util.ArrayList;
-import java.util.Collection;
 import java.util.List;
 
 @ComponentConfigs({
@@ -208,7 +206,7 @@
 
    }
 
-   public Page invokeSetBindingBean(Page bean) throws Exception
+   public void invokeSetBindingBean(Object bean) throws Exception
    {
       String ownerType = getUIFormSelectBox("ownerType").getValue();
       String ownerId = getUIStringInput("ownerId").getValue();
@@ -219,27 +217,27 @@
          ownerId = "/" + ownerId;
       }
 
-      PageData data = bean.buildData();
-      data.setPageId(getUIStringInput("pageId").getValue());
-      data.setOwnerType(ownerType);
-      data.setOwnerId(ownerId);
-      data.setName(getUIStringInput("name").getValue());
+      Page page = (Page)bean;
+      page.setPageId(getUIStringInput("pageId").getValue());
+      page.setOwnerType(ownerType);
+      page.setOwnerId(ownerId);
+      page.setName(getUIStringInput("name").getValue());
       String title = getUIStringInput("title").getValue();
       if (title == null || title.trim().length() < 1)
-         title = data.getName();
-      data.setTitle(title);
+         title = page.getName();
+      page.setTitle(title);
 
-      if (!data.isShowMaxWindow())
+      if (!page.isShowMaxWindow())
       {
-         data.setShowMaxWindow((Boolean)getUIFormCheckBoxInput("showMaxWindow").getValue());
+         page.setShowMaxWindow((Boolean)getUIFormCheckBoxInput("showMaxWindow").getValue());
       }
-      if (!PortalConfig.USER_TYPE.equals(data.getOwnerType()))
+      if (!PortalConfig.USER_TYPE.equals(page.getOwnerType()))
       {
-         data.setAccessPermissions(uiPermissionSetting.getChild(UIListPermissionSelector.class).getValue());
-         data.setEditPermission(uiPermissionSetting.getChild(UIPermissionSelector.class).getValue());
+         page.setAccessPermissions(uiPermissionSetting.getChild(UIListPermissionSelector.class).getValue());
+         page.setEditPermission(uiPermissionSetting.getChild(UIPermissionSelector.class).getValue());
       }
       UserACL userACL = getApplicationComponent(UserACL.class);
-      userACL.hasPermission(new Page(data));
+      userACL.hasPermission(page);
 
       UIFormInputItemSelector uiTemplate = getChildById("Template");
       if (uiTemplate != null)
@@ -247,39 +245,23 @@
          SelectItemOption<?> itemOption = uiTemplate.getSelectedItemOption();
          if (itemOption != null)
          {
-            data.setFactoryId(itemOption.getIcon());
+            page.setFactoryId(itemOption.getIcon());
             //        page.setTemplate((String)itemOption.getValue());
-            if (data.getFactoryId().equals(Page.DESKTOP_PAGE))
-               data.setShowMaxWindow(true);
+            if (page.getFactoryId().equals(Page.DESKTOP_PAGE))
+               page.setShowMaxWindow(true);
          }
       }
-
-      //
-      Collection<ModelObject> children = new ArrayList<ModelObject>(bean.getChildren());
-
-      //
       UIPageTemplateOptions uiConfigOptions = getChild(UIPageTemplateOptions.class);
       if (uiConfigOptions == null)
-      {
-         Page selectedPage = uiConfigOptions.createPageFromSelectedOption(data.getOwnerType(), data.getOwnerId());
-         if (selectedPage == null)
-         {
-            children.clear();
-            children.addAll(selectedPage.getChildren());
-            data.setFactoryId(selectedPage.getFactoryId());
-            if (Page.DESKTOP_PAGE.equals(data.getFactoryId()))
-               data.setShowMaxWindow(true);
-         }
-      }
+         return;
+      Page selectedPage = uiConfigOptions.createPageFromSelectedOption(page.getOwnerType(), page.getOwnerId());
+      if (selectedPage == null)
+         return;
+      page.setChildren(selectedPage.getChildren());
+      page.setFactoryId(selectedPage.getFactoryId());
+      if (Page.DESKTOP_PAGE.equals(page.getFactoryId()))
+         page.setShowMaxWindow(true);
 
-      //
-      Page newPage = new Page(bean, data);
-
-      //
-      newPage.getChildren().addAll(children);
-
-      //
-      return newPage;
    }
 
    static public class SaveActionListener extends EventListener<UIPageForm>
@@ -297,10 +279,10 @@
          UIPage uiPage = uiPageForm.getUIPage();
          if (uiPage == null)
             return;
-         PageData data = new PageData();
-         data.setPageId(uiPage.getPageId());
-         uiPageForm.invokeSetBindingBean(data);
-         data.setOwnerType(uiPage.getOwnerType());
+         Page page = new Page();
+         page.setPageId(uiPage.getPageId());
+         uiPageForm.invokeSetBindingBean(page);
+         page.setOwnerType(uiPage.getOwnerType());
          List<UIPortlet> uiPortlets = new ArrayList<UIPortlet>();
          findAllPortlet(uiPortlets, uiPage);
          ArrayList<ModelObject> applications = new ArrayList<ModelObject>();
@@ -309,16 +291,17 @@
             applications.add(PortalDataMapper.buildModelObject(uiPortlet));
          }
 
-         Page page = new Page(data);
-         if (Page.DESKTOP_PAGE.equals(uiPage.getFactoryId()) && !Page.DESKTOP_PAGE.equals(data.getFactoryId()))
+         if (Page.DESKTOP_PAGE.equals(uiPage.getFactoryId()) && !Page.DESKTOP_PAGE.equals(page.getFactoryId()))
          {
-            data.setShowMaxWindow(false);
+            page.setShowMaxWindow(false);
             uiPage.getChildren().clear();
-            page.getChildren().addAll(applications);
+            page.setChildren(applications);
 
-            data.setModifier(pcontext.getRemoteUser());
+            page.setModifier(pcontext.getRemoteUser());
             PortalDataMapper.toUIPage(uiPage, page);
             //        if(page.getTemplate() == null) page.setTemplate(uiPage.getTemplate()) ;
+            if (page.getChildren() == null)
+               page.setChildren(new ArrayList<ModelObject>());
 
             //        uiEditBar.setUIPage(uiPage);
             //        Class<?> [] childrenToRender = {UIPageEditBar.class,
@@ -332,14 +315,16 @@
             return;
          }
 
-         if (Page.DESKTOP_PAGE.equals(data.getFactoryId()))
+         if (Page.DESKTOP_PAGE.equals(page.getFactoryId()))
          {
             uiPage.getChildren().clear();
-            page.getChildren().addAll(applications);
+            page.setChildren(applications);
 
-            data.setModifier(pcontext.getRemoteUser());
+            page.setModifier(pcontext.getRemoteUser());
             PortalDataMapper.toUIPage(uiPage, page);
             //        if(page.getTemplate() == null) page.setTemplate(uiPage.getTemplate()) ;
+            if (page.getChildren() == null)
+               page.setChildren(new ArrayList<ModelObject>());
 
             UIPortalToolPanel toolPanel = Util.getUIPortalToolPanel();
             toolPanel.setShowMaskLayer(true);
@@ -364,14 +349,14 @@
             if (component != null)
                children.add(component);
          }
-         page.getChildren().addAll(children);
+         page.setChildren(children);
          uiPage.getChildren().clear();
 
-         data.setModifier(pcontext.getRemoteUser());
+         page.setModifier(pcontext.getRemoteUser());
          PortalDataMapper.toUIPage(uiPage, page);
          //      if(page.getTemplate() == null) page.setTemplate(uiPage.getTemplate()) ;
          if (page.getChildren() == null)
-            page.getChildren().clear();
+            page.setChildren(new ArrayList<ModelObject>());
       }
 
       protected void findAllPortlet(List<UIPortlet> list, UIContainer uiContainer)

Modified: portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageNodeForm2.java
===================================================================
--- portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageNodeForm2.java	2009-10-22 19:40:46 UTC (rev 401)
+++ portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageNodeForm2.java	2009-10-22 22:02:30 UTC (rev 402)
@@ -23,8 +23,8 @@
 import org.exoplatform.portal.config.DataStorage;
 import org.exoplatform.portal.config.UserACL;
 import org.exoplatform.portal.config.UserPortalConfigService;
+import org.exoplatform.portal.config.model.ModelObject;
 import org.exoplatform.portal.config.model.Page;
-import org.exoplatform.portal.config.model.PageData;
 import org.exoplatform.portal.config.model.PageNavigation;
 import org.exoplatform.portal.config.model.PageNode;
 import org.exoplatform.portal.webui.navigation.PageNavigationUtils;
@@ -380,30 +380,32 @@
 
          UIFormStringInput uiPageTitle = uiInputSet.getChildById("pageTitle");
 
-         PageData data = new PageData();
-         data.setOwnerType(uiForm.getOwnerType());
-         data.setOwnerId(ownerId);
-         data.setName(uiPageName.getValue());
-         String title = uiPageTitle.getValue();
+         Page page = new Page();
+         page.setOwnerType(uiForm.getOwnerType());
+         page.setOwnerId(ownerId);
+         page.setName(uiPageName.getValue());
+         String title = uiPageTitle.getValue();;
          if (title == null || title.trim().length() < 1)
-            title = data.getName();
-         data.setTitle(title);
+            title = page.getName();
+         page.setTitle(title);
 
-         data.setShowMaxWindow(false);
+         page.setShowMaxWindow(false);
 
-         data.setAccessPermissions(accessPermission);
-         data.setEditPermission(editPermission);
+         page.setAccessPermissions(accessPermission);
+         page.setEditPermission(editPermission);
 
-         Page page = new Page(data);
          userACL.hasPermission(page);
 
-         data.setCreator(pcontext.getRemoteUser());
+         page.setCreator(pcontext.getRemoteUser());
+         page.setModifiable(true);
+         if (page.getChildren() == null)
+            page.setChildren(new ArrayList<ModelObject>());
 
          UserPortalConfigService service = uiForm.getApplicationComponent(UserPortalConfigService.class);
 
          // check page is exist
          DataStorage dataStorage = uiForm.getApplicationComponent(DataStorage.class);
-         Page existPage = dataStorage.getPage(data.getPageId());
+         Page existPage = dataStorage.getPage(page.getPageId());
          if (existPage != null)
          {
             uiPortalApp.addMessage(new ApplicationMessage("UIPageForm.msg.sameName", null));

Modified: portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalComponentActionListener.java
===================================================================
--- portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalComponentActionListener.java	2009-10-22 19:40:46 UTC (rev 401)
+++ portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalComponentActionListener.java	2009-10-22 22:02:30 UTC (rev 402)
@@ -24,7 +24,6 @@
 import org.exoplatform.portal.config.UserACL;
 import org.exoplatform.portal.config.model.ApplicationType;
 import org.exoplatform.portal.config.model.Container;
-import org.exoplatform.portal.config.model.ContainerData;
 import org.exoplatform.portal.config.model.TransientApplicationState;
 import org.exoplatform.portal.config.model.gadget.GadgetId;
 import org.exoplatform.portal.config.model.portlet.PortletId;
@@ -224,10 +223,9 @@
                org.exoplatform.portal.webui.container.UIContainer uiContainer =
                   uiTarget.createUIComponent(org.exoplatform.portal.webui.container.UIContainer.class, null, null);
                Container container = uiContainerConfig.getContainer(sourceId);
-               ContainerData data = container.buildData();
-               data.setId(String.valueOf(container.hashCode()));
+               container.setId(String.valueOf(container.hashCode()));
                uiContainer.setStorageId(container.getStorageId());
-               PortalDataMapper.toUIContainer(uiContainer, new Container(container, data));
+               PortalDataMapper.toUIContainer(uiContainer, container);
                String[] accessPers = uiContainer.getAccessPermissions();
                for (String accessPer : accessPers)
                {

Modified: portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/util/PortalDataMapper.java
===================================================================
--- portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/util/PortalDataMapper.java	2009-10-22 19:40:46 UTC (rev 401)
+++ portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/util/PortalDataMapper.java	2009-10-22 22:02:30 UTC (rev 402)
@@ -21,20 +21,15 @@
 
 import org.exoplatform.portal.config.UserPortalConfig;
 import org.exoplatform.portal.config.model.Application;
-import org.exoplatform.portal.config.model.ApplicationData;
 import org.exoplatform.portal.config.model.ApplicationState;
 import org.exoplatform.portal.config.model.ApplicationType;
 import org.exoplatform.portal.config.model.Container;
-import org.exoplatform.portal.config.model.ContainerData;
 import org.exoplatform.portal.config.model.Dashboard;
 import org.exoplatform.portal.config.model.ModelObject;
 import org.exoplatform.portal.config.model.Page;
 import org.exoplatform.portal.config.model.PageBody;
-import org.exoplatform.portal.config.model.PageData;
-import org.exoplatform.portal.config.model.PersistentApplicationState;
 import org.exoplatform.portal.config.model.PortalConfig;
 import org.exoplatform.portal.config.model.SiteBody;
-import org.exoplatform.portal.config.model.TransientApplicationState;
 import org.exoplatform.portal.config.model.gadget.GadgetApplication;
 import org.exoplatform.portal.config.model.gadget.GadgetId;
 import org.exoplatform.portal.config.model.portlet.PortletApplication;
@@ -42,8 +37,6 @@
 import org.exoplatform.portal.config.model.wsrp.WSRPApplication;
 import org.exoplatform.portal.config.model.wsrp.WSRPId;
 import org.exoplatform.portal.pom.spi.gadget.Gadget;
-import org.exoplatform.portal.pom.spi.portlet.Preferences;
-import org.exoplatform.portal.pom.spi.wsrp.WSRPState;
 import org.exoplatform.portal.webui.application.PortletState;
 import org.exoplatform.portal.webui.application.UIGadget;
 import org.exoplatform.portal.webui.application.UIPortlet;
@@ -62,8 +55,6 @@
 import org.gatein.pc.api.info.PortletInfo;
 
 import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
 import java.util.List;
 import java.util.Set;
 
@@ -109,29 +100,29 @@
 
    private static GadgetApplication toGadget(UIGadget uiGadget)
    {
-      ApplicationData data = new ApplicationData();
-      data.setProperties(uiGadget.getProperties());
-      GadgetApplication app = new GadgetApplication(uiGadget.getStorageId(), uiGadget.getStorageName(), uiGadget.getGadgetId(), (PersistentApplicationState<Gadget>)uiGadget.getState(), data);
+      GadgetApplication app = new GadgetApplication(uiGadget.getStorageId(), uiGadget.getGadgetId());
+      app.setState(uiGadget.getState());
+      app.setProperties(uiGadget.getProperties());
+      app.setStorageName(uiGadget.getStorageName());
       return app;
    }
 
-   private static void toContainerData(UIContainer uiContainer, ContainerData data) {
-      data.setId(uiContainer.getId());
-      data.setName(uiContainer.getName());
-      data.setTitle(uiContainer.getTitle());
-      data.setIcon(uiContainer.getIcon());
-      data.setDescription(uiContainer.getDescription());
-      data.setHeight(uiContainer.getHeight());
-      data.setWidth(uiContainer.getWidth());
-      data.setTemplate(uiContainer.getTemplate());
-      data.setFactoryId(uiContainer.getFactoryId());
-      data.setAccessPermissions(uiContainer.getAccessPermissions());
-   }
+   public static void toContainer(Container model, UIContainer uiContainer)
+   {
+      model.setId(uiContainer.getId());
+      model.setName(uiContainer.getName());
+      model.setTitle(uiContainer.getTitle());
+      model.setIcon(uiContainer.getIcon());
+      model.setDescription(uiContainer.getDescription());
+      model.setHeight(uiContainer.getHeight());
+      model.setWidth(uiContainer.getWidth());
+      model.setTemplate(uiContainer.getTemplate());
+      model.setFactoryId(uiContainer.getFactoryId());
+      model.setAccessPermissions(uiContainer.getAccessPermissions());
 
-   private static Collection<ModelObject> toContainerChildren(UIContainer uiContainer) {
       List<UIComponent> uiChildren = uiContainer.getChildren();
       if (uiChildren == null)
-         return Collections.emptyList();
+         return;
       ArrayList<ModelObject> children = new ArrayList<ModelObject>();
       for (UIComponent child : uiChildren)
       {
@@ -139,85 +130,26 @@
          if (component != null)
             children.add(component);
       }
-      return children;
+      model.setChildren(children);
    }
 
-   public static Container toContainer(UIContainer uiContainer)
-   {
-      ContainerData data = new ContainerData();
-
-      //
-      toContainerData(uiContainer, data);
-
-      //
-      Container model = new Container(uiContainer.getStorageId(), data);
-
-      //
-      Collection<ModelObject> children = toContainerChildren(uiContainer);
-
-      //
-      model.getChildren().addAll(children);
-
-      //
-      return model;
-   }
-
    private static <S, I> Application<S, I> toPortletModel(UIPortlet<S, ?, I> uiPortlet)
    {
       Application<S, I> model;
       PortletState<S, I> state = uiPortlet.getState();
       ApplicationType<S, I> type = state.getApplicationType();
       I applicationId = state.getApplicationId();
-
-      //
-      ApplicationData data = new ApplicationData();
-      data.setTitle(uiPortlet.getTitle());
-      data.setWidth(uiPortlet.getWidth());
-      data.setHeight(uiPortlet.getHeight());
-      data.setDescription(uiPortlet.getDescription());
-      data.setShowInfoBar(uiPortlet.getShowInfoBar());
-      data.setShowApplicationState(uiPortlet.getShowWindowState());
-      data.setShowApplicationMode(uiPortlet.getShowPortletMode());
-      data.setDescription(uiPortlet.getDescription());
-      data.setIcon(uiPortlet.getIcon());
-      data.setProperties(uiPortlet.getProperties());
-      data.setTheme(uiPortlet.getTheme());
-      data.setAccessPermissions(uiPortlet.getAccessPermissions());
-      data.setModifiable(uiPortlet.isModifiable());
-
-      //
       if (type == ApplicationType.PORTLET)
       {
-         if (uiPortlet.getStorageId() != null)
-         {
-            model = (Application<S, I>)new PortletApplication(uiPortlet.getStorageId(), uiPortlet.getStorageName(), (PortletId)applicationId, (PersistentApplicationState<Preferences>)state.getApplicationState(), data);
-         }
-         else
-         {
-            model = (Application<S, I>)new PortletApplication(uiPortlet.getStorageName(), (PortletId)applicationId, (TransientApplicationState<Preferences>)state.getApplicationState(), data);
-         }
+         model = (Application<S, I>)new PortletApplication(uiPortlet.getStorageId(), (PortletId)applicationId);
       }
       else if (type == ApplicationType.GADGET)
       {
-         if (uiPortlet.getStorageId() != null)
-         {
-            model = (Application<S, I>)new GadgetApplication(uiPortlet.getStorageId(), uiPortlet.getStorageName(), (GadgetId)applicationId, (PersistentApplicationState<Gadget>)state.getApplicationState(), data);
-         }
-         else
-         {
-            model = (Application<S, I>)new GadgetApplication(uiPortlet.getStorageName(), (GadgetId)applicationId, (TransientApplicationState<Gadget>)state.getApplicationState(), data);
-         }
+         model = (Application<S, I>)new GadgetApplication(uiPortlet.getStorageId(), (GadgetId)applicationId);
       }
       else if (type == ApplicationType.WSRP_PORTLET)
       {
-         if (uiPortlet.getStorageId() != null)
-         {
-            model = (Application<S, I>)new WSRPApplication(uiPortlet.getStorageId(), uiPortlet.getStorageName(), (WSRPId)applicationId, (PersistentApplicationState<WSRPState>)state.getApplicationState(), data);
-         }
-         else
-         {
-            model = (Application<S, I>)new WSRPApplication(uiPortlet.getStorageName(), (WSRPId)applicationId, (TransientApplicationState<WSRPState>)state.getApplicationState(), data);
-         }
+         model = (Application<S, I>)new WSRPApplication(uiPortlet.getStorageId(), (WSRPId)applicationId);
       }
       else
       {
@@ -225,36 +157,47 @@
       }
 
       //
+      model.setStorageName(uiPortlet.getStorageName());
+      model.setState(state.getApplicationState());
+      model.setTitle(uiPortlet.getTitle());
+      model.setWidth(uiPortlet.getWidth());
+      model.setHeight(uiPortlet.getHeight());
+      model.setDescription(uiPortlet.getDescription());
+      model.setShowInfoBar(uiPortlet.getShowInfoBar());
+      model.setShowApplicationState(uiPortlet.getShowWindowState());
+      model.setShowApplicationMode(uiPortlet.getShowPortletMode());
+      model.setDescription(uiPortlet.getDescription());
+      model.setIcon(uiPortlet.getIcon());
+      model.setProperties(uiPortlet.getProperties());
+      model.setTheme(uiPortlet.getTheme());
+      model.setAccessPermissions(uiPortlet.getAccessPermissions());
+      model.setModifiable(uiPortlet.isModifiable());
       return model;
    }
 
-   static private Page toPageModel(UIPage uiPage)
+   private static Container toContainer(UIContainer uiContainer)
    {
-      PageData data = new PageData();
-      data.setCreator(uiPage.getCreator());
-      data.setModifier(uiPage.getModifier());
-      data.setOwnerId(uiPage.getOwnerId());
-      data.setOwnerType(uiPage.getOwnerType());
-      data.setIcon(uiPage.getIcon());
-      data.setTitle(uiPage.getTitle());
-      data.setAccessPermissions(uiPage.getAccessPermissions());
-      data.setEditPermission(uiPage.getEditPermission());
-      data.setFactoryId(uiPage.getFactoryId());
-      data.setShowMaxWindow(uiPage.isShowMaxWindow());
+      Container model = new Container(uiContainer.getStorageId());
+      toContainer(model, uiContainer);
+      return model;
+   }
 
-      //
-      toContainerData(uiPage, data);
-
-      //
-      Page model = new Page(uiPage.getStorageId(), data);
-
-      //
-      Collection<ModelObject> children = toContainerChildren(uiPage);
-
-      //
-      model.getChildren().addAll(children);
-
-      //
+   static private Page toPageModel(UIPage uiPage)
+   {
+      Page model = new Page(uiPage.getStorageId());
+      toContainer(model, uiPage);
+      model.setCreator(uiPage.getCreator());
+      model.setModifier(uiPage.getModifier());
+      model.setOwnerId(uiPage.getOwnerId());
+      model.setOwnerType(uiPage.getOwnerType());
+      model.setIcon(uiPage.getIcon());
+      model.setPageId(uiPage.getPageId());
+      model.setTitle(uiPage.getTitle());
+      model.setAccessPermissions(uiPage.getAccessPermissions());
+      model.setEditPermission(uiPage.getEditPermission());
+      model.setFactoryId(uiPage.getFactoryId());
+      model.setShowMaxWindow(uiPage.isShowMaxWindow());
+      model.setModifiable(uiPage.isModifiable());
       return model;
    }
 
@@ -271,7 +214,7 @@
       model.setModifiable(uiPortal.isModifiable());
       model.setProperties(uiPortal.getProperties());
 
-      model.setPortalLayout(new Container(new ContainerData()));
+      model.setPortalLayout(new Container());
 
       List<UIComponent> children = uiPortal.getChildren();
       if (children == null)
@@ -283,7 +226,7 @@
          if (component != null)
             newChildren.add(component);
       }
-      model.getPortalLayout().getChildren().addAll(newChildren);
+      model.getPortalLayout().setChildren(newChildren);
       return model;
    }
 
@@ -396,6 +339,7 @@
       uiPage.setPageId(model.getPageId());
       uiPage.setTitle(model.getTitle());
       uiPage.setShowMaxWindow(model.isShowMaxWindow());
+      uiPage.setModifiable(model.isModifiable());
 
       List<UIPortlet> portlets = new ArrayList<UIPortlet>();
       uiPage.findComponentOfType(portlets, UIPortlet.class);



More information about the gatein-commits mailing list