wt.team
Class MigrateProjectToTeamObject

java.lang.Object
  extended bywt.team.MigrateProjectToTeamObject
All Implemented Interfaces:
JavaMigrator

public class MigrateProjectToTeamObject
extends Object
implements JavaMigrator

[5/6/2003 Susan Li]: Modify this migrator for 7.0: 1. remove creating Team for Project2. This version is only used for WNC pre-6.2 to 7.0. PJL don't use it so no need to create ContainerTeam for Project2. 2. remove RolePrincipalLink, instead put all info into RolePrincipalMap. 3. remove usage of ProjectDomainLink. This object is for PJL, WNC don't use it.


Field Summary
private static AccessControllerAdapter aca
           
private static long administrator
           
private static Hashtable assignedActivityTemplates
           
private static Hashtable batchCounts
           
private static String CLASSNAME
           
private static Connection connection
           
private static DirectiveServices directive_services
           
private static String FC_RESOURCE
           
private static Hashtable ht
           
private static LobHandler lobHandler
           
private static boolean MIGRATE_ALL_WFLS
           
private static PDSIfc pds
           
private static PersistentObjectManager pom
           
private static Hashtable preparedStatements
           
private static WTProperties properties
           
private static Map rarms
           
private static Map rpms
           
private static long system
           
private static Hashtable teamNames
           
private static Hashtable templateObjs
           
private static Hashtable templates
           
private static boolean VERBOSE
           
private static LobLocator waLobLocator
           
private static LobLocator weoLobLocator
           
private static Hashtable wfProcesses
           
private static WTConnection wtconnection
           
private static LobLocator wtoLobLocator
           
 
Constructor Summary
MigrateProjectToTeamObject()
           
 
Method Summary
protected  void addTeamName(String name)
           
protected  void batch(PreparedStatement preparedStatement, String key)
           
private  void close(PreparedStatement stmt, int batchedUpdates)
           
protected  void closePreparedStatements()
           
private  String convertPrjVarString(String prj)
           
private  String convertPrjVarToTTString(String prj)
           
static void createFederatedLink(String teamType, long teamObjectId, long projId)
           
 void createLink(String table, String roleClassName, long teamObjectId, long projId, boolean roleA)
           
protected  void createPreparedStatement(String key, String sqlStatement)
           
private  void createProjectMappings(Project project, long teamTemplateId)
           
 void createRoleActorRoleMap(Role role, ActorRole actorRole, long teamTemplateId)
           
protected  String createRoleholderMappings(RoleHolder roleHolder, long teamId, String entryset)
           
 void createRolePrincipalMap(String princClass, String princOid, Role role, long teamObjectId, String teamType)
           
protected  void createStatements()
           
private  long createTeam(ResultSet rs, RoleHolder roleHolder, boolean fromProject, long templateOid, String name, Vector processes)
           
private  long createTeamForVar(ResultSet rs, RoleHolder roleHolder, long templateOid, String name)
           
private  void createTeamTemplate(ResultSet rs, Project project)
           
 void fixWAATLocalProjects()
           
 PreparedStatement fixWAATProjectAssignees(String templateRef, PreparedStatement pStmt)
          Fixes project references within WfAssignedActivityTemplates.
protected  long getAdministrator()
           
protected  String getClassname(String pbo)
           
private  long getMakeTeamForPrj(Project prj)
           
protected  String getOid(String pbo)
           
protected  PreparedStatement getPreparedStatement(String key)
           
protected  RoleHolder getProject(String key)
           
static void getProjects()
           
private  Enumeration getRoles(RoleHolder roleHolder)
           
protected  long getSystem()
           
protected  String getTable(String pbo)
           
protected  long getTeamTemplateId(String key)
           
static void getWAATsWithProjectAssignees()
           
protected  WfProcess getWf(Vector wfVector, String oid)
           
protected  WfProcess getWfProcess(String key)
           
static void getWfProcesses()
           
static void getWfProcessTemplates()
          This method returns all the WfProcessTemplate objects.
protected  void initializePreparedStatements()
           
private  void loadTemplateObjs()
           
 int migratePrefs()
           
 int migrateProjects()
          This method migrates all the project objects into team templates or teams
 int migrateRoleHolders()
           
 int migrateWA()
          This method finds WfAssignee's with project assignee in the ASSIGNEE attribute.
 int migrateWAATs()
           
 int migrateWEO()
          This method updates the WfExecutionObject's ProcessData and returns the number of records updated.
 int migrateWTO()
          This method updates the WfTemplateObject's ProcessDataInfo and returns the number of records updated.
 boolean runMigration(DirectiveServices directiveServices)
          Run the migration.
