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