001    /**
002     * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portal.upgrade.v7_0_0;
016    
017    import com.liferay.portal.kernel.upgrade.BaseUpgradeLastPublishDate;
018    import com.liferay.portal.kernel.util.LoggingTimer;
019    
020    /**
021     * @author Levente Hud??k
022     */
023    public class UpgradeLastPublishDate extends BaseUpgradeLastPublishDate {
024    
025            @Override
026            protected void doUpgrade() throws Exception {
027                    upgradeAssetCategoriesAdmin();
028                    upgradeBlogs();
029                    upgradeDocumentLibrary();
030                    upgradeLayoutsAdmin();
031                    upgradeMessageBoards();
032                    upgradeMobileDeviceRules();
033                    upgradeSiteAdmin();
034                    upgradeWebSite();
035            }
036    
037            protected void upgradeAssetCategoriesAdmin() throws Exception {
038                    try (LoggingTimer loggingTimer = new LoggingTimer()) {
039                            addLastPublishDateColumn("AssetCategory");
040    
041                            updateLastPublishDates("147", "AssetCategory");
042    
043                            addLastPublishDateColumn("AssetTag");
044    
045                            updateLastPublishDates("147", "AssetTag");
046    
047                            addLastPublishDateColumn("AssetVocabulary");
048    
049                            updateLastPublishDates("147", "AssetVocabulary");
050                    }
051            }
052    
053            protected void upgradeBlogs() throws Exception {
054                    try (LoggingTimer loggingTimer = new LoggingTimer()) {
055                            addLastPublishDateColumn("BlogsEntry");
056    
057                            updateLastPublishDates("33", "BlogsEntry");
058                    }
059            }
060    
061            protected void upgradeDocumentLibrary() throws Exception {
062                    try (LoggingTimer loggingTimer = new LoggingTimer()) {
063                            addLastPublishDateColumn("DLFileEntry");
064    
065                            updateLastPublishDates("20", "DLFileEntry");
066    
067                            addLastPublishDateColumn("DLFileEntryType");
068    
069                            updateLastPublishDates("20", "DLFileEntryType");
070    
071                            addLastPublishDateColumn("DLFileShortcut");
072    
073                            updateLastPublishDates("20", "DLFileShortcut");
074    
075                            addLastPublishDateColumn("DLFileVersion");
076    
077                            updateLastPublishDates("20", "DLFileVersion");
078    
079                            addLastPublishDateColumn("DLFolder");
080    
081                            updateLastPublishDates("20", "DLFolder");
082    
083                            addLastPublishDateColumn("Repository");
084    
085                            updateLastPublishDates("20", "Repository");
086    
087                            addLastPublishDateColumn("RepositoryEntry");
088    
089                            updateLastPublishDates("20", "RepositoryEntry");
090                    }
091            }
092    
093            protected void upgradeLayoutsAdmin() throws Exception {
094                    try (LoggingTimer loggingTimer = new LoggingTimer()) {
095                            addLastPublishDateColumn("Layout");
096    
097                            updateLastPublishDates("88", "Layout");
098    
099                            addLastPublishDateColumn("LayoutFriendlyURL");
100    
101                            updateLastPublishDates("88", "LayoutFriendlyURL");
102                    }
103            }
104    
105            protected void upgradeMessageBoards() throws Exception {
106                    try (LoggingTimer loggingTimer = new LoggingTimer()) {
107                            addLastPublishDateColumn("MBBan");
108    
109                            updateLastPublishDates("19", "MBBan");
110    
111                            addLastPublishDateColumn("MBCategory");
112    
113                            updateLastPublishDates("19", "MBCategory");
114    
115                            addLastPublishDateColumn("MBDiscussion");
116    
117                            updateLastPublishDates("19", "MBDiscussion");
118    
119                            addLastPublishDateColumn("MBMessage");
120    
121                            updateLastPublishDates("19", "MBMessage");
122    
123                            addLastPublishDateColumn("MBThread");
124    
125                            updateLastPublishDates("19", "MBThread");
126    
127                            addLastPublishDateColumn("MBThreadFlag");
128    
129                            updateLastPublishDates("19", "MBThreadFlag");
130                    }
131            }
132    
133            protected void upgradeMobileDeviceRules() throws Exception {
134                    try (LoggingTimer loggingTimer = new LoggingTimer()) {
135                            addLastPublishDateColumn("MDRAction");
136    
137                            updateLastPublishDates("178", "MDRAction");
138    
139                            addLastPublishDateColumn("MDRRule");
140    
141                            updateLastPublishDates("178", "MDRRule");
142    
143                            addLastPublishDateColumn("MDRRuleGroup");
144    
145                            updateLastPublishDates("178", "MDRRuleGroup");
146    
147                            addLastPublishDateColumn("MDRRuleGroupInstance");
148    
149                            updateLastPublishDates("178", "MDRRuleGroupInstance");
150                    }
151            }
152    
153            protected void upgradeSiteAdmin() throws Exception {
154                    try (LoggingTimer loggingTimer = new LoggingTimer()) {
155                            addLastPublishDateColumn("Team");
156    
157                            updateLastPublishDates("134", "Team");
158                    }
159            }
160    
161            protected void upgradeWebSite() throws Exception {
162                    try (LoggingTimer loggingTimer = new LoggingTimer()) {
163                            addLastPublishDateColumn("Website");
164                    }
165            }
166    
167    }