wt.ixb.handlers.forclasses
Class ExpImpForIBADefinition

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

public class ExpImpForIBADefinition
extends ClassExporterImporterTemplateGeneral


Field Summary
private static String ALREADY_EXPORTED
           
private static String IBA_DEFINITIONS_PATH_CACHE
           
private static String IBA_DEFINITIONS_ROOT_XML
           
private static String IMPORTED_EXISTING_IBA_DEFINITIONS
           
private static String IMPORTED_NEW_IBA_DEFINITIONS
           
private static boolean IS_HIERARCHICAL_DEFINITION_ALLOWED
           
static String LITE_IBA_REFERENCEABLE
          IBAReferenceable is not Federatable, and generally different implementation of IBAReferenceable interface has quite different attributes and attribute constaints.
static String NEW_IBA_DEFINITION_VIEW
           
private static String NOT_EXPORTED_DEFINITION
           
private static String NOT_EXPORTED_ORGANIZER
           
private  ExpImpForUnits unitsHandler
           
 
Fields inherited from class wt.ixb.publicforhandlers.ClassExporterImporterTemplateGeneral
CONFLICT_RESOURCE
 
Constructor Summary
ExpImpForIBADefinition()
           
 
Method Summary
 void addIBADefinitionForExport(String path, Exporter exporter)
           
 void addIBAOrganizerForExport(String name, Exporter exporter)
           
 void checkConflicts(IxbElement rootXml, Importer importer)
          Check conflicts against existing iba definition or attribute organizer.
private  void checkConflictsForIBADefinition(IxbElement fileXML, Importer importer, Vector orgPaths)
           
private  void checkQuantityOfMeasureConflictsForUnitDefinition(IxbElement fileXML, AbstractAttributeDefinition aad, Importer importer)
           
private  void exportAttributeDefinition(AbstractAttributeDefinition ad, Exporter exporter)
           
private  void exportAttributeOrganizer(AttributeOrganizer ao, Exporter exporter)
           
 void exportObject(Object object, Exporter exporter)
          Exports the specified object in context given by parameter exporter.
 void finalizeExport(Exporter exporter)
          This method is called in the end of the whole export process to execute any additional export process finalization.
private  AbstractAttributeDefinizerDefaultView getAttributeDefinizerView(String path, Importer importer)
           
private  AttributeOrganizer getAttributeOrganizerOfFullName(String fullName)
           
private  AttributeOrganizer getAttributeOrganizerOfNameAndPath(String name, String path)
          AttributeOrganizer can not be uniquely determined by its name.
private  AttributeOrgDefaultView getAttributeOrgDefView(String fullPath)
           
private  String getClassNameWithoutPath(String fullClassName)
           
private static String getFullPathOfIBAs(AbstractAttributeDefinizerDefaultView theView)
           
 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  String getParentPath(String path)
           
private static int getPathLevel(String path)
           
private  String getPathOfAttributeDefinition_WithOrganizer(AttributeHierarchyParent ad)
           
private static String getPathWithoutOrg(String fullPath)
          Assume the full path is TestOrganizer/Orga/TestString100, where it is assume that TestOrganizer/Orga is corresponding to AttributeOrganizer, and TestString100 is corresponding to StringDefinition.
private  String getPathWithoutOrgFromCache(Vector cachedOrgPaths, String fullPath)
          This method is invoked during conflict check for better user warning/error messages.
private  QuantityOfMeasureDefaultView getQuantityOfMeasureDefaultView(String qomName, Importer importer)
           
protected  String getRootTag()
           
private  Object importAttributeOrganizerObject(String name, String description, String displayName, String hierachyDispname, String parentPath, Importer importer)
           
private  Object importBooleanDefinitionObject(String name, String description, String displayName, String hierachyDispname, String parentPath, Importer importer)
           
 Object importElement(IxbElement rootXML, Importer importer)
          Imports XML element in context given by importer parameter.
private  Object importFloatDefinitionObject(String name, String description, String displayName, String hierachyDispname, String parentPath, Importer importer)
           
private  Object importIntegerDefinitionObject(String name, String description, String displayName, String hierachyDispname, String parentPath, Importer importer)
           
private  Object importRatioDefinitionObject(String name, String description, String displayName, String hierachyDispname, String parentPath, Importer importer)
           
private  Object importReferenceDefinitionObject(String name, String description, String displayName, String hierachyDispname, String parentPath, String referenceClass, Importer importer)
           
private  Object importStringDefinitionObject(String name, String description, String displayName, String hierachyDispname, String parentPath, Importer importer)
           
private  Object importTimestampDefinitionObject(String name, String description, String displayName, String hierachyDispname, String parentPath, Importer importer)
           
private  Object importUnitDefinitionObject(String name, String description, String displayName, String hierachyDispname, String parentPath, String qomName, Enumeration defaultMsNameValues, Enumeration msNameValues, Importer importer)
           
private  Object importURLDefinitionObject(String name, String description, String displayName, String hierachyDispname, String parentPath, Importer importer)
           
 void outputLog(Object ob, Importer importer)
          Output log for imported object.
