wt.ixb.handlers.forclasses
Class ExpImpForUnits

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

public class ExpImpForUnits
extends ClassExporterImporterTemplateGeneral


Field Summary
private static String ALREADY_EXPORTED
           
private  Vector importedExistingUnits
           
private  Vector importedNewUnits
           
private static String NOT_EXPORTED_MEASUREMENT_SYSTEM
           
private static String NOT_EXPORTED_QUANTITY_OF_MEASURE
           
private  IxbDocument rootXML
           
private  Hashtable units
           
 
Fields inherited from class wt.ixb.publicforhandlers.ClassExporterImporterTemplateGeneral
CONFLICT_RESOURCE
 
Constructor Summary
ExpImpForUnits()
           
 
Method Summary
 void addMeasurementSystemForExport(String name)
           
 void addQuantityOfMeasureForExport(String name)
           
 void checkConflicts(IxbElement fileXML, Importer importer)
          Checks conflicts that can arise while import process.
private  boolean checkConflictsForMeasurementSystems(IxbElement fileXML, Importer importer, MeasurementSystemDefaultView msView)
          we require the 2 measurement systems (represented by "msView" and fileXML, respectively) to have the same exactly symbols and symbol values; otherwise we report a conflict ....
private  boolean checkConflictsForQuantityOfMeasures(IxbElement fileXML, Importer importer, QuantityOfMeasureDefaultView qomView)
          we require the 2 QuantityOfMeasure (represented by "qomView" and fileXML, respectively) to have the same (as follows) 1) Base symbols must be the same; 2) and symbol values; otherwise we report a conflict ....
protected static boolean checkIdenticalAttributes(Enumeration keyValues, Hashtable attrs, boolean ignoreExtraAttr)
           
private  void exportMeasurementSystem(MeasurementSystemDefaultView msView, Exporter exporter)
           
 void exportObject(Object object, Exporter exporter)
          Exports the specified object in context given by parameter exporter.
private  void exportQuantityOfMeasure(QuantityOfMeasureDefaultView qomView, Exporter exporter)
           
 void finalizeExport(Exporter exporter)
          This method is called in the end of the whole export process to execute any additional export process finalization.
 Object findAmongExistingObjects(IxbElement fileXML, Importer importer)
           
private  MeasurementSystemDefaultView findExistingMeasurementSystemDefaultView(IxbElement fileXML, Importer importer)
           
private  QuantityOfMeasureDefaultView findExistingQuantityOfMeasureDefaultView(IxbElement fileXML, Importer importer)
           
private  String getClassNameWithoutPath(String fullClassName)
           
 int getImportPriority()
          because of UnitDefinition (which has an attribute of QuantityOfMeasure), QuantityOfMeasure and MeasurementSystem objects shld have a higher priority than IBA Definitions
protected  String getRootTag()
           
 Object importElement(IxbElement rootXML, Importer importer)
          Imports XML element in context given by importer parameter.
private  MeasurementSystemDefaultView importMeasurementSystems(IxbElement fileXML, Importer importer)
           
private  QuantityOfMeasureDefaultView importQuantityOfMeasures(IxbElement fileXML, Importer importer)
           
 void outputLog(Object ob, Importer importer)
          Output log for imported object that is imported by importElement.
private static void PP(String s)
           
 void previewElement(IxbElement fileXML, Importer importer)
          Preview XML element in context given by importer parameter.
private  Vector[] sortDisplayUnitsElements(Enumeration units)
          MeasurementSystem will be imported before QuantityOfMeasure.
 
Methods inherited from class wt.ixb.publicforhandlers.ClassExporterImporterTemplateGeneral
finalizeCheckConflicts, finalizeImport, getAdditionalImportPriority, getObjectDisplayID, prepareForCheckConflicts, prepareForImport
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

units

private Hashtable units

rootXML

private IxbDocument rootXML

importedNewUnits

private Vector importedNewUnits

importedExistingUnits

private Vector importedExistingUnits

NOT_EXPORTED_QUANTITY_OF_MEASURE

private static final String NOT_EXPORTED_QUANTITY_OF_MEASURE
See Also:
Constant Field Values

NOT_EXPORTED_MEASUREMENT_SYSTEM

private static final String NOT_EXPORTED_MEASUREMENT_SYSTEM
See Also:
Constant Field Values

ALREADY_EXPORTED

private static final String ALREADY_EXPORTED
See Also:
Constant Field Values
Constructor Detail

ExpImpForUnits

public ExpImpForUnits()
Method Detail

getRootTag

protected String getRootTag()

exportObject

public void exportObject(Object object,
                         Exporter exporter)
                  throws WTException
Description copied from class: ClassExporterImporterTemplateGeneral
Exports the specified object in context given by parameter exporter.

Supported API: true

Specified by:
exportObject in interface ClassExporter
Specified by:
exportObject in class ClassExporterImporterTemplateGeneral
Parameters:
object - The object to be exported.
exporter - The Exporter instance that represents the context of the export operation.
Throws:
WTException

addQuantityOfMeasureForExport

