001
014
015 package com.liferay.portal.upgrade.v5_2_0;
016
017 import com.liferay.portal.kernel.upgrade.BaseUpgradePortletPreferences;
018 import com.liferay.portal.kernel.util.StringPool;
019 import com.liferay.portal.kernel.util.StringUtil;
020 import com.liferay.portal.kernel.util.Validator;
021 import com.liferay.portlet.PortletPreferencesFactoryUtil;
022
023 import javax.portlet.PortletPreferences;
024
025
030 public class UpgradeDocumentLibrary extends BaseUpgradePortletPreferences {
031
032 @Override
033 protected String[] getPortletIds() {
034 return new String[] {"20"};
035 }
036
037 @Override
038 protected String upgradePreferences(
039 long companyId, long ownerId, int ownerType, long plid,
040 String portletId, String xml)
041 throws Exception {
042
043 PortletPreferences portletPreferences =
044 PortletPreferencesFactoryUtil.fromXML(
045 companyId, ownerId, ownerType, plid, portletId, xml);
046
047 String fileEntryColumns = portletPreferences.getValue(
048 "fileEntryColumns", StringPool.BLANK);
049
050 if (Validator.isNotNull(fileEntryColumns)) {
051 fileEntryColumns = StringUtil.replace(
052 fileEntryColumns, "document", "name");
053
054 portletPreferences.setValue("fileEntryColumns", fileEntryColumns);
055 }
056
057 return PortletPreferencesFactoryUtil.toXML(portletPreferences);
058 }
059
060 }