Project

General

Profile

« Previous | Next » 

Revision 7ccf6d90

Added by Andreas Müller over 2 years ago

ref #9918 improve cache initialization for imports

View differences:

cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/common/utils/ImportDeduplicationHelper.java
422 422
    }
423 423

  
424 424
    private <T extends TeamOrPersonBase<?>> void initAuthorTitleCaches(T teamOrPerson) {
425
        if (teamOrPerson == null) {
426
            return;
427
        }
425 428
        //NOTE: this is more or less redundant copy from CdmPreDataChangeListener
426 429
        if (teamOrPerson.isInstanceOf(Team.class)){
427 430
            Team team = CdmBase.deproxy(teamOrPerson, Team.class);
......
431 434
            if (!team.isProtectedCollectorTitleCache()){
432 435
                team.setCollectorTitleCache(null, false);
433 436
            }
437
            //not redundant part
438
            for (Person member : team.getTeamMembers()) {
439
                initAuthorTitleCaches(member);
440
            }
441
            //end not redundant part
434 442
        }
435 443
        teamOrPerson.getNomenclaturalTitleCache();
436 444
        teamOrPerson.getCollectorTitleCache();
......
440 448
    }
441 449

  
442 450
    private void initReferenceCaches(Reference ref) {
451
        if (ref == null) {
452
            return;
453
        }
443 454
        ////TODO better do via matching strategy  (newReference might have caches == null)
444
        //the below is more or less a copy from CdmPreDataChangeListener
455
        //the below is more or less a copy from CdmPreDataChangeListener (except for inReference handling)
445 456
        ref.getAbbrevTitleCache();
446 457
        ref.getTitleCache();
458

  
459
        initAuthorTitleCaches(ref.getAuthorship());
460
        initReferenceCaches(ref.getInReference());
447 461
   }
448 462

  
449 463
    public AgentBase<?> getExistingAgent(AgentBase<?> agent, boolean parsed) {

Also available in: Unified diff