Class ClassExporterImporterTemplate

java.lang.Object
wt.ixb.publicforhandlers.ClassExporterImporterTemplateGeneral
wt.ixb.publicforhandlers.ClassExporterImporterTemplate
All Implemented Interfaces:
ClassExporter, ClassExporterImporter, ElementImporter
Direct Known Subclasses:
wt.esi.ixb.handlers.forclasses._ExpImpForERPPartSpecificPlantData, ExpImpForLinkObject, ExpImpForVersionedObject

public abstract class ClassExporterImporterTemplate extends ClassExporterImporterTemplateGeneral
Abstract class, most of standard export/import handlers extend. This class implements some typical model of export/import process.

Supported API: true

Extendable: true
  • Method Details

    • exportObject

      public void exportObject(Object object, Exporter exporter) throws WTException
      Exports the specified object in context given by parameter exporter.
      The implementation of this method is partitioned into several protected methods. Individual class handlers can override the following protected methods:
      • createFileXMLOnExport(Exporter exporter), which create an IxbDocument with the root tag. See getRootTag();
      • exportAttributes (Object object, IxbElement fileXML, Exporter exporter) which will export the attributes according to the DTD. The parameter fileXML is the returned vlue from createFileXMLOnExport(Exporter exporter).
      • storeElement(Object object, IxbElement fileXML, Exporter exporter) which will store the fileXML into an xml-file.
      Also, export actions from either client or system registry will be performed. Specifically, the two methods wt.ixb.tuner.ExportActionHelper.performPreExportAction () and wt.ixb.tuner.ExportActionHelper.performPostExportAction () will be called before and after th above three protected methods, respectively.

      Supported API: true
      Specified by:
      exportObject in interface ClassExporter
      Specified by:
      exportObject in class ClassExporterImporterTemplateGeneral
      Parameters:
      object -
      exporter - The Exporter instance that represents the context of the export operation.
      Throws:
      WTException
    • createFileXMLOnExport

      protected IxbDocument createFileXMLOnExport(Exporter exporter) throws WTException
      Creates an IxbDocument with the root tag. See getRootTag()

      Supported API: true
      Parameters:
      exporter -
      Returns:
      IxbDocument
      Throws:
      WTException
    • exportAttributes

      protected void exportAttributes(Object object, IxbDocument fileXML, Exporter exporter) throws WTException
      Export the attributes according to the DTD. The parameter fileXML is the returned vlue from the method createFileXMLOnExport(Exporter exporter).

      Supported API: true
      Parameters:
      object -
      fileXML -
      exporter -
      Throws:
      WTException
    • exportAttributes

      protected void exportAttributes(Object object, IxbElement fileXML, Exporter exporter) throws WTException
      Export the attributes according to the DTD. The parameter fileXML is the returned value from the method createFileXMLOnExport(Exporter exporter).

      Supported API: true
      Parameters:
      object -
      fileXML -
      exporter -
      Throws:
      WTException
    • execExportObjectContents

      protected void execExportObjectContents(Object object, IxbDocument fileXML, Exporter exporter) throws WTException
      Calls the exportObjectContents method of all AttributeExporterImporter implementing ExpImpForContentAttrtItfc interface

      Supported API: true
      Throws:
      WTException
    • prepareForCheckConflicts

      public void prepareForCheckConflicts(List<IxbElement> ixbElementLst, Importer importer) throws WTException
      Called in the beginning of conflict check process prior to the real import or preview.

      Supported API: true
      Specified by:
      prepareForCheckConflicts in interface ElementImporter
      Overrides:
      prepareForCheckConflicts in class ClassExporterImporterTemplateGeneral
      Parameters:
      ixbElementLst - List of IxbElements
      importer - The Importer instance that represents the context of the import operation
      Throws:
      WTException
    • storeElement

      protected void storeElement(Object object, IxbDocument fileXML, Exporter exporter) throws WTException
      Stores the exported result fileXML IxbDocument into an XML file or other format accrding to the export handler ApplicationExportHandler.

      Supported API: true
      Parameters:
      object -
      fileXML -
      exporter -
      Throws:
      WTException
    • getRootTag

      protected String getRootTag()
      Returns the desired root tag for the object type to be exported, e.g. "WTDocument". Individual class handlers are expected to implement this method, otherwise the importer might be confused to choosed the exact class handler during import.

      Supported API: true
      Returns:
      String
    • importElement

      @Deprecated public Object importElement(IxbElement fileXML, Importer importer) throws WTException
      Imports XML element in context given by importer parameter. Returns the imported object, which might be newly created or already existed in the datastore.

      Supported API: true
      Specified by:
      importElement in interface ElementImporter
      Specified by:
      importElement in class ClassExporterImporterTemplateGeneral
      Parameters:
      fileXML -
      importer - The Importer instance that represents the context of the import operation.
      Returns:
      Object
      Throws:
      WTException
    • _checkConflicts

      public void _checkConflicts(List<IxbElement> elements, Importer importer, String actionName, String tag) throws WTException
      Checks conflicts that can arise while import process. This method is used to delegate the checkConflict to actor.

      Supported API: true
      Specified by:
      _checkConflicts in interface ElementImporter
      Overrides:
      _checkConflicts in class ClassExporterImporterTemplateGeneral
      Parameters:
      elements - the XML elements to be imported.
      importer - The Importer instance that represents the context of the import operation.
      Throws:
      WTException
    • createObject

      public abstract Object createObject(IxbElement fileXML, Importer importer) throws WTException
      Creates new instance of Windchill object. Every class requires its own method to create object of this class. So, this method must be overriden by any class specific import handler

      Supported API: true
      Parameters:
      fileXML -
      importer -
      Returns:
      Object
      Throws:
      WTException
    • importObjectAttributes

      public Object importObjectAttributes(Object object, IxbElement fileXML, Importer importer) throws WTException
      Imports class specific atributes from the XML file. This method should be implemented for most of the class handlers. If the object class inherits from another replicated class (for example, inherits from WTPart) then it generally should give a new implementation for this method; in this implementation it should at first call importObjectAttributes of its ansector

      Supported API: true
      Parameters:
      object -
      fileXML -
      importer -
      Returns:
      Object
      Throws:
      WTException
    • storeObject

      @Deprecated public Object storeObject(Object object, IxbElement fileXML, Importer importer) throws WTException
      Deprecated.
      That is the general template how to store object. It looks like it will be good for many classes. If for some class it is not good then it can be override this method

      Supported API: true
      Parameters:
      object -
      fileXML -
      importer -
      Returns:
      Object
      Throws:
      WTException
    • importObjectAttributesAfterStore

      public Object importObjectAttributesAfterStore(Object object, IxbElement fileXML, Importer importer) throws WTException
      Imports class specific attributes from the XML element after object gets stored
      This method should be implemented for most of the classes This method is required because some of attributes (IBA, Content) can not be added to the object before it gets stored. So, we can not set this attribute in importObjectAttributes method because it is called before store object.
      If class inherits from another replicated class (for example, inherits from WTPart) then for this class generally a new implementation of this method should be given; in this implementation it should at first call importObjectAttributesAfterStore() of its ansector

      Supported API: true
      Parameters:
      object -
      fileXML -
      importer -
      Returns:
      Object
      Throws:
      WTException
    • storeAdditionalInfo

      protected void storeAdditionalInfo(Object object, IxbDocument fileXML, String fileId, Exporter exporter) throws WTException
      By default will do whatever processing is specified in Application handler. Handlers which need to do something different (or nothing at all) should override this method. *

      Supported API: true
      Throws:
      WTException
    • rememberNewObInfo

      protected void rememberNewObInfo(Object obj, IxbElement fileXML, boolean objectNew, Importer importer) throws WTException
      Implements typical way of storing information about imported object That information can be used if in import package there are other objects, referenced this one

      Supported API: true
      Throws:
      WTException
    • finalizeImportObject

      @Deprecated public Object finalizeImportObject(boolean objectNew, Object object, IxbElement fileXML, Importer importer) throws WTException
      Some actions in the end of the import process. This method is called even if there were no real import - i.e. if existing object was found, that represents object to be imported

      Supported API: true
      Parameters:
      objectNew -
      object -
      fileXML -
      importer -
      Returns:
      Throws:
      WTException