Author: theute
Date: 2011-07-18 14:32:56 -0400 (Mon, 18 Jul 2011)
New Revision: 6882
Modified:
epp/portal/branches/EPP_5_2_Branch/
epp/portal/branches/EPP_5_2_Branch/component/
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/web/portal/src/main/webapp/WEB-INF/conf/portal/portal-configuration.xml
Log:
JBEPP-1011
Option to override portal metadata at startup
Property changes on: epp/portal/branches/EPP_5_2_Branch
___________________________________________________________________
Modified: svn:mergeinfo
- /epp/portal/branches/EPP_5_1_0_GA_JBEPP-795:5868
/portal/branches/branch-GTNPORTAL-1592:4894
/portal/branches/branch-GTNPORTAL-1643:5002,5063,5167
/portal/branches/branch-GTNPORTAL-1700:5348,5363,5402,5445
/portal/branches/branch-GTNPORTAL-1731:5668
/portal/branches/branch-GTNPORTAL-1745:5765
/portal/branches/branch-GTNPORTAL-1822:5943
/portal/branches/branch-GTNPORTAL-1832:6030,6063
/portal/branches/branch-GTNPORTAL-1872:6400
/portal/branches/global-portlet-metadata:6298-6384
/portal/branches/site-describability:6171-6235
/portal/trunk:4891,5744,5822,5943,6168,6196,6201-6203,6205-6206,6437,6440,6452,6573
+ /epp/portal/branches/EPP_5_1_0_GA_JBEPP-795:5868
/portal/branches/branch-GTNPORTAL-1592:4894
/portal/branches/branch-GTNPORTAL-1643:5002,5063,5167
/portal/branches/branch-GTNPORTAL-1700:5348,5363,5402,5445
/portal/branches/branch-GTNPORTAL-1731:5668
/portal/branches/branch-GTNPORTAL-1745:5765
/portal/branches/branch-GTNPORTAL-1822:5943,5952
/portal/branches/branch-GTNPORTAL-1832:6030,6063
/portal/branches/branch-GTNPORTAL-1872:6400
/portal/branches/global-portlet-metadata:6298-6384
/portal/branches/site-describability:6171-6235
/portal/trunk:4891,5744,5822,5943,6168,6196,6201-6203,6205-6206,6437,6440,6452,6573
Property changes on: epp/portal/branches/EPP_5_2_Branch/component
___________________________________________________________________
Modified: svn:mergeinfo
- /epp/portal/branches/EPP_5_1_0_GA_JBEPP-795/component:5868
/portal/branches/branch-GTNPORTAL-1592/component:4894
/portal/branches/branch-GTNPORTAL-1643/component:5002,5063,5167
/portal/branches/branch-GTNPORTAL-1700/component:5348,5363,5402,5445
/portal/branches/branch-GTNPORTAL-1731/component:5668
/portal/branches/branch-GTNPORTAL-1745/component:5765
/portal/branches/branch-GTNPORTAL-1822/component:5943
/portal/branches/branch-GTNPORTAL-1832/component:6030,6063
/portal/branches/branch-GTNPORTAL-1872/component:6400
/portal/trunk/component:4891,5744,5822,5943,6031,6033,6168,6196,6201-6203,6205-6206,6437,6440,6452,6573
+ /epp/portal/branches/EPP_5_1_0_GA_JBEPP-795/component:5868
/portal/branches/branch-GTNPORTAL-1592/component:4894
/portal/branches/branch-GTNPORTAL-1643/component:5002,5063,5167
/portal/branches/branch-GTNPORTAL-1700/component:5348,5363,5402,5445
/portal/branches/branch-GTNPORTAL-1731/component:5668
/portal/branches/branch-GTNPORTAL-1745/component:5765
/portal/branches/branch-GTNPORTAL-1822/component:5943,5952
/portal/branches/branch-GTNPORTAL-1832/component:6030,6063
/portal/branches/branch-GTNPORTAL-1872/component:6400
/portal/trunk/component:4891,5744,5822,5943,6031,6033,6168,6196,6201-6203,6205-6206,6437,6440,6452,6573
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-07-18
14:10:08 UTC (rev 6881)
+++
epp/portal/branches/EPP_5_2_Branch/component/portal/src/main/java/org/exoplatform/portal/config/NewPortalConfigListener.java 2011-07-18
18:32:56 UTC (rev 6882)
@@ -83,6 +83,12 @@
/** . */
private boolean isUseTryCatch;
+ /**
+ * If true the portal clear portal metadata from data storage and replace
+ * it with new data created from .xml files
+ */
+ private boolean overrideExistingData;
+
/** . */
private Logger log = LoggerFactory.getLogger(getClass());
@@ -127,6 +133,16 @@
isUseTryCatch = true;
}
+ valueParam = params.getValueParam("override");
+ if(valueParam != null)
+ {
+ overrideExistingData = "true".equals(valueParam.getValue());
+ }
+ else
+ {
+ overrideExistingData = false;
+ }
+
}
public void run() throws Exception
@@ -134,7 +150,9 @@
RequestLifeCycle.begin(PortalContainer.getInstance());
try
{
- if (dataStorage_.getPortalConfig(defaultPortal) != null)
+ //DANGEROUS! If the user delete the defaultPortal (ie: classic), the next time
he restarts
+ //the server. Data of predefined owners would be overriden
+ if (dataStorage_.getPortalConfig(defaultPortal) != null &&
!overrideExistingData)
return;
}
finally
@@ -320,6 +338,10 @@
result.addAll(other.templateConfigs);
this.templateConfigs = Collections.unmodifiableList(result);
}
+
+ //The override is true if and only if one of the plugin NewPortalConfigListener
configures its
+ //override param as true
+ overrideExistingData = overrideExistingData || other.overrideExistingData;
}
public void initPortalConfigDB(NewPortalConfig config) throws Exception
@@ -436,8 +458,16 @@
}
else
{
- navigation.merge(currentNavigation);
- dataStorage_.save(navigation);
+ if(overrideExistingData)
+ {
+ dataStorage_.remove(currentNavigation);
+ dataStorage_.create(navigation);
+ }
+ else
+ {
+ navigation.merge(currentNavigation);
+ dataStorage_.save(navigation);
+ }
}
}
Modified:
epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/conf/portal/portal-configuration.xml
===================================================================
---
epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/conf/portal/portal-configuration.xml 2011-07-18
14:10:08 UTC (rev 6881)
+++
epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/WEB-INF/conf/portal/portal-configuration.xml 2011-07-18
18:32:56 UTC (rev 6882)
@@ -113,6 +113,11 @@
<description>the path to the location that contains Page
templates</description>
<value>war:/conf/portal/template/pages</value>
</value-param>
+ <value-param>
+ <name>override</name>
+ <description>The flag parameter to decide if portal metadata is
overriden on restarting server</description>
+ <value>false</value>
+ </value-param>
<object-param>
<name>site.templates.location</name>
<description>description</description>