001
014
015 package com.liferay.portal.upgrade.v6_2_0;
016
017 import com.liferay.portal.kernel.upgrade.BaseUpgradePortletPreferences;
018 import com.liferay.portal.kernel.util.GetterUtil;
019 import com.liferay.portal.kernel.util.Validator;
020 import com.liferay.portlet.PortletPreferencesFactoryUtil;
021 import com.liferay.util.RSSUtil;
022
023 import javax.portlet.PortletPreferences;
024
025
028 public class UpgradeAssetPublisher extends BaseUpgradePortletPreferences {
029
030 @Override
031 protected String[] getPortletIds() {
032 return new String[] {"101_INSTANCE_%"};
033 }
034
035 @Override
036 protected String upgradePreferences(
037 long companyId, long ownerId, int ownerType, long plid,
038 String portletId, String xml)
039 throws Exception {
040
041 PortletPreferences portletPreferences =
042 PortletPreferencesFactoryUtil.fromXML(
043 companyId, ownerId, ownerType, plid, portletId, xml);
044
045 String rssFormat = GetterUtil.getString(
046 portletPreferences.getValue("rssFormat", null));
047
048 if (Validator.isNotNull(rssFormat)) {
049 String rssFeedType = RSSUtil.getFeedType(
050 RSSUtil.getFormatType(rssFormat),
051 RSSUtil.getFormatVersion(rssFormat));
052
053 portletPreferences.setValue("rssFeedType", rssFeedType);
054 }
055
056 portletPreferences.reset("rssFormat");
057
058 return PortletPreferencesFactoryUtil.toXML(portletPreferences);
059 }
060
061 }