|
||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.opencms.setup.update6to7.A_CmsUpdateDBPart
org.opencms.setup.update6to7.generic.CmsUpdateDBProjectId
public class CmsUpdateDBProjectId
This class updates the project ids from integer values to CmsUUIDs in all existing database tables.
It creates new UUIDs for each existing project and stores it into a temporary table.
For each table using a project id a new column for the UUID is added and the according data is transferred.
After that the original indexes and the column for the project id index is dropped and the new column with the project uuid becomes the primary key.
Field Summary | |
---|---|
protected static java.lang.String |
COLUMN_PROJECT_ID
Constant for the sql column PROJECT_ID. |
protected static java.lang.String |
COLUMN_PROJECT_LASTMODIFIED
Constant for the sql query to use the column PROJECT_LASTMODIFIED. |
protected static java.lang.String |
COLUMN_PROJECT_UUID
Constant for the sql column PROJECT_UUID. |
protected static java.lang.String |
COLUMN_TEMP_PROJECT_UUID
Constant for the sql column TEMP_PROJECT_UUID. |
protected static java.lang.String |
HISTORY_PROJECTS_TABLE
Constant for the table name of the CMS_HISTORY_PROJECTS table. |
protected static java.lang.String |
QUERY_ADD_PRIMARY_KEY
Constant for the sql query to add a new primary key. |
protected static java.lang.String |
QUERY_ADD_TEMP_UUID_COLUMN
Constant for the sql query to add a new column to the table. |
protected static java.lang.String |
QUERY_CREATE_HISTORY_PROJECTS_TABLE
Constant for the sql query to create the new CMS_HISTORY_PROJECTS table. |
protected static java.lang.String |
QUERY_CREATE_TEMP_TABLE_UUIDS
Constant for the sql query to create the temporary table. |
protected static java.lang.String |
QUERY_DESCRIBE_TABLE
Constant for the sql query to describe the given table. |
protected static java.lang.String |
QUERY_READ_MAX_PUBTAG
Constant for the sql query to read max publish tag. |
protected static java.lang.String |
REPLACEMENT_COLUMN
Constant for the replacement in the SQL query for the columnname. |
protected static java.lang.String |
REPLACEMENT_NEW_COLUMN
Constant for the replacement in the SQL query for the new columnname. |
protected static java.lang.String |
REPLACEMENT_OLDID
Constant for the replacement in the SQL query for old id to update. |
protected static java.lang.String |
REPLACEMENT_PRIMARY_KEY
Constant for the replacement in the SQL query for the primary key. |
protected static java.lang.String |
REPLACEMENT_TABLENAME
Constant for the replacement in the SQL query for the tablename. |
protected static java.lang.String[] |
RESOURCE_TABLES
Array of the online and offline resources tables. |
protected static java.util.List |
RESOURCES_TABLES_LIST
Arraylist for the online and offline resources tables that shall be updated. |
protected static java.lang.String[] |
TABLES
Array of the tables that are to be updated. |
protected static java.util.List |
TABLES_LIST
Arraylist for the tables that shall be updated. |
protected static java.lang.String |
TEMP_UUID_COLUMN
Constant for the temporary UUID column in the tables. |
protected static java.lang.String |
TEMPORARY_TABLE_NAME
Constant for the name of temporary table containing the project ids and uuids. |
Fields inherited from class org.opencms.setup.update6to7.A_CmsUpdateDBPart |
---|
m_poolData, m_queries, QUERY_PROPERTIES_PREFIX |
Constructor Summary | |
---|---|
CmsUpdateDBProjectId()
Constructor. |
Method Summary | |
---|---|
protected void |
addPrimaryKey(CmsSetupDb dbCon,
java.lang.String tablename,
java.lang.String primaryKey)
Adds a new primary key to the given table. |
protected void |
addUUIDColumnToTable(CmsSetupDb dbCon,
java.lang.String tablename,
java.lang.String column)
Adds the new column for the uuids to a table. |
protected boolean |
checkColumnTypeProjectId(int type)
Check if the column type of the project id is incorrect. |
protected void |
createHistProjectsTable(CmsSetupDb dbCon)
Creates the CMS_HISTORY_PROJECTS table if it does not exist yet. |
protected void |
createTempTable(CmsSetupDb dbCon)
Creates the temp table for project ids if it does not exist yet. |
protected java.lang.String |
getColumnProjectIdResourcePath()
Returns the columns for the primary key of the project resources table. |
protected void |
internalExecute(CmsSetupDb dbCon)
Does the hard work. |
protected boolean |
needsUpdating(CmsSetupDb dbCon,
java.lang.String tablename)
Checks if the given table needs an update of the uuids. |
protected void |
transferDataToHistoryTable(CmsSetupDb dbCon)
Transfers the data from the CMS_BACKUP_PROJECTS to the CMS_HISTORY_PROJECTS table. |
Methods inherited from class org.opencms.setup.update6to7.A_CmsUpdateDBPart |
---|
execute, getDbInstance, getPoolData, isKeepHistory, loadQueryProperties, readQuery, setPoolData |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final java.lang.String COLUMN_PROJECT_ID
protected static final java.lang.String COLUMN_PROJECT_LASTMODIFIED
protected static final java.lang.String COLUMN_PROJECT_UUID
protected static final java.lang.String COLUMN_TEMP_PROJECT_UUID
protected static final java.lang.String HISTORY_PROJECTS_TABLE
protected static final java.lang.String QUERY_ADD_PRIMARY_KEY
protected static final java.lang.String QUERY_ADD_TEMP_UUID_COLUMN
protected static final java.lang.String QUERY_CREATE_HISTORY_PROJECTS_TABLE
protected static final java.lang.String QUERY_CREATE_TEMP_TABLE_UUIDS
protected static final java.lang.String QUERY_DESCRIBE_TABLE
protected static final java.lang.String QUERY_READ_MAX_PUBTAG
protected static final java.lang.String REPLACEMENT_COLUMN
protected static final java.lang.String REPLACEMENT_NEW_COLUMN
protected static final java.lang.String REPLACEMENT_OLDID
protected static final java.lang.String REPLACEMENT_PRIMARY_KEY
protected static final java.lang.String REPLACEMENT_TABLENAME
protected static final java.lang.String[] RESOURCE_TABLES
protected static final java.util.List RESOURCES_TABLES_LIST
protected static final java.lang.String[] TABLES
protected static final java.util.List TABLES_LIST
protected static final java.lang.String TEMP_UUID_COLUMN
protected static final java.lang.String TEMPORARY_TABLE_NAME
Constructor Detail |
---|
public CmsUpdateDBProjectId() throws java.io.IOException
java.io.IOException
- if the query properties cannot be readMethod Detail |
---|
protected void addPrimaryKey(CmsSetupDb dbCon, java.lang.String tablename, java.lang.String primaryKey) throws java.sql.SQLException
dbCon
- the db connection interfacetablename
- the table to add the primary key toprimaryKey
- the new primary key
java.sql.SQLException
- if something goes wrongprotected void addUUIDColumnToTable(CmsSetupDb dbCon, java.lang.String tablename, java.lang.String column) throws java.sql.SQLException
dbCon
- the db connection interfacetablename
- the table to add the column tocolumn
- the new colum to add
java.sql.SQLException
- if something goes wrongprotected boolean checkColumnTypeProjectId(int type)
type
- the type of the column from the meta data
protected void createHistProjectsTable(CmsSetupDb dbCon) throws java.sql.SQLException
dbCon
- the db connection interface
java.sql.SQLException
- if soemthing goes wrongprotected void createTempTable(CmsSetupDb dbCon) throws java.sql.SQLException
dbCon
- the db connection interface
java.sql.SQLException
- if soemthing goes wrongprotected java.lang.String getColumnProjectIdResourcePath()
protected void internalExecute(CmsSetupDb dbCon) throws java.sql.SQLException
A_CmsUpdateDBPart
internalExecute
in class A_CmsUpdateDBPart
dbCon
- the db connection interface
java.sql.SQLException
- if somethign goes wrongA_CmsUpdateDBPart.internalExecute(org.opencms.setup.CmsSetupDb)
protected boolean needsUpdating(CmsSetupDb dbCon, java.lang.String tablename) throws java.sql.SQLException
dbCon
- the db connection interfacetablename
- the table to check
java.sql.SQLException
- if something goes wrongprotected void transferDataToHistoryTable(CmsSetupDb dbCon) throws java.sql.SQLException
The datetime type for the column PROJECT_PUBLISHDATE is converted to the new long value.
dbCon
- the db connection interface
java.sql.SQLException
- if something goes wrong
|
||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |