eu.etaxonomy.cdm.io.common.mapping
Class DbImportExtensionCreationMapper

java.lang.Object
  extended by eu.etaxonomy.cdm.io.common.mapping.CdmMapperBase
      extended by eu.etaxonomy.cdm.io.common.mapping.CdmAttributeMapperBase
          extended by eu.etaxonomy.cdm.io.common.mapping.MultipleAttributeMapperBase<CdmSingleAttributeMapperBase>
              extended by eu.etaxonomy.cdm.io.common.mapping.DbImportMultiAttributeMapperBase<CREATE,STATE>
                  extended by eu.etaxonomy.cdm.io.common.mapping.DbImportObjectCreationMapperBase<SUPPLEMENT,STATE>
                      extended by eu.etaxonomy.cdm.io.common.mapping.DbImportSupplementCreationMapperBase<Extension,IdentifiableEntity,DbImportStateBase<?,?>,ExtensionType>
                          extended by eu.etaxonomy.cdm.io.common.mapping.DbImportExtensionCreationMapper
All Implemented Interfaces:
IDbImportMapper<DbImportStateBase<?,?>,Extension>

public class DbImportExtensionCreationMapper
extends DbImportSupplementCreationMapperBase<Extension,IdentifiableEntity,DbImportStateBase<?,?>,ExtensionType>

Object creation mapper which creates a extensions.

Version:
1.0
Author:
a.mueller

Field Summary
 
Fields inherited from class eu.etaxonomy.cdm.io.common.mapping.DbImportSupplementCreationMapperBase
addOriginalSourceId, dbSupplementedObjectAttribute, dbSupplementValueAttribute, supplementType
 
Fields inherited from class eu.etaxonomy.cdm.io.common.mapping.DbImportObjectCreationMapperBase
dbIdAttribute, objectToCreateNamespace
 
Fields inherited from class eu.etaxonomy.cdm.io.common.mapping.DbImportMultiAttributeMapperBase
importMapperHelper
 
Fields inherited from class eu.etaxonomy.cdm.io.common.mapping.MultipleAttributeMapperBase
singleMappers
 
Constructor Summary
protected DbImportExtensionCreationMapper(String dbSupplementedObjectAttribute, String supplementedObjectNamespace, String dbSupplementValueAttribute, String dbIdAttribute, ExtensionType supplementType)
           
 
Method Summary
protected  boolean addSupplement(Extension extension, IdentifiableEntity identifiableEntity, String id)
          Adds the supplement to the supplementable entity.
protected  Extension createObject(ResultSet rs)
          This method creates the object to be created.
static DbImportExtensionCreationMapper NewInstance(String dbExtendedObjectAttribute, String extendedObjectNamespace)
          Creates an extension mapper which creates an empty extension.
static DbImportExtensionCreationMapper NewInstance(String dbExtendedObjectAttribute, String extendedObjectNamespace, String dbExtensionValueAttribute, String dbIdAttribute, ExtensionType extensionType)
          Creates an extension mapper which creates an extension and sets the extension value, the extension type and adds an annotation holding the original source id
protected  void setSupplementValue(ResultSet rs, Extension extension)
           
 
Methods inherited from class eu.etaxonomy.cdm.io.common.mapping.DbImportSupplementCreationMapperBase
addOriginalSource, doInvoke
 
Methods inherited from class eu.etaxonomy.cdm.io.common.mapping.DbImportObjectCreationMapperBase
getTransformer, invoke
 
Methods inherited from class eu.etaxonomy.cdm.io.common.mapping.DbImportMultiAttributeMapperBase
getForeignKey, getRelatedObject, getRelatedObject, getState, initialize
 
Methods inherited from class eu.etaxonomy.cdm.io.common.mapping.MultipleAttributeMapperBase
getDestinationAttributeList, getDestinationAttributes, getSourceAttributeList, getSourceAttributes, getStringDbValue
 
Methods inherited from class eu.etaxonomy.cdm.io.common.mapping.CdmAttributeMapperBase
toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DbImportExtensionCreationMapper

protected DbImportExtensionCreationMapper(String dbSupplementedObjectAttribute,
                                          String supplementedObjectNamespace,
                                          String dbSupplementValueAttribute,
                                          String dbIdAttribute,
                                          ExtensionType supplementType)
Method Detail

NewInstance

public static DbImportExtensionCreationMapper NewInstance(String dbExtendedObjectAttribute,
                                                          String extendedObjectNamespace)
Creates an extension mapper which creates an empty extension.

Parameters:
dbExtendedObjectAttribute - the database column that holds the foreign key for the extended object - obligatory
extendedObjectNamespace - the namespace under which the extended object has been saved previously - obligatory
Returns:
DbImportExtensionCreationMapper

NewInstance

public static DbImportExtensionCreationMapper NewInstance(String dbExtendedObjectAttribute,
                                                          String extendedObjectNamespace,
                                                          String dbExtensionValueAttribute,
                                                          String dbIdAttribute,
                                                          ExtensionType extensionType)
Creates an extension mapper which creates an extension and sets the extension value, the extension type and adds an annotation holding the original source id

Parameters:
dbExtendedObjectAttribute - the database column that holds the foreign key for the extended object - obligatory
extendedObjectNamespace - the namespace under which the extended object has been saved previously - obligatory
dbExtensionValueAttribute - if null no extension value is set
dbIdAttribute - if null not original source id annotation is added
extensionType - if null no extension type is set
Returns:
DbImportExtensionCreationMapper

addSupplement

protected boolean addSupplement(Extension extension,
                                IdentifiableEntity identifiableEntity,
                                String id)
Description copied from class: DbImportSupplementCreationMapperBase
Adds the supplement to the supplementable entity. Returns falls if supplementable entity is null

Specified by:
addSupplement in class DbImportSupplementCreationMapperBase<Extension,IdentifiableEntity,DbImportStateBase<?,?>,ExtensionType>
Parameters:
extension - the supplement (e.g. an instance of class Extension)
identifiableEntity - the supplementable entity (e.g. an IdentifiableEntity in case of a supplement of type Extension
id - the supplementableEntity original source id (needed for verbose logging)

setSupplementValue

protected void setSupplementValue(ResultSet rs,
                                  Extension extension)
                           throws SQLException
Specified by:
setSupplementValue in class DbImportSupplementCreationMapperBase<Extension,IdentifiableEntity,DbImportStateBase<?,?>,ExtensionType>
Throws:
SQLException

createObject

protected Extension createObject(ResultSet rs)
                          throws SQLException
Description copied from class: DbImportObjectCreationMapperBase
This method creates the object to be created. It needs to be implemented by the concrete classes. E.g. if you have a TaxonNameCreation class which inherits from this class you need to implement createObject by creating an empty taxon name.

Specified by:
createObject in class DbImportObjectCreationMapperBase<Extension,DbImportStateBase<?,?>>
Parameters:
rs - The result set
Returns:
The object to be created
Throws:
SQLException


Copyright © 2007-2013 EDIT. All Rights Reserved.