Author: theute
Date: 2011-10-04 02:49:53 -0400 (Tue, 04 Oct 2011)
New Revision: 7638
Added:
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/org/exoplatform/portal/config/site1-conf/group/
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/org/exoplatform/portal/config/site1-conf/group/platform/
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/org/exoplatform/portal/config/site1-conf/group/platform/administrators/
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/org/exoplatform/portal/config/site1-conf/group/platform/administrators/group.xml
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/org/exoplatform/portal/config/site2-conf/group/
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/org/exoplatform/portal/config/site2-conf/group/platform/
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/org/exoplatform/portal/config/site2-conf/group/platform/administrators/
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/org/exoplatform/portal/config/site2-conf/group/platform/administrators/pages.xml
Removed:
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/org/exoplatform/portal/config/site1-conf/group/platform/
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/org/exoplatform/portal/config/site1-conf/group/platform/administrators/
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/org/exoplatform/portal/config/site1-conf/group/platform/administrators/group.xml
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/org/exoplatform/portal/config/site2-conf/group/platform/
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/org/exoplatform/portal/config/site2-conf/group/platform/administrators/
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/org/exoplatform/portal/config/site2-conf/group/platform/administrators/pages.xml
Modified:
epp/portal/branches/EPP_5_2_Branch/component/portal/
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/NewPortalConfigListener.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/AbstractSiteDataImportTest.java
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/org/exoplatform/portal/config/TestImport1-configuration.xml
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/org/exoplatform/portal/config/TestImport2-configuration.xml
Log:
JBEPP-1203 [Data Import] It does not work properly with PortalConfig in extension
Property changes on: epp/portal/branches/EPP_5_2_Branch/component/portal
___________________________________________________________________
Modified: svn:mergeinfo
- /portal/trunk:7451
/portal/trunk/component/portal:7451
+ /portal/trunk:7451
/portal/trunk/component/portal:7451,7500
Modified:
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/NewPortalConfigListener.java
===================================================================
---
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/NewPortalConfigListener.java 2011-10-04
03:03:58 UTC (rev 7637)
+++
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/NewPortalConfigListener.java 2011-10-04
06:49:53 UTC (rev 7638)
@@ -495,16 +495,25 @@
String type = config.getOwnerType();
UnmarshalledObject<PortalConfig> obj = getConfig(config, owner, type,
PortalConfig.class);
- ImportMode importMode = getRightMode(config.getImportMode());
-
- PortalConfig pConfig = (obj != null) ? obj.getObject() : null;
- if (pConfig == null)
+ PortalConfig pConfig;
+ if (obj == null)
{
- pConfig = new PortalConfig(type);
- pConfig.setPortalLayout(new Container());
- pConfig.setName(owner);
+ if (dataStorage_.getPortalConfig(type, owner) != null)
+ {
+ return true;
+ }
+ else
+ {
+ pConfig = new PortalConfig(type, owner);
+ }
}
+ else
+ {
+ pConfig = obj.getObject();
+ }
+ ImportMode importMode = getRightMode(config.getImportMode());
+
PortalConfigImporter portalImporter = new PortalConfigImporter(importMode, pConfig,
dataStorage_);
try
{
Modified:
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/AbstractSiteDataImportTest.java
===================================================================
---
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/AbstractSiteDataImportTest.java 2011-10-04
03:03:58 UTC (rev 7637)
+++
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/java/org/exoplatform/portal/config/AbstractSiteDataImportTest.java 2011-10-04
06:49:53 UTC (rev 7638)
@@ -6,6 +6,7 @@
import org.exoplatform.portal.config.model.Container;
import org.exoplatform.portal.config.model.Page;
import org.exoplatform.portal.config.model.PortalConfig;
+import org.exoplatform.portal.mop.SiteType;
import org.exoplatform.portal.mop.importer.Imported;
import org.exoplatform.portal.pom.config.POMSessionManager;
import org.exoplatform.portal.pom.spi.portlet.Portlet;
@@ -39,7 +40,7 @@
Workspace workspace = mgr.getSession().getWorkspace();
assertTrue(workspace.isAdapted(Imported.class));
- //
+ // Test portal
DataStorage dataStorage =
(DataStorage)container.getComponentInstanceOfType(DataStorage.class);
PortalConfig portal = dataStorage.getPortalConfig("classic");
Container layout = portal.getPortalLayout();
@@ -47,19 +48,30 @@
Application<Portlet> layoutPortlet =
(Application<Portlet>)layout.getChildren().get(0);
assertEquals("site2/layout",
dataStorage.getId(layoutPortlet.getState()));
- //
- Page home = dataStorage.getPage("portal::classic::home");
- assertNotNull(home);
- assertEquals("site 1", home.getTitle());
+ Page page = dataStorage.getPage("portal::classic::home");
+ assertNotNull(page);
+ assertEquals("site 1", page.getTitle());
+
+ page = dataStorage.getPage("portal::classic::page1");
+ assertNotNull(page);
+ assertEquals("site 2", page.getTitle());
+
+ page = dataStorage.getPage("portal::classic::page2");
+ assertNotNull(page);
+ assertEquals("site 2", page.getTitle());
- Page page1 = dataStorage.getPage("portal::classic::page1");
- assertNotNull(page1);
- assertEquals("site 2", page1.getTitle());
+ // Test group
+ portal = dataStorage.getPortalConfig(SiteType.GROUP.getName(),
"/platform/administrators");
+ layout = portal.getPortalLayout();
+ assertEquals(1, layout.getChildren().size());
+ layoutPortlet = (Application<Portlet>)layout.getChildren().get(0);
+ assertEquals("site1/layout",
dataStorage.getId(layoutPortlet.getState()));
- Page page2 = dataStorage.getPage("portal::classic::page2");
- assertNotNull(page2);
- assertEquals("site 2", page2.getTitle());
+ page = dataStorage.getPage("group::/platform/administrators::page1");
+ assertNotNull(page);
+ assertEquals("site 2", page.getTitle());
+ // Test user
Page dashboard1 = dataStorage.getPage("user::root::dashboard1");
assertNotNull(dashboard1);
assertEquals("site 2", dashboard1.getTitle());
@@ -76,7 +88,7 @@
Workspace workspace = mgr.getSession().getWorkspace();
assertTrue(workspace.isAdapted(Imported.class));
- //
+ // Test portal
DataStorage dataStorage =
(DataStorage)container.getComponentInstanceOfType(DataStorage.class);
PortalConfig portal = dataStorage.getPortalConfig("classic");
Container layout = portal.getPortalLayout();
@@ -84,18 +96,28 @@
Application<Portlet> layoutPortlet =
(Application<Portlet>)layout.getChildren().get(0);
assertEquals("site1/layout",
dataStorage.getId(layoutPortlet.getState()));
- //
- Page home = dataStorage.getPage("portal::classic::home");
- assertNotNull(home);
- assertEquals("site 1", home.getTitle());
+ Page page = dataStorage.getPage("portal::classic::home");
+ assertNotNull(page);
+ assertEquals("site 1", page.getTitle());
+
+ page = dataStorage.getPage("portal::classic::page1");
+ assertNotNull(page);
+ assertEquals("site 1", page.getTitle());
+
+ page = dataStorage.getPage("portal::classic::page2");
+ assertNull(page);
- Page page1 = dataStorage.getPage("portal::classic::page1");
- assertNotNull(page1);
- assertEquals("site 1", page1.getTitle());
+ // Test group
+ portal = dataStorage.getPortalConfig(SiteType.GROUP.getName(),
"/platform/administrators");
+ layout = portal.getPortalLayout();
+ assertEquals(1, layout.getChildren().size());
+ layoutPortlet = (Application<Portlet>)layout.getChildren().get(0);
+ assertEquals("site1/layout",
dataStorage.getId(layoutPortlet.getState()));
- Page page2 = dataStorage.getPage("portal::classic::page2");
- assertNull(page2);
+ page = dataStorage.getPage("group::/platform/administrators::page1");
+ assertNull(page);
+ // Test user
Page dashboard1 = dataStorage.getPage("user::root::dashboard1");
assertNull(dashboard1);
Modified:
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/org/exoplatform/portal/config/TestImport1-configuration.xml
===================================================================
---
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/org/exoplatform/portal/config/TestImport1-configuration.xml 2011-10-04
03:03:58 UTC (rev 7637)
+++
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/org/exoplatform/portal/config/TestImport1-configuration.xml 2011-10-04
06:49:53 UTC (rev 7638)
@@ -59,6 +59,28 @@
</object>
</object-param>
<object-param>
+ <name>group.configuration</name>
+ <description>description</description>
+ <object
type="org.exoplatform.portal.config.NewPortalConfig">
+ <field name="predefinedOwner">
+ <collection type="java.util.HashSet">
+ <value>
+ <string>/platform/administrators</string>
+ </value>
+ </collection>
+ </field>
+ <field name="ownerType">
+ <string>group</string>
+ </field>
+ <field name="templateLocation">
+
<string>classpath:/org/exoplatform/portal/config/${import.portal.1}-conf</string>
+ </field>
+ <field name="importMode">
+ <string>${import.mode.1}</string>
+ </field>
+ </object>
+ </object-param>
+ <object-param>
<name>user.configuration</name>
<description>description</description>
<object
type="org.exoplatform.portal.config.NewPortalConfig">
Modified:
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/org/exoplatform/portal/config/TestImport2-configuration.xml
===================================================================
---
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/org/exoplatform/portal/config/TestImport2-configuration.xml 2011-10-04
03:03:58 UTC (rev 7637)
+++
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/org/exoplatform/portal/config/TestImport2-configuration.xml 2011-10-04
06:49:53 UTC (rev 7638)
@@ -18,9 +18,8 @@
~ 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
-->
-<configuration
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-
xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_2.xsd
http://www.exoplaform.org/xml/ns/kernel_1_2.xsd"
-
xmlns="http://www.exoplaform.org/xml/ns/kernel_1_2.xsd">
+<configuration
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_2.xsd
http://www.exoplaform.org/xml/ns/kernel_1_2.xsd"
+
xmlns="http://www.exoplaform.org/xml/ns/kernel_1_2.xsd">
<external-component-plugins>
<target-component>org.exoplatform.portal.config.UserPortalConfigService</target-component>
@@ -60,6 +59,28 @@
</object>
</object-param>
<object-param>
+ <name>group.configuration</name>
+ <description>description</description>
+ <object
type="org.exoplatform.portal.config.NewPortalConfig">
+ <field name="predefinedOwner">
+ <collection type="java.util.HashSet">
+ <value>
+ <string>/platform/administrators</string>
+ </value>
+ </collection>
+ </field>
+ <field name="ownerType">
+ <string>group</string>
+ </field>
+ <field name="templateLocation">
+
<string>classpath:/org/exoplatform/portal/config/${import.portal_2}-conf</string>
+ </field>
+ <field name="importMode">
+ <string>${import.mode_2}</string>
+ </field>
+ </object>
+ </object-param>
+ <object-param>
<name>user.configuration</name>
<description>description</description>
<object
type="org.exoplatform.portal.config.NewPortalConfig">
Deleted:
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/org/exoplatform/portal/config/site1-conf/group/platform/administrators/group.xml
===================================================================
---
portal/trunk/component/portal/src/test/resources/org/exoplatform/portal/config/site1-conf/group/platform/administrators/group.xml 2011-09-23
11:44:57 UTC (rev 7500)
+++
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/org/exoplatform/portal/config/site1-conf/group/platform/administrators/group.xml 2011-10-04
06:49:53 UTC (rev 7638)
@@ -1,41 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!--
-
- Copyright (C) 2011 eXo Platform SAS.
-
- This is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of
- the License, or (at your option) any later version.
-
- This software is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this software; if not, write to the Free
- Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
-
--->
-
-<portal-config
-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-
xsi:schemaLocation="http://www.gatein.org/xml/ns/gatein_objects_1_2
http://www.gatein.org/xml/ns/gatein_objects_1_2"
-
xmlns="http://www.gatein.org/xml/ns/gatein_objects_1_2">
- <portal-name>exo</portal-name>
- <locale>en</locale>
- <access-permissions>Everyone</access-permissions>
- <edit-permission>*:/exo</edit-permission>
- <portal-layout>
- <portlet-application>
- <portlet>
- <application-ref>site1</application-ref>
- <portlet-ref>layout</portlet-ref>
- </portlet>
- <access-permissions>Everyone</access-permissions>
- <show-info-bar>true</show-info-bar>
- </portlet-application>
- </portal-layout>
-</portal-config>
Copied:
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/org/exoplatform/portal/config/site1-conf/group/platform/administrators/group.xml
(from rev 7500,
portal/trunk/component/portal/src/test/resources/org/exoplatform/portal/config/site1-conf/group/platform/administrators/group.xml)
===================================================================
---
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/org/exoplatform/portal/config/site1-conf/group/platform/administrators/group.xml
(rev 0)
+++
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/org/exoplatform/portal/config/site1-conf/group/platform/administrators/group.xml 2011-10-04
06:49:53 UTC (rev 7638)
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+
+ Copyright (C) 2011 eXo Platform SAS.
+
+ This is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of
+ the License, or (at your option) any later version.
+
+ This software is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this software; if not, write to the Free
+ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+
+-->
+
+<portal-config
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://www.gatein.org/xml/ns/gatein_objects_1_2
http://www.gatein.org/xml/ns/gatein_objects_1_2"
+
xmlns="http://www.gatein.org/xml/ns/gatein_objects_1_2">
+ <portal-name>exo</portal-name>
+ <locale>en</locale>
+ <access-permissions>Everyone</access-permissions>
+ <edit-permission>*:/exo</edit-permission>
+ <portal-layout>
+ <portlet-application>
+ <portlet>
+ <application-ref>site1</application-ref>
+ <portlet-ref>layout</portlet-ref>
+ </portlet>
+ <access-permissions>Everyone</access-permissions>
+ <show-info-bar>true</show-info-bar>
+ </portlet-application>
+ </portal-layout>
+</portal-config>
Deleted:
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/org/exoplatform/portal/config/site2-conf/group/platform/administrators/pages.xml
===================================================================
---
portal/trunk/component/portal/src/test/resources/org/exoplatform/portal/config/site2-conf/group/platform/administrators/pages.xml 2011-09-23
11:44:57 UTC (rev 7500)
+++
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/org/exoplatform/portal/config/site2-conf/group/platform/administrators/pages.xml 2011-10-04
06:49:53 UTC (rev 7638)
@@ -1,40 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!--
-
- Copyright (C) 2009 eXo Platform SAS.
-
- This is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of
- the License, or (at your option) any later version.
-
- This software is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this software; if not, write to the Free
- Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
-
--->
-
-<page-set
-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-
xsi:schemaLocation="http://www.gatein.org/xml/ns/gatein_objects_1_2
http://www.gatein.org/xml/ns/gatein_objects_1_2"
-
xmlns="http://www.gatein.org/xml/ns/gatein_objects_1_2">
-
- <page>
- <name>page1</name>
- <title>site 2</title>
- <portlet-application>
- <portlet>
- <application-ref>site2</application-ref>
- <portlet-ref>page1</portlet-ref>
- </portlet>
- <access-permissions>Everyone</access-permissions>
- <show-info-bar>true</show-info-bar>
- </portlet-application>
- </page>
-</page-set>
Copied:
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/org/exoplatform/portal/config/site2-conf/group/platform/administrators/pages.xml
(from rev 7500,
portal/trunk/component/portal/src/test/resources/org/exoplatform/portal/config/site2-conf/group/platform/administrators/pages.xml)
===================================================================
---
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/org/exoplatform/portal/config/site2-conf/group/platform/administrators/pages.xml
(rev 0)
+++
epp/portal/branches/EPP_5_2_Branch/component/portal/src/test/resources/org/exoplatform/portal/config/site2-conf/group/platform/administrators/pages.xml 2011-10-04
06:49:53 UTC (rev 7638)
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+
+ Copyright (C) 2009 eXo Platform SAS.
+
+ This is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of
+ the License, or (at your option) any later version.
+
+ This software is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this software; if not, write to the Free
+ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+
+-->
+
+<page-set
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://www.gatein.org/xml/ns/gatein_objects_1_2
http://www.gatein.org/xml/ns/gatein_objects_1_2"
+
xmlns="http://www.gatein.org/xml/ns/gatein_objects_1_2">
+
+ <page>
+ <name>page1</name>
+ <title>site 2</title>
+ <portlet-application>
+ <portlet>
+ <application-ref>site2</application-ref>
+ <portlet-ref>page1</portlet-ref>
+ </portlet>
+ <access-permissions>Everyone</access-permissions>
+ <show-info-bar>true</show-info-bar>
+ </portlet-application>
+ </page>
+</page-set>