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