private static void PP(String s)
           
 void previewElement(IxbElement fileXML, Importer importer)
          Preview XML element in context given by importer parameter.
static AbstractAttributeDefinition queryIBADefinitionFromFullPath(Class ibaDefClass, String fullPath, Importer importer)
          Since IBA Definition name does not need to be unique anymore, to successfully query the AbstractAttributeDefinition object, the path and name shld be passed also.
private  void reallyImportIBADefinition(IxbElement fileXML, Importer importer)
           
 
Methods inherited from class wt.ixb.publicforhandlers.ClassExporterImporterTemplateGeneral
finalizeCheckConflicts, finalizeImport, getAdditionalImportPriority, prepareForCheckConflicts, prepareForImport
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NOT_EXPORTED_DEFINITION

private static final String NOT_EXPORTED_DEFINITION
See Also:
Constant Field Values

NOT_EXPORTED_ORGANIZER

private static final String NOT_EXPORTED_ORGANIZER
See Also:
Constant Field Values

ALREADY_EXPORTED

private static final String ALREADY_EXPORTED
See Also:
Constant Field Values

NEW_IBA_DEFINITION_VIEW

public static final String NEW_IBA_DEFINITION_VIEW
See Also:
Constant Field Values

LITE_IBA_REFERENCEABLE

public static final String LITE_IBA_REFERENCEABLE
IBAReferenceable is not Federatable, and generally different implementation of IBAReferenceable interface has quite different attributes and attribute constaints. In order to embed the (IBA) ReferenceDefinition and IBAReferenceable into IXB framework easily, we intend to maintain a public liteIBAReferenceableCache for each Importer instance: the key will be the source site's IBAReferenceable object identifier (String), the value will be the LiteIBAReferenceable of the corresponding IBAReferenceable object, such as BusinessEntityDefaultView, etc.

See Also:
Constant Field Values

IBA_DEFINITIONS_PATH_CACHE

private static final String IBA_DEFINITIONS_PATH_CACHE
See Also:
Constant Field Values

IBA_DEFINITIONS_ROOT_XML

private static final String IBA_DEFINITIONS_ROOT_XML
See Also:
Constant Field Values

IMPORTED_NEW_IBA_DEFINITIONS

private static final String IMPORTED_NEW_IBA_DEFINITIONS
See Also:
Constant Field Values

IMPORTED_EXISTING_IBA_DEFINITIONS

private static final String IMPORTED_EXISTING_IBA_DEFINITIONS
See Also:
Constant Field Values

unitsHandler

private ExpImpForUnits unitsHandler

IS_HIERARCHICAL_DEFINITION_ALLOWED

private static boolean IS_HIERARCHICAL_DEFINITION_ALLOWED
Constructor Detail

ExpImpForIBADefinition

public ExpImpForIBADefinition()
Method Detail

getRootTag

protected String getRootTag()

addIBADefinitionForExport

public void addIBADefinitionForExport(String path,
                                      Exporter exporter)
                               throws WTException
Throws:
WTException

addIBAOrganizerForExport

public void addIBAOrganizerForExport(String name,
                                     Exporter exporter)
                              throws WTException
Throws:
WTException

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

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

exportAttributeDefinition

private void exportAttributeDefinition(AbstractAttributeDefinition ad,
                                       Exporter exporter)
                                throws WTException
Throws:
WTException

exportAttributeOrganizer

private void exportAttributeOrganizer(AttributeOrganizer ao,
                                      Exporter exporter)
                               throws WTException
Throws:
WTException

checkConflicts

public void checkConflicts(IxbElement rootXml,
                           Importer importer)
                    throws WTException
Check conflicts against existing iba definition or attribute organizer. Existing iba definition or attribute organizer is found according to the name and parent path as in the XML file Currently the import action is the default one (PickingExisting object) Overrideable conflicts are as follows: i) The IBADefinition or AttributeOrganizer is not found in the target system. ii) The attributes "displayName", "description" and "hierachyDisplayName" are different from the existing object in the target system Non-overrideable conflicts will be reported if and only if the TypeDefinition exists at the target system, and the type is different (for example, in the XML file it is "StringDefinition" but in the target system it is "IntegerDefinition")

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

checkConflictsForIBADefinition

private void checkConflictsForIBADefinition(IxbElement fileXML,
                                            Importer importer,
                                            Vector orgPaths)
                                     throws WTException
Throws:
WTException

checkQuantityOfMeasureConflictsForUnitDefinition

