wt.ixb.publicforhandlers
Class AbsExpImpForNonIteratedObject

java.lang.Object
  extended bywt.ixb.publicforhandlers.ClassExporterImporterTemplateGeneral
      extended bywt.ixb.publicforhandlers.ClassExporterImporterTemplate
          extended bywt.ixb.publicforhandlers.AbsExpImpForNonIteratedObject
All Implemented Interfaces:
ClassExporter, ClassExporterImporter, ElementImporter, ElementImportHandlerIfc, ExpImpOfObjectRefIfc, ExpOfObjectRefIfc, ImpOfObjectRefIfc, IxbSimpleAttributeHolderIfc
Direct Known Subclasses:
ExpImpForCollectionCriteria, ExpImpForRepresentation

public abstract class AbsExpImpForNonIteratedObject
extends ClassExporterImporterTemplate
implements ExpImpOfObjectRefIfc, IxbSimpleAttributeHolderIfc, ElementImportHandlerIfc


Nested Class Summary
 
Nested classes inherited from class wt.ixb.publicforhandlers.ClassExporterImporterTemplate
ClassExporterImporterTemplate.ContentHolderCommitListener
 
Field Summary
private  String handlerName
           
protected  Vector nonOverridableAttrVec
           
protected  Vector overridableAttrVec
           
 
Fields inherited from class wt.ixb.publicforhandlers.ClassExporterImporterTemplate
 
Fields inherited from class wt.ixb.publicforhandlers.ClassExporterImporterTemplateGeneral
CONFLICT_RESOURCE
 
Constructor Summary
AbsExpImpForNonIteratedObject()
           
 
Method Summary
protected abstract  Object _createObject(IxbElement fileXML, Importer importer)
           
protected abstract  Object _createSubstituteObject(IxbElement fileXML, Importer importer)
           
protected  Object _importObjectAttributes(Object object, boolean objectExistsPriorImport, IxbElement fileXML, Importer importer)
           
 boolean actionIsApplicable(String actionName)
           
protected  void addAttrConflicts(Object existingObject, String importedId, IxbElement fileXML, Importer importer)
           
protected  void addAttributeConflicts(Object existingObject, IxbElement fileXML, Importer importer)
           
protected  void addObjectConflict(Object existingObject, IxbElement fileXML, Importer importer)
           
protected  void addSimpleAttributeConflicts(Object existingObject, IxbElement fileXML, Importer importer)
           
 void checkConflicts(IxbElement fileXML, Importer importer)
          Checks conflicts that can arise while import process.
 Object createObject(IxbElement fileXML, Importer importer)
          Creates new instance of Windchill object.
 Object createSubstituteObject(IxbElement fileXML, Importer importer)
           
protected  void devError(String message)
           
protected  boolean didObjectExistPriorImport(IxbElement fileXML, Importer importer)
           
 void exportAttributes(Object object, IxbDocument fileXML, Exporter exporter)
          Export the attributes according to the DTD.
protected  void exportObjectAttributes(Object object, IxbElement fileXML, Exporter exporter)
           
protected  void exportSimpleAttributes(Object object, IxbElement fileXML)
           
 Object findAmongExistingObjects(IxbElement fileXML, Importer importer)
          Implements typical way of finding whether object from given XML file exists already in Windchill database.
 Object findExistingSubstituteObject(IxbElement fileXML, Importer importer)
           
protected  Object findNCacheObjectFromXML(IxbElement fileXML, Importer importer)
           
protected abstract  Object findObjectExistingPriorImport(IxbElement fileXML, Importer importer)
           
protected  Object findObjectFromCache(IxbElement fileXML, Importer importer)
           
 Object findObjectFromXML(IxbElement fileXML, Importer importer)
           
protected abstract  Object findSubstituteObjectExistingPriorImport(IxbElement fileXML, Importer importer)
           
protected  String getActionName(IxbElement fileXML)
           
 String getAttributeVal(Object object, String attrTag)
           
 String getDefaultActionName()
           
