ref #10449 allow filtering out synonyms in list imports
authorAndreas Müller <a.mueller@bgbm.org>
Fri, 12 Jan 2024 16:10:17 +0000 (17:10 +0100)
committerAndreas Müller <a.mueller@bgbm.org>
Fri, 12 Jan 2024 16:10:33 +0000 (17:10 +0100)
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/cdmLight/CdmLightClassificationExport.java
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/coldp/ColDpClassificationExport.java
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/out/TaxonTreeExportConfiguratorBase.java
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/wfo/out/WfoClassificationExport.java

index c5fa4fc09ecba73492d94fa97cccf7b726a86264..84e9ff74ea313a70d6c790d6fc7ebdb9fc0de3f2 100755 (executable)
@@ -306,37 +306,40 @@ public class CdmLightClassificationExport
                     TaxonName name = taxon.getName();
                     handleName(state, name, taxon, true);
 
-                    //homotypic group / synonyms
-                    HomotypicalGroup homotypicGroup = taxon.getHomotypicGroup();
-                    int index = 0;
-                    int homotypicGroupIndex = 0;
-                    handleHomotypicalGroup(state, homotypicGroup, taxon, homotypicGroupIndex);
-                    homotypicGroupIndex++;
-                    for (Synonym syn : taxon.getSynonymsInGroup(homotypicGroup)) {
-                        handleSynonym(state, syn, index);
-                        index++;
-                    }
-                    List<HomotypicalGroup> heterotypicHomotypicGroups = taxon.getHeterotypicSynonymyGroups();
-                    for (HomotypicalGroup group: heterotypicHomotypicGroups){
-                        handleHomotypicalGroup(state, group, taxon, homotypicGroupIndex);
-                        for (Synonym syn : taxon.getSynonymsInGroup(group)) {
+                    if (state.getConfig().isDoSynonyms()) {
+
+                        //homotypic group / synonyms
+                        HomotypicalGroup homotypicGroup = taxon.getHomotypicGroup();
+                        int index = 0;
+                        int homotypicGroupIndex = 0;
+                        handleHomotypicalGroup(state, homotypicGroup, taxon, homotypicGroupIndex);
+                        homotypicGroupIndex++;
+                        for (Synonym syn : taxon.getSynonymsInGroup(homotypicGroup)) {
                             handleSynonym(state, syn, index);
                             index++;
                         }
-                        homotypicGroupIndex++;
-                    }
+                        List<HomotypicalGroup> heterotypicHomotypicGroups = taxon.getHeterotypicSynonymyGroups();
+                        for (HomotypicalGroup group: heterotypicHomotypicGroups){
+                            handleHomotypicalGroup(state, group, taxon, homotypicGroupIndex);
+                            for (Synonym syn : taxon.getSynonymsInGroup(group)) {
+                                handleSynonym(state, syn, index);
+                                index++;
+                            }
+                            homotypicGroupIndex++;
+                        }
 
-                    //pro parte synonyms
-                    index = 0;
-                    for (Taxon tax : taxon.getAllProParteSynonyms()) {
-                        handleProPartePartialMisapplied(state, tax, taxon, true, false, index);
-                        index++;
-                    }
+                        //pro parte synonyms
+                        index = 0;
+                        for (Taxon tax : taxon.getAllProParteSynonyms()) {
+                            handleProPartePartialMisapplied(state, tax, taxon, true, false, index);
+                            index++;
+                        }
 
-                    //misapplications
-                    for (Taxon tax : taxon.getAllMisappliedNames()) {
-                        handleProPartePartialMisapplied(state, tax, taxon, false, true, index);
-                        index++;
+                        //misapplications
+                        for (Taxon tax : taxon.getAllMisappliedNames()) {
+                            handleProPartePartialMisapplied(state, tax, taxon, false, true, index);
+                            index++;
+                        }
                     }
 
                     //taxon table
index 2a97b249f9d156fd58c8aa4bbaeeacb61d344025..133d2a99849329d1955a309ce17963fb4c03edee 100644 (file)
@@ -301,22 +301,24 @@ public class ColDpClassificationExport
                 TaxonName name = taxon.getName();
                 handleName(state, name, taxon, true);
 
-                //homotypic group / synonyms
-                HomotypicalGroup homotypicGroup = taxon.getHomotypicGroup();
-                int index = 0;
-                handleHomotypicalGroup(state, homotypicGroup, taxon);
-                for (Synonym syn : taxon.getSynonymsInGroup(homotypicGroup)) {
-                    handleSynonym(state, syn, index);
-                    index++;
-                }
-
-                List<HomotypicalGroup> heterotypicHomotypicGroups = taxon.getHeterotypicSynonymyGroups();
-                for (HomotypicalGroup group: heterotypicHomotypicGroups){
-                    handleHomotypicalGroup(state, group, taxon);
-                    for (Synonym syn : taxon.getSynonymsInGroup(group)) {
+                if (state.getConfig().isDoSynonyms()) {
+                    //homotypic group / synonyms
+                    HomotypicalGroup homotypicGroup = taxon.getHomotypicGroup();
+                    int index = 0;
+                    handleHomotypicalGroup(state, homotypicGroup, taxon);
+                    for (Synonym syn : taxon.getSynonymsInGroup(homotypicGroup)) {
                         handleSynonym(state, syn, index);
                         index++;
                     }
+
+                    List<HomotypicalGroup> heterotypicHomotypicGroups = taxon.getHeterotypicSynonymyGroups();
+                    for (HomotypicalGroup group: heterotypicHomotypicGroups){
+                        handleHomotypicalGroup(state, group, taxon);
+                        for (Synonym syn : taxon.getSynonymsInGroup(group)) {
+                            handleSynonym(state, syn, index);
+                            index++;
+                        }
+                    }
                 }
 
                 //TODO 2 pro parte synonyms and misapplications
index ffdf042fd2d87b2ecddd3789fd8742182634724c..b7a645c671df9aa0b4768059cec010caa241ac8e 100644 (file)
@@ -23,7 +23,17 @@ public abstract class TaxonTreeExportConfiguratorBase
 
     private static final long serialVersionUID = 1663876643435871032L;
 
+
+    private boolean doSynonyms = true;
+
     protected TaxonTreeExportConfiguratorBase(IExportTransformer transformer) {
         super(transformer);
     }
+
+    public boolean isDoSynonyms() {
+        return doSynonyms;
+    }
+    public void setDoSynonyms(boolean doSynonyms) {
+        this.doSynonyms = doSynonyms;
+    }
 }
\ No newline at end of file
index cfc0a33548a33d455b470bacf40307d353f44e28..1ceb9f147ce3bc07374b964ebf40677cbac7ac5a 100644 (file)
@@ -287,6 +287,11 @@ public class WfoClassificationExport
     }
 
     private void handleSynonyms(WfoExportState state, Taxon taxon) {
+
+        if (!state.getConfig().isDoSynonyms()) {
+            return;
+        }
+
         //homotypic group / synonyms
         HomotypicalGroup homotypicGroup = taxon.getHomotypicGroup();
         handleHomotypicalGroup(state, homotypicGroup, taxon);