package com.ibm.nzna.projects.tcon ;
/*-----------------------------------------------------------*/
/* tConvert */
/* */
/* Description: */
/* Source code for: tConvert */
/* */
/* */
/* @Copyright 2000 IBM */
/* */
/*-----------------------------------------------------------*/
import com.ibm.nzna.shared.db.* ;
import com.ibm.nzna.shared.util.* ;
import com.ibm.nzna.projects.common.quest.type.* ;
import java.sql.* ;
import java.util.* ;
/**
* This Java program will convert the old Quest 5.x type tables
* to the new Quest 6.0 TypeCategory table. Currently this Batch
* program will convert the following tables:
*
* TIGRIS.TYPEBRAND
* TIGRIS.TYPEGROUP
* TIGRIS.TYPECATEGORY
*
*
* @version 1.0, 5/11/2001
* @author David Lentz
*/
/*-----------------------------------------------------------*/
/* */
/* tConvert */
/* */
/*-----------------------------------------------------------*/
public class tConvert extends Object {
/**
* This main method will kick off the merge. The only
* params needed are the database name, database server and
* database port number for the Quest 6.0 Database
**/
public static void main ( String args[] ) {
/*-----------------------------------------------------------*/
/* */
/* If we don't have all of the args, exit */
/* */
/*-----------------------------------------------------------*/
if ( ( args == null ) || ( args.length < 3 ) ) {
System.out.println ( "Usage: java com.ibm.nzna.projects.tcon.tConvert " ) ;
System.exit(-1) ;
}
/*-----------------------------------------------------------*/
/* */
/* Initialize a Log System */
/* */
/*-----------------------------------------------------------*/
new LogSystem ( 1, "tcon.out" ) ;
/*-----------------------------------------------------------*/
/* */
/* Connect to the database */
/* */
/*-----------------------------------------------------------*/
if ( connectToDatabase ( args[0], args[1], args[2] ) ) {
new TypeCategory() ;
/*-----------------------------------------------------------*/
/* */
/* Remove data from tables we will work with */
/* */
/*-----------------------------------------------------------*/
removePreData() ;
//checkDupsInMultimedia ( "TIGRIS" ) ;
//checkDupsInMultimedia ( "QUEST" ) ;
//if ( mergeGraphics() ) {
// if ( mergeFiles() ) {
if ( processBrands() ) {
if ( processFamilies() ) {
if ( processCategories() ) {
if ( mergeOldDocumentCategories() ) {
TypeCategory.writeToDatabase() ;
}
}
}
}
// }
//}
createMiscTypes() ;
DatabaseSystem.shutdown() ;
}
System.exit(0) ;
}
/**
* This method will connect to the database. It will return TRUE if a connection
* was established
*/
private static boolean connectToDatabase ( String databaseName, String server, String port ) {
boolean rc = false ;
try {
new DatabaseSystem ( true, LogSystem.getInstance(), false ) ;
rc = DatabaseSystem.createConnection ( DatabaseSystem.QUEST,
databaseName,
server,
port,
"quest",
"j0hnny" ) ;
DatabaseSystem.setAutoDisconnect ( false ) ;
DatabaseSystem.setAllowMultipleConnections ( false ) ;
LogSystem.log ( 1, "Connected to database "+databaseName+" on Server "+server ) ;
} catch ( Exception e ) {
rc = false ;
LogSystem.log ( 1, e, false ) ;
}
return( rc ) ;
}
/**
* This method will move all current TIGRIS.TYPEBRAND entries to the new TypeCategory Schema
**/
private static boolean processBrands () {
boolean rc = false ;
SQLMethod sqlMethod = new SQLMethod ( DatabaseSystem.QUEST, "processBrands", 5 ) ;
try {
Statement stmt = sqlMethod.createStatement() ;
ResultSet rs = stmt.executeQuery ( "SELECT BRANDIND, DESCRIPT, OWNER FROM TIGRIS.TYPEBRAND where brandind > 0" ) ;
int i = 0 ;
while ( rs.next() ) {
LogSystem.log ( 1, "Creating Brand "+rs.getString(2).trim() ) ;
TypeCategory.createTypeCategory ( rs.getInt(1),
0,
rs.getString(2).trim(),
TypeCategory.LEVEL_BRAND,
0,
"N",
rs.getString(3).trim() ) ;
TypeCategory.createDraftTypeCategory ( rs.getInt(1),
0,
rs.getString(2).trim(),
TypeCategory.LEVEL_BRAND,
0,
"N",
rs.getString(3).trim() ) ;
i++ ;
}
System.out.println ( "Created "+i+" Brands" ) ;
rs.close() ;
rc = true ;
} catch ( Exception e ) {
LogSystem.log ( 1, e, false ) ;
sqlMethod.rollBack() ;
}
sqlMethod.close() ;
return( rc ) ;
}
/**
* This method will process the Families in Quest
**/
private static boolean processFamilies () {
boolean rc = false ;
SQLMethod sqlMethod = new SQLMethod ( DatabaseSystem.QUEST, "processFamilies", 5 ) ;
try {
int i = 0 ;
Statement stmt = sqlMethod.createStatement() ;
ResultSet rs = stmt.executeQuery ( "SELECT TYPEBRAND.DESCRIPT, TYPEGROUP.DESCRIPT,TYPEGROUP.OWNER, TYPEGROUP.GROUPIND "+
"FROM TIGRIS.TYPEBRAND TYPEBRAND, "+
" TIGRIS.TYPEGROUP TYPEGROUP, "+
" TIGRIS.BRANDS BRANDS "+
"WHERE TYPEBRAND.BRANDIND = BRANDS.BRANDIND AND "+
" TYPEGROUP.GROUPIND = BRANDS.GROUPIND AND TYPEBRAND.BRANDIND > 0 " ) ;
while ( rs.next() ) {
LogSystem.log ( 1, "Creating Family "+rs.getString(2).trim()+" under Brand "+rs.getString(1) ) ;
TypeCategoryRec family = TypeCategory.createTypeCategory ( TypeCategory.getCategoryFromDescription ( rs.getString(1).trim() ).getInd(),
rs.getString(2).trim(),
TypeCategory.LEVEL_FAMILY,
0,
"N",
rs.getString(3).trim() ) ;
TypeCategory.createDraftTypeCategory ( family.getInd(),
TypeCategory.getCategoryFromDescription ( rs.getString(1).trim() ).getInd(),
rs.getString(2).trim(),
TypeCategory.LEVEL_FAMILY,
0,
"N",
rs.getString(3).trim() ) ;
i++ ;
}
System.out.println ( "Created "+i+" Families" ) ;
rs.close() ;
rc = true ;
} catch ( Exception e ) {
LogSystem.log ( 1, e, false ) ;
sqlMethod.rollBack() ;
}
sqlMethod.close() ;
return( rc ) ;
}
/**
* This method will read in all information from the TIGRIS.TYPEDOCCAT and will create an entry
* in the typecategory table under each brand for each category.
*/
private static boolean processCategories() {
SQLMethod sqlMethod = new SQLMethod ( DatabaseSystem.QUEST, "processCategories", 5 ) ;
boolean rc = false ;
try {
Statement stmt = sqlMethod.createStatement() ;
ResultSet rs = stmt.executeQuery ( "SELECT DESCRIPT FROM TIGRIS.TYPEDOCCAT" ) ;
Vector brands = TypeCategory.getCategories ( TypeCategory.LEVEL_BRAND ) ;
int i = 0 ;
int j = 0 ;
int k = 0 ;
while ( rs.next() ) {
i=0 ;
while ( i < brands.size() ) {
if ( !((TypeCategoryRec)brands.elementAt(i)).getIsDraft() ) {
TypeCategory.createTypeCategory ( ((TypeCategoryRec)brands.elementAt(i)).getInd(),
rs.getString(1).trim(),
TypeCategory.LEVEL_DOC_CATEGORY,
0,
"N",
"QUEST" ) ;
j++ ;
}
i++ ;
}
k++ ;
}
System.out.println ( "Created "+j+" Categories. "+k+" Unique" ) ;
rc = true ;
rs.close() ;
} catch ( Exception e ) {
LogSystem.log ( 1, e, false ) ;
sqlMethod.close() ;
rc= false ;
}
sqlMethod.close() ;
return( rc ) ;
}
/**
* This method will make an entry in the new QUEST.CATEGORY and TIGRIS.CATEGORY tables
* taking the data from the old TIGRIS.DOCCATEGORY and QUEST.DOCCATEGORY table. This essentially
* will move all of the Document Category associations into the new schema
*/
private static boolean mergeOldDocumentCategories () {
return ( true ) ;
// return( ( mergeOldDocumentCategories ( "TIGRIS" ) ) &&
// ( mergeOldDocumentCategories ( "QUEST" ) ) ) ;
}
//private static boolean mergeOldDocumentCategories ( String qualifier ) {
// Vector brands = TypeCategory.getCategories ( TypeCategory.LEVEL_BRAND ) ;
// boolean rc = false ;
// int i = 0 ;
// int size = brands.size() ;
// /*-----------------------------------------------------------*/
// /* */
// /* Walk through the list of brands, reading all documents */
// /* for each brand and processing each document */
// /* */
// /*-----------------------------------------------------------*/
// while ( i < size ) {
// TypeCategoryRec brand = (TypeCategoryRec)brands.elementAt(i) ;
// System.out.println ( "Reading all "+qualifier+" "+brand.toString()+" docs" ) ;
// Vector docInds = getDocumentsUnderBrand ( brand, qualifier ) ;
// i++ ;
// }
//
// return( rc ) ;
//}
//private static Vector getDocumentsUnderBrand ( TypeCategoryRec brand, String qualifier ) {
// SQLMethod sqlMethod = new SQLMethod ( DatabaseSystem.QUEST, "getDocs", 5 ) ;
// try {
// Statement stmt = sqlMethod.createStatement() ;
// ResultSet rs = stmt.executeQuery ( "SELECT DISTINCT (A.DOCIND ) "+
// "FROM "+qualifier+".DOCUMENTS A, "+
// " "+qualifier+".CATEGORY B, "+
// " "+qualifier+".TYPECATEGORY C, "+
// " "+qualifier+".TYPECATCHILD D "+
// "WHERE C.TYPECATIND = "+brand.getInd()+" AND "+
// " D.PARENTCATIND = C.TYPECATIND AND "+
// " B.TYPECATIND = D.TYPECATIND AND "+
// "
// } catch ( Exception e ) {
// LogSystem.log ( 1, e, false ) ;
// e.printStackTrace() ;
// System.exit(0) ;
// }
//}
/**
* This method will take all of the data from the TIGRIS.GRAPHICS/TIGRIS.DOCGRAPHIC
* and will put the data in the TIGNEW.GRAPHICS table
*/
private static boolean mergeGraphics () {
SQLMethod sqlMethod = new SQLMethod ( DatabaseSystem.QUEST, "mergeGraphics", 5 ) ;
boolean rc = false ;
try {
Statement stmt = sqlMethod.createStatement() ;
System.out.println ( "\n\nMerging Graphics" ) ;
stmt.execute ( "INSERT INTO TIGNEW.GRAPHICS SELECT DISTINCT A.DOCIND, FILENAME "+
"FROM TIGRIS.DOCGRAPHIC A, TIGRIS.GRAPHICS B "+
"WHERE A.GRAPHICIND = B.GRAPHICIND" ) ;
stmt.execute ( "INSERT INTO QUESTNEW.GRAPHICS SELECT DISTINCT A.DOCIND, FILENAME "+
"FROM QUEST.DOCGRAPHIC A, TIGRIS.GRAPHICS B "+
"WHERE A.GRAPHICIND = B.GRAPHICIND" ) ;
rc = true ;
LogSystem.log ( 1, "Graphics Merged Succesfully" ) ;
} catch ( Exception e ) {
LogSystem.log ( 1, e, false ) ;
sqlMethod.close() ;
rc= false ;
}
sqlMethod.close() ;
return( rc ) ;
}
/**
* This method will take all of the data from the TIGRIS.DOCMEDIA/TIGRIS.MULTIMEDIA
* and will put the data in the TIGRIS.DOCFILES table
*/
private static boolean mergeFiles () {
SQLMethod sqlMethod = new SQLMethod ( DatabaseSystem.QUEST, "mergeFiles", 5 ) ;
boolean rc = false ;
try {
Statement stmt = sqlMethod.createStatement() ;
System.out.println ( "Merging Files" ) ;
stmt.executeUpdate ( "INSERT INTO TIGRIS.DOCFILES "+
"SELECT DISTINCT DOCIND, FILENAME, GENINFO, SIZE, FILEURL, FILEVERSION, 0, 0 "+
"FROM TIGRIS.DOCMEDIA A, TIGRIS.MULTIMEDIA B "+
"WHERE A.MULTIMEDIAIND = B.MULTIMEDIAIND" ) ;
stmt.executeUpdate ( "INSERT INTO QUEST.DOCFILES "+
"SELECT DISTINCT DOCIND, FILENAME, GENINFO, SIZE, FILEURL, FILEVERSION, 0, 0 "+
"FROM QUEST.DOCMEDIA A, TIGRIS.MULTIMEDIA B "+
"WHERE A.MULTIMEDIAIND = B.MULTIMEDIAIND" ) ;
rc = true ;
LogSystem.log ( 1, "Files Merged Succesfully" ) ;
} catch ( Exception e ) {
LogSystem.log ( 1, e, false ) ;
sqlMethod.close() ;
rc= false ;
}
sqlMethod.close() ;
return( rc ) ;
}
public static void checkDupsInMultimedia ( String schema) {
Hashtable hash = new Hashtable () ;
Vector deleteItems = new Vector ( 1 ) ;
SQLMethod sqlMethod = new SQLMethod ( DatabaseSystem.QUEST, "mergeFiles", 5 ) ;
boolean rc = false ;
try {
Statement stmt = sqlMethod.createStatement() ;
int count = 0 ;
ResultSet rs = stmt.executeQuery ( "SELECT A.DOCIND, B.FILENAME, B.MULTIMEDIAIND FROM "+schema+".DOCMEDIA A, TIGRIS.MULTIMEDIA B where A.multimediaind = b.multimediaind" ) ;
while ( rs.next() ) {
String key = rs.getInt(1)+rs.getString(2).trim() ;
if ( hash.get ( key ) != null ) {
System.out.println ( "Duplicate Found, deleting! "+key ) ;
deleteItems.addElement ( ""+rs.getInt(3) ) ;
} else {
hash.put ( key, key ) ;
count++ ;
}
}
System.out.println ( "Finished sorting through schema "+schema+" and "+count+" Multimedia associations were found. "+deleteItems.size()+" duplicate(s)" ) ;
if ( ( deleteItems != null ) && ( deleteItems.size() > 0 ) ) {
int i = 0 ;
int size = deleteItems.size() ;
while ( i < size ) {
stmt.executeUpdate ( "DELETE FROM TIGRIS.DOCMEDIA where multimediaind = "+((String)deleteItems.elementAt(i)).toString() ) ;
stmt.executeUpdate ( "DELETE FROM QUEST.DOCMEDIA where multimediaind = "+((String)deleteItems.elementAt(i)).toString() ) ;
stmt.executeUpdate ( "DELETE FROM TIGRIS.MULTIMEDIA where multimediaind = "+((String)deleteItems.elementAt(i)).toString() ) ;
i++ ;
}
}
rc = true ;
LogSystem.log ( 1, "Files Merged Succesfully" ) ;
} catch ( Exception e ) {
LogSystem.log ( 1, e, false ) ;
sqlMethod.close() ;
rc= false ;
}
sqlMethod.close() ;
}
/**
* This method will create all of the misc. type entries for us
*/
private static boolean createMiscTypes () {
SQLMethod sqlMethod = new SQLMethod ( DatabaseSystem.QUEST, "createMiscTypes", 5 ) ;
boolean rc = false ;
try {
Statement stmt = sqlMethod.createStatement() ;
//stmt.executeUpdate ( "INSERT INTO PRODUCT.TYPEPRODUCT VALUES ( 1, 'System')" ) ;
//stmt.executeUpdate ( "INSERT INTO PRODUCT.TYPEPRODUCT VALUES ( 2, 'Option')" ) ;
//stmt.executeUpdate ( "INSERT INTO PRODUCT.TYPEPRODUCT VALUES ( 3, 'Monitor')" ) ;
rc = true ;
LogSystem.log ( 1, "Files Merged Succesfully" ) ;
} catch ( Exception e ) {
LogSystem.log ( 1, e, false ) ;
sqlMethod.close() ;
rc= false ;
}
sqlMethod.close() ;
return( rc ) ;
}
/**
* This method will remove data from tables we insert into
*/
private static boolean removePreData () {
SQLMethod sqlMethod = new SQLMethod ( DatabaseSystem.QUEST, "createMiscTypes", 5 ) ;
boolean rc = false ;
try {
Statement stmt = sqlMethod.createStatement() ;
stmt.executeUpdate ( "DELETE FROM PRODUCT.CATEGORY" ) ;
stmt.executeUpdate ( "DELETE FROM PRODUCT.GEO" ) ;
stmt.executeUpdate ( "DELETE FROM PRODUCT.COUNTRY" ) ;
stmt.executeUpdate ( "DELETE FROM PRODUCT.PRODUCT" ) ;
stmt.executeUpdate ( "DELETE FROM PRODRAFT.CATEGORY" ) ;
stmt.executeUpdate ( "DELETE FROM PRODRAFT.GEO" ) ;
stmt.executeUpdate ( "DELETE FROM PRODRAFT.COUNTRY" ) ;
stmt.executeUpdate ( "DELETE FROM PRODRAFT.PRODUCT" ) ;
stmt.executeUpdate ( "DELETE FROM TIGRIS.DOCFILES" ) ;
stmt.executeUpdate ( "DELETE FROM QUEST.DOCFILES" ) ;
stmt.executeUpdate ( "DELETE FROM PRODUCT.TYPECATCHILD" ) ;
stmt.executeUpdate ( "DELETE FROM PRODRAFT.TYPECATCHILD" ) ;
stmt.executeUpdate ( "DELETE FROM PRODUCT.TYPECATEGORY" ) ;
stmt.executeUpdate ( "DELETE FROM PRODRAFT.TYPECATEGORY" ) ;
stmt.executeUpdate ( "DELETE FROM PRODUCT.TYPEPRODUCT" ) ;
stmt.executeUpdate ( "DELETE FROM TIGNEW.GRAPHICS" ) ;
stmt.executeUpdate ( "DELETE FROM QUESTNEW.GRAPHICS" ) ;
stmt.executeUpdate ( "DELETE FROM PRODUCT.TYPEOFFERING" ) ;
stmt.executeUpdate ( "DELETE FROM PRODUCT.TYPECUSTOMER" ) ;
stmt.executeUpdate ( "DELETE FROM PRODRAFT.TYPECANCEL" ) ;
stmt.executeUpdate ( "DELETE FROM PRODUCT.TYPEWARRANTY" ) ;
stmt.executeUpdate ( "DELETE FROM PRODUCT.TYPEDATE" ) ;
stmt.executeUpdate ( "DELETE FROM PRODUCT.TYPEXREF" ) ;
stmt.executeUpdate ( "INSERT INTO PRODUCT.TYPECATEGORY values ( 0, 'Default Brand', 0, 'brand', 0, 'N', 'quest', 'N')" ) ;
stmt.executeUpdate ( "INSERT INTO PRODRAFT.TYPECATEGORY values ( 0, 'Default Brand', 0, 'brand', 0, 'N', 'quest', 'N')" ) ;
stmt.executeUpdate ( "INSERT INTO PRODUCT.TYPEOFFERING values ( 0, 'Default Offering' )" ) ;
stmt.executeUpdate ( "INSERT INTO PRODUCT.TYPEOFFERING values ( 1, 'CTO Offering' )" ) ;
stmt.executeUpdate ( "INSERT INTO PRODUCT.TYPECUSTOMER values ( 0, 'Default Customer' )" ) ;
stmt.executeUpdate ( "INSERT INTO PRODRAFT.TYPECANCEL values ( 0, 'I dont''t Know')" ) ;
stmt.executeUpdate ( "INSERT INTO PRODUCT.TYPEWARRANTY values ( 0, 'Unknown', 'Unknown' )" ) ;
stmt.executeUpdate ( "DELETE FROM TIGRIS.COUNTER WHERE COUNTER = 'TYPECATIND' " ) ;
stmt.executeUpdate ( "DELETE FROM TIGRIS.COUNTER WHERE COUNTER = 'DCATIND' " ) ;
stmt.executeUpdate ( "DELETE FROM TIGRIS.COUNTER WHERE COUNTER = 'TYPEOFFER' " ) ;
stmt.executeUpdate ( "DELETE FROM TIGRIS.COUNTER WHERE COUNTER = 'TYPEWARR' " ) ;
stmt.executeUpdate ( "DELETE FROM TIGRIS.COUNTER WHERE COUNTER = 'TYPECUST' " ) ;
stmt.executeUpdate ( "DELETE FROM TIGRIS.COUNTER WHERE COUNTER = 'TYPEPROD' " ) ;
stmt.executeUpdate ( "DELETE FROM TIGRIS.COUNTER WHERE COUNTER = 'TYPECNCL' " ) ;
stmt.executeUpdate ( "DELETE FROM TIGRIS.COUNTER WHERE COUNTER = 'PRODRAFT' " ) ;
stmt.executeUpdate ( "DELETE FROM TIGRIS.COUNTER WHERE COUNTER = 'TYPECATIND'" ) ;
stmt.executeUpdate ( "DELETE FROM TIGRIS.COUNTER WHERE COUNTER = 'TYPEDATE'" ) ;
stmt.executeUpdate ( "DELETE FROM TIGRIS.COUNTER WHERE COUNTER = 'TYPEOFFER'" ) ;
stmt.executeUpdate ( "DELETE FROM TIGRIS.COUNTER WHERE COUNTER = 'PRODUCT'" ) ;
stmt.executeUpdate ( "INSERT INTO TIGRIS.COUNTER values ( 'TYPECATIND', 50000, user, current timestamp)" ) ;
stmt.executeUpdate ( "INSERT INTO TIGRIS.COUNTER values ( 'DCATIND', 50000, user, current timestamp)" ) ;
stmt.executeUpdate ( "INSERT INTO TIGRIS.COUNTER values ( 'TYPEDATE', 3, user, current timestamp)" ) ;
stmt.executeUpdate ( "INSERT INTO TIGRIS.COUNTER values ( 'TYPEOFFER', 3, user, current timestamp)" ) ;
stmt.executeUpdate ( "INSERT INTO TIGRIS.COUNTER values ( 'TYPEWARR', 1, user, current timestamp)" ) ;
stmt.executeUpdate ( "INSERT INTO TIGRIS.COUNTER values ( 'TYPECUST', 3, user, current timestamp)" ) ;
stmt.executeUpdate ( "INSERT INTO TIGRIS.COUNTER values ( 'TYPEPROD', 4, user, current timestamp)" ) ;
stmt.executeUpdate ( "INSERT INTO TIGRIS.COUNTER values ( 'TYPECNCL', 4, user, current timestamp)" ) ;
stmt.executeUpdate ( "INSERT INTO TIGRIS.COUNTER values ( 'PRODRAFT', 100, user, current timestamp)" ) ;
stmt.executeUpdate ( "INSERT INTO TIGRIS.COUNTER values ( 'PRODUCT', 50000, user, current timestamp)" ) ;
stmt.executeUpdate ( "INSERT INTO PRODUCT.TYPEOFFERING values ( 0, 'Default Offering')" ) ;
stmt.executeUpdate ( "INSERT INTO PRODUCT.TYPEDATE values ( 0, 'Default Date')" ) ;
stmt.executeUpdate ( "INSERT INTO PRODUCT.TYPEDATE values ( 1, 'Target')" ) ;
stmt.executeUpdate ( "INSERT INTO PRODUCT.TYPEDATE values ( 2, 'Actual')" ) ;
stmt.executeUpdate ( "INSERT INTO PRODUCT.TYPEXREF values ( 1, 'FRU Part')" ) ;
stmt.executeUpdate ( "INSERT INTO PRODUCT.TYPEXREF values ( 2, 'CRU Part')" ) ;
stmt.executeUpdate ( "INSERT INTO PRODUCT.TYPEPRODUCT values ( 0, 'Default Product')" ) ;
stmt.executeUpdate ( "INSERT INTO PRODUCT.TYPEPRODUCT values ( 1, 'System' )" ) ;
stmt.executeUpdate ( "INSERT INTO PRODUCT.TYPEPRODUCT values ( 2, 'Option' )" ) ;
stmt.executeUpdate ( "INSERT INTO PRODUCT.TYPEPRODUCT values ( 3, 'Monitor' )" ) ;
stmt.executeUpdate ( "INSERT INTO PRODRFT.TYPECANCEL values ( 0, 'Default' )" ) ;
stmt.executeUpdate ( "DELETE FROM TIGRIS.CONSTANTS WHERE CONSTANT = 'BMP_ANNOUNCE_DAYS'" ) ;
stmt.executeUpdate ( "INSERT INTO TIGRIS.CONSTANTS VALUES ( 'BMP_ANNOUNCE_DAYS', 14, '', 'ProdGen', user, current timestamp)" ) ;
stmt.executeUpdate ( "DELETE FROM TIGRIS.CONSTANTS WHERE CONSTANT = 'PRODGEN_TIMESTAMP'" ) ;
stmt.executeUpdate ( "INSERT INTO TIGRIS.CONSTANTS VALUES ( 'PRODGEN_TIMESTAMP', 0, '2001-07-10-07.00.00.000000', 'ProdGen', user, current timestamp)" ) ;
rc = true ;
LogSystem.log ( 1, "Database Primed Succesfully" ) ;
} catch ( Exception e ) {
LogSystem.log ( 1, e, false ) ;
sqlMethod.close() ;
rc= false ;
}
sqlMethod.close() ;
return( rc ) ;
}
public static void readBrands () {
long startTime = System.currentTimeMillis() ;
Vector brands = TypeCategory.getCategories ( TypeCategory.LEVEL_BRAND ) ;
if ( brands != null ) {
int i = 0 ;
int size = brands.size() ;
while ( i < size ) {
System.out.println ( i+": "+brands.elementAt(i) ) ;
i++ ;
}
}
System.out.println ( "Reading Brands Took "+((System.currentTimeMillis()-startTime))+"(ms)" ) ;
startTime = System.currentTimeMillis() ;
brands = TypeCategory.getCategories ( TypeCategory.LEVEL_FAMILY ) ;
if ( brands != null ) {
int i = 0 ;
int size = brands.size() ;
while ( i < size ) {
System.out.println ( i+": "+brands.elementAt(i) ) ;
i++ ;
}
}
System.out.println ( "Reading Families Took "+((System.currentTimeMillis()-startTime))+"(ms)" ) ;
}
} /* tConvert */