001
014
015 package com.liferay.portal.upgrade.v6_0_3;
016
017 import com.liferay.portal.kernel.util.GetterUtil;
018 import com.liferay.portal.kernel.util.StringPool;
019 import com.liferay.portal.upgrade.BaseUpgradePortletPreferences;
020 import com.liferay.portlet.PortletPreferencesImpl;
021 import com.liferay.portlet.PortletPreferencesSerializer;
022
023
026 public class UpgradeSitemap extends BaseUpgradePortletPreferences {
027
028 protected String getUpdatePortletPreferencesWhereClause() {
029 return "portletId like '85_%'";
030 }
031
032 protected String upgradePreferences(
033 long companyId, long ownerId, int ownerType, long plid,
034 String portletId, String xml)
035 throws Exception {
036
037 PortletPreferencesImpl preferences =
038 PortletPreferencesSerializer.fromXML(
039 companyId, ownerId, ownerType, plid, portletId, xml);
040
041 long rootLayoutId = GetterUtil.getLong(
042 preferences.getValue("root-layout-id", StringPool.BLANK));
043
044 if (rootLayoutId > 0) {
045 String uuid = getLayoutUuid(plid, rootLayoutId);
046
047 if (uuid != null) {
048 preferences.setValue("root-layout-uuid", uuid);
049 }
050
051 preferences.reset("root-layout-id");
052 }
053
054 return PortletPreferencesSerializer.toXML(preferences);
055 }
056
057 }