001/* 002 * This library is part of OpenCms - 003 * the Open Source Content Management System 004 * 005 * Copyright (c) Alkacon Software GmbH & Co. KG (http://www.alkacon.com) 006 * 007 * This library is free software; you can redistribute it and/or 008 * modify it under the terms of the GNU Lesser General Public 009 * License as published by the Free Software Foundation; either 010 * version 2.1 of the License, or (at your option) any later version. 011 * 012 * This library is distributed in the hope that it will be useful, 013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 015 * Lesser General Public License for more details. 016 * 017 * For further information about Alkacon Software GmbH & Co. KG, please see the 018 * company website: http://www.alkacon.com 019 * 020 * For further information about OpenCms, please see the 021 * project website: http://www.opencms.org 022 * 023 * You should have received a copy of the GNU Lesser General Public 024 * License along with this library; if not, write to the Free Software 025 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 026 */ 027 028package org.opencms.setup.db.update6to7.mysql; 029 030import org.opencms.setup.CmsSetupDb; 031 032import java.io.IOException; 033import java.sql.SQLException; 034import java.util.Collections; 035import java.util.Map; 036 037/** 038 * This class makes an update of the CMS_USERS table splitting it up into CMS_USERS and CMS_USERDATA.<p> 039 * Unnecessary colums from CMS_USERS will be deleted and the new column USER_DATECREATED is added. 040 */ 041public class CmsUpdateDBCmsUsers extends org.opencms.setup.db.update6to7.CmsUpdateDBCmsUsers { 042 043 /** Constant for the query to create the user data table.<p> */ 044 private static final String QUERY_CREATE_TABLE_USERDATA_MYSQL = "Q_CREATE_TABLE_USERDATA_MYSQL"; 045 046 /** Constant for the SQL query properties.<p> */ 047 private static final String QUERY_PROPERTY_FILE = "cms_users_queries.properties"; 048 049 /** 050 * Default constructor.<p> 051 * 052 * @throws IOException if the default sql queries property file could not be read 053 */ 054 public CmsUpdateDBCmsUsers() 055 throws IOException { 056 057 super(); 058 loadQueryProperties(getPropertyFileLocation() + QUERY_PROPERTY_FILE); 059 } 060 061 /** 062 * Creates the CMS_USERDATA table if it does not exist yet.<p> 063 * 064 * @param dbCon the db connection interface 065 * 066 * @throws SQLException if something goes wrong 067 */ 068 @Override 069 protected void createUserDataTable(CmsSetupDb dbCon) throws SQLException { 070 071 System.out.println(new Exception().getStackTrace()[0].toString()); 072 String createStatement = readQuery(QUERY_CREATE_TABLE_USERDATA_MYSQL); 073 Map<String, String> replacer = Collections.singletonMap("${tableEngine}", m_poolData.get("engine")); 074 dbCon.updateSqlStatement(createStatement, replacer, null); 075 } 076}