protected  void setConnection(Connection a_connection)
           
protected  void setDirectiveServices(DirectiveServices directiveServices)
           
protected  void setPds(PDSIfc a_pds)
           
protected  void setPom(PersistentObjectManager a_pom)
           
private  void setupPrerequisites()
           
protected  void setWtconnection(WTConnection a_wtconnection)
           
 boolean updateContext(ProcessData ctx)
           
 boolean updateContextSignature(ProcessDataInfo ctxSig)
           
 int updateLcmdWOWf()
          This method returns all the lcmd objects.
protected  int updateObject(String oid, String projId, String table, String columnSearch)
           
private  int updateObject(String pbo, Vector wfVector, String projId)
           
static PreparedStatement updatePref(long oid, String newValue, PreparedStatement pStatement)
           
 void updateRow(long teamId, long teamTemplateId, ProcessData context, String objectId, String table)
          Overloaded updateRow to handle ProcessData object.
 void updateRow(long teamId, long teamTemplateId, String objectId, String table)
           
 PreparedStatement updateWA(String oid, WfAssignee wa, String table)
          Update the WfAssgnment's ASSIGNEE attribute.
static PreparedStatement updateWAATRow(String objectId, String teamId, String teamTemplateId, PreparedStatement pStatement)
           
static PreparedStatement updateWAATRow(TeamRefVector tRV, String objectId, PreparedStatement pStatement)
           
 PreparedStatement updateWEO(String oid, ProcessData pData, String table)
          Update the WfExecutionObject's ProcessData CONTEXT attribute.
private  void updateWf(WfProcess wfProcess, long teamId, long teamTemplateId)
           
 WfTeamAssignee updateWfAssignee(WfAssignee wa)
           
 PreparedStatement updateWTO(String oid, ProcessDataInfo pDataInfo, String table)
          Update the WfTemplateObject's ProcessDataInfo CONTEXTSIGNATURE attribute.
 int upgrade()
           
protected  String validateTeamName(String name)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FC_RESOURCE

private static final String FC_RESOURCE
See Also:
Constant Field Values

CLASSNAME

private static final String CLASSNAME

ht

private static Hashtable ht

wfProcesses

private static Hashtable wfProcesses

assignedActivityTemplates

private static Hashtable assignedActivityTemplates

templates

private static Hashtable templates

templateObjs

private static Hashtable templateObjs

preparedStatements

private static Hashtable preparedStatements

batchCounts

private static Hashtable batchCounts

teamNames

private static Hashtable teamNames

pom

private static PersistentObjectManager pom

connection

private static Connection connection

wtconnection

private static WTConnection wtconnection

directive_services

private static DirectiveServices directive_services

aca

private static AccessControllerAdapter aca

VERBOSE

private static boolean VERBOSE

administrator

private static long administrator

system

private static long system

pds

private static PDSIfc pds

lobHandler

private static LobHandler lobHandler

wtoLobLocator

private static LobLocator wtoLobLocator

weoLobLocator

private static LobLocator weoLobLocator

waLobLocator

private static LobLocator waLobLocator

MIGRATE_ALL_WFLS

private static boolean MIGRATE_ALL_WFLS

properties

private static WTProperties properties

rpms

private static Map rpms

rarms

private static Map rarms
Constructor Detail

MigrateProjectToTeamObject

public MigrateProjectToTeamObject()
Method Detail

runMigration

public boolean runMigration(DirectiveServices directiveServices)
                     throws SQLException,
                            DirectiveExecutionException
Description copied from interface: JavaMigrator
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 JavaMigrator
Parameters:
directiveServices - provide access to database, logging, and versioning information
Throws:
SQLException
DirectiveExecutionException

upgrade

public int upgrade()
            throws WTException,
                   SQLException
Throws:
WTException
SQLException

migrateProjects

public int migrateProjects()
                    throws WTException
This method migrates all the project objects into team templates or teams

Throws:
WTException

migrateRoleHolders

public int migrateRoleHolders()
                       throws WTException,
                              SQLException
Throws:
WTException
SQLException

updateWf

private void updateWf(WfProcess wfProcess,
                      long teamId,
                      long teamTemplateId)
               throws WTException
Throws:
WTException

createTeamTemplate

