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.dao.jdbc.DataAccess;
018    import com.liferay.portal.kernel.upgrade.UpgradeProcess;
019    import com.liferay.portal.kernel.util.StringBundler;
020    import com.liferay.portal.model.ReleaseConstants;
021    
022    import java.sql.PreparedStatement;
023    import java.sql.ResultSet;
024    import java.sql.Timestamp;
025    
026    /**
027     * @author Miguel Pastor
028     */
029    public class UpgradeModules extends UpgradeProcess {
030    
031            @Override
032            protected void doUpgrade() throws Exception {
033                    PreparedStatement ps = null;
034                    ResultSet rs = null;
035    
036                    try {
037                            StringBundler sb = new StringBundler(5);
038    
039                            sb.append("insert into Release_ (mvccVersion, releaseId, ");
040                            sb.append("createDate, modifiedDate, servletContextName, ");
041                            sb.append("schemaVersion, buildNumber, buildDate, verified, ");
042                            sb.append("state_, testString) values (?, ?, ?, ?, ?, ?, ?, ?, ");
043                            sb.append("?, ?, ?)");
044    
045                            String sql = sb.toString();
046    
047                            ps = connection.prepareStatement(sql);
048    
049                            Timestamp timestamp = new Timestamp(System.currentTimeMillis());
050    
051                            for (String bundleSymbolicName : _bundleSymbolicNames) {
052                                    ps.setLong(1, 0);
053                                    ps.setLong(2, increment());
054                                    ps.setTimestamp(3, timestamp);
055                                    ps.setTimestamp(4, timestamp);
056                                    ps.setString(5, bundleSymbolicName);
057                                    ps.setString(6, "0.0.1");
058                                    ps.setInt(7, 001);
059                                    ps.setTimestamp(8, timestamp);
060                                    ps.setBoolean(9, false);
061                                    ps.setInt(10, 0);
062                                    ps.setString(11, ReleaseConstants.TEST_STRING);
063    
064                                    ps.addBatch();
065                            }
066    
067                            ps.executeBatch();
068                    }
069                    finally {
070                            DataAccess.cleanUp(ps, rs);
071                    }
072            }
073    
074            private static final String[] _bundleSymbolicNames = new String[] {
075                    "com.liferay.amazon.rankings.web", "com.liferay.announcements.web",
076                    "com.liferay.asset.browser.web",
077                    "com.liferay.asset.categories.admin.web",
078                    "com.liferay.asset.categories.navigation.web",
079                    "com.liferay.asset.publisher.web", "com.liferay.asset.tags.admin.web",
080                    "com.liferay.asset.tags.compiler.web",
081                    "com.liferay.asset.tags.navigation.web",
082                    "com.liferay.blogs.recent.bloggers.web", "com.liferay.blogs.web",
083                    "com.liferay.bookmarks.service", "com.liferay.bookmarks.web",
084                    "com.liferay.comment.page.comments.web",
085                    "com.liferay.currency.converter.web", "com.liferay.dictionary.web",
086                    "com.liferay.document.library.web",
087                    "com.liferay.dynamic.data.lists.service",
088                    "com.liferay.dynamic.data.lists.web",
089                    "com.liferay.dynamic.data.mapping.service", "com.liferay.expando.web",
090                    "com.liferay.exportimport.web", "com.liferay.flags.page.flags.web",
091                    "com.liferay.hello.velocity.web", "com.liferay.iframe.web",
092                    "com.liferay.invitation.web", "com.liferay.item.selector.web",
093                    "com.liferay.journal.content.search.web",
094                    "com.liferay.journal.content.web", "com.liferay.journal.service",
095                    "com.liferay.journal.web", "com.liferay.layout.admin.web",
096                    "com.liferay.layout.prototype.web",
097                    "com.liferay.layout.set.prototype.web",
098                    "com.liferay.loan.calculator.web", "com.liferay.marketplace.service",
099                    "com.liferay.message.boards.web", "com.liferay.mobile.device.rules.web",
100                    "com.liferay.my.account.web", "com.liferay.nested.portlets.web",
101                    "com.liferay.network.utilities.web",
102                    "com.liferay.password.generator.web",
103                    "com.liferay.password.policies.admin.web",
104                    "com.liferay.plugins.admin.web", "com.liferay.polls.service",
105                    "com.liferay.portal.instances.web", "com.liferay.portal.lock.service",
106                    "com.liferay.portal.settings.web",
107                    "com.liferay.portlet.configuration.web", "com.liferay.portlet.css.web",
108                    "com.liferay.quick.note.web.uprade;",
109                    "com.liferay.ratings.page.ratings.web", "com.liferay.roles.admin.web",
110                    "com.liferay.rss.web", "com.liferay.search.web",
111                    "com.liferay.server.admin.web", "com.liferay.shopping.service",
112                    "com.liferay.shopping.web", "com.liferay.site.admin.web",
113                    "com.liferay.site.browser.web", "com.liferay.site.memberships.web",
114                    "com.liferay.site.my.sites.web",
115                    "com.liferay.site.navigation.breadcrumb.web",
116                    "com.liferay.site.navigation.directory.web",
117                    "com.liferay.site.navigation.language.web",
118                    "com.liferay.site.navigation.menu.web",
119                    "com.liferay.site.navigation.site.map.web",
120                    "com.liferay.site.teams.web", "com.liferay.social.activities.web",
121                    "com.liferay.social.activity.web",
122                    "com.liferay.social.group.statistics.web",
123                    "com.liferay.social.requests.web",
124                    "com.liferay.social.user.statistics.web", "com.liferay.staging.bar.web",
125                    "com.liferay.translator.web", "com.liferay.trash.web",
126                    "com.liferay.unit.converter.web", "com.liferay.user.groups.admin.web",
127                    "com.liferay.users.admin.web", "com.liferay.web.proxy.web",
128                    "com.liferay.wiki.service", "com.liferay.wiki.web",
129                    "com.liferay.xsl.content.web"
130            };
131    
132    }