org.opencms.setup.update6to7.generic
Class CmsUpdateDBUpdateOU

java.lang.Object
  extended by org.opencms.setup.update6to7.A_CmsUpdateDBPart
      extended by org.opencms.setup.update6to7.generic.CmsUpdateDBUpdateOU
All Implemented Interfaces:
I_CmsUpdateDBPart
Direct Known Subclasses:
CmsUpdateDBUpdateOU, CmsUpdateDBUpdateOU

public class CmsUpdateDBUpdateOU
extends A_CmsUpdateDBPart

This class upgrades the database tables containing new OU columns.

These tables are cms_groups cms_history_principals cms_history_projects cms_projects cms_users

Since:
7.0.0
Version:
$Revision: 1.2 $
Author:
Roland Metzler

Field Summary
protected static java.lang.String GROUP_OU_COLUMN
          Constant for the GROUP_OU column.
protected static java.lang.String PROJECT_OU_COLUMN
          Constant for the PROJECT_OU column.
protected static java.lang.String QUERY_ADD_OUS_TO_TABLE
          Constant for the query that adds the ous to the table.
protected static java.lang.String QUERY_KEY_ALTER_TABLE
          Constant for the alteration of the table.
protected static java.lang.String REPLACEMENT_COLUMNNAME
          Constant for the replacement in the SQL query for the columnname.
protected static java.lang.String REPLACEMENT_TABLENAME
          Constant for the replacement in the SQL query for the tablename.
protected static java.lang.String TABLE_BACKUP_PROJECTS
          Constant for the CMS_BACKUP_PROJECTS table.
protected static java.lang.String TABLE_CMS_GROUPS
          Constant for the CMS_GROUPS table.
protected static java.lang.String TABLE_CMS_USERS
          Constant for the CMS_USERS table.
protected static java.lang.String TABLE_PROJECTS
          Constant for the CMS_PROJECTS table.
protected static java.lang.String USER_OU_COLUMN
          Constant for the USER_OU column.
 
Fields inherited from class org.opencms.setup.update6to7.A_CmsUpdateDBPart
m_poolData, m_queries, QUERY_PROPERTIES_PREFIX
 
Constructor Summary
CmsUpdateDBUpdateOU()
          Constructor.
 
Method Summary
protected  boolean findOUColumn(CmsSetupDb dbCon, java.lang.String table, java.lang.String ouColumn)
          Checks if the column USER_OU is found in the resultset.
protected  void internalExecute(CmsSetupDb dbCon)
          Does the hard work.
protected  int updateOUs(CmsSetupDb dbCon, java.lang.String table, java.lang.String ouColumn)
          Updates the database tables with the new OUs if necessary for the given 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

GROUP_OU_COLUMN

protected static final java.lang.String GROUP_OU_COLUMN
Constant for the GROUP_OU column.

See Also:
Constant Field Values

PROJECT_OU_COLUMN

protected static final java.lang.String PROJECT_OU_COLUMN
Constant for the PROJECT_OU column.

See Also:
Constant Field Values

QUERY_ADD_OUS_TO_TABLE

protected static final java.lang.String QUERY_ADD_OUS_TO_TABLE
Constant for the query that adds the ous to the table.

See Also:
Constant Field Values

QUERY_KEY_ALTER_TABLE

protected static final java.lang.String QUERY_KEY_ALTER_TABLE
Constant for the alteration of the table.

See Also:
Constant Field Values

REPLACEMENT_COLUMNNAME

protected static final java.lang.String REPLACEMENT_COLUMNNAME
Constant for the replacement in the SQL query for the columnname.

See Also:
Constant Field Values

REPLACEMENT_TABLENAME

protected static final java.lang.String REPLACEMENT_TABLENAME
Constant for the replacement in the SQL query for the tablename.

See Also:
Constant Field Values

TABLE_BACKUP_PROJECTS

protected static final java.lang.String TABLE_BACKUP_PROJECTS
Constant for the CMS_BACKUP_PROJECTS table.

See Also:
Constant Field Values

TABLE_CMS_GROUPS

protected static final java.lang.String TABLE_CMS_GROUPS
Constant for the CMS_GROUPS table.

See Also:
Constant Field Values

TABLE_CMS_USERS

protected static final java.lang.String TABLE_CMS_USERS
Constant for the CMS_USERS table.

See Also:
Constant Field Values

TABLE_PROJECTS

protected static final java.lang.String TABLE_PROJECTS
Constant for the CMS_PROJECTS table.

See Also:
Constant Field Values

USER_OU_COLUMN

protected static final java.lang.String USER_OU_COLUMN
Constant for the USER_OU column.

See Also:
Constant Field Values
Constructor Detail

CmsUpdateDBUpdateOU

public CmsUpdateDBUpdateOU()
                    throws java.io.IOException
Constructor.

Throws:
java.io.IOException - if the sql queries properties file could not be read
Method Detail

findOUColumn

protected boolean findOUColumn(CmsSetupDb dbCon,
                               java.lang.String table,
                               java.lang.String ouColumn)
Checks if the column USER_OU is found in the resultset.

Parameters:
dbCon - the db connection interface
table - the table to check
ouColumn - the type of OU to find (e.g. USER_OU or GROUP_OU)
Returns:
true if the column is in the result set, false if not

internalExecute

protected void internalExecute(CmsSetupDb dbCon)
Description copied from class: A_CmsUpdateDBPart
Does the hard work.

Specified by:
internalExecute in class A_CmsUpdateDBPart
Parameters:
dbCon - the db connection interface
See Also:
A_CmsUpdateDBPart.internalExecute(org.opencms.setup.CmsSetupDb)

updateOUs

protected int updateOUs(CmsSetupDb dbCon,
                        java.lang.String table,
                        java.lang.String ouColumn)
Updates the database tables with the new OUs if necessary for the given table.

Parameters:
dbCon - the db connection interface
table - the table to update
ouColumn - the column to insert
Returns:
true if everything worked fine, false if not