Project

General

Profile

Revision 3f3714e3

ID3f3714e36beec5f4e258a86627fdc5382ce38e5f
Parent 886e3f27
Child 96741cad

Added by Andreas Müller over 2 years ago

ref #7799 compute author caches in deduplicationHelper

View differences:

cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/common/utils/ImportDeduplicationHelper.java
426 426
            return null;
427 427
        }else{
428 428
            initAgentMap(state);
429
            initAuthorTitleCaches(author);
429 430
            T result = getTeamOrPerson(author);
430 431
            if (result == null){
431 432
                putAgentBase(author.getTitleCache(), author);
......
438 439
        }
439 440
    }
440 441

  
442
    /**
443
     * @param author
444
     */
445
    private <T extends TeamOrPersonBase<?>> void initAuthorTitleCaches(T author) {
446
        //more or less copy from CdmPreDataChangeListener
447
        String nomTitle = author.getNomenclaturalTitle();
448
        if (author instanceof Team){
449
            Team team = (Team)author;
450
            //nomTitle is not necessarily cached when it is created
451
            team.setNomenclaturalTitle(nomTitle, team.isProtectedNomenclaturalTitleCache());
452
        }else{
453
            author.setNomenclaturalTitle(nomTitle);
454
        }
455
        String titleCache = author.getTitleCache();
456
        if (! author.isProtectedTitleCache()){
457
            author.setTitleCache(titleCache, false);
458
        }
459
    }
460

  
441 461
    public AgentBase<?> getExistingAgent(STATE state,
442 462
            AgentBase<?> agent) {
443 463
        if (agent == null){
cdmlib-persistence/src/main/java/eu/etaxonomy/cdm/persistence/hibernate/CdmPreDataChangeListener.java
93 93
        }
94 94
    }
95 95

  
96

  
97

  
98 96
    private static void cacheDeterminationNames(Object entity) {
99 97
        if (entity instanceof DeterminationEvent) {
100 98
            DeterminationEvent detEv = (DeterminationEvent)entity;
......
134 132
                    if (! teamOrPerson.isProtectedTitleCache()){
135 133
                        teamOrPerson.setTitleCache(titleCache, false);
136 134
                    }
135
                    //if this is changed in future, change also in ImportDeduplicationHelper
137 136

  
138
                    //reference caches
139 137
                }else if(Reference.class.isAssignableFrom(entityClazz)){
138
                    //reference caches
140 139
                    Reference ref = (Reference)entity;
141 140
                    ref.getAbbrevTitleCache();
142 141
                    ref.getTitleCache();
143
                //specimen
144 142
                }else if (SpecimenOrObservationBase.class.isAssignableFrom(entityClazz)){
143
                    //specimen
145 144
                    SpecimenOrObservationBase<?> specimen = (SpecimenOrObservationBase<?>)entity;
146 145
                    if (!specimen.isProtectedTitleCache()){
147 146
                        specimen.setTitleCache(specimen.generateTitle(), false);

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)