wt.step.processor
Class ImportFromP21Processor

java.lang.Object
  extended bywt.step.processor.ImportFromP21Processor
Direct Known Subclasses:
ImportTest.MockImportProcessor

public class ImportFromP21Processor
extends Object

Process a Part21 file in order to import its content into Windchill. The import process is controlled by specifying one of the import tokens.

See Also:
ImportScheme

Field Summary
private  ManagedBaseline _baselineForImports
           
private  Hashtable _entityToInstanceMap
           
private  EntityTraverser _entityTraverser
           
private  Hashtable _importedInstancesRecord
           
private  String _importFolder
           
private  ImportScheme _importSchemeForVersions
           
private  String _importStepFilename
           
private  boolean _logImportReasoning
           
private static StringBuffer _sharedInstanceIdBuffer
          A buffer reused for constructing instance ids
private  String[] _uploadFilesFilter
          A collection of filenames for contents that should be uploaded, or null if all contents should be uploaded.
private  ExpressSchema _wtSchema
           
private static String CONTENT_ITEM_FILENAME
           
private static String CONTENT_ITEMS
           
private static String IDENTIFIER_SERIES
           
private static String ITERATION_IDENTIFIER
           
private static String ITERATION_INFO
           
private static String ITERATION_MASTER
           
private static String LINK_ROLE_A_OBJECT
           
private static String LINK_ROLE_B_OBJECT
           
private static String MASTER_NAME
           
private static String MASTER_NUMBER
           
private  Vector mkrObjectList
           
private  Vector mkrWarnings
           
private  boolean needCheckin
           
private  Workable roleA
           
private static String SERIES_VALUE
           
private static String VERSION_IDENTIFIER
           
private static String VERSION_INFO
           
 
Constructor Summary
ImportFromP21Processor(ExpressSchema wtSchema)
          Constructs the import engine ready for performing STEP imports
 
Method Summary
protected  void applyContentsUpload(ContentHandler contentHandler, FormatContentHolder contentHolder, String documentNumber, Vector contents)
           
private  RevisionControlled checkForAlreadyImported(Class masterClass, String masterNumber, String versionId, String iterationId)
           
private  void freeResourcesForGarbageCollection()
           
private  Vector getEntityContentItems(StepEntity stepIteration)
          For an Entity that has associated content items, this will return a Vector of their unique filenames (it is possible that the mapping process may lead to repeats being present).
private  String getEntityIterationId(StepEntity stepIteration)
          For an Entity that represents an iteration, this will return the iteration identifier.
private  String getEntityVersionId(StepEntity stepIteration)
          For an Entity that represents an iteration, this will return the version identifier.
 Vector getImportedInstances()
           
private  RevisionControlled importIteration(StepEntity stepIteration)
          Extracts the required information from the Step Data to enable a new iteration to be created, or an existing instance to be updated.
private  void importIterations(StepData p21data)
          Looks through the objects in the StepData for PartVersion subclasses which will be instantiated.
private  ObjectToObjectLink importLink(StepEntity stepLink, StepData sd)
          Extracts the required information from the Step Data to enable a new link to be created, or an existing instance to be updated.
private  void importLinks(StepData p21data)
           
 void importStepData(StepData p21data, ImportScheme importSchemeForVersions, String importFolder, String[] importFilesList, ManagedBaseline baseline)
          Import Windchill Schema data from a Part21 data set
 void importStepFile(String p21Filename, ImportScheme importSchemeForVersions, String importFolder, String[] importFilesList, ManagedBaseline baseline)
          Import Windchill Schema data from a Part21 STEP file
private  boolean isFilteredIn(String filename)
          Checks wether a given filename has been selected for upload as content.
private  Persistable mapEntityToWTInstance(StepEntity entity)
           
private  void recordEntityToInstanceMap(StepEntity entity, Object instance)
          Record a map of entity to instance so that further STEP references can be matched and repeated inports can be avoided.
private  void recordImportedIteration(StepEntity entity, RevisionControlled instance)
          Record an imported iteration in String form so that it can be matched against repetitions in the STEP file.
private  void recordInBaseline(Object item)
           
protected  void uploadAnyContentFiles(RevisionControlled iteration, StepEntity entity)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_wtSchema

private ExpressSchema _wtSchema

_entityToInstanceMap

private Hashtable _entityToInstanceMap

_importedInstancesRecord

private Hashtable _importedInstancesRecord

mkrObjectList

private Vector mkrObjectList

mkrWarnings

private Vector mkrWarnings

needCheckin

private boolean needCheckin

roleA

private Workable roleA

_sharedInstanceIdBuffer

private static StringBuffer _sharedInstanceIdBuffer
A buffer reused for constructing instance ids


ITERATION_MASTER

private static final String ITERATION_MASTER
See Also:
Constant Field Values

MASTER_NAME

private static final String MASTER_NAME
See Also:
Constant Field Values

MASTER_NUMBER

private static final String MASTER_NUMBER
See Also:
Constant Field Values

ITERATION_INFO

private static final String ITERATION_INFO
See Also:
Constant Field Values

ITERATION_IDENTIFIER

private static final String ITERATION_IDENTIFIER
See Also:
Constant Field Values

IDENTIFIER_SERIES

private static final String IDENTIFIER_SERIES
See Also:
Constant Field Values

