ref #5448 Correctly set sec reference on synonyms and avoid for
authorPatrick Plitzner <p.plitzner@bgbm.org>
Thu, 1 Dec 2016 08:09:58 +0000 (09:09 +0100)
committerPatrick Plitzner <p.plitzner@bgbm.org>
Thu, 1 Dec 2016 08:09:58 +0000 (09:09 +0100)
misapplied names

app-import/src/main/java/eu/etaxonomy/cdm/io/redlist/gefaesspflanzen/RedListGefaesspflanzenImportClassification.java
app-import/src/main/java/eu/etaxonomy/cdm/io/redlist/gefaesspflanzen/RedListGefaesspflanzenImportNames.java

index 52c6be273f97d1079764f26c5a0008173e1cca06..ef21caa8f60a1d0efcbf0945b5e0c71987f5b248 100644 (file)
@@ -199,7 +199,16 @@ public class RedListGefaesspflanzenImportClassification extends DbImportBase<Red
             createParentChildNodes(gesamtListeClassification, id, gueltString, taxZusatzString, taxonBase, parent);
             //Buttler/Checklist taxon
             if(CdmUtils.isNotBlank(clTaxonString) && clTaxonString.equals("b")){
-                createParentChildNodes(checklistClassification, id, gueltString, taxZusatzString, taxonBase, parent);
+                if(taxonBase.isInstanceOf(Taxon.class)){
+                    createParentChildNodes(checklistClassification, id, gueltString, taxZusatzString, taxonBase, parent);
+                }
+                else if(taxonBase.isInstanceOf(Synonym.class)){
+                    //if it is a synonym it is already added to the accepted taxon
+                    //so we just change the sec reference
+                    taxonBase.setSec(checklistClassification.getReference());
+                    taxonBase.setTitleCache(null);
+                }
+
             }
         }
 
@@ -262,6 +271,8 @@ public class RedListGefaesspflanzenImportClassification extends DbImportBase<Red
                     return;
                 }
                 parent.addMisappliedName((Taxon) taxonBase, null, null);
+                //return because misapplied names do not have sec references
+                return;
             }
             else{
                 classification.addParentChild(parent, (Taxon)taxonBase, null, null);
index 9b7a4a4909e38f8067a9069660cc737b9d8427b6..3733778637c6b793ce5230aeddcb7e8c8980361f 100644 (file)
@@ -119,7 +119,6 @@ public class RedListGefaesspflanzenImportNames extends DbImportBase<RedListGefae
     private void makeSingleNameAndTaxon(RedListGefaesspflanzenImportState state, ResultSet rs, Set<TaxonNameBase> namesToSave, Set<TaxonBase> taxaToSave)
             throws SQLException {
         long id = rs.getLong(RedListUtil.NAMNR);
-        String clTaxonString = rs.getString(RedListUtil.CL_TAXON);
         String relationE = rs.getString(RedListUtil.E);
         String relationW = rs.getString(RedListUtil.W);
         String relationK = rs.getString(RedListUtil.K);