public void addQuantityOfMeasureForExport(String name)
                                   throws WTException
Throws:
WTException

addMeasurementSystemForExport

public void addMeasurementSystemForExport(String name)
                                   throws WTException
Throws:
WTException

finalizeExport

public void finalizeExport(Exporter exporter)
                    throws WTException
Description copied from class: ClassExporterImporterTemplateGeneral
This method is called in the end of the whole export process to execute any additional export process finalization.

Supported API: true

Specified by:
finalizeExport in interface ClassExporter
Overrides:
finalizeExport in class ClassExporterImporterTemplateGeneral
Parameters:
exporter - Exports the specified object in context given by parameter exporter.
Throws:
WTException

exportQuantityOfMeasure

private void exportQuantityOfMeasure(QuantityOfMeasureDefaultView qomView,
                                     Exporter exporter)
                              throws WTException
Throws:
WTException

exportMeasurementSystem

private void exportMeasurementSystem(MeasurementSystemDefaultView msView,
                                     Exporter exporter)
                              throws WTException
Throws:
WTException

getClassNameWithoutPath

private String getClassNameWithoutPath(String fullClassName)

outputLog

public void outputLog(Object ob,
                      Importer importer)
               throws WTException
Output log for imported object that is imported by importElement.

Specified by:
outputLog in interface ElementImporter
Overrides:
outputLog in class ClassExporterImporterTemplateGeneral
Parameters:
ob - the object element that is imported
importer - the container that represents the context of the import operation

Supported API: true
Throws:
WTException

getImportPriority

public int getImportPriority()
                      throws WTException
because of UnitDefinition (which has an attribute of QuantityOfMeasure), QuantityOfMeasure and MeasurementSystem objects shld have a higher priority than IBA Definitions

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

previewElement

public void previewElement(IxbElement fileXML,
                           Importer importer)
                    throws WTException
Description copied from class: ClassExporterImporterTemplateGeneral
Preview XML element in context given by importer parameter. Usually it will check conflicts without performing real import.

Supported API: true

Specified by:
previewElement in interface ElementImporter
Overrides:
previewElement 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

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

findAmongExistingObjects

public Object findAmongExistingObjects(IxbElement fileXML,
                                       Importer importer)
                                throws WTException
Throws:
WTException

importElement

public Object importElement(IxbElement rootXML,
                            Importer importer)
                     throws WTException
Description copied from class: ClassExporterImporterTemplateGeneral
Imports XML element in context given by importer parameter. Returns the imported object.

Supported API: true

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

sortDisplayUnitsElements

private Vector[] sortDisplayUnitsElements(Enumeration units)
                                   throws WTException
MeasurementSystem will be imported before QuantityOfMeasure. So sort the elemts at first

Throws:
WTException

importMeasurementSystems

private MeasurementSystemDefaultView importMeasurementSystems(IxbElement fileXML,
                                                              Importer importer)
                                                       throws RemoteException,
                                                              WTException
Throws:
RemoteException
WTException

importQuantityOfMeasures

private QuantityOfMeasureDefaultView importQuantityOfMeasures(IxbElement fileXML,
                                                              Importer importer)
                                                       throws RemoteException,
                                                              WTException,
                                                              WTPropertyVetoException
Throws:
RemoteException
WTException
WTPropertyVetoException

findExistingMeasurementSystemDefaultView

private MeasurementSystemDefaultView findExistingMeasurementSystemDefaultView(IxbElement fileXML,
                                                                              Importer importer)
                                                                       throws RemoteException,
                                                                              WTException
Throws:
RemoteException
WTException

findExistingQuantityOfMeasureDefaultView

private QuantityOfMeasureDefaultView findExistingQuantityOfMeasureDefaultView(IxbElement fileXML,
                                                                              Importer importer)
                                                                       throws RemoteException,
                                                                              WTException
Throws:
RemoteException
WTException

checkConflictsForMeasurementSystems

private boolean checkConflictsForMeasurementSystems(IxbElement fileXML,
                                                    Importer importer,
                                                    MeasurementSystemDefaultView msView)
                                             throws WTException
we require the 2 measurement systems (represented by "msView" and fileXML, respectively) to have the same exactly symbols and symbol values; otherwise we report a conflict ....

Returns:
true if a conflict exists
Throws:
WTException

checkConflictsForQuantityOfMeasures

private boolean checkConflictsForQuantityOfMeasures(IxbElement fileXML,
                                                    Importer importer,
                                                    QuantityOfMeasureDefaultView qomView)
                                             throws WTException
we require the 2 QuantityOfMeasure (represented by "qomView" and fileXML, respectively) to have the same (as follows) 1) Base symbols must be the same; 2) and symbol values; otherwise we report a conflict ....

Returns:
true if a conflict exists
Throws:
WTException

checkIdenticalAttributes

protected static boolean checkIdenticalAttributes(Enumeration keyValues,
                                                  Hashtable attrs,
                                                  boolean ignoreExtraAttr)
                                           throws WTException
Throws:
WTException

PP

private static void PP(String s)