com.ptc.windchill.repairtools.multiplePrimaries
Class RunPrimaryFix

java.lang.Object
  extended bycom.ptc.windchill.repairtools.multiplePrimaries.RunPrimaryFix

public class RunPrimaryFix
extends Object

Combines together the calling of the various fix tools into one class to cleanup a data corruption issue where multiple primaries have been associated with one document. This corruption can happen when the multipl iterations/versions of a document are created using the loader in 6.2.6 DSU 6 and 7.0 (before the general patch) or in customizations prior to that. A patch went into both 6.2.6 DSU 7 and the 7.0 general patch that should stop this condition from happening anymore, however existing customizations that have this problem and are not corrected could continue to create multiple primaries if they are not corrected.

Please verify the data using the report part of the tool described below to make sure that the correct files are deleted. Error conditions to look for are if you have loaded versions/iterations out of sequence, this tool will not help cleanup those documents.

1. BACKUP THE DATABASE.

2. INSTALL FIX TOOLS: Put the following files in Windchill\codebase\com\ptc\windchill\repairtools\multiplePrimaries. PrimaryFix.class PrimaryFix$FileEntry.class PrimaryFix$DocIteration.class RunPrimaryFix.class

Create a directory to run the tools from. Put primaryfix_csvmap.txt and default.csv in that directory. Go to that directory.

3. CHECK FOR MULTIPLE PRIMARIES: Run the following in the directory that you created in step 2: windchill com.ptc.windchill.repairtools.multiplePrimaries.RunPrimaryFix -report c:\Temp\primaryfix

You will be prompted to login, use your administrator id and password. The administrator must have access to read/delete all of the documents in Windchill or this will not work. Where c:\Temp\primaryfix is the path and base of a filename to put the reports in. Any complete filename path or base may be used. This is just an example used in this documentation. Three files are created. primaryfix_report.csv is a quick list of any documents that have multiple primaries. The querying is broken up into two parts so that the full analysis is only performed on the documents in the database that have multiple primaries. So if this query finds no multiple primaries then none of the three files are created. primaryfix_output.html contains information in a readable format that can be read either in a browser or in Excel. This file should be reviewed for multiple primaries that need to be deleted and also to make sure that the tool has identified the right files before deleting the files. primaryfix_delete.csv is an output that is read by the second option of this tool to delete the files that are extra primary files.

4. VERIFY THE RESULTS: Open primaryfix_output.html in Excel or a web browser and verify that the output is correct. How to interpret primaryfix_output.html. Read through the results and verify that the files that have TRUE in the Delete column are the files that should be deleted for each iteration/version of the document. The columns are defined as the following, order should be the order that the document iterations/versions were created and also the correct linear order for the versions. Number is the number of the document. Master OID is the internal ID of the record that links all of the documents iterations/versions together as one document. The Version OID is the internal id of that particular iteration of the document. Version is the version(iteration) of the document. Filename lists all of the primaries files associated to this instance of the document. AD OID is the internal id of the record that links the iteration of the document to the content. There is a specific AD OID for each file that is associated with the iteration of a document. The Stream OID is the internal id of the file that is stored in the system. There is only one copy of the file in the database, but multiple iterations of a document can point to the same file. The Delete? column is used to show which ones this tool has determined are duplicates. Documents that the tool analyzes and finds that all primary files should be deleted from it because they are duplicates, will be listed with a warning message in red. These documents will have to be analyzed manually to determine which files are correct for that iteration. This type of situation can happen if documents are created out of version/iteration sequence. It can also happen if the original load failed to attach a file to a particular version/iteration of the document or there was no new data file for that version/iteration.

5. DELETE THE EXTRA FILES: From the directory that you created in step 2, run: windchill com.ptc.windchill.repairtools.multiplePrimaries.RunPrimaryFix -delete c:\Temp\primaryfix

6. RERUN THE CHECK FOR MULTIPLE PRIMARIES: Rerun the command from step 3 to see if there are any multiple primaries left. If you loaded versions/iterations out of sequence this tool will not be able to clear the primaries off of all of those documents. USE A NEW FILENAME, OTHERWISE IT WILL DISPLAY AN ERROR MESSAGE. windchill com.ptc.windchill.repairtools.multiplePrimaries.RunPrimaryFix -report c:\Temp\doublecheck

This class and methods are only supported for the purpose defined in this javadoc, it will not be part the regular codebase in any release.

See Also:
StandardLoadService

Field Summary
private static ResourceBundle rb
          Resource bundle object for localizing message text
private static String RESOURCE
           
static boolean VERBOSE
          Flag to control verbose debugging output during document loading.
 
Constructor Summary
RunPrimaryFix()
           
 
Method Summary
private static void deleteMultiplePrimaries(String baseFilename)
           
static void main(String[] args)
           
private static void printNoExtraPrimaries()
           
private static void printWarning(String info)
           
private static boolean queryForMultiplePrimaries(String baseFilename)
           
private static void reportOnMultiplePrimaries(String baseFilename)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RESOURCE

private static String RESOURCE

rb

private static ResourceBundle rb
Resource bundle object for localizing message text


VERBOSE

public static boolean VERBOSE
Flag to control verbose debugging output during document loading. This constant is controlled via wt.properties file entry
wt.doc.load.verbose

The default value is false.

Constructor Detail

RunPrimaryFix

public RunPrimaryFix()
Method Detail

main

public static void main(String[] args)
                 throws Exception
Throws:
Exception

queryForMultiplePrimaries

private static boolean queryForMultiplePrimaries(String baseFilename)
                                          throws WTException
Throws:
WTException

printWarning

private static void printWarning(String info)

printNoExtraPrimaries

private static void printNoExtraPrimaries()

reportOnMultiplePrimaries

private static void reportOnMultiplePrimaries(String baseFilename)

deleteMultiplePrimaries

private static void deleteMultiplePrimaries(String baseFilename)
                                     throws WTException
Throws:
WTException