001
014
015 package com.liferay.portal.upgrade.v4_3_0.util;
016
017 import com.liferay.portal.kernel.upgrade.util.BaseUpgradeColumnImpl;
018 import com.liferay.portal.kernel.upgrade.util.UpgradeColumn;
019 import com.liferay.portal.kernel.util.StringUtil;
020
021
024 public class JournalTemplateXSLUpgradeColumnImpl extends BaseUpgradeColumnImpl {
025
026 public JournalTemplateXSLUpgradeColumnImpl(UpgradeColumn templateIdColumn) {
027 super("xsl");
028
029 _templateIdColumn = templateIdColumn;
030 }
031
032 public Object getNewValue(Object oldValue) throws Exception {
033 String xsl = (String)oldValue;
034
035 return formatXSL(xsl);
036 }
037
038 protected String formatXSL(String xsl) throws Exception {
039
043
044 String templateId = (String)_templateIdColumn.getOldValue();
045
046 if (templateId.equals("BASIC-BANNER")) {
047
048
049
050 xsl = StringUtil.replace(
051 xsl,
052 "background-repeat: no-repeat; width: 520; height: 175;",
053 "background-repeat: no-repeat; width: 520px; height: 175px;");
054 }
055
056 return xsl;
057 }
058
059 private UpgradeColumn _templateIdColumn;
060
061 }