Project

General

Profile

« Previous | Next » 

Revision 5d7d0b62

Added by Andreas Müller over 2 years ago

ref #9809 add the source reference to newly added authors

View differences:

cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/reference/ris/in/RisReferenceImport.java
296 296
            Reference ref, Reference inRef) {
297 297
        List<RisValue> authorList = getListValue(record, RisReferenceTag.AU);
298 298
        if (!authorList.isEmpty()){
299
            TeamOrPersonBase<?> author = makeAuthor(state, authorList);
299
            TeamOrPersonBase<?> author = makeAuthor(state, authorList, record);
300 300
            ref.setAuthorship(author);
301 301
        }
302 302
        List<RisValue> secondaryAuthorList = getListValue(record, RisReferenceTag.A2);
303 303
        if (!secondaryAuthorList.isEmpty()){
304 304
            if (inRef != null){
305 305
                if (inRef.getType() != ReferenceType.Journal){
306
                    TeamOrPersonBase<?> secAuthor = makeAuthor(state, secondaryAuthorList);
306
                    TeamOrPersonBase<?> secAuthor = makeAuthor(state, secondaryAuthorList, record);
307 307
                    inRef.setAuthorship(secAuthor);
308 308
                }else{
309 309
                    String message = "The tag %s ('%s') exists but the in-reference type is 'journal' which typically has no author."
......
420 420
        }
421 421
    }
422 422

  
423
    private TeamOrPersonBase<?> makeAuthor(RisReferenceImportState state, List<RisValue> list) {
423
    private TeamOrPersonBase<?> makeAuthor(RisReferenceImportState state, List<RisValue> list, Map<RisReferenceTag, List<RisValue>> record) {
424 424
        if (list.size() == 1){
425
            return makePerson(state, list.get(0));
425
            return makePerson(state, list.get(0), record);
426 426
        }else{
427 427
            Team team = Team.NewInstance();
428

  
428 429
            for (RisValue value : list){
429
                team.addTeamMember(makePerson(state, value));
430
                team.addTeamMember(makePerson(state, value, record));
430 431
            }
432

  
433
            //source
434
            String recordLocation = recordLocation(state, record);
435
            team.addImportSource(null, null, state.getConfig().getSourceReference(), recordLocation);
436

  
431 437
            return team;
432 438
        }
433 439
    }
434 440

  
435
    private Person makePerson(RisReferenceImportState state, RisValue risValue) {
441
    private Person makePerson(RisReferenceImportState state, RisValue risValue, Map<RisReferenceTag, List<RisValue>> record) {
436 442
        Person person = Person.NewInstance();
437 443
        String[] split = risValue.value.split(",");
438 444
        if (split.length >= 1){
......
450 456
            person.setSuffix(split[2].trim());
451 457
        }
452 458

  
459
        //source
460
        String recordLocation = recordLocation(state, record);
461
        person.addImportSource(null, null, state.getConfig().getSourceReference(), recordLocation);
462

  
453 463
        return person;
454 464
    }
455 465

  

Also available in: Unified diff