protected abstract  String getExistingObjectIdString(Object object)
           
protected abstract  String getImportedObjectIdString(IxbElement fileXML)
           
protected  String getObjectDisplayID(Object object)
           
 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.
protected  Object importSimpleAttributes(Object object, boolean objectExistPriorImport, Enumeration attrEnum, IxbElement fileXML)
           
protected  Object importSimpleAttributes(Object object, boolean objectExistPriorImport, IxbElement fileXML)
           
 boolean isObjectInConflict(IxbElement fileXML, Importer importer)
           
protected  void logAndThrowWTException(WTException e, String logMessage)
           
protected  void logWTException(WTException e, String logMessage)
           
protected  boolean needToUpdate(Object existingObject, IxbElement fileXML, Importer importer)
           
 boolean objectExistPriorImport(IxbElement element, Importer importer)
           
 void outputLog(Object object, Importer importer)
          Output log for imported object.
protected  void printLog(String message)
           
protected  void putObjectInfoInCache(Persistable persistant, boolean isNew, IxbElement fileXML, Importer importer)
           
protected  void resetObjectConflictContext(Object existingObject, IxbElement fileXML, Importer importer)
           
 void setAttributeVal(Object object, String attrTag, String attrVal)
           
protected  void setObjectConflictContext(Object existingObject, IxbElement fileXML, Importer importer)
           
 Object storeObject(Object object, IxbElement fileXML, Importer importer)
          That is the general template how to store object.
 boolean supportsImportActors()
           
 
Methods inherited from class wt.ixb.publicforhandlers.ClassExporterImporterTemplate
createFileXMLOnExport, exportObject, finalizeImportObject, getRootTag, isObjectIgnored, isObjectNew, rememberNewObInfo, setObjectIgnored, setObjectIsNew, storeAdditionalInfo, storeElement
 
Methods inherited from class wt.ixb.publicforhandlers.ClassExporterImporterTemplateGeneral
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
 
Methods inherited from interface wt.ixb.publicforhandlers.ExpOfObjectRefIfc
exportObjectRef
 

Field Detail

overridableAttrVec

protected Vector overridableAttrVec

nonOverridableAttrVec

protected Vector nonOverridableAttrVec

handlerName

private String handlerName
Constructor Detail

AbsExpImpForNonIteratedObject

public AbsExpImpForNonIteratedObject()
Method Detail

getExistingObjectIdString

protected abstract String getExistingObjectIdString(Object object)
                                             throws WTException
Throws:
WTException

getImportedObjectIdString

protected abstract String getImportedObjectIdString(IxbElement fileXML)
                                             throws WTException
Throws:
WTException

findObjectExistingPriorImport

protected abstract Object findObjectExistingPriorImport(IxbElement fileXML,
                                                        Importer importer)
                                                 throws WTException
Throws:
WTException

findSubstituteObjectExistingPriorImport

protected abstract Object findSubstituteObjectExistingPriorImport(IxbElement fileXML,
                                                                  Importer importer)
                                                           throws WTException
Throws:
WTException

_createObject

protected abstract Object _createObject(IxbElement fileXML,
                                        Importer importer)
                                 throws WTException
Throws:
WTException

_createSubstituteObject

protected abstract Object _createSubstituteObject(IxbElement fileXML,
                                                  Importer importer)
                                           throws WTException
Throws:
WTException

importElement

public Object importElement(IxbElement fileXML,
                            Importer importer)
                     throws WTException
Description copied from class: ClassExporterImporterTemplate
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
Overrides:
importElement in class ClassExporterImporterTemplate
Parameters:
fileXML -
importer - The Importer instance that represents the context of the import operation.
Returns:
Object
Throws:
WTException

outputLog