private void createTeamTemplate(ResultSet rs,
                                Project project)
                         throws WTException,
                                SQLException
Throws:
WTException
SQLException

createProjectMappings

private void createProjectMappings(Project project,
                                   long teamTemplateId)
                            throws WTException
Throws:
WTException

createRoleholderMappings

protected String createRoleholderMappings(RoleHolder roleHolder,
                                          long teamId,
                                          String entryset)
                                   throws WTException
Throws:
WTException

createTeam

private long createTeam(ResultSet rs,
                        RoleHolder roleHolder,
                        boolean fromProject,
                        long templateOid,
                        String name,
                        Vector processes)
                 throws WTException,
                        SQLException
Throws:
WTException
SQLException

createRolePrincipalMap

public void createRolePrincipalMap(String princClass,
                                   String princOid,
                                   Role role,
                                   long teamObjectId,
                                   String teamType)
                            throws WTException
Throws:
WTException

createRoleActorRoleMap

public void createRoleActorRoleMap(Role role,
                                   ActorRole actorRole,
                                   long teamTemplateId)
                            throws WTException
Throws:
WTException

getProjects

public static void getProjects()
                        throws WTException
Throws:
WTException

validateTeamName

protected String validateTeamName(String name)
                           throws WTException
Throws:
WTException

getWf

protected WfProcess getWf(Vector wfVector,
                          String oid)
                   throws WTException
Throws:
WTException

getRoles

private Enumeration getRoles(RoleHolder roleHolder)

getWfProcesses

public static void getWfProcesses()
                           throws WTException
Throws:
WTException

getWfProcessTemplates

public static void getWfProcessTemplates()
                                  throws WTException
This method returns all the WfProcessTemplate objects.

Throws:
WTException

updateLcmdWOWf

public int updateLcmdWOWf()
                   throws WTException,
                          SQLException
This method returns all the lcmd objects.

Throws:
WTException
SQLException

updateRow

public void updateRow(long teamId,
                      long teamTemplateId,
                      String objectId,
                      String table)
               throws WTException
Throws:
WTException

updateRow

public void updateRow(long teamId,
                      long teamTemplateId,
                      ProcessData context,
                      String objectId,
                      String table)
               throws WTException
Overloaded updateRow to handle ProcessData object.

Throws:
WTException

createLink

public void createLink(String table,
                       String roleClassName,
                       long teamObjectId,
                       long projId,
                       boolean roleA)
                throws WTException,
                       SQLException
Throws:
WTException
SQLException

createFederatedLink

public static void createFederatedLink(String teamType,
                                       long teamObjectId,
                                       long projId)
                                throws WTException,
                                       SQLException
Throws:
WTException
SQLException

close

private void close(PreparedStatement stmt,
                   int batchedUpdates)
            throws WTException
Throws:
WTException

createPreparedStatement

protected void createPreparedStatement(String key,
                                       String sqlStatement)
                                throws WTException
Throws:
WTException

batch

protected void batch(PreparedStatement preparedStatement,
                     String key)
              throws WTException
Throws:
WTException

createStatements

protected void createStatements()
                         throws WTException
Throws:
WTException

migrateWAATs

public int migrateWAATs()
                 throws WTException,
                        SQLException
Throws:
WTException
SQLException

getWAATsWithProjectAssignees

public static void getWAATsWithProjectAssignees()
                                         throws WTException
Throws:
WTException

fixWAATLocalProjects

public void fixWAATLocalProjects()
                          throws WTException
Throws:
WTException

fixWAATProjectAssignees

public PreparedStatement fixWAATProjectAssignees(String templateRef,
                                                 PreparedStatement pStmt)
                                          throws WTException,
                                                 SQLException
Fixes project references within WfAssignedActivityTemplates.

Throws:
WTException
SQLException

updateWAATRow

public static PreparedStatement updateWAATRow(TeamRefVector tRV,
                                              String objectId,
                                              PreparedStatement pStatement)
                                       throws WTException,
                                              SQLException
Throws:
WTException
SQLException

updateWAATRow

public static PreparedStatement updateWAATRow(String objectId,
                                              String teamId,
                                              String teamTemplateId,
                                              PreparedStatement pStatement)
                                       throws WTException,
                                              SQLException
Throws:
WTException
SQLException

migratePrefs

public int migratePrefs()
                 throws WTException,
                        SQLException
Throws:
WTException
SQLException

updatePref