private void checkQuantityOfMeasureConflictsForUnitDefinition(IxbElement fileXML,
                                                              AbstractAttributeDefinition aad,
                                                              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

reallyImportIBADefinition

private void reallyImportIBADefinition(IxbElement fileXML,
                                       Importer importer)
                                throws WTException
Throws:
WTException

importStringDefinitionObject

private Object importStringDefinitionObject(String name,
                                            String description,
                                            String displayName,
                                            String hierachyDispname,
                                            String parentPath,
                                            Importer importer)
                                     throws WTException
Throws:
WTException

importBooleanDefinitionObject

private Object importBooleanDefinitionObject(String name,
                                             String description,
                                             String displayName,
                                             String hierachyDispname,
                                             String parentPath,
                                             Importer importer)
                                      throws WTException
Throws:
WTException

importIntegerDefinitionObject

private Object importIntegerDefinitionObject(String name,
                                             String description,
                                             String displayName,
                                             String hierachyDispname,
                                             String parentPath,
                                             Importer importer)
                                      throws WTException
Throws:
WTException

importReferenceDefinitionObject

private Object importReferenceDefinitionObject(String name,
                                               String description,
                                               String displayName,
                                               String hierachyDispname,
                                               String parentPath,
                                               String referenceClass,
                                               Importer importer)
                                        throws WTException
Throws:
WTException

importFloatDefinitionObject

private Object importFloatDefinitionObject(String name,
                                           String description,
                                           String displayName,
                                           String hierachyDispname,
                                           String parentPath,
                                           Importer importer)
                                    throws WTException
Throws:
WTException

importRatioDefinitionObject

private Object importRatioDefinitionObject(String name,
                                           String description,
                                           String displayName,
                                           String hierachyDispname,
                                           String parentPath,
                                           Importer importer)
                                    throws WTException
Throws:
WTException

importURLDefinitionObject

private Object importURLDefinitionObject(String name,
                                         String description,
                                         String displayName,
                                         String hierachyDispname,
                                         String parentPath,
                                         Importer importer)
                                  throws WTException
Throws:
WTException

importTimestampDefinitionObject

private Object importTimestampDefinitionObject(String name,
                                               String description,
                                               String displayName,
                                               String hierachyDispname,
                                               String parentPath,
                                               Importer importer)
                                        throws WTException
Throws:
WTException

getAttributeDefinizerView

private AbstractAttributeDefinizerDefaultView getAttributeDefinizerView(String path,
                                                                        Importer importer)
                                                                 throws WTException
Throws:
WTException

getAttributeOrganizerOfNameAndPath

private AttributeOrganizer getAttributeOrganizerOfNameAndPath(String name,
                                                              String path)
                                                       throws WTException
AttributeOrganizer can not be uniquely determined by its name. The path is also important

Throws:
WTException

getAttributeOrgDefView

private AttributeOrgDefaultView getAttributeOrgDefView(String fullPath)
                                                throws WTException
Throws:
WTException

getPathOfAttributeDefinition_WithOrganizer

private String getPathOfAttributeDefinition_WithOrganizer(AttributeHierarchyParent ad)
                                                   throws WTException
Throws:
WTException

getParentPath

private String getParentPath(String path)

getPathLevel

private static int getPathLevel(String path)

getClassNameWithoutPath

private String getClassNameWithoutPath(String fullClassName)

getAttributeOrganizerOfFullName

private AttributeOrganizer getAttributeOrganizerOfFullName(String fullName)
                                                    throws WTException
Throws:
WTException

importUnitDefinitionObject

private Object importUnitDefinitionObject(String name,
                                          String description,
                                          String displayName,
                                          String hierachyDispname,
                                          String parentPath,
                                          String qomName,
                                          Enumeration defaultMsNameValues,
                                          Enumeration msNameValues,
                                          Importer importer)
                                   throws WTException
Throws:
WTException

importAttributeOrganizerObject

private Object importAttributeOrganizerObject(String name,
                                              String description,
                                              String displayName,
                                              String hierachyDispname,
                                              String parentPath,
                                              Importer importer)
                                       throws WTException
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

queryIBADefinitionFromFullPath

public static AbstractAttributeDefinition queryIBADefinitionFromFullPath(Class ibaDefClass,
                                                                         String fullPath,
                                                                         Importer importer)
                                                                  throws WTException
Since IBA Definition name does not need to be unique anymore, to successfully query the AbstractAttributeDefinition object, the path and name shld be passed also.

Throws:
WTException

getPathWithoutOrgFromCache

private String getPathWithoutOrgFromCache(Vector cachedOrgPaths,
                                          String fullPath)
This method is invoked during conflict check for better user warning/error messages. Since orgs not existed in the DB are not created during this stage, the only choice is to cache the related orgs temporarily


getPathWithoutOrg

private static String getPathWithoutOrg(String fullPath)
                                 throws WTException
Assume the full path is TestOrganizer/Orga/TestString100, where it is assume that TestOrganizer/Orga is corresponding to AttributeOrganizer, and TestString100 is corresponding to StringDefinition. Basically we shld return TestString100 in this case Note: we can consider to maintain a cache for the result; otherwise this will affect performance

Throws:
WTException

getFullPathOfIBAs

private static String getFullPathOfIBAs(AbstractAttributeDefinizerDefaultView theView)
                                 throws WTException
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

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

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

getQuantityOfMeasureDefaultView

private QuantityOfMeasureDefaultView getQuantityOfMeasureDefaultView(String qomName,
                                                                     Importer importer)
                                                              throws RemoteException,
                                                                     WTException
Throws:
RemoteException
WTException

PP

private static void PP(String s)