wt.ixb.handlers.forclasses
Class ExpImpForClassificationNode

java.lang.Object
  extended bywt.ixb.publicforhandlers.ClassExporterImporterTemplateGeneral
      extended bywt.ixb.publicforhandlers.ClassExporterImporterTemplate
          extended bywt.ixb.handlers.forclasses.ExpImpForClassificationNode
All Implemented Interfaces:
ClassExporter, ClassExporterImporter, ElementImporter

public class ExpImpForClassificationNode
extends ClassExporterImporterTemplate



Supported API: true

Extendable: true


Nested Class Summary
 
Nested classes inherited from class wt.ixb.publicforhandlers.ClassExporterImporterTemplate
ClassExporterImporterTemplate.ContentHolderCommitListener
 
Field Summary
private static String CLASSNAME
           
static String EXPORTED_CLASSIFICATION_NODE
           
private static String RESOURCE
           
 
Fields inherited from class wt.ixb.publicforhandlers.ClassExporterImporterTemplate
 
Fields inherited from class wt.ixb.publicforhandlers.ClassExporterImporterTemplateGeneral
CONFLICT_RESOURCE
 
Constructor Summary
ExpImpForClassificationNode()
           
 
Method Summary
private  void checkConflictForClassificationStruct(ClassificationNodeDefaultView existingV, ClassificationNode existingNode, IxbElement fileXML, Importer importer)
          Check the conflicts for the ClassificationStruct for the ClassificationNode found from database against the XML file in the jar.
private  void checkConflictForNodeAttributes(ClassificationNodeDefaultView existingView, IxbElement fileXML, Importer importer)
          Check the conflicts for the ClassificationNode found from database against the XML file.
 void checkConflicts(IxbElement fileXML, Importer importer)
          Check conflicts for the XML file against the ClassificationNode object in datase.
private  ClassificationNodeDefaultView createClassificationNode(IxbElement fileXML, Importer importer)
          To create a brand new ClassificationNode instance and persisted into database absed on the information provided by the XML file
 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.
private  void exportClassificationStruct(ClassificationNode node, IxbElement fileXML, Exporter exporter)
           
private  void exportImageHolder(ClassificationNodeDefaultView defV, ClassificationNode node, IxbElement fileXML, Exporter exporter)
           
 Object findAmongExistingObjects(IxbElement fileXML, Importer importer)
          Find the ClassificationNode instance in database based on the name and path.
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.
 int getAdditionalImportPriority(IxbElement fileXML)
          Return the "additional" import priority based on the XML file, supplemented to getImportPriority() The returned number defines the order in which XML file will be imported if getImportPriority() returns the same value.
private  ClassificationNodeDefaultView getClassificationNodeDefaultViewByPath(String nodePath)
          Find the ClassificationNodeDefaultView by full path.
private  ClassificationStructDefaultView getClassificationStructDefaultView(String className, String ibaPath)
          Get the ClassificationStructDefaultView according to the primary className.
private  String getFullPath(ClassificationNodeDefaultView defV)
           
 int getImportPriority()
          Return the import priority of the object type represented by this import handler.
 String getObjectDisplayID(IxbElement fileXML, Importer importer)
          Return the localized identity of the element that will be used in import operation.
private  Vector getParentNodes(ClassificationNode node)
           
private  String getParentPath(ClassificationNode node)
           
protected  String getRootTag()
          Returns "ClassificationNode" as the root tag of the XML file.
 Object importElement(IxbElement fileXML, Importer importer)
          Imports XML element in context given by importer parameter.
 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.
 void outputLog(Object ob, Importer importer)
          Output log for imported object.
private static void PP(String s)
           
 
Methods inherited from class wt.ixb.publicforhandlers.ClassExporterImporterTemplate
createFileXMLOnExport, exportObject, finalizeImportObject, importObjectAttributes, isObjectIgnored, isObjectNew, rememberNewObInfo, setObjectIgnored, setObjectIsNew, storeAdditionalInfo, storeElement, storeObject
 
Methods inherited from class wt.ixb.publicforhandlers.ClassExporterImporterTemplateGeneral
finalizeCheckConflicts, finalizeExport, finalizeImport, 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

EXPORTED_CLASSIFICATION_NODE

public static final String EXPORTED_CLASSIFICATION_NODE
See Also:
Constant Field Values
Constructor Detail

ExpImpForClassificationNode

public ExpImpForClassificationNode()
Method Detail

getRootTag

protected String getRootTag()
Returns "ClassificationNode" as the root tag of the XML file.

Supported API: true

Overrides:
getRootTag in class ClassExporterImporterTemplate
Returns:
String

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

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

findAmongExistingObjects

public Object findAmongExistingObjects(IxbElement fileXML,
                                       Importer importer)
                                throws WTException
Find the ClassificationNode instance in database based on the name and path.

Supported API: true

Overrides:
findAmongExistingObjects in class ClassExporterImporterTemplate
Parameters:
fileXML -
importer -
Returns:
Object
Throws:
WTException

checkConflicts

public void checkConflicts(IxbElement fileXML,
                           Importer importer)
                    throws WTException