public void outputLog(Object object,
                      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 ClassExporterImporterTemplate
Throws:
WTException

supportsImportActors

public boolean supportsImportActors()

actionIsApplicable

public boolean actionIsApplicable(String actionName)
                           throws WTException
Throws:
WTException

getDefaultActionName

public String getDefaultActionName()

getActionName

protected String getActionName(IxbElement fileXML)
                        throws WTException
Throws:
WTException

exportAttributes

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

Supported API: true

Overrides:
exportAttributes in class ClassExporterImporterTemplate
Parameters:
object -
fileXML -
exporter -
Throws:
WTException

findAmongExistingObjects

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

Supported API: true

Specified by:
findAmongExistingObjects in interface ElementImportHandlerIfc
Overrides:
findAmongExistingObjects in class ClassExporterImporterTemplate
Parameters:
fileXML -
importer -
Returns:
Object
Throws:
WTException

findExistingSubstituteObject

public Object findExistingSubstituteObject(IxbElement fileXML,
                                           Importer importer)
                                    throws WTException
Specified by:
findExistingSubstituteObject in interface ElementImportHandlerIfc
Throws:
WTException

findObjectFromXML

public Object findObjectFromXML(IxbElement fileXML,
                                Importer importer)
                         throws WTException
Specified by:
findObjectFromXML in interface ImpOfObjectRefIfc
Throws:
WTException

findNCacheObjectFromXML

protected Object findNCacheObjectFromXML(IxbElement fileXML,
                                         Importer importer)
                                  throws WTException
Throws:
WTException

findObjectFromCache

protected Object findObjectFromCache(IxbElement fileXML,
                                     Importer importer)
                              throws WTException
Throws:
WTException

putObjectInfoInCache

protected void putObjectInfoInCache(Persistable persistant,
                                    boolean isNew,
                                    IxbElement fileXML,
                                    Importer importer)
                             throws WTException
Throws:
WTException

createObject

public Object createObject(IxbElement fileXML,
                           Importer importer)
                    throws WTException
Description copied from class: ClassExporterImporterTemplate
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

Specified by:
createObject in interface ElementImportHandlerIfc
Specified by:
createObject in class ClassExporterImporterTemplate
Parameters:
fileXML -
importer -
Returns:
Object
Throws:
WTException

createSubstituteObject

public Object createSubstituteObject(IxbElement fileXML,
                                     Importer importer)
                              throws WTException
Specified by:
createSubstituteObject in interface ElementImportHandlerIfc
Throws:
WTException

importObjectAttributes

public Object importObjectAttributes(Object object,
                                     IxbElement fileXML,
                                     Importer importer)
                              throws WTException
Description copied from class: ClassExporterImporterTemplate
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

Specified by:
importObjectAttributes in interface ElementImportHandlerIfc
Overrides:
importObjectAttributes in class ClassExporterImporterTemplate
Parameters:
object -
fileXML -
importer -
Returns:
Object
Throws:
WTException

objectExistPriorImport

public boolean objectExistPriorImport(IxbElement element,
                                      Importer importer)
                               throws WTException
Specified by:
objectExistPriorImport in interface ImpOfObjectRefIfc
Throws:
WTException

didObjectExistPriorImport

protected boolean didObjectExistPriorImport(IxbElement fileXML,
                                            Importer importer)
                                     throws WTException
Throws:
WTException

storeObject

public Object storeObject(Object object,
                          IxbElement fileXML,
                          Importer importer)
                   throws WTException
Description copied from class: ClassExporterImporterTemplate
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

Specified by:
storeObject in interface ElementImportHandlerIfc
Overrides:
storeObject in class ClassExporterImporterTemplate
Parameters:
object -
fileXML -
importer -
Returns:
Object
Throws:
WTException

isObjectInConflict

public boolean isObjectInConflict(IxbElement fileXML,
                                  Importer importer)
                           throws WTException
Throws:
WTException

importObjectAttributesAfterStore

public Object importObjectAttributesAfterStore(Object object,
                                               IxbElement fileXML,
                                               Importer importer)
                                        throws WTException
Description copied from class: ClassExporterImporterTemplate
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

Specified by:
importObjectAttributesAfterStore in interface ElementImportHandlerIfc
Overrides:
importObjectAttributesAfterStore in class ClassExporterImporterTemplate
Parameters:
object -
fileXML -
importer -
Returns:
Object
Throws:
WTException

checkConflicts

public void checkConflicts(IxbElement fileXML,
                           Importer importer)
                    throws WTException
Description copied from class: ClassExporterImporterTemplateGeneral
Checks conflicts that can arise while import process.

Supported API: true

Specified by:
checkConflicts in interface ElementImporter
Overrides:
checkConflicts in class ClassExporterImporterTemplateGeneral
Parameters:
fileXML - the XML element to be imported.
importer - The Importer instance that represents the context of the import operation.
Throws:
WTException

addObjectConflict

protected void addObjectConflict(Object existingObject,
                                 IxbElement fileXML,
                                 Importer importer)
                          throws WTException
Throws:
WTException

addAttributeConflicts

protected void addAttributeConflicts(Object existingObject,
                                     IxbElement fileXML,
                                     Importer importer)
                              throws WTException
Throws:
WTException

addAttrConflicts

protected void addAttrConflicts(Object existingObject,
                                String importedId,
                                IxbElement fileXML,
                                Importer importer)
                         throws WTException
Throws:
WTException

setObjectConflictContext

protected void setObjectConflictContext(Object existingObject,
                                        IxbElement fileXML,
                                        Importer importer)
                                 throws WTException
Throws:
WTException

resetObjectConflictContext

protected void resetObjectConflictContext(Object existingObject,
                                          IxbElement fileXML,
                                          Importer importer)
                                   throws WTException
Throws:
WTException

needToUpdate

protected boolean needToUpdate(Object existingObject,
                               IxbElement fileXML,
                               Importer importer)
                        throws WTException
Throws:
WTException

exportObjectAttributes

protected void exportObjectAttributes(Object object,
                                      IxbElement fileXML,
                                      Exporter exporter)
                               throws WTException
Throws:
WTException

_importObjectAttributes

protected Object _importObjectAttributes(Object object,
                                         boolean objectExistsPriorImport,
                                         IxbElement fileXML,
                                         Importer importer)
                                  throws WTException
Throws:
WTException

exportSimpleAttributes

protected void exportSimpleAttributes(Object object,
                                      IxbElement fileXML)
                               throws WTException
Throws:
WTException

importSimpleAttributes

protected Object importSimpleAttributes(Object object,
                                        boolean objectExistPriorImport,
                                        IxbElement fileXML)
                                 throws WTException
Throws:
WTException

importSimpleAttributes

protected Object importSimpleAttributes(Object object,
                                        boolean objectExistPriorImport,
                                        Enumeration attrEnum,
                                        IxbElement fileXML)
                                 throws WTException
Throws:
WTException

addSimpleAttributeConflicts

protected void addSimpleAttributeConflicts(Object existingObject,
                                           IxbElement fileXML,
                                           Importer importer)
                                    throws WTException
Throws:
WTException

getAttributeVal

public String getAttributeVal(Object object,
                              String attrTag)
                       throws WTException
Specified by:
getAttributeVal in interface IxbSimpleAttributeHolderIfc
Throws:
WTException

setAttributeVal

public void setAttributeVal(Object object,
                            String attrTag,
                            String attrVal)
                     throws WTException,
                            WTPropertyVetoException
Specified by:
setAttributeVal in interface IxbSimpleAttributeHolderIfc
Throws:
WTException
WTPropertyVetoException

getObjectDisplayID

protected String getObjectDisplayID(Object object)
                             throws WTException
Throws:
WTException

printLog

protected void printLog(String message)

logAndThrowWTException

protected void logAndThrowWTException(WTException e,
                                      String logMessage)
                               throws WTException
Throws:
WTException

logWTException

protected void logWTException(WTException e,
                              String logMessage)
                       throws WTException
Throws:
WTException

devError

protected void devError(String message)
                 throws WTException
Throws:
WTException