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