3 * Copyright (C) 2007 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
7 * The contents of this file are subject to the Mozilla Public License Version 1.1
8 * See LICENSE.TXT at the top of this package for the full license terms.
11 package eu
.etaxonomy
.taxeditor
.model
;
13 import java
.lang
.reflect
.InvocationTargetException
;
14 import java
.lang
.reflect
.Method
;
15 import java
.util
.Arrays
;
16 import java
.util
.List
;
19 import org
.apache
.commons
.lang
.StringUtils
;
20 import org
.hibernate
.LazyInitializationException
;
22 import eu
.etaxonomy
.cdm
.api
.service
.DefaultCategoricalDescriptionBuilder
;
23 import eu
.etaxonomy
.cdm
.api
.service
.DefaultQuantitativeDescriptionBuilder
;
24 import eu
.etaxonomy
.cdm
.api
.service
.DescriptionBuilder
;
25 import eu
.etaxonomy
.cdm
.common
.CdmUtils
;
26 import eu
.etaxonomy
.cdm
.model
.common
.CdmBase
;
27 import eu
.etaxonomy
.cdm
.model
.common
.Group
;
28 import eu
.etaxonomy
.cdm
.model
.common
.IdentifiableEntity
;
29 import eu
.etaxonomy
.cdm
.model
.common
.Language
;
30 import eu
.etaxonomy
.cdm
.model
.common
.LanguageString
;
31 import eu
.etaxonomy
.cdm
.model
.common
.LanguageStringBase
;
32 import eu
.etaxonomy
.cdm
.model
.common
.Marker
;
33 import eu
.etaxonomy
.cdm
.model
.common
.MarkerType
;
34 import eu
.etaxonomy
.cdm
.model
.common
.OriginalSourceBase
;
35 import eu
.etaxonomy
.cdm
.model
.common
.RelationshipBase
;
36 import eu
.etaxonomy
.cdm
.model
.common
.RelationshipTermBase
;
37 import eu
.etaxonomy
.cdm
.model
.common
.Representation
;
38 import eu
.etaxonomy
.cdm
.model
.common
.User
;
39 import eu
.etaxonomy
.cdm
.model
.description
.CategoricalData
;
40 import eu
.etaxonomy
.cdm
.model
.description
.CommonTaxonName
;
41 import eu
.etaxonomy
.cdm
.model
.description
.DescriptionBase
;
42 import eu
.etaxonomy
.cdm
.model
.description
.DescriptionElementBase
;
43 import eu
.etaxonomy
.cdm
.model
.description
.DescriptionElementSource
;
44 import eu
.etaxonomy
.cdm
.model
.description
.Distribution
;
45 import eu
.etaxonomy
.cdm
.model
.description
.Feature
;
46 import eu
.etaxonomy
.cdm
.model
.description
.IndividualsAssociation
;
47 import eu
.etaxonomy
.cdm
.model
.description
.PresenceAbsenceTerm
;
48 import eu
.etaxonomy
.cdm
.model
.description
.QuantitativeData
;
49 import eu
.etaxonomy
.cdm
.model
.description
.SpecimenDescription
;
50 import eu
.etaxonomy
.cdm
.model
.description
.TaxonDescription
;
51 import eu
.etaxonomy
.cdm
.model
.description
.TaxonInteraction
;
52 import eu
.etaxonomy
.cdm
.model
.description
.TaxonNameDescription
;
53 import eu
.etaxonomy
.cdm
.model
.description
.TextData
;
54 import eu
.etaxonomy
.cdm
.model
.location
.NamedArea
;
55 import eu
.etaxonomy
.cdm
.model
.media
.Media
;
56 import eu
.etaxonomy
.cdm
.model
.name
.HomotypicalGroup
;
57 import eu
.etaxonomy
.cdm
.model
.name
.HybridRelationship
;
58 import eu
.etaxonomy
.cdm
.model
.name
.NameRelationship
;
59 import eu
.etaxonomy
.cdm
.model
.name
.NameTypeDesignation
;
60 import eu
.etaxonomy
.cdm
.model
.name
.SpecimenTypeDesignation
;
61 import eu
.etaxonomy
.cdm
.model
.name
.TaxonNameBase
;
62 import eu
.etaxonomy
.cdm
.model
.name
.TypeDesignationBase
;
63 import eu
.etaxonomy
.cdm
.model
.name
.TypeDesignationStatusBase
;
64 import eu
.etaxonomy
.cdm
.model
.occurrence
.DeterminationEvent
;
65 import eu
.etaxonomy
.cdm
.model
.occurrence
.SpecimenOrObservationBase
;
66 import eu
.etaxonomy
.cdm
.model
.taxon
.Classification
;
67 import eu
.etaxonomy
.cdm
.model
.taxon
.Taxon
;
68 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonBase
;
69 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonNode
;
70 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonRelationship
;
71 import eu
.etaxonomy
.taxeditor
.store
.CdmStore
;
74 * <p>DescriptionHelper class.</p>
80 public class DescriptionHelper
{
83 * Returns whatever the element's title cache equivalent is,
84 * depending on its class.
86 * @param element a {@link eu.etaxonomy.cdm.model.description.DescriptionElementBase} object.
87 * @param language a {@link eu.etaxonomy.cdm.model.common.Language} object.
88 * @return a {@link java.lang.String} object.
90 public static String
getCache(DescriptionElementBase element
,
93 String mainElementLabel
= null;
94 DescriptionBase
<?
> descr
= element
.getInDescription();
96 if (descr
.isInstanceOf(TaxonDescription
.class)){
97 Taxon taxon
= CdmBase
.deproxy(descr
, TaxonDescription
.class).getTaxon();
99 mainElementLabel
= taxon
.getTitleCache();
101 }else if (descr
.isInstanceOf(SpecimenDescription
.class)){
102 SpecimenOrObservationBase
<?
> specimen
= CdmBase
.deproxy(descr
, SpecimenDescription
.class).getDescribedSpecimenOrObservation();
103 if (specimen
!= null){
104 mainElementLabel
= specimen
.getTitleCache();
106 }else if (descr
.isInstanceOf(TaxonNameDescription
.class)){
107 TaxonNameBase
<?
, ?
> name
= CdmBase
.deproxy(descr
, TaxonNameDescription
.class).getTaxonName();
109 mainElementLabel
= name
.getTitleCache();
115 if (element
instanceof TextData
) {
116 cache
= ((TextData
) element
).getText(language
);
118 if (element
instanceof CommonTaxonName
) {
119 cache
= ((CommonTaxonName
) element
).getName();
121 if (element
instanceof TaxonInteraction
) {
122 Taxon taxon2
= ((TaxonInteraction
) element
).getTaxon2();
123 if(taxon2
!= null && taxon2
.getName() != null){
124 cache
= taxon2
.getName().getTitleCache();
126 cache
= "No taxon chosen";
130 if (element
instanceof Distribution
) {
131 Distribution distribution
= (Distribution
) element
;
133 NamedArea area
= distribution
.getArea();
135 cache
= area
.getLabel();
137 PresenceAbsenceTerm status
= distribution
.getStatus();
139 cache
+= ", no status";
141 cache
+= ", " + status
.getLabel();
145 String result
= cache
== null ?
"" : cache
;
146 if (StringUtils
.isNotBlank(mainElementLabel
)){
147 result
= CdmUtils
.concat(" ", result
, "(" + mainElementLabel
+ ")");
153 * Returns whatever the element's title cache equivalent is,
154 * depending on its class, using the default language.
156 * @param element a {@link eu.etaxonomy.cdm.model.description.DescriptionElementBase} object.
157 * @return a {@link java.lang.String} object.
159 public static String
getCache(DescriptionElementBase element
) {
160 return getCache(element
, CdmStore
.getDefaultLanguage());
164 * Set whatever the element's title cache equivalent is,
165 * depending on its class.
167 * @param element a {@link eu.etaxonomy.cdm.model.description.DescriptionElementBase} object.
168 * @param value a {@link java.lang.String} object.
169 * @param language a {@link eu.etaxonomy.cdm.model.common.Language} object.
171 public static void setCache(DescriptionElementBase element
,
172 String value
, Language language
) {
173 if (element
instanceof TextData
) {
174 ((TextData
) element
).putText(language
, value
);
176 }else if (element
instanceof CommonTaxonName
) {
177 ((CommonTaxonName
) element
).setName(value
);
179 }else if (element
instanceof TaxonInteraction
) {
181 }else if(element
instanceof Distribution
){
182 MessagingUtils
.warn(DescriptionHelper
.class, "trying to set cache on distribution, don't know what to do at the moment.");
185 MessagingUtils
.warn(DescriptionHelper
.class, "No matching subclass found for DescriptionElementBase object, 'cache' not set.");
190 * Set whatever the element's title cache equivalent is,
191 * depending on its class, using the default language.
193 * @param element a {@link eu.etaxonomy.cdm.model.description.DescriptionElementBase} object.
194 * @param value a {@link java.lang.String} object.
196 public static void setCache(DescriptionElementBase element
,
198 setCache(element
, value
, CdmStore
.getDefaultLanguage());
203 * <p>getObjectDescription</p>
205 * @param element a {@link java.lang.Object} object.
206 * @return a {@link java.lang.String} object.
208 public static String
getObjectDescription(Object element
) {
209 if (element
instanceof IdentifiableEntity
) {
211 return ((IdentifiableEntity
) element
).getTitleCache();
212 }catch(LazyInitializationException e
){
213 String result
= "No Session to initialize title cache for IdentifiableEntity";
214 MessagingUtils
.error(DescriptionHelper
.class, result
, e
);
215 return "TODO: " + result
;
217 }else if (element
instanceof OriginalSourceBase
) {
219 OriginalSourceBase
<?
> originalSource
= (OriginalSourceBase
<?
>) element
;
220 // ISourceable sourcedObject = originalSource.getSourcedObj();
221 //due to #5743 the bidirectionality for sourced object had to be removed
222 String sourceObjectTitle
= "sourced object data not available (#5743)";
223 // if(sourcedObject instanceof IIdentifiableEntity){
224 // sourceObjectTitle = ((IdentifiableEntity) sourcedObject).getTitleCache();
225 // }else if(sourcedObject instanceof DescriptionElementBase){
226 // sourceObjectTitle = "Element for description: " + ((DescriptionElementBase) sourcedObject).getInDescription().getTitleCache();
228 // throw new IllegalStateException("Unknown ISourceable object for given OriginalSourceBase");
231 return CdmUtils
.concat("; ", new String
[]{originalSource
.getIdNamespace(), originalSource
.getIdInSource(), sourceObjectTitle
});
232 }catch(LazyInitializationException e
){
233 String result
= "Error initializing title cache for ISourceable of an OriginalSourceBase";
234 MessagingUtils
.error(DescriptionHelper
.class, result
, e
);
235 return "TODO: " + result
;
237 }else if (element
instanceof LanguageStringBase
) {
238 return ((LanguageStringBase
) element
).getText();
239 }else if (element
instanceof DescriptionElementBase
) {
240 return getCache((DescriptionElementBase
) element
);
241 }else if (element
instanceof RelationshipBase
<?
, ?
, ?
>) {
242 return getCache((RelationshipBase
<?
, ?
, ?
>) element
);
243 }else if (element
instanceof TypeDesignationBase
<?
>) {
244 return getCache((TypeDesignationBase
<?
>) element
);
245 }else if (element
instanceof HomotypicalGroup
) {
246 return getCache((HomotypicalGroup
) element
);
247 }else if (element
instanceof TaxonNode
) {
248 return getCache((TaxonNode
) element
);
249 }else if (element
instanceof DeterminationEvent
) {
250 return getCache((DeterminationEvent
) element
);
251 }else if (element
instanceof Marker
) {
252 Marker marker
= (Marker
) element
;
253 MarkerType type
= marker
.getMarkerType();
254 return (type
== null ?
"- no marker type -" : marker
.getMarkerType().getLabel()) + " (" + marker
.getFlag() + ")";
255 }else if (element
instanceof User
) {
256 User user
= (User
) element
;
257 return user
.getUsername();
258 }else if (element
instanceof Group
) {
259 Group group
= (Group
) element
;
260 return group
.getName();
262 // TODO write return texts for HomotypicalGroup, etc.
263 return element
.toString();
268 private static String
getCache(DeterminationEvent detEvent
) {
270 String taxonStr
= null;
271 TaxonNameBase
<?
,?
> taxonName
= detEvent
.getTaxonName();
272 TaxonBase
<?
> taxon
= detEvent
.getTaxon();
273 if (taxonName
!= null){
274 taxonStr
= taxonName
.getTitleCache();
276 if (StringUtils
.isBlank(taxonStr
) && taxon
!= null){
277 taxonStr
= taxon
.getTitleCache();
279 if (StringUtils
.isBlank(taxonStr
)){
280 taxonStr
= "no or unlabled taxon";
285 SpecimenOrObservationBase
<?
> unit
= detEvent
.getIdentifiedUnit();
288 unitStr
= unit
.getTitleCache();
289 if (StringUtils
.isBlank(unitStr
)){
290 unitStr
= "Unlabled unit";
296 String result
= CdmUtils
.concat(" determined as ", unitStr
, taxonStr
);
301 private static String
getCache(TaxonNode taxonNode
) {
303 Classification classification
= taxonNode
.getClassification();
304 if (classification
!= null){
305 String classificationStr
= classification
.getName() == null ?
"" : classification
.getName().getText();
306 result
= CdmUtils
.concat("" , result
, classificationStr
);
307 if (StringUtils
.isBlank(result
)){
308 result
= classification
.toString();
312 TaxonNode parentNode
= taxonNode
.getParent();
313 if (parentNode
== null){
314 parentStr
= "no parent";
316 Taxon parentTaxon
= parentNode
.getTaxon();
317 if (parentTaxon
== null){
318 parentStr
= "no parent taxon";
320 TaxonNameBase
<?
,?
> parentName
= parentTaxon
.getName();
321 if (parentName
== null){
322 parentStr
= "child of " + parentTaxon
.getTitleCache();
324 parentStr
= "child of " + parentName
.getTitleCache();
328 result
= CdmUtils
.concat(": ", result
, parentStr
);
333 private static String
getCache(TypeDesignationBase
<?
> designation
) {
334 designation
= CdmBase
.deproxy(designation
);
335 TypeDesignationStatusBase
<?
> status
= designation
.getTypeStatus();
336 Set
<TaxonNameBase
> from
;
337 IdentifiableEntity
<?
> to
;
338 from
= designation
.getTypifiedNames();
339 if (designation
.isInstanceOf(SpecimenTypeDesignation
.class)){
340 to
= ((SpecimenTypeDesignation
)designation
).getTypeSpecimen();
341 }else if (designation
.isInstanceOf(NameTypeDesignation
.class)){
342 to
= ((NameTypeDesignation
)designation
).getTypeName();
344 throw new RuntimeException("Type Designation class not supported: " + designation
.getClass().getName());
346 String typeLabel
= null;
348 Representation typeRepr
= status
.getPreferredRepresentation(CdmStore
.getDefaultLanguage());
349 if (typeRepr
!= null){
350 typeLabel
= typeRepr
.getAbbreviatedLabel();
352 if (StringUtils
.isBlank(typeLabel
) && typeRepr
!= null){
353 typeLabel
= typeRepr
.getLabel();
355 if (StringUtils
.isBlank(typeLabel
) ){
356 typeLabel
= status
.getSymbol();
358 if (StringUtils
.isBlank(typeLabel
)){
359 typeLabel
= status
.getTitleCache();
362 if (StringUtils
.isBlank(typeLabel
)){
365 String fromString
= "";
366 for (TaxonNameBase
<?
,?
> name
: from
){
367 CdmUtils
.concat(",", fromString
, name
.getTitleCache());
369 String result
= CdmUtils
.concat(" ", new String
[]{from
== null ?
null : fromString
,
370 typeLabel
, to
== null?
null : to
.getTitleCache()});
374 private static String
getCache(RelationshipBase
<?
, ?
, ?
> rel
) {
375 rel
= CdmBase
.deproxy(rel
);
376 RelationshipTermBase
<?
> type
= rel
.getType();
377 IdentifiableEntity
<?
> from
;
378 IdentifiableEntity
<?
> to
;
379 if (rel
.isInstanceOf(NameRelationship
.class)){
380 from
= ((NameRelationship
)rel
).getFromName();
381 to
= ((NameRelationship
)rel
).getToName();
382 }else if (rel
.isInstanceOf(HybridRelationship
.class)){
383 from
= ((HybridRelationship
)rel
).getParentName();
384 to
= ((HybridRelationship
)rel
).getHybridName();
385 }else if (rel
.isInstanceOf(TaxonRelationship
.class)){
386 from
= ((TaxonRelationship
)rel
).getFromTaxon();
387 to
= ((TaxonRelationship
)rel
).getToTaxon();
390 Method fromMethod
= rel
.getClass().getMethod("getRelatedFrom");
391 Method toMethod
= rel
.getClass().getMethod("getRelatedFrom");
392 fromMethod
.setAccessible(true);
393 toMethod
.setAccessible(true);
394 from
= (IdentifiableEntity
<?
>)fromMethod
.invoke(rel
);
395 to
= (IdentifiableEntity
<?
>)toMethod
.invoke(rel
);
396 } catch (NoSuchMethodException
| SecurityException
| IllegalAccessException
397 | IllegalArgumentException
| InvocationTargetException e
) {
398 throw new RuntimeException(e
);
401 String typeLabel
= null;
403 Representation typeRepr
= type
.getPreferredRepresentation(CdmStore
.getDefaultLanguage());
404 if (typeRepr
!= null){
405 typeLabel
= typeRepr
.getAbbreviatedLabel();
407 if (StringUtils
.isBlank(typeLabel
) && typeRepr
!= null){
408 typeLabel
= typeRepr
.getLabel();
410 if (StringUtils
.isBlank(typeLabel
) ){
411 typeLabel
= type
.getSymbol();
413 if (StringUtils
.isBlank(typeLabel
)){
414 typeLabel
= type
.getTitleCache();
417 if (StringUtils
.isBlank(typeLabel
)){
420 String result
= CdmUtils
.concat(" ", new String
[]{from
== null ?
null : from
.getTitleCache(),
421 typeLabel
, to
== null?
null : to
.getTitleCache()});
426 private static String
getCache(HomotypicalGroup hg
) {
428 for (TaxonNameBase
<?
,?
> tnb
: hg
.getTypifiedNames()){
429 result
= CdmUtils
.concat(", ", result
, tnb
.getTitleCache());
431 if (StringUtils
.isBlank(result
)){
432 result
= "No typified names";
438 * <p>getObjectClassname</p>
440 * @param element a {@link java.lang.Object} object.
441 * @return a {@link java.lang.String} object.
443 public static String
getObjectClassname(Object element
) {
444 return element
.getClass().getSimpleName();
448 * <p>getFeatureNodeContainerText</p>
450 * @param element a {@link eu.etaxonomy.taxeditor.model.FeatureNodeContainer} object.
451 * @return a {@link java.lang.String} object.
453 public static String
getFeatureNodeContainerText(FeatureNodeContainer element
) {
454 String result
= null;
455 if(element
.getFeatureNode() != null && element
.getFeatureNode().getFeature() != null){
456 result
= element
.getFeatureNode().getFeature().getLabel(CdmStore
.getDefaultLanguage());
458 return "No label set";
461 result
= element
.getFeatureNode().getFeature().getLabel();
467 * <p>getQuantitativeDataText</p>
469 * @param element a {@link eu.etaxonomy.cdm.model.description.QuantitativeData} object.
470 * @return a {@link java.lang.String} object.
472 public static String
getQuantitativeDataText(QuantitativeData element
) {
473 TextData textData
= quantitativeDescriptionBuilder
.build(element
, getLanguageList());
475 return textData
.getText(CdmStore
.getDefaultLanguage());
479 * <p>getCategoricalDataText</p>
481 * @param element a {@link eu.etaxonomy.cdm.model.description.CategoricalData} object.
482 * @return a {@link java.lang.String} object.
484 public static String
getCategoricalDataText(CategoricalData element
) {
485 TextData textData
= categoricalDescriptionBuilder
.build(element
, getLanguageList());
487 return textData
.getText(CdmStore
.getDefaultLanguage());
490 private static List
<Language
> getLanguageList(){
491 return Arrays
.asList(new Language
[]{CdmStore
.getDefaultLanguage()});
494 private static DescriptionBuilder
<QuantitativeData
> quantitativeDescriptionBuilder
= new DefaultQuantitativeDescriptionBuilder();
495 private static DescriptionBuilder
<CategoricalData
> categoricalDescriptionBuilder
= new DefaultCategoricalDescriptionBuilder();
499 * <p>getDistributionText</p>
501 * @param element a {@link eu.etaxonomy.cdm.model.description.Distribution} object.
502 * @return a {@link java.lang.String} object.
504 public static String
getDistributionText(Distribution element
) {
506 String text
= "EMPTY";
508 Distribution distribution
= element
;
510 NamedArea area
= distribution
.getArea();
513 text
= NamedArea
.labelWithLevel(area
, CdmStore
.getDefaultLanguage());
515 PresenceAbsenceTerm status
= distribution
.getStatus();
517 if (status
!= null) {
518 text
+= ", " + status
.getLabel();
520 text
+= ", NO STATUS";
527 * <p>getImageText</p>
529 * @param media a {@link eu.etaxonomy.cdm.model.media.Media} object.
530 * @return a {@link java.lang.String} object.
532 public static String
getImageText(Media media
) {
533 LanguageString title
= media
.getTitle(CdmStore
.getDefaultLanguage());
535 return title
.getText();
543 * <p>getElementText</p>
545 * @param element a {@link eu.etaxonomy.cdm.model.description.TextData} object.
546 * @return a {@link java.lang.String} object.
548 public static String
getElementText(TextData element
) {
550 if(element
.getFeature().equals(Feature
.CITATION())){
552 for(DescriptionElementSource source
: element
.getSources()){
553 if(source
.getCitation() != null){
554 text
+= source
.getCitation().getTitleCache();
556 if(source
.getNameUsedInSource() != null){
557 text
+= " [ " + source
.getNameUsedInSource().getTitleCache() + " ]";
560 if(CdmUtils
.isEmpty(text
)){
561 text
= "No sources provided";
564 List
<Language
> languages
= Arrays
.asList(new Language
[]{CdmStore
.getDefaultLanguage()});
565 LanguageString languageString
= element
.getPreferredLanguageString(languages
);
566 text
= languageString
!= null ? languageString
.getText() : null;
568 return CdmUtils
.isEmpty(text
) ?
"No text provided" : text
;
572 * <p>getTaxonInteractionText</p>
574 * @param element a {@link eu.etaxonomy.cdm.model.description.TaxonInteraction} object.
575 * @return a {@link java.lang.String} object.
577 public static String
getTaxonInteractionText(TaxonInteraction element
) {
579 Taxon taxon2
= element
.getTaxon2();
580 if(taxon2
!= null && taxon2
.getName() != null){
581 text
= taxon2
.getName().getTitleCache();
583 text
= "No taxon chosen";
590 * <p>getCommonNameText</p>
592 * @param commonName a {@link eu.etaxonomy.cdm.model.description.CommonTaxonName} object.
593 * @return a {@link java.lang.String} object.
595 public static String
getCommonNameText(CommonTaxonName commonName
) {
596 String name
= commonName
.getName();
597 if (name
== null || name
.length() == 0) {
598 name
= "No name provided";
600 Language language
= commonName
.getLanguage();
601 if (language
== null) {
602 name
+= " (No language provided)";
604 name
+= " (" + language
.getDescription() + ")";
610 * <p>getDescriptionText</p>
612 * @param element a {@link eu.etaxonomy.cdm.model.description.DescriptionBase} object.
613 * @return a {@link java.lang.String} object.
615 public static String
getDescriptionText(DescriptionBase element
) {
616 String text
= element
.getTitleCache();
617 if (text
== null || text
.length() == 0) {
618 text
= "No label provided";
625 * <p>getIndividualsAssociationText</p>
627 * @param element a {@link eu.etaxonomy.cdm.model.description.IndividualsAssociation} object.
628 * @return a {@link java.lang.String} object.
630 public static String
getIndividualsAssociationText(IndividualsAssociation element
) {
631 SpecimenOrObservationBase derivedUnit
= element
.getAssociatedSpecimenOrObservation();
632 if(derivedUnit
!= null){
633 return derivedUnit
.getTitleCache();
635 return "No unit chosen";
641 * @param element a {@link java.lang.Object} object.
642 * @return a {@link java.lang.String} object.
644 public static String
getLabel(Object element
){
645 String noLabelString
= "[no label]";
646 if (element
instanceof FeatureNodeContainer
){
647 return getFeatureNodeContainerText((FeatureNodeContainer
) element
);
649 else if (element
instanceof DescriptionBase
) {
650 return getDescriptionText((DescriptionBase
) element
);
652 else if(element
instanceof CategoricalData
){
653 String categoricalDataText
= getCategoricalDataText((CategoricalData
) element
);
654 if(categoricalDataText
==null || categoricalDataText
.isEmpty()){
655 categoricalDataText
= noLabelString
;
657 return categoricalDataText
;
659 else if (element
instanceof CommonTaxonName
) {
660 return getCommonNameText((CommonTaxonName
) element
);
662 else if (element
instanceof Distribution
) {
663 return getDistributionText((Distribution
) element
);
665 else if (element
instanceof IndividualsAssociation
) {
666 return getIndividualsAssociationText((IndividualsAssociation
) element
);
668 else if (element
instanceof QuantitativeData
) {
669 String quantitativeDataText
= getQuantitativeDataText((QuantitativeData
) element
);
670 if(quantitativeDataText
==null || quantitativeDataText
.isEmpty()){
671 quantitativeDataText
= noLabelString
;
673 return quantitativeDataText
;
675 else if (element
instanceof TaxonInteraction
) {
676 return getTaxonInteractionText((TaxonInteraction
) element
);
678 else if (element
instanceof TextData
) {
679 return getElementText((TextData
) element
);
682 return element
.toString();