ref #10096 add new taxon node status to TaxonNodeStatus and TaxonNode getters
authorAndreas Müller <a.mueller@bgbm.org>
Tue, 26 Jul 2022 10:55:20 +0000 (12:55 +0200)
committerAndreas Müller <a.mueller@bgbm.org>
Tue, 26 Jul 2022 10:55:20 +0000 (12:55 +0200)
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/taxon/TaxonNode.java
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/taxon/TaxonNodeStatus.java

index f108ec60f0ee421b12622eff520c76dec12e9745..9cde8d2a197818bcaf25cfb5225310046d63842a 100644 (file)
@@ -257,7 +257,27 @@ public class TaxonNode
     //#8281 indicates a preliminary placement
     public boolean isDoubtful() {return hasStatus(TaxonNodeStatus.DOUBTFUL);}
 
-    public boolean isExcluded() {return hasStatus(TaxonNodeStatus.EXCLUDED);}
+    /**
+     * <code>true</code> if status is {@link TaxonNodeStatus#EXCLUDED} or any
+     * of its child status
+     */
+    public boolean isExcluded() {return isKindOf(TaxonNodeStatus.EXCLUDED);}
+
+    /**
+     * <code>true</code> if status is {@link TaxonNodeStatus#EXCLUDED} but not
+     * a sub-status (more specific excluded status)
+     */
+    public boolean isExcludedOnly() {return hasStatus(TaxonNodeStatus.EXCLUDED);}
+
+    public boolean isGeographicallyExcluded() {return hasStatus(TaxonNodeStatus.EXCLUDED_GEO);}
+
+    public boolean isTaxonomicallyExcluded() {return hasStatus(TaxonNodeStatus.EXCLUDED_TAX);}
+
+    public boolean isNomenclaturallyExcluded() {return hasStatus(TaxonNodeStatus.EXCLUDED_NOM);}
+
+    public boolean isUncertainApplication() {return hasStatus(TaxonNodeStatus.UNCERTAIN_APPLICATION);}
+
+    public boolean isUnresolved() {return hasStatus(TaxonNodeStatus.UNRESOLVED);}
 
 //************************************************************/
 
@@ -969,6 +989,14 @@ public class TaxonNode
         return CdmUtils.nullSafeEqual(this.status, status);
     }
 
+    private boolean isKindOf(TaxonNodeStatus status) {
+        if (this.status == null) {
+            return status == null;
+        }else {
+            return this.status.isKindOf(status);
+        }
+    }
+
 //*********************** CLONE ********************************************************/
     /**
      * Clones <i>this</i> taxon node. This is a shortcut that enables to create
index d8529b9f6eb8d9c1f1b426b81a9e14bb005d46c0..190404ecfa727278de6f2926755491a4c6236838 100644 (file)
@@ -21,11 +21,18 @@ import eu.etaxonomy.cdm.model.term.EnumeratedTermVoc;
 import eu.etaxonomy.cdm.model.term.IEnumTerm;
 
 /**
+ * The status for the placement (taxon node) of taxon/name in classification.
+ *
+ * For more information on the status see #10096, #9005, #8281
+ *
  * @author a.mueller
  * @since 26.05.2020
  */
 public enum TaxonNodeStatus implements IEnumTerm<TaxonNodeStatus>{
 
+    //TODO maybe we want a status "Included" too, instead of making TaxonNode.status an optional
+    //     attribute (see comments in #10096 attachement)
+
     //0  - see #8281
     /**
      * The placement of the taxon is doubtful or preliminary.
@@ -42,11 +49,55 @@ public enum TaxonNodeStatus implements IEnumTerm<TaxonNodeStatus>{
 
     //2
     /**
-     * The taxon for some reason is excluded from the treatment this {@link TaxonNode} belongs too.
+     * The taxon or name for any reason is excluded from the treatment this {@link TaxonNode} belongs too.
+     * See sub status for more specific reasons.
      */
     @XmlEnumValue("Excluded")
-    EXCLUDED(UUID.fromString("23d259b6-2d7e-4df6-8745-0e24fbe63187"), "Excluded", "EXC", Character.toString((char)248), null)
-    ;
+    EXCLUDED(UUID.fromString("23d259b6-2d7e-4df6-8745-0e24fbe63187"), "Excluded", "EXC", Character.toString((char)248), null),
+
+    //3
+    /**
+     * Taxon or name excluded, geographically out of scope. <BR>
+     * E.g. a taxon that does not occur in the region of the flora treatment.
+     */
+    @XmlEnumValue("Excluded_geo")
+    EXCLUDED_GEO(UUID.fromString("a76c0fa8-e04d-421c-ac10-07a3c6770d45"), "Excluded geo.", "EXCG", Character.toString((char)248)+"g", EXCLUDED),
+
+    //4
+    /**
+     * Taxon or name excluded, taxonomically out of scope. <BR>
+     * E.g. name being a taxon name or synonym belonging to a taxon that is not part of the treatment.
+     */
+    @XmlEnumValue("Excluded_tax")
+    EXCLUDED_TAX(UUID.fromString("689a5821-e59d-4ec2-ae33-2331bdb39f34"), "Excluded tax.", "EXCT", Character.toString((char)248)+"t", EXCLUDED),
+
+    //5
+    /**
+     * Name excluded for nomenclatural reasons. <BR>
+     * E.g. an effectively published name ascribing the name to an author who merely and correctly cited an earlier name.
+     */
+    @XmlEnumValue("Excluded_nom")
+    EXCLUDED_NOM(UUID.fromString("b4484183-6f19-4901-af96-0ab6183cebfb"), "Excluded nom.", "EXCN", Character.toString((char)248)+"n", EXCLUDED),
+
+    //6
+    /**
+     * Name of verified uncertain application <BR>
+     * E.g. an effectively published name ascribing the name to an author who merely and correctly cited an earlier name.<BR>
+     * Alternative symbol: ↑ or u+2BD1 (https://unicode-table.com/en/2BD1/)
+     */
+    @XmlEnumValue("Uncertain_app")
+    UNCERTAIN_APPLICATION(UUID.fromString("c87ea64a-f3d3-41fe-a4c5-dd6a8697fc46"), "Uncertain application", "UNA", Character.toString((char)248)+"a", EXCLUDED),
+
+    //6
+    /**
+     * Name of verified uncertain application <BR>
+     * E.g. an effectively published name ascribing the name to an author who merely and correctly cited an earlier name.<BR>
+     * Alternative symbol: ↑ or u+2BD1 (https://unicode-table.com/en/2BD1/)
+     */
+    @XmlEnumValue("Unresolved")
+    UNRESOLVED(UUID.fromString("ce6f2430-9662-4b78-8fc2-48b5fa9fd37e"), "Unresolved", "UNR", "u", null),
+
+;
 
 // **************** END ENUM **********************/