public static PreparedStatement updatePref(long oid,
                                           String newValue,
                                           PreparedStatement pStatement)
                                    throws WTException,
                                           SQLException
Throws:
WTException
SQLException

setupPrerequisites

private void setupPrerequisites()
                         throws WTException
Throws:
WTException

updateObject

private int updateObject(String pbo,
                         Vector wfVector,
                         String projId)
                  throws WTException,
                         SQLException
Throws:
WTException
SQLException

updateObject

protected int updateObject(String oid,
                           String projId,
                           String table,
                           String columnSearch)
                    throws WTException,
                           SQLException
Throws:
WTException
SQLException

getTable

protected String getTable(String pbo)
                   throws WTException
Throws:
WTException

getClassname

protected String getClassname(String pbo)
                       throws WTException
Throws:
WTException

getOid

protected String getOid(String pbo)
                 throws WTException
Throws:
WTException

migrateWTO

public int migrateWTO()
               throws WTException,
                      SQLException
This method updates the WfTemplateObject's ProcessDataInfo and returns the number of records updated.

Throws:
WTException
SQLException

migrateWEO

public int migrateWEO()
               throws WTException,
                      SQLException
This method updates the WfExecutionObject's ProcessData and returns the number of records updated.

Throws:
WTException
SQLException

migrateWA

public int migrateWA()
              throws WTException,
                     SQLException
This method finds WfAssignee's with project assignee in the ASSIGNEE attribute. It then converts these to team assignees, updates the db record and returns the number of records updated. Note that it only updates WAs that are not COMPLETED.

Throws:
WTException
SQLException

updateContextSignature

public boolean updateContextSignature(ProcessDataInfo ctxSig)
                               throws WTException
Throws:
WTException

updateContext

public boolean updateContext(ProcessData ctx)
                      throws WTException
Throws:
WTException

updateWfAssignee

public WfTeamAssignee updateWfAssignee(WfAssignee wa)
                                throws SQLException,
                                       WTException
Throws:
SQLException
WTException

updateWTO

public PreparedStatement updateWTO(String oid,
                                   ProcessDataInfo pDataInfo,
                                   String table)
                            throws WTException,
                                   SQLException
Update the WfTemplateObject's ProcessDataInfo CONTEXTSIGNATURE attribute.

Throws:
WTException
SQLException

updateWEO

public PreparedStatement updateWEO(String oid,
                                   ProcessData pData,
                                   String table)
                            throws WTException,
                                   SQLException
Update the WfExecutionObject's ProcessData CONTEXT attribute.

Throws:
WTException
SQLException

updateWA

public PreparedStatement updateWA(String oid,
                                  WfAssignee wa,
                                  String table)
                           throws WTException,
                                  SQLException
Update the WfAssgnment's ASSIGNEE attribute.

Throws:
WTException
SQLException

convertPrjVarString

private String convertPrjVarString(String prj)
                            throws SQLException,
                                   WTException
Throws:
SQLException
WTException

convertPrjVarToTTString

private String convertPrjVarToTTString(String prj)
                                throws WTException
Throws:
WTException

loadTemplateObjs

private void loadTemplateObjs()
                       throws WTException
Throws:
WTException

getMakeTeamForPrj

private long getMakeTeamForPrj(Project prj)
                        throws SQLException
Throws:
SQLException

createTeamForVar

private long createTeamForVar(ResultSet rs,
                              RoleHolder roleHolder,
                              long templateOid,
                              String name)
                       throws WTException,
                              SQLException
Throws:
WTException
SQLException

setConnection

protected void setConnection(Connection a_connection)

setWtconnection

protected void setWtconnection(WTConnection a_wtconnection)

setDirectiveServices

protected void setDirectiveServices(DirectiveServices directiveServices)

setPds

protected void setPds(PDSIfc a_pds)

setPom

protected void setPom(PersistentObjectManager a_pom)

getProject

protected RoleHolder getProject(String key)

getTeamTemplateId

protected long getTeamTemplateId(String key)

getAdministrator

protected long getAdministrator()
                         throws WTException
Throws:
WTException

getSystem

protected long getSystem()
                  throws WTException
Throws:
WTException

getPreparedStatement

protected PreparedStatement getPreparedStatement(String key)

closePreparedStatements

protected void closePreparedStatements()
                                throws WTException
Throws:
WTException

initializePreparedStatements

protected void initializePreparedStatements()

addTeamName

protected void addTeamName(String name)

getWfProcess

protected WfProcess getWfProcess(String key)