wt.ixb.publicforhandlers
Class ClassExporterImporterTemplate

java.lang.Object
  extended bywt.ixb.publicforhandlers.ClassExporterImporterTemplateGeneral
      extended bywt.ixb.publicforhandlers.ClassExporterImporterTemplate
All Implemented Interfaces:
ClassExporter, ClassExporterImporter, ElementImporter
Direct Known Subclasses:
AbsExpImpForNonIteratedObject, AdHocAclImporter, CollaborationContainerSpecIxHandler, CollaborationTemplateIIXHandler, ContainerDefaultsIXHandler, CreateFromRuleIXHandler, CsvIxHandler, DocumentTemplateIXHandler, ExecObjIxHandler, ExpImpForBaseCriterionDef, ExpImpForBusinessEntity, ExpImpForClassificationNode, ExpImpForCriterionDefValidWith, ExpImpForEPMBuildHistory, ExpImpForEPMBuildLinksRule, ExpImpForEPMContainedIn, ExpImpForEPMDescribeLink, ExpImpForEPMMemberLink, ExpImpForEPMReferenceLink, ExpImpForEPMSepFamilyTable, ExpImpForEPMVariantLink, ExpImpForReportTemplate, ExpImpForUnitSeedLink, ExpImpForVersionedObject, ExpImpForWTPartDescribeLink, ExpImpForWTPartReferenceLink, ExpImpForWTPartUsageLink, ExpImpForWTTypeDefinition, FolderLinkIxHandler, FolderStructureIXHandler, IndexPolicyRuleIXHandler, LibConfigIxHandler, LibraryTemplateIXHandler, LoadXMLFileIXHandler, NMACLRuleIXHandler, NMDomainIXHandler, NMGroupIxHandler, NMGuestMembershipIXHandler, NMProjectMembershipIXHandler, NotebookIXHandler, ObjectSeedIXHandler, OrgConfigIXHandler, OrgStructureIXHandler, PDMLinkProductIXHandler, PDMProductMembershipIXHandler, ProdConfigIxHandler, ProductStructureIxHandler, ProductTemplateIXHandler, ProjectConfigIxHandler, ProjectContainerEnumeratedTypeIXHandler, ProjectContainerIXHandler, ProjectResourceIxHandler, ProjectTemplateIxHandler, SandboxBaselineIxHandler, ShareMapIxHandler, TeamExportHolderHandler, TemplateDocumentIXHandler, TypeBasedRuleIXHandler

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: false


Nested Class Summary
protected  class ClassExporterImporterTemplate.ContentHolderCommitListener
           
 
Field Summary
private static String CLASSNAME
           
private  boolean objectIgnored
           
private  boolean objectNew
          objectNew is used for log purpose, to count how many new objects are created When a Actor create an object, or find an existing object, it will set objectNew to true or false respectively
private static String RESOURCE
           
 
Fields inherited from class wt.ixb.publicforhandlers.ClassExporterImporterTemplateGeneral
CONFLICT_RESOURCE
 
Constructor Summary
ClassExporterImporterTemplate()
           
 
Method Summary
protected  IxbDocument createFileXMLOnExport(Exporter exporter)
          Creates an IxbDocument with the root tag.
abstract  Object createObject(IxbElement fileXML, Importer importer)
          Creates new instance of Windchill object.
protected  void exportAttributes(Object object, IxbDocument fileXML, Exporter exporter)
          Export the attributes according to the DTD.
 void exportObject(Object object, Exporter exporter)
          Exports the specified object in context given by parameter exporter.
 Object finalizeImportObject(boolean objectNew, Object object, IxbElement fileXML, Importer importer)
          Some actions in the end of the import process.
 Object findAmongExistingObjects(IxbElement fileXML, Importer importer)
          Implements typical way of finding whether object from given XML file exists already in Windchill database.
private  Object findAmongExistingObjectsForImport(IxbElement fileXML, Importer importer)
          Implements typical way of finding whether object from given XML file exists already in Windchill database for import application.
protected  String getRootTag()
          Returns the desired root tag for the object type to be exported, e.g.
 Object importElement(IxbElement fileXML, Importer importer)
          Imports XML element in context given by importer parameter.
 Object importObjectAttributes(Object object, IxbElement fileXML, Importer importer)
          Imports class specific atributes from the XML file.
 Object importObjectAttributesAfterStore(Object object, IxbElement fileXML, Importer importer)
          Imports class specific atributes 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.
 boolean isObjectIgnored()
           
 boolean isObjectNew()
           
 void outputLog(Object ob, Importer importer)
          Output log for imported object.
private static void PP(String s)
           
protected  void rememberNewObInfo(Object ob, IxbElement fileXML, boolean objectNew, Importer importer)
          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
 void setObjectIgnored(boolean ignored)
           
 void setObjectIsNew(boolean isNew)
           
protected  void storeAdditionalInfo(Object object, IxbDocument fileXML, String fileId, Exporter exporter)
          By default will do whatever processing is specified in Application handler.
protected  void storeElement(Object object, IxbDocument fileXML, Exporter exporter)
          Stores the exported result fileXML IxbDocument into an XML file or other format accrding to the export handler ApplicationExportHandler.
 Object storeObject(Object object, IxbElement fileXML, Importer importer)
          That is the general template how to store object.
 
Methods inherited from class wt.ixb.publicforhandlers.ClassExporterImporterTemplateGeneral
checkConflicts, finalizeCheckConflicts, finalizeExport, finalizeImport, getAdditionalImportPriority, getImportPriority, getObjectDisplayID, prepareForCheckConflicts, prepareForImport, previewElement
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RESOURCE

private static final String RESOURCE
See Also:
Constant Field Values

CLASSNAME

private static final String CLASSNAME

objectNew

private boolean objectNew
objectNew is used for log purpose, to count how many new objects are created When a Actor create an object, or find an existing object, it will set objectNew to true or false respectively


objectIgnored

private boolean objectIgnored
Constructor Detail

ClassExporterImporterTemplate

public ClassExporterImporterTemplate()
Method Detail

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: 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

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

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

findAmongExistingObjects

public Object findAmongExistingObjects(IxbElement fileXML,
                                       Importer importer)
                                throws WTException
Implements typical way of finding whether object from given XML file exists already in Windchill database.

Supported API: true

Parameters:
fileXML -
importer -
Returns:
Object
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

public Object storeObject(Object object,
                          IxbElement fileXML,
                          Importer importer)
                   throws WTException
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 atributes 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

setObjectIsNew

public void setObjectIsNew(boolean isNew)

isObjectNew

public boolean isObjectNew()

setObjectIgnored

public void setObjectIgnored(boolean ignored)

isObjectIgnored

public boolean isObjectIgnored()

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 ob,
                                 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

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

Throws:
WTException

outputLog

public void outputLog(Object ob,
                      Importer importer)
               throws WTException
Description copied from class: ClassExporterImporterTemplateGeneral
Output log for imported object.

Supported API: true

Specified by:
outputLog in interface ElementImporter
Overrides:
outputLog in class ClassExporterImporterTemplateGeneral
Parameters:
ob - he object for the log. It can be a new imported object or an existing one in the datastore.
importer - The Importer instance that represents the context of the import operation.
Throws:
WTException

findAmongExistingObjectsForImport

private Object findAmongExistingObjectsForImport(IxbElement fileXML,
                                                 Importer importer)
                                          throws WTException
Implements typical way of finding whether object from given XML file exists already in Windchill database for import application.

Parameters:
fileXML -
importer -
Returns:
Throws:
WTException

PP

private static void PP(String s)