Project

General

Profile

« Previous | Next » 

Revision af5e38cf

Added by Andreas Müller almost 8 years ago

revert last commit

View differences:

cdmlib-model/src/main/java/eu/etaxonomy/cdm/strategy/cache/reference/DefaultReferenceCacheStrategy.java
149 149
        ReferenceType type = reference.getType();
150 150
        boolean isAbbrev = true;
151 151

  
152
        if (reference.isProtectedAbbrevTitleCache()){
153
            return reference.getAbbrevTitleCache();
154
        }
155

  
152 156
        if (type == ReferenceType.Article){
153 157
            result =  getTitleWithoutYearAndAuthor(reference, isAbbrev);
154 158
            boolean useFullDatePublished = false;
......
221 225

  
222 226
    @Override
223 227
    public String getNomenclaturalCache(Reference reference) {
224
        //TODO maybe not needed as getNomenclaturalCitation also handles protected
225
        if (reference.isProtectedAbbrevTitleCache()){
226
            return reference.getAbbrevTitleCache();
227
        }
228

  
229 228
        return this.getNomenclaturalCitation(reference, null);
230 229
    }
231 230

  
......
247 246
        //copy from InRefDefaultCacheStrategyBase
248 247
        if (inRef != null){
249 248
            result = CdmUtils.getPreferredNonEmptyString(inRef.getTitleCache(),
250
                    inRef.fullAbbrevTitleString(), isAbbrev, trim)  ;
249
                    inRef.getAbbrevTitleCache(), isAbbrev, trim)  ;
251 250
        }else{
252 251
            result = String.format("- undefined %s -", getUndefinedLabel(type));
253 252
        }
......
471 470
    public String getNomenclaturalCitation(Reference reference, String microReference) {
472 471
        if (reference.isProtectedAbbrevTitleCache()){
473 472
            String cache = reference.getAbbrevTitleCache();
474
            return handleDetailAndYearForProtected(reference, cache, microReference);
475
        }
473
            return handleDetailAndYearForPreliminary(reference, cache, microReference);
476 474

  
475
        }
477 476
        String result = getTokenizedNomenclaturalTitel(reference);
478 477
        //if no data is available and only titleCache is protected take the protected title
479 478
        //this is to avoid empty cache if someone forgets to set also the abbrevTitleCache
480 479
        //we need to think about handling protected not separate for abbrevTitleCache  and titleCache
481 480
        if (result.equals(INomenclaturalReference.MICRO_REFERENCE_TOKEN) && reference.isProtectedTitleCache() ){
482 481
            String cache = reference.getTitleCache();
483
            return handleDetailAndYearForProtected(reference, cache, microReference);
482
            return handleDetailAndYearForPreliminary(reference, cache, microReference);
484 483
        }
485 484

  
486 485
        microReference = Nz(microReference);
......
502 501
     * @param microRef
503 502
     * @return
504 503
     */
505
    private String handleDetailAndYearForProtected(Reference nomenclaturalReference, String cache, String microReference) {
504
    private String handleDetailAndYearForPreliminary(Reference nomenclaturalReference, String cache, String microReference) {
506 505
        String microRef = isNotBlank(microReference) ? getBeforeMicroReference() + microReference : "";
507 506
        if (cache == null){
508 507
            logger.warn("Cache is null. This should never be the case.");

Also available in: Unified diff