Check conflicts for the XML file against the ClassificationNode object in datase.

Supported API: true

Specified by:
checkConflicts in interface ElementImporter
Overrides:
checkConflicts in class ClassExporterImporterTemplateGeneral
Parameters:
fileXML -
importer -
Throws:
WTException

getAdditionalImportPriority

public int getAdditionalImportPriority(IxbElement fileXML)
                                throws WTException
Return the "additional" import priority based on the XML file, supplemented to getImportPriority() The returned number defines the order in which XML file will be imported if getImportPriority() returns the same value. In general, if getImportPriority() returns a smaller value, it will have a higher import priority; for the XML files with the same value of getImportPriority(), the one with a smaller value of getAdditionalImportPriority() will have a higher import priority.
The returned value is the depth specified in the "path" tag in the XML file of the corresponding ClassificationNode instance

Supported API: true

Specified by:
getAdditionalImportPriority in interface ElementImporter
Overrides:
getAdditionalImportPriority in class ClassExporterImporterTemplateGeneral
Parameters:
fileXML -
Returns:
int
Throws:
WTException

importElement

public Object importElement(IxbElement fileXML,
                            Importer importer)
                     throws WTException
Imports XML element in context given by importer parameter. Returns the ClassificationNodeDefaultView, 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 -
Returns:
Object
Throws:
WTException

createObject

public 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

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

getImportPriority

public int getImportPriority()
                      throws WTException
Description copied from class: ClassExporterImporterTemplateGeneral
Return the import priority of the object type represented by this import handler.
Import priority defines the order in which objects will be imported. This method does not carry parameters in the signature. The return value can not be negative. Those XML files will have a higher import priority for smaller returned values.

Supported API: true

Specified by:
getImportPriority in interface ElementImporter
Specified by:
getImportPriority in class ClassExporterImporterTemplateGeneral
Returns:
int
Throws:
WTException

getParentPath

private String getParentPath(ClassificationNode node)
                      throws WTException
Throws:
WTException

getFullPath

private String getFullPath(ClassificationNodeDefaultView defV)
                    throws WTException
Throws:
WTException

getParentNodes

private Vector getParentNodes(ClassificationNode node)
                       throws WTException
Throws:
WTException

exportImageHolder

private void exportImageHolder(ClassificationNodeDefaultView defV,
                               ClassificationNode node,
                               IxbElement fileXML,
                               Exporter exporter)
                        throws WTException
Throws:
WTException

exportClassificationStruct

private void exportClassificationStruct(ClassificationNode node,
                                        IxbElement fileXML,
                                        Exporter exporter)
                                 throws WTException
Throws:
WTException

getClassificationNodeDefaultViewByPath

private ClassificationNodeDefaultView getClassificationNodeDefaultViewByPath(String nodePath)
                                                                      throws WTException
Find the ClassificationNodeDefaultView by full path. If found, return the associated ClassificationNodeDefaultView; otherwise return null.

Returns:
ClassificationNodeDefaultView
Throws:
WTException

getObjectDisplayID

public String getObjectDisplayID(IxbElement fileXML,
                                 Importer importer)
                          throws WTException
Description copied from class: ClassExporterImporterTemplateGeneral
Return the localized identity of the element that will be used in import operation. This is mostly for localized log purpose.

Supported API: true

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

checkConflictForNodeAttributes

private void checkConflictForNodeAttributes(ClassificationNodeDefaultView existingView,
                                            IxbElement fileXML,
                                            Importer importer)
                                     throws WTException
Check the conflicts for the ClassificationNode found from database against the XML file. The conflicts for soft attributes and ClassificationStruct will be checked separately.

Parameters:
existingView -
fileXML -
importer -
Throws:
WTException

checkConflictForClassificationStruct

private void checkConflictForClassificationStruct(ClassificationNodeDefaultView existingV,
                                                  ClassificationNode existingNode,
                                                  IxbElement fileXML,
                                                  Importer importer)
                                           throws WTException
Check the conflicts for the ClassificationStruct for the ClassificationNode found from database against the XML file in the jar.

Parameters:
existingV -
existingNode -
fileXML -
importer -
Throws:
WTException

createClassificationNode

private ClassificationNodeDefaultView createClassificationNode(IxbElement fileXML,
                                                               Importer importer)
                                                        throws WTException
To create a brand new ClassificationNode instance and persisted into database absed on the information provided by the XML file

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

Overrides:
importObjectAttributesAfterStore in class ClassExporterImporterTemplate
Parameters:
object -
fileXML -
importer -
Returns:
Object
Throws:
WTException

getClassificationStructDefaultView

private ClassificationStructDefaultView getClassificationStructDefaultView(String className,
                                                                           String ibaPath)
                                                                    throws WTException
Get the ClassificationStructDefaultView according to the primary className. According to the design note of ClassificationStruct, each className --- the so-called primary className -- will be associated with only one ClassificationStruct instance.

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 ClassExporterImporterTemplate
Throws:
WTException

findAmongExistingObjectsForImport

private Object findAmongExistingObjectsForImport(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 for import application.

Throws:
WTException

PP

private static void PP(String s)