wt.ixb.publicforapps
Class Importer

java.lang.Object
  extended by wt.ixb.publicforapps.ExpImporter
      extended by wt.ixb.publicforapps.Importer

public class Importer
extends ExpImporter

Importer is the container representing import handlers for the context of the import operation. Importer instance is not stateless and there should be only one instance for each importer request.
To construct an instance of Importer use IxbHelper.newImport() with the desired signatures.
There are two major categories of methods in this class to execute import:



Supported API: true

Extendable: true


Field Summary
 
Fields inherited from class wt.ixb.publicforapps.ExpImporter
attributeExporterImporterManager, generalContext, ixbHandlersManager
 
Method Summary
 void addToModifiedObjects(Object oldId, Object newId)
          add new identity of imported object in the hashtable

Supported API: true
 IxbDocument doImport(InputStream docStream)
          Provides information for import.
 IxbDocument doImport(IxbDocument doc)
          Provides information for import.
 IxbDocument doImport(String docName, String docTag)
          Provides information for import.
 void finalizeImport()
          Really performs all work, especially the real import, related to the import based on the information, provided by previous calls of doImport methods: Checks the information from XML files for potential conflicts Creates Windchill objects

Supported API: true
 void finishImport()
          Call finalizeImport method to really performs all work, especially the real import, related to the import based on the information, provided by previous calls of doImport methods.
 IxbElement getElementForEndOfLink(IxbElement endXML, String endId)
          A link always has two ends, each end is represented by its ufid in the link's XML file.
 WTContainerRef getTargetContainerRef()
          Returns the container reference where the import is launched.
 void importElement(IxbElement doc)
          ATTENTION! This method can not be used directly from application.
 void logMessage(String resourceBundle, String messageKey, Object[] textInserts)
          Sends log message to export/import application

Supported API: true
 void logMessage(String resourceBundle, String messageKey, Object[] textInserts, int importanceLevel)
          Sends log message to export/import application

Supported API: true
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

doImport

public IxbDocument doImport(InputStream docStream)
                     throws WTException
Provides information for import. No real import will be done at that point.

Supported API: true

Parameters:
docStream - InputStream representing content of XML document to de imported
Returns:
IxbDocument
Throws:
WTException

doImport

public IxbDocument doImport(IxbDocument doc)
                     throws WTException
Provides information for import. No real import will be done at that point.

Supported API: true

Parameters:
doc - IxbDocument representing content of XML document to de imported
Returns:
IxbDocument
Throws:
WTException

doImport

public IxbDocument doImport(String docName,
                            String docTag)
                     throws WTException
Provides information for import. No real import will be done at that point.
This is an optimization: application additionally informs IXB service about root tag of XML document. This helps IXB to avoid additional XML parsing.
Replication and export/import application use this optimization

Supported API: true

Parameters:
docName - identifier of XML document to be imported. Application import handler must be able to return the XML document based on this identifier
docTag - tag of root element in this XML document.
Returns:
IxbDocument
Throws:
WTException

finalizeImport

public void finalizeImport()
                    throws WTException
Really performs all work, especially the real import, related to the import based on the information, provided by previous calls of doImport methods:

Supported API: true

Throws:
WTException

logMessage

public void logMessage(String resourceBundle,
                       String messageKey,
                       Object[] textInserts)
                throws WTException
Sends log message to export/import application

Supported API: true

Specified by:
logMessage in class ExpImporter
Parameters:
resourceBundle -
messageKey -
textInserts -
Throws:
WTException

logMessage

public void logMessage(String resourceBundle,
                       String messageKey,
                       Object[] textInserts,
                       int importanceLevel)
                throws WTException
Sends log message to export/import application

Supported API: true

Specified by:
logMessage in class ExpImporter
Parameters:
resourceBundle -
messageKey -
textInserts -
importanceLevel -
Throws:
WTException

finishImport

public void finishImport()
                  throws WTException
Call finalizeImport method to really performs all work, especially the real import, related to the import based on the information, provided by previous calls of doImport methods. The difference between finishImport and finalizeImport is the finishImport also cleans the Importer instance's cache and makes the it to be reusable. Therefore the Importer instance could be reused to enter a new importing cycle.

Supported API: true

Throws:
WTException

importElement

public void importElement(IxbElement doc)
                   throws WTException
ATTENTION! This method can not be used directly from application. Application can use 'doImport (IxbDocument)' only. Method 'importElement (IxbElement doc)'can be used from import handlers only to import inner elements of IxbDocument

Supported API: true

Throws:
WTException

addToModifiedObjects

public void addToModifiedObjects(Object oldId,
                                 Object newId)
add new identity of imported object in the hashtable

Supported API: true

Parameters:
oldId - identity of the object in the XML file,such as ufid, local Id... or it can be the object itself
newId - identity of the object that is newly created in the system,such as ufid, local Id... or it canbe the object itself
Since:
Windchill R6.2.6

getElementForEndOfLink

public IxbElement getElementForEndOfLink(IxbElement endXML,
                                         String endId)
                                  throws WTException
A link always has two ends, each end is represented by its ufid in the link's XML file. However, the information about the link's ends in the XML file may not be correct, if ufids of those ends are modified when they (the ends) are imported.
This method gets the correct IxbElement that represents for one end of the link in the XML file, no matter the end's ufid is modified or not.

Supported API: true

Parameters:
endXML - the original IxbElement in the XML file that represents one end of a link
endId - the original id (ufid or localId of the end in the XML file (A.K.A. oldId in htModifiedObjects)
Returns:
the IxbElement
Throws:
WTException
Since:
Windchill R6.2.6

getTargetContainerRef

public WTContainerRef getTargetContainerRef()
                                     throws WTException
Returns the container reference where the import is launched.

Supported API: true

Returns:
WTContainerRef
Throws:
WTException