Project

General

Profile

« Previous | Next » 

Revision 47bab95f

Added by Patrick Plitzner over 7 years ago

ref #5448 Reduce multiple ex authors to only two

View differences:

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

  
264 264
        //combination author
265 265
        if(authorKombString.contains(RedListUtil.EX)){
266
            //TODO: what happens with multiple ex authors??
266
            // multiple ex authors will be reduced to only the last one
267
            // e.g. Almq. ex Sternström ex Dahlst. -> Almq. ex Dahlst.
267 268
            String[] kombSplit = authorKombString.split(RedListUtil.EX);
268
            if(kombSplit.length!=2){
269
                RedListUtil.logMessage(id, "Multiple ex combination authors found", logger);
270
            }
271
            for (int i = 0; i < kombSplit.length; i++) {
272
                if(i==0){
273
                    //first author is ex author
274
                    TeamOrPersonBase<?> authorKomb = (TeamOrPersonBase<?>) state.getRelatedObject(RedListUtil.AUTHOR_NAMESPACE, kombSplit[i]);
275
                    name.setExCombinationAuthorship(authorKomb);
276
                }
277
                else{
278
                    TeamOrPersonBase<?> authorKomb = (TeamOrPersonBase<?>) state.getRelatedObject(RedListUtil.AUTHOR_NAMESPACE, kombSplit[i]);
279
                    name.setCombinationAuthorship(authorKomb);
280
                }
281
            }
269
            //first author is ex combination author
270
            String exAuthorString = kombSplit[0];
271
            TeamOrPersonBase<?> exAuthor = (TeamOrPersonBase<?>) state.getRelatedObject(RedListUtil.AUTHOR_NAMESPACE, exAuthorString);
272
            name.setExCombinationAuthorship(exAuthor);
273
            //the last author is the combination author
274
            String authorString = kombSplit[kombSplit.length-1];
275
            TeamOrPersonBase<?> combAuthor = (TeamOrPersonBase<?>) state.getRelatedObject(RedListUtil.AUTHOR_NAMESPACE, authorString);
276
            name.setCombinationAuthorship(combAuthor);
282 277
        }
283 278
        else if(authorKombString.trim().contains(RedListUtil.AUCT)){
284 279
            RedListUtil.logMessage(id, "AUCT information in "+RedListUtil.AUTOR_KOMB+" column", logger);

Also available in: Unified diff