wt.step.processor
Class WTStepProcessor

java.lang.Object
  extended bywt.step.processor.StepProcessor
      extended bywt.step.processor.WTStepProcessor

public class WTStepProcessor
extends StepProcessor

Extends the StepProcessor functionality to manage the import and export of STEP related files through packaged archives attached to WTDocuments as content.

See Also:
StepProcessor

Field Summary
private static WTStepProcessor _theInstance
           
 
Fields inherited from class wt.step.processor.StepProcessor
 
Constructor Summary
private WTStepProcessor()
          Access only through getInstance() as a Singleton.
 
Method Summary
 void export(ExportSelection exportSelection)
          Extends the StepProcessor to package up the generated STEP file and add it as primary content to a WTDocument.
private  void extractContentToDirectory(WTDocument doc, File dir)
          Extract the first content item of the given document as a package file, into the given directory.
private  File findBaseStepFile(File dir)
          Finds the STEP file for a zip file import.
static String getConversionLog()
           
static String[] getExportSchemaNames()
           
static String[] getImportFileList(WTDocument doc)
          Gets a list of all files in the ZIP file excluding directories and the first STEP (.stp) file in the base directory.
static String[] getImportSchemaNames()
           
static WTStepProcessor getInstance()
          Get the one and only instance of the WTStepProcessor
private static InputStream getPackageFileContentStream(WTDocument doc)
          Accesses the first content item of the given document as an InputStream.
private  File getTempDir()
          Create a temporary directory file.
 void importStepFile(WTDocument stepFilesHolder, String importSchema, ImportScheme versionsImportScheme, String importFolder, String[] importFilesList, ManagedBaseline baseline)
          Extends the StepProcessor functionality to import from a WTDocument rather than a file directory structure.
(package private) static String[] listWithoutStpFile(String[] originalList)
           
private  void packageAndAddToDocument(WTDocument document, File contentDir, String exportName)
          Build a package file from the exported directory structure and upload it as primary content of the given document.
 
Methods inherited from class wt.step.processor.StepProcessor
exportObjects, getImportedInstances, importStepFile
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_theInstance

private static WTStepProcessor _theInstance
Constructor Detail

WTStepProcessor

private WTStepProcessor()
                 throws TransferException
Access only through getInstance() as a Singleton.

Method Detail

getInstance

public static final WTStepProcessor getInstance()
                                         throws TransferException
Get the one and only instance of the WTStepProcessor

Throws:
TransferException

getExportSchemaNames

public static String[] getExportSchemaNames()
                                     throws TransferException
Throws:
TransferException
See Also:
SchemaConverter.getExportSchemaNames()

getImportSchemaNames

public static String[] getImportSchemaNames()
                                     throws TransferException
Throws:
TransferException
See Also:
SchemaConverter.getImportSchemaNames()

export

public void export(ExportSelection exportSelection)
            throws TransferException
Extends the StepProcessor to package up the generated STEP file and add it as primary content to a WTDocument.

Parameters:
exportSelection - What and where to export.
Throws:
TransferException

packageAndAddToDocument

private void packageAndAddToDocument(WTDocument document,
                                     File contentDir,
                                     String exportName)
                              throws TransferException
Build a package file from the exported directory structure and upload it as primary content of the given document.

Throws:
TransferException

getTempDir

private File getTempDir()
Create a temporary directory file. This is created in the Windchill {wt.temp} directory.


importStepFile

public void importStepFile(WTDocument stepFilesHolder,
                           String importSchema,
                           ImportScheme versionsImportScheme,
                           String importFolder,
                           String[] importFilesList,
                           ManagedBaseline baseline)
                    throws TransferException
Extends the StepProcessor functionality to import from a WTDocument rather than a file directory structure. The first content file in the WTDocument is assumed to contain a package file of the STEP file and associated documents requiring import. The step file should be in the root directory and all associated files should be in subdirectories whose names match the ids of the documents are contents for.

Parameters:
stepFilesHolder - The WTDocument with the package file to be imported as content (primary or secondary).
baseline - Optional baseline for holding imported items.
Throws:
TransferException
See Also:
StepProcessor.importStepFile(java.lang.String, java.lang.String, wt.step.processor.ImportScheme, java.lang.String, java.lang.String[], wt.vc.baseline.ManagedBaseline)

extractContentToDirectory

private void extractContentToDirectory(WTDocument doc,
                                       File dir)
                                throws TransferException
Extract the first content item of the given document as a package file, into the given directory.

Throws:
TransferException

getPackageFileContentStream

private static InputStream getPackageFileContentStream(WTDocument doc)
                                                throws TransferException
Accesses the first content item of the given document as an InputStream.

Throws:
TransferException

findBaseStepFile

private File findBaseStepFile(File dir)
                       throws TransferException
Finds the STEP file for a zip file import. Once expanded into a directory it expected that there will be a single '.stp' file in the base directory.

Returns:
The first '.stp' file found in the given directory. If more than one is found then a warning is issued.
Throws:
Throws - a TransferException is no '.stp' file is found.
TransferException

getImportFileList

public static String[] getImportFileList(WTDocument doc)
                                  throws TransferException
Gets a list of all files in the ZIP file excluding directories and the first STEP (.stp) file in the base directory.

Throws:
TransferException

listWithoutStpFile

static String[] listWithoutStpFile(String[] originalList)

getConversionLog

public static String getConversionLog()
See Also:
SchemaConverter.getConversionLog()