SERIES_VALUE

private static final String SERIES_VALUE
See Also:
Constant Field Values

VERSION_INFO

private static final String VERSION_INFO
See Also:
Constant Field Values

VERSION_IDENTIFIER

private static final String VERSION_IDENTIFIER
See Also:
Constant Field Values

CONTENT_ITEMS

private static final String CONTENT_ITEMS
See Also:
Constant Field Values

CONTENT_ITEM_FILENAME

private static final String CONTENT_ITEM_FILENAME
See Also:
Constant Field Values

LINK_ROLE_A_OBJECT

private static final String LINK_ROLE_A_OBJECT
See Also:
Constant Field Values

LINK_ROLE_B_OBJECT

private static final String LINK_ROLE_B_OBJECT
See Also:
Constant Field Values

_entityTraverser

private EntityTraverser _entityTraverser

_importSchemeForVersions

private ImportScheme _importSchemeForVersions

_importFolder

private String _importFolder

_baselineForImports

private ManagedBaseline _baselineForImports

_logImportReasoning

private boolean _logImportReasoning

_importStepFilename

private String _importStepFilename

_uploadFilesFilter

private String[] _uploadFilesFilter
A collection of filenames for contents that should be uploaded, or null if all contents should be uploaded.

Constructor Detail

ImportFromP21Processor

public ImportFromP21Processor(ExpressSchema wtSchema)
                       throws WTException,
                              TransferException
Constructs the import engine ready for performing STEP imports

Method Detail

importStepFile

public void importStepFile(String p21Filename,
                           ImportScheme importSchemeForVersions,
                           String importFolder,
                           String[] importFilesList,
                           ManagedBaseline baseline)
                    throws WTException,
                           TransferException
Import Windchill Schema data from a Part21 STEP file

Throws:
WTException
TransferException

importStepData

public void importStepData(StepData p21data,
                           ImportScheme importSchemeForVersions,
                           String importFolder,
                           String[] importFilesList,
                           ManagedBaseline baseline)
                    throws WTException,
                           TransferException
Import Windchill Schema data from a Part21 data set

Throws:
WTException
TransferException

freeResourcesForGarbageCollection

private void freeResourcesForGarbageCollection()

importIterations

private void importIterations(StepData p21data)
                       throws WTException,
                              TransferException
Looks through the objects in the StepData for PartVersion subclasses which will be instantiated.

Throws:
WTException
TransferException

uploadAnyContentFiles

protected void uploadAnyContentFiles(RevisionControlled iteration,
                                     StepEntity entity)
                              throws TransferException
Throws:
TransferException

applyContentsUpload

protected void applyContentsUpload(ContentHandler contentHandler,
                                   FormatContentHolder contentHolder,
                                   String documentNumber,
                                   Vector contents)
                            throws TransferException
Throws:
TransferException

recordEntityToInstanceMap

private void recordEntityToInstanceMap(StepEntity entity,
                                       Object instance)
Record a map of entity to instance so that further STEP references can be matched and repeated inports can be avoided.


recordImportedIteration

private void recordImportedIteration(StepEntity entity,
                                     RevisionControlled instance)
                              throws TransferException
Record an imported iteration in String form so that it can be matched against repetitions in the STEP file. Note: It is the identities in the STEP file that are recorded rather than the identities of the imported instance as they may not match.

Throws:
TransferException

recordInBaseline

private void recordInBaseline(Object item)
                       throws TransferException
Throws:
TransferException

checkForAlreadyImported

private RevisionControlled checkForAlreadyImported(Class masterClass,
                                                   String masterNumber,
                                                   String versionId,
                                                   String iterationId)

getEntityVersionId

private String getEntityVersionId(StepEntity stepIteration)
                           throws TransferException
For an Entity that represents an iteration, this will return the version identifier. Otherwise it will throw an Error.

Throws:
TransferException

getEntityIterationId

private String getEntityIterationId(StepEntity stepIteration)
                             throws TransferException
For an Entity that represents an iteration, this will return the iteration identifier. If no iteration information is present (only version info!?) then null is returned.

Throws:
TransferException

getEntityContentItems

private Vector getEntityContentItems(StepEntity stepIteration)
                              throws TransferException
For an Entity that has associated content items, this will return a Vector of their unique filenames (it is possible that the mapping process may lead to repeats being present). If no content items are present then null is returned.

Parameters:
stepIteration - The Step representation of the contentHolder
Throws:
TransferException

isFilteredIn

private boolean isFilteredIn(String filename)
Checks wether a given filename has been selected for upload as content.


importIteration

private RevisionControlled importIteration(StepEntity stepIteration)
                                    throws TransferException
Extracts the required information from the Step Data to enable a new iteration to be created, or an existing instance to be updated.

Throws:
TransferException

importLinks

private void importLinks(StepData p21data)
                  throws WTException,
                         TransferException
Throws:
WTException
TransferException

mapEntityToWTInstance

private Persistable mapEntityToWTInstance(StepEntity entity)
                                   throws TransferException
Throws:
TransferException

importLink

private ObjectToObjectLink importLink(StepEntity stepLink,
                                      StepData sd)
                               throws TransferException
Extracts the required information from the Step Data to enable a new link to be created, or an existing instance to be updated.

Throws:
TransferException

getImportedInstances

public Vector getImportedInstances()