eu.etaxonomy.cdm.io.common
Class CdmImportBase<CONFIG extends IImportConfigurator,STATE extends ImportStateBase>

java.lang.Object
  extended by eu.etaxonomy.cdm.api.application.CdmApplicationDefaultConfiguration
      extended by eu.etaxonomy.cdm.io.common.CdmIoBase<STATE>
          extended by eu.etaxonomy.cdm.io.common.CdmImportBase<CONFIG,STATE>
All Implemented Interfaces:
ICdmApplicationConfiguration, ICdmImport<CONFIG,STATE>, ICdmIO<STATE>, IIoObservable, org.springframework.beans.factory.Aware, org.springframework.context.ApplicationContextAware
Direct Known Subclasses:
DbImportBase, DwcaImport, EndNoteImportBase, ExcelImporterBase, IkeyPlusImport, SDDDataSetImport, SpecimenImportBase, SpecimenSythesysExcelImport, TcsRdfImportBase, TcsXmlImportBase, XmlImportBase

public abstract class CdmImportBase<CONFIG extends IImportConfigurator,STATE extends ImportStateBase>
extends CdmIoBase<STATE>
implements ICdmImport<CONFIG,STATE>

Version:
1.0
Author:
a.mueller

Nested Class Summary
static class CdmImportBase.TermMatchMode
           
 
Field Summary
protected static boolean CREATE
           
protected static boolean IMAGE_GALLERY
           
protected static boolean READ_MEDIA_DATA
           
static UUID uuidUserDefinedAnnotationTypeVocabulary
           
static UUID uuidUserDefinedExtensionTypeVocabulary
           
static UUID uuidUserDefinedFeatureVocabulary
           
static UUID uuidUserDefinedMarkerTypeVocabulary
           
static UUID uuidUserDefinedMeasurementUnitVocabulary
           
static UUID uuidUserDefinedModifierVocabulary
           
static UUID uuidUserDefinedNamedAreaLevelVocabulary
           
static UUID uuidUserDefinedNamedAreaVocabulary
           
static UUID uuidUserDefinedRankVocabulary
           
static UUID uuidUserDefinedReferenceSystemVocabulary
           
static UUID uuidUserDefinedStateVocabulary
           
static UUID uuidUserDefinedStatisticalMeasureVocabulary
           
static UUID uuidUserDefinedTaxonRelationshipTypeVocabulary
           
 
Fields inherited from class eu.etaxonomy.cdm.io.common.CdmIoBase
ioName
 
Fields inherited from class eu.etaxonomy.cdm.api.application.CdmApplicationDefaultConfiguration
applicationContext
 
Fields inherited from interface eu.etaxonomy.cdm.io.common.ICdmIO
FEATURE_STORE, NOMREF_DETAIL_STORE, NOMREF_STORE, PERSON_STORE, REF_DETAIL_STORE, REFERENCE_STORE, SPECIMEN_STORE, TAXON_STORE, TAXONNAME_STORE, TEAM_STORE, USER_STORE
 
Constructor Summary
CdmImportBase()
           
 
Method Summary
 void addOriginalSource(CdmBase cdmBase, Object idAttributeValue, String namespace, Reference citation)
          Adds an orginal source to a sourceable objects (implemented for Identifiable entity and description element.
 void addOriginalSource(ResultSet rs, CdmBase cdmBase, String dbIdAttribute, String namespace, Reference citation)
           
protected  void fillMissingEpithets(NonViralName parentName, NonViralName childName)
          If the child name is missing genus or species epithet information and the rank is below genus or species respectively the according epithets are taken from the parent name.
protected  void fillMissingEpithetsForTaxa(Taxon parentTaxon, Taxon childTaxon)
          If the child taxon is missing genus or species epithet information and the rank is below genus or species respectively the according epithets are taken from the parent taxon.
protected  Taxon getAcceptedTaxon(TaxonBase<?> taxonBase)
          Returns the accepted taxon of a taxon base.
protected  AnnotationType getAnnotationType(STATE state, UUID uuid, String label, String text, String labelAbbrev, TermVocabulary<AnnotationType> voc)
           
protected  ExtensionType getExtensionType(STATE state, UUID uuid, String label, String text, String labelAbbrev)
           
protected  ExtensionType getExtensionType(STATE state, UUID uuid, String label, String text, String labelAbbrev, TermVocabulary<ExtensionType> voc)
           
protected  Feature getFeature(STATE state, UUID uuid)
          Returns a feature if it exists, null otherwise.
protected  Feature getFeature(STATE state, UUID uuid, String label, String description, String labelAbbrev, TermVocabulary<Feature> voc)
          Returns a feature for a given uuid by first checking if the uuid has already been used in this import, if not checking if the feature exists in the database, if not creating it anew (with vocabulary etc.).
protected  TextData getFeaturePlaceholder(STATE state, DescriptionBase<?> description, Feature feature, boolean createIfNotExists)
          Returns the textdata that holds general information about a feature for a taxon description.
protected  Media getImageMedia(String uriString, boolean readMediaData, boolean isFigure)
          Creates
protected  Language getLanguage(STATE state, UUID uuid, String label, String text, String labelAbbrev)
          Returns a language for a given uuid by first ...
protected  Language getLanguage(STATE state, UUID uuid, String label, String text, String labelAbbrev, TermVocabulary voc)
           
protected  MarkerType getMarkerType(STATE state, String keyString)
           
protected  MarkerType getMarkerType(STATE state, UUID uuid, String label, String text, String labelAbbrev)
           
protected  MarkerType getMarkerType(STATE state, UUID uuid, String label, String text, String labelAbbrev, TermVocabulary<MarkerType> voc)
           
protected  MeasurementUnit getMeasurementUnit(STATE state, UUID uuid, String label, String description, String labelAbbrev, TermVocabulary<MeasurementUnit> voc)
          Returns a MeasurementUnit for a given uuid by first checking if the uuid has already been used in this import, if not checking if the MeasurementUnit exists in the database, if not creating it anew (with vocabulary etc.).
protected  Modifier getModifier(STATE state, UUID uuid, String label, String description, String labelAbbrev, TermVocabulary<Modifier> voc)
          Returns a Modifier for a given uuid by first checking if the uuid has already been used in this import, if not checking if the Modifier exists in the database, if not creating it anew (with vocabulary etc.).
protected  NamedArea getNamedArea(STATE state, UUID uuid, String label, String text, String labelAbbrev, NamedAreaType areaType, NamedAreaLevel level)
          Returns a named area for a given uuid by first .
protected  NamedArea getNamedArea(STATE state, UUID uuid, String label, String text, String labelAbbrev, NamedAreaType areaType, NamedAreaLevel level, TermVocabulary voc, CdmImportBase.TermMatchMode matchMode)
           
protected  NamedAreaLevel getNamedAreaLevel(STATE state, UUID uuid, String label, String text, String labelAbbrev, TermVocabulary<NamedAreaLevel> voc)
           
protected  PresenceTerm getPresenceTerm(STATE state, UUID uuid, String label, String text, String labelAbbrev)
          Returns a presence term for a given uuid by first ...
protected  Rank getRank(STATE state, UUID uuid, String label, String text, String labelAbbrev, OrderedTermVocabulary<Rank> voc, Rank lowerRank)
           
protected  ReferenceSystem getReferenceSystem(STATE state, UUID uuid, String label, String text, String labelAbbrev, TermVocabulary voc)
           
 SpecimenDescription getSpecimenDescription(SpecimenOrObservationBase specimen, boolean isImageGallery, boolean createNewIfNotExists)
          Returns the specimen description for a specimen or observation.
 SpecimenDescription getSpecimenDescription(SpecimenOrObservationBase specimen, Reference ref, boolean isImageGallery, boolean createNewIfNotExists)
          Like getSpecimenDescription(SpecimenOrObservationBase, boolean, boolean) Only matches a description if the given reference is a source of the description.
If a new description is created the given reference will be added as a source.
protected  State getStateTerm(STATE state, UUID uuid)
          Returns a State if it exists.
protected  State getStateTerm(STATE importState, UUID uuid, String label, String text, String labelAbbrev, OrderedTermVocabulary<State> voc)
          Returns a State for a given uuid by first checking if the uuid has already been used in this import, if not checking if the state exists in the database, if not creating it anew (with vocabulary etc.).
protected  StatisticalMeasure getStatisticalMeasure(STATE state, UUID uuid, String label, String description, String labelAbbrev, TermVocabulary<StatisticalMeasure> voc)
          Returns a StatisticalMeasure for a given uuid by first checking if the uuid has already been used in this import, if not checking if the StatisticalMeasure exists in the database, if not creating it anew (with vocabulary etc.).
 TaxonDescription getTaxonDescription(Taxon taxon, boolean isImageGallery, boolean createNewIfNotExists)
          Returns the taxon description for a taxon.
 TaxonDescription getTaxonDescription(Taxon taxon, Reference ref, boolean isImageGallery, boolean createNewIfNotExists)
          Like getTaxonDescription(Taxon, boolean, boolean) Only matches a description if the given reference is a source of the description.
If a new description is created the given reference will be added as a source.
 TaxonNameDescription getTaxonNameDescription(TaxonNameBase<?,?> name, Reference ref, boolean isImageGallery, boolean createNewIfNotExists)
          Like getTaxonDescription(Taxon, boolean, boolean) Only matches a description if the given reference is a source of the description.
If a new description is created the given reference will be added as a source.
 TaxonNameDescription getTaxonNameDescription(TaxonNameBase name, boolean isImageGallery, boolean createNewIfNotExists)
          Returns the taxon description for a taxon.
protected  TaxonRelationshipType getTaxonRelationshipType(STATE state, UUID uuid, String label, String text, String labelAbbrev, TermVocabulary<TaxonRelationshipType> voc)
          Returns a taxon relationship type for a given uuid by first checking if the uuid has already been used in this import, if not checking if the taxon relationship type exists in the database, if not creating it anew (with vocabulary etc.).
protected
<T extends DefinedTermBase>
TermVocabulary<T>
getVocabulary(UUID uuid, String text, String label, String abbrev, URI termSourceUri, boolean isOrdered, T type)
           
protected  Classification makeTree(STATE state, Reference reference)
           
protected  Classification makeTreeMemSave(STATE state, Reference ref)
          Alternative memory saving method variant of #makeTree(STATE state, Reference ref) which stores only the UUID instead of the full tree in the ImportStateBase by using state.putTreeUuid(ref, tree);
protected  String NB(String str)
          Returns null for all blank strings.
protected  Double nullSafeDouble(ResultSet rs, String columnName)
           
protected  Float nullSafeFloat(ResultSet rs, String columnName)
           
protected  Integer nullSafeInt(ResultSet rs, String columnName)
          Retrieves an Integer value from a result set.
 
Methods inherited from class eu.etaxonomy.cdm.io.common.CdmIoBase
addObserver, addObservers, check, commitTransaction, countObservers, countSteps, doCheck, doInvoke, fire, fireProgressEvent, fireWarningEvent, fireWarningEvent, flush, getInstance, getObservers, getSuccessString, invoke, isBlank, isIgnore, isNotBlank, removeObserver, removeObservers, rollbackTransaction, startTransaction, startTransaction, updateProgress, updateProgress, warnProgress
 
Methods inherited from class eu.etaxonomy.cdm.api.application.CdmApplicationDefaultConfiguration
authenticate, getAgentService, getAuthenticationManager, getBean, getClassificationService, getCollectionService, getCommonService, getDatabaseService, getDescriptionService, getFeatureNodeService, getFeatureTreeService, getGrantedAuthorityService, getGroupService, getIdentificationKeyService, getLocationService, getMainService, getMediaService, getNameService, getOccurrenceService, getPermissionEvaluator, getPolytomousKeyNodeService, getPolytomousKeyService, getReferenceService, getTaxonNodeService, getTaxonService, getTermService, getTransactionManager, getUserService, getVocabularyService, getWorkingSetService, NewConversation, setApplicationContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface eu.etaxonomy.cdm.io.common.ICdmIO
check, fire, invoke, updateProgress, updateProgress, warnProgress
 
Methods inherited from interface eu.etaxonomy.cdm.io.common.IIoObservable
addObserver, addObservers, countObservers, getObservers, removeObserver, removeObservers
 

Field Detail

CREATE

protected static final boolean CREATE
See Also:
Constant Field Values

IMAGE_GALLERY

protected static final boolean IMAGE_GALLERY
See Also:
Constant Field Values

READ_MEDIA_DATA

protected static final boolean READ_MEDIA_DATA
See Also:
Constant Field Values

uuidUserDefinedNamedAreaLevelVocabulary

public static final UUID uuidUserDefinedNamedAreaLevelVocabulary

uuidUserDefinedNamedAreaVocabulary

public static final UUID uuidUserDefinedNamedAreaVocabulary

uuidUserDefinedExtensionTypeVocabulary

public static final UUID uuidUserDefinedExtensionTypeVocabulary

uuidUserDefinedReferenceSystemVocabulary

public static final UUID uuidUserDefinedReferenceSystemVocabulary

uuidUserDefinedFeatureVocabulary

public static final UUID uuidUserDefinedFeatureVocabulary

uuidUserDefinedMeasurementUnitVocabulary

public static final UUID uuidUserDefinedMeasurementUnitVocabulary

uuidUserDefinedStatisticalMeasureVocabulary

public static final UUID uuidUserDefinedStatisticalMeasureVocabulary

uuidUserDefinedStateVocabulary

public static final UUID uuidUserDefinedStateVocabulary

uuidUserDefinedTaxonRelationshipTypeVocabulary

public static final UUID uuidUserDefinedTaxonRelationshipTypeVocabulary

uuidUserDefinedAnnotationTypeVocabulary

public static final UUID uuidUserDefinedAnnotationTypeVocabulary

uuidUserDefinedMarkerTypeVocabulary

public static final UUID uuidUserDefinedMarkerTypeVocabulary

uuidUserDefinedRankVocabulary

public static final UUID uuidUserDefinedRankVocabulary

uuidUserDefinedModifierVocabulary

public static final UUID uuidUserDefinedModifierVocabulary
Constructor Detail

CdmImportBase

public CdmImportBase()
Method Detail

makeTree

protected Classification makeTree(STATE state,
                                  Reference reference)

makeTreeMemSave

protected Classification makeTreeMemSave(STATE state,
                                         Reference ref)
Alternative memory saving method variant of #makeTree(STATE state, Reference ref) which stores only the UUID instead of the full tree in the ImportStateBase by using state.putTreeUuid(ref, tree);

Parameters:
state -
ref -
Returns:

getExtensionType

protected ExtensionType getExtensionType(STATE state,
                                         UUID uuid,
                                         String label,
                                         String text,
                                         String labelAbbrev)

getExtensionType

protected ExtensionType getExtensionType(STATE state,
                                         UUID uuid,
                                         String label,
                                         String text,
                                         String labelAbbrev,
                                         TermVocabulary<ExtensionType> voc)

getMarkerType

protected MarkerType getMarkerType(STATE state,
                                   String keyString)

getMarkerType

protected MarkerType getMarkerType(STATE state,
                                   UUID uuid,
                                   String label,
                                   String text,
                                   String labelAbbrev)

getMarkerType

protected MarkerType getMarkerType(STATE state,
                                   UUID uuid,
                                   String label,
                                   String text,
                                   String labelAbbrev,
                                   TermVocabulary<MarkerType> voc)

getAnnotationType

protected AnnotationType getAnnotationType(STATE state,
                                           UUID uuid,
                                           String label,
                                           String text,
                                           String labelAbbrev,
                                           TermVocabulary<AnnotationType> voc)

getReferenceSystem

protected ReferenceSystem getReferenceSystem(STATE state,
                                             UUID uuid,
                                             String label,
                                             String text,
                                             String labelAbbrev,
                                             TermVocabulary voc)

getRank

protected Rank getRank(STATE state,
                       UUID uuid,
                       String label,
                       String text,
                       String labelAbbrev,
                       OrderedTermVocabulary<Rank> voc,
                       Rank lowerRank)

getNamedArea

protected NamedArea getNamedArea(STATE state,
                                 UUID uuid,
                                 String label,
                                 String text,
                                 String labelAbbrev,
                                 NamedAreaType areaType,
                                 NamedAreaLevel level)
Returns a named area for a given uuid by first . If the named area does not

Parameters:
state -
uuid -
label -
text -
labelAbbrev -
areaType -
level -
Returns:

getNamedArea

protected NamedArea getNamedArea(STATE state,
                                 UUID uuid,
                                 String label,
                                 String text,
                                 String labelAbbrev,
                                 NamedAreaType areaType,
                                 NamedAreaLevel level,
                                 TermVocabulary voc,
                                 CdmImportBase.TermMatchMode matchMode)

getNamedAreaLevel

protected NamedAreaLevel getNamedAreaLevel(STATE state,
                                           UUID uuid,
                                           String label,
                                           String text,
                                           String labelAbbrev,
                                           TermVocabulary<NamedAreaLevel> voc)

getStateTerm

protected State getStateTerm(STATE state,
                             UUID uuid)
Returns a State if it exists. null otherwise.

Parameters:
state -
uuid -
Returns:
State

getStateTerm

protected State getStateTerm(STATE importState,
                             UUID uuid,
                             String label,
                             String text,
                             String labelAbbrev,
                             OrderedTermVocabulary<State> voc)
Returns a State for a given uuid by first checking if the uuid has already been used in this import, if not checking if the state exists in the database, if not creating it anew (with vocabulary etc.). If label, text and labelAbbrev are all null no state is created.

Parameters:
importState -
uuid -
label -
text -
labelAbbrev -
voc -
Returns:

getFeature

protected Feature getFeature(STATE state,
                             UUID uuid)
Returns a feature if it exists, null otherwise.

Parameters:
state -
uuid -
Returns:
See Also:
getFeature(ImportStateBase, UUID, String, String, String, TermVocabulary)

getFeature

protected Feature getFeature(STATE state,
                             UUID uuid,
                             String label,
                             String description,
                             String labelAbbrev,
                             TermVocabulary<Feature> voc)
Returns a feature for a given uuid by first checking if the uuid has already been used in this import, if not checking if the feature exists in the database, if not creating it anew (with vocabulary etc.). If label, text and labelAbbrev are all null no feature is created.

Parameters:
state -
uuid -
label -
text -
labelAbbrev -
Returns:

getMeasurementUnit

protected MeasurementUnit getMeasurementUnit(STATE state,
                                             UUID uuid,
                                             String label,
                                             String description,
                                             String labelAbbrev,
                                             TermVocabulary<MeasurementUnit> voc)
Returns a MeasurementUnit for a given uuid by first checking if the uuid has already been used in this import, if not checking if the MeasurementUnit exists in the database, if not creating it anew (with vocabulary etc.). If label, text and labelAbbrev are all null no MeasurementUnit is created.

Parameters:
state -
uuid -
label -
text -
labelAbbrev -
Returns:

getStatisticalMeasure

protected StatisticalMeasure getStatisticalMeasure(STATE state,
                                                   UUID uuid,
                                                   String label,
                                                   String description,
                                                   String labelAbbrev,
                                                   TermVocabulary<StatisticalMeasure> voc)
Returns a StatisticalMeasure for a given uuid by first checking if the uuid has already been used in this import, if not checking if the StatisticalMeasure exists in the database, if not creating it anew (with vocabulary etc.). If label, text and labelAbbrev are all null no StatisticalMeasure is created.

Parameters:
state -
uuid -
label -
text -
labelAbbrev -
Returns:

getModifier

protected Modifier getModifier(STATE state,
                               UUID uuid,
                               String label,
                               String description,
                               String labelAbbrev,
                               TermVocabulary<Modifier> voc)
Returns a Modifier for a given uuid by first checking if the uuid has already been used in this import, if not checking if the Modifier exists in the database, if not creating it anew (with vocabulary etc.). If label, text and labelAbbrev are all null no Modifier is created.

Parameters:
state -
uuid -
label -
text -
labelAbbrev -
Returns:

getTaxonRelationshipType

protected TaxonRelationshipType getTaxonRelationshipType(STATE state,
                                                         UUID uuid,
                                                         String label,
                                                         String text,
                                                         String labelAbbrev,
                                                         TermVocabulary<TaxonRelationshipType> voc)
Returns a taxon relationship type for a given uuid by first checking if the uuid has already been used in this import, if not checking if the taxon relationship type exists in the database, if not creating it anew (with vocabulary etc.). If label, text and labelAbbrev are all null no taxon relationship type is created.

Parameters:
state -
uuid -
label -
text -
labelAbbrev -
Returns:

getPresenceTerm

protected PresenceTerm getPresenceTerm(STATE state,
                                       UUID uuid,
                                       String label,
                                       String text,
                                       String labelAbbrev)
Returns a presence term for a given uuid by first ...

Parameters:
state -
uuid -
label -
text -
labelAbbrev -
Returns:

getLanguage

protected Language getLanguage(STATE state,
                               UUID uuid,
                               String label,
                               String text,
                               String labelAbbrev)
Returns a language for a given uuid by first ...

Parameters:
state -
uuid -
label -
text -
labelAbbrev -
Returns:

getLanguage

protected Language getLanguage(STATE state,
                               UUID uuid,
                               String label,
                               String text,
                               String labelAbbrev,
                               TermVocabulary voc)

getVocabulary

protected <T extends DefinedTermBase> TermVocabulary<T> getVocabulary(UUID uuid,
                                                                      String text,
                                                                      String label,
                                                                      String abbrev,
                                                                      URI termSourceUri,
                                                                      boolean isOrdered,
                                                                      T type)
Parameters:
uuid -
Returns:

addOriginalSource

public void addOriginalSource(CdmBase cdmBase,
                              Object idAttributeValue,
                              String namespace,
                              Reference citation)
Adds an orginal source to a sourceable objects (implemented for Identifiable entity and description element. If cdmBase is not sourceable nothing happens. TODO Move to DbImportBase once this exists. TODO also implemented in DbImportObjectCreationMapper (reduce redundance)

Parameters:
rs -
cdmBase -
dbIdAttribute -
namespace -
citation -
Throws:
SQLException

addOriginalSource

public void addOriginalSource(ResultSet rs,
                              CdmBase cdmBase,
                              String dbIdAttribute,
                              String namespace,
                              Reference citation)
                       throws SQLException
Parameters:
rs -
cdmBase -
dbIdAttribute -
namespace -
citation -
Throws:
SQLException
See Also:
addOriginalSource(CdmBase, Object, String, Reference)

fillMissingEpithetsForTaxa

protected void fillMissingEpithetsForTaxa(Taxon parentTaxon,
                                          Taxon childTaxon)
If the child taxon is missing genus or species epithet information and the rank is below genus or species respectively the according epithets are taken from the parent taxon. If the name is an autonym and has no combination author/basionym author the authors are taken from the parent.

Parameters:
parentTaxon -
childTaxon -

fillMissingEpithets

protected void fillMissingEpithets(NonViralName parentName,
                                   NonViralName childName)
If the child name is missing genus or species epithet information and the rank is below genus or species respectively the according epithets are taken from the parent name. If the name is an autonym and has no combination author/basionym author the authors are taken from the parent.

Parameters:
parentTaxon -
childTaxon -

getTaxonNameDescription

public TaxonNameDescription getTaxonNameDescription(TaxonNameBase name,
                                                    boolean isImageGallery,
                                                    boolean createNewIfNotExists)
Returns the taxon description for a taxon. If there are multiple taxon descriptions an arbitrary one is chosen. If no taxon description exists, a new one is created if createNewIfNotExists is true.

Parameters:
createNewIfNotExists -
isImageGallery - if true only taxon description being image galleries are considered. If false only taxon description being no image galleries are considered.
Returns:

getTaxonNameDescription

public TaxonNameDescription getTaxonNameDescription(TaxonNameBase<?,?> name,
                                                    Reference ref,
                                                    boolean isImageGallery,
                                                    boolean createNewIfNotExists)
Like getTaxonDescription(Taxon, boolean, boolean) Only matches a description if the given reference is a source of the description.
If a new description is created the given reference will be added as a source.

See Also:
getTaxonDescription(Taxon, boolean, boolean)

getTaxonDescription

public TaxonDescription getTaxonDescription(Taxon taxon,
                                            boolean isImageGallery,
                                            boolean createNewIfNotExists)
Returns the taxon description for a taxon. If there are multiple taxon descriptions an arbitrary one is chosen. If no taxon description exists, a new one is created if createNewIfNotExists is true.

Parameters:
createNewIfNotExists -
isImageGallery - if true only taxon description being image galleries are considered. If false only taxon description being no image galleries are considered.
Returns:

getTaxonDescription

public TaxonDescription getTaxonDescription(Taxon taxon,
                                            Reference ref,
                                            boolean isImageGallery,
                                            boolean createNewIfNotExists)
Like getTaxonDescription(Taxon, boolean, boolean) Only matches a description if the given reference is a source of the description.
If a new description is created the given reference will be added as a source.

See Also:
getTaxonDescription(Taxon, boolean, boolean)

getSpecimenDescription

public SpecimenDescription getSpecimenDescription(SpecimenOrObservationBase specimen,
                                                  boolean isImageGallery,
                                                  boolean createNewIfNotExists)
Returns the specimen description for a specimen or observation. If there are multiple specimen descriptions an arbitrary one is chosen. If no specimen description exists, a new one is created if createNewIfNotExists is true.

Parameters:
createNewIfNotExists -
isImageGallery - if true only specimen description being image galleries are considered. If false only specimen description being no image galleries are considered.
Returns:

getSpecimenDescription

public SpecimenDescription getSpecimenDescription(SpecimenOrObservationBase specimen,
                                                  Reference ref,
                                                  boolean isImageGallery,
                                                  boolean createNewIfNotExists)
Like getSpecimenDescription(SpecimenOrObservationBase, boolean, boolean) Only matches a description if the given reference is a source of the description.
If a new description is created the given reference will be added as a source.

See Also:
getTaxonDescription(Taxon, boolean, boolean)

getFeaturePlaceholder

protected TextData getFeaturePlaceholder(STATE state,
                                         DescriptionBase<?> description,
                                         Feature feature,
                                         boolean createIfNotExists)
Returns the textdata that holds general information about a feature for a taxon description. This is mainly necessary for descriptions that have more than one description element for a given feature such as 'distribution', 'description' or 'common name'. It may also hold for hierarchical features where no description element exists for a higher hierarchie level. Example: the description feature has subfeatures. But some information like authorship, figures, sources need to be added to the description itself. Currently a feature placeholder is marked by a marker of type 'feature placeholder'. Maybe in future there will be a boolean marker in the TextData class itself.

Parameters:
state -
feature -
taxon -
ref -
createIfNotExists -
Returns:

getAcceptedTaxon

protected Taxon getAcceptedTaxon(TaxonBase<?> taxonBase)
Returns the accepted taxon of a taxon base.
If taxonBase is of type taxon the same object is returned. If taxonBase is of type synonym the accepted taxon is returned if one exists. If no accepted taxon exists null is returned. If multiple accepted taxa exist the one taxon with the same secundum reference is returned. If no such single taxon exists an illegal state exception is thrown.

Parameters:
taxonBase -
Returns:

getImageMedia

protected Media getImageMedia(String uriString,
                              boolean readMediaData,
                              boolean isFigure)
                       throws MalformedURLException
Creates

Parameters:
uriString -
readDataFromUrl -
Returns:
Throws:
MalformedURLException
See Also:
READ_MEDIA_DATA

nullSafeInt

protected Integer nullSafeInt(ResultSet rs,
                              String columnName)
                       throws SQLException
Retrieves an Integer value from a result set. If the value is NULL null is returned. ResultSet.getInt() returns 0 therefore we need a special handling for this case.

Parameters:
rs -
columnName -
Returns:
Throws:
SQLException

nullSafeDouble

protected Double nullSafeDouble(ResultSet rs,
                                String columnName)
                         throws SQLException
Throws:
SQLException

nullSafeFloat

protected Float nullSafeFloat(ResultSet rs,
                              String columnName)
                       throws SQLException
Throws:
SQLException

NB

protected String NB(String str)
Returns null for all blank strings. Identity function otherwise.

Parameters:
str -
Returns:


Copyright © 2007-2013 EDIT. All Rights Reserved.