ref #5448 Reduce multiple ex authors to only two
authorPatrick Plitzner <p.plitzner@bgbm.org>
Tue, 30 Aug 2016 14:23:00 +0000 (16:23 +0200)
committerAndreas Kohlbecker <a.kohlbecker@bgbm.org>
Fri, 9 Sep 2016 07:05:29 +0000 (09:05 +0200)
app-import/src/main/java/eu/etaxonomy/cdm/io/redlist/gefaesspflanzen/RedListGefaesspflanzenImportNames.java

index bfa597cf246845db67700654ac6bd4bc114ddee1..77008624fcf1a49d0b17cd4dcb07c4e5fcfceaef 100644 (file)
@@ -263,22 +263,17 @@ public class RedListGefaesspflanzenImportNames extends DbImportBase<RedListGefae
 
         //combination author
         if(authorKombString.contains(RedListUtil.EX)){
-            //TODO: what happens with multiple ex authors??
+            // multiple ex authors will be reduced to only the last one
+            // e.g. Almq. ex Sternström ex Dahlst. -> Almq. ex Dahlst.
             String[] kombSplit = authorKombString.split(RedListUtil.EX);
-            if(kombSplit.length!=2){
-                RedListUtil.logMessage(id, "Multiple ex combination authors found", logger);
-            }
-            for (int i = 0; i < kombSplit.length; i++) {
-                if(i==0){
-                    //first author is ex author
-                    TeamOrPersonBase<?> authorKomb = (TeamOrPersonBase<?>) state.getRelatedObject(RedListUtil.AUTHOR_NAMESPACE, kombSplit[i]);
-                    name.setExCombinationAuthorship(authorKomb);
-                }
-                else{
-                    TeamOrPersonBase<?> authorKomb = (TeamOrPersonBase<?>) state.getRelatedObject(RedListUtil.AUTHOR_NAMESPACE, kombSplit[i]);
-                    name.setCombinationAuthorship(authorKomb);
-                }
-            }
+            //first author is ex combination author
+            String exAuthorString = kombSplit[0];
+            TeamOrPersonBase<?> exAuthor = (TeamOrPersonBase<?>) state.getRelatedObject(RedListUtil.AUTHOR_NAMESPACE, exAuthorString);
+            name.setExCombinationAuthorship(exAuthor);
+            //the last author is the combination author
+            String authorString = kombSplit[kombSplit.length-1];
+            TeamOrPersonBase<?> combAuthor = (TeamOrPersonBase<?>) state.getRelatedObject(RedListUtil.AUTHOR_NAMESPACE, authorString);
+            name.setCombinationAuthorship(combAuthor);
         }
         else if(authorKombString.trim().contains(RedListUtil.AUCT)){
             RedListUtil.logMessage(id, "AUCT information in "+RedListUtil.AUTOR_KOMB+" column", logger);