wt.admin
Class ReparentDomainsMigrator

java.lang.Object
  extended bywt.admin.ReparentDomainsMigrator
All Implemented Interfaces:
Migrator

public class ReparentDomainsMigrator
extends Object
implements Migrator

Prior to R6, the parent of all domains was the global system domain. Now the parent of all domains created prior to R6 is to be the root domain. This migrator needs to do the following: - create a root domain. - create accessPolicyRules for the root Domain: 1) for Administrators group give ALL permissions to all objects. 2) Give READ permission to all users for AdministrativeDomain objects. - change the parent of domains whose parent is currently the global system domain to now be the root domain. - AccessPolicyRule, IndexPolicyRule, and NotificationRule classes were made DomainAdministered in R6, so will have new columns: CLASSNAMEKEYDOMAINREF VARCHAR2(200) IDA3DOMAINREF NUMBER These columns need to be populated in existing rules.


Field Summary
private  String ADMIN_GROUP_NAME
           
private  String all_id
           
private  PrintWriter debugLog
           
private  String read_id
           
private  String ROOT_DOMAIN
           
private  long root_domain_id
           
private  String SYSTEM_DOMAIN
           
private  long system_id
           
 
Constructor Summary
ReparentDomainsMigrator()
           
 
Method Summary
private  void changeAlltoRootDomain(Connection connection)
          Change all AdministrativeDomains that currently have the parent as the global system domain to now have as the parent, Root.
private  void createRootDomain(Connection connection)
          create Root Domain
private  void createRootDomainRules(Connection connection)
          create Root Domain's accessPolicyRules.
private  void populateNewColumns(Connection connection)
          Populate new columns in tables AccessPolicyRule, NotificationRule, IndexPolicyRule.
 boolean runMigration(Connection connection, PersistentObjectManager pom, PrintWriter logWriter)
          Run the migration.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

all_id

private String all_id

ADMIN_GROUP_NAME

private String ADMIN_GROUP_NAME

debugLog

private PrintWriter debugLog

read_id

private String read_id

ROOT_DOMAIN

private String ROOT_DOMAIN

root_domain_id

private long root_domain_id

SYSTEM_DOMAIN

private String SYSTEM_DOMAIN

system_id

private long system_id
Constructor Detail

ReparentDomainsMigrator

public ReparentDomainsMigrator()
Method Detail

runMigration

public boolean runMigration(Connection connection,
                            PersistentObjectManager pom,
                            PrintWriter logWriter)
                     throws SQLException,
                            WTIntrospectionException,
                            DatastoreException,
                            IOException,
                            ClassNotFoundException,
                            WTException,
                            InvalidPermissionException
Description copied from interface: Migrator
Run the migration.

Migrators should log all output to the given PrintWriter. This is the log that is created by RunMigrators. It is an autoflush writer.

Migrators should return true if they successfully completed migration and false otherwise. It is the migrator's responsibility to log failure reasons to the log.

Migrators should not concern themselves with committing the work on the connection. The MigratorRunner will commit the connection work after running each Migrator.

Specified by:
runMigration in interface Migrator
Parameters:
connection - an open connection to the Windchill database
pom - a persistent object manager against the Windchill database
logWriter - an autoflush printwriter for logging any and all output
Throws:
SQLException
WTIntrospectionException
DatastoreException
IOException
ClassNotFoundException
WTException
InvalidPermissionException

createRootDomain

private void createRootDomain(Connection connection)
                       throws SQLException,
                              IOException,
                              PersistenceException,
                              DatastoreException
create Root Domain

Throws:
SQLException
IOException
PersistenceException
DatastoreException

createRootDomainRules

private void createRootDomainRules(Connection connection)
                            throws SQLException,
                                   IOException,
                                   PersistenceException,
                                   DatastoreException
create Root Domain's accessPolicyRules. Two rules are created: 1) for Administrators group, give ALL permissions to all objects. 2) for all users, give READ permission to AdministrativeDomain objects.

Throws:
SQLException
IOException
PersistenceException
DatastoreException

changeAlltoRootDomain

private void changeAlltoRootDomain(Connection connection)
                            throws SQLException
Change all AdministrativeDomains that currently have the parent as the global system domain to now have as the parent, Root.

Throws:
SQLException

populateNewColumns

private void populateNewColumns(Connection connection)
                         throws SQLException
Populate new columns in tables AccessPolicyRule, NotificationRule, IndexPolicyRule.

Throws:
SQLException