public class CmsUpdateDBProjectId extends A_CmsUpdateDBPart
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.
限定符和类型 | 字段和说明 |
---|---|
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<java.lang.String> |
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<java.lang.String> |
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.
|
m_poolData, m_queries
构造器和说明 |
---|
CmsUpdateDBProjectId()
Constructor.
|
限定符和类型 | 方法和说明 |
---|---|
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.
|
execute, getPoolData, getPropertyFileLocation, isKeepHistory, loadQueryProperties, readQuery
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<java.lang.String> RESOURCES_TABLES_LIST
protected static final java.lang.String[] TABLES
protected static final java.util.List<java.lang.String> TABLES_LIST
protected static final java.lang.String TEMP_UUID_COLUMN
protected static final java.lang.String TEMPORARY_TABLE_NAME
public CmsUpdateDBProjectId() throws java.io.IOException
java.io.IOException
- if the query properties cannot be readprotected 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 keyjava.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 addjava.sql.SQLException
- if something goes wrongprotected boolean checkColumnTypeProjectId(int type)
type
- the type of the column from the meta dataprotected void createHistProjectsTable(CmsSetupDb dbCon) throws java.sql.SQLException
dbCon
- the db connection interfacejava.sql.SQLException
- if soemthing goes wrongprotected void createTempTable(CmsSetupDb dbCon) throws java.sql.SQLException
dbCon
- the db connection interfacejava.sql.SQLException
- if soemthing goes wrongprotected java.lang.String getColumnProjectIdResourcePath()
protected void internalExecute(CmsSetupDb dbCon) throws java.sql.SQLException
A_CmsUpdateDBPart
internalExecute
在类中 A_CmsUpdateDBPart
dbCon
- the db connection interfacejava.sql.SQLException
- if something 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 checkjava.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 interfacejava.sql.SQLException
- if something goes wrong