Project

General

Profile

« Previous | Next » 

Revision beab3950

Added by Andreas Müller almost 3 years ago

ref #3764 correct handling of series and volume for section with journal

View differences:

cdmlib-model/src/main/java/eu/etaxonomy/cdm/strategy/cache/reference/ReferenceDefaultCacheStrategy.java
216 216
        String inRefPart = getInRefAuthorAndTitle(inRef, reference.getType(), isAbbrev);
217 217
        if (inRef != null && !inRef.isArticle()){
218 218
            inRefPart = addInRefPages(inRef, inRefPart);
219
            if (inRef.isJournal()){
220
                inRefPart = addSeriesAndVolume(reference, inRefPart, isAbbrev);  //usually only needed for journals
221
            }
219 222
        }
220 223
        inRefPart = CdmUtils.addTrailingDotIfNotExists(inRefPart);
221 224
        inRefPart = biblioInSeparator + inRefPart;
......
268 271
        return result;
269 272
    }
270 273

  
274
    //copied from TitleWithoutYearAndAuthor.getTitleWithoutYearAndAuthorArticle
275
    //may be somehow merged in future
276
    private String addSeriesAndVolume(Reference ref, String inRefPart, boolean isAbbrev) {
277
        String series = Nz(ref.getSeriesPart()).trim();
278
        String volume = Nz(ref.getVolume()).trim();
279

  
280
        String inRefTitle = ReferenceDefaultCacheStrategy.UNDEFINED_JOURNAL;
281
        boolean needsComma = false;
282
        Reference inRef = ref.getInReference();
283
        if (inRef != null){
284
            inRefTitle = CdmUtils.getPreferredNonEmptyString(inRef.getTitle(), inRef.getAbbrevTitle(), isAbbrev, true);
285
            if (isNotBlank(inRefTitle)){
286
                needsComma = TitleWithoutYearAndAuthorHelper.computeNeedsCommaArticle(inRefPart, volume, series);
287
                if (! needsComma && (isNotBlank(volume)||isNotBlank(series))){
288
                    inRefPart += blank;
289
                }
290
            }
291
        }
292
        inRefPart = TitleWithoutYearAndAuthorHelper.getSeriesAndVolPartArticle(series, volume, needsComma, inRefPart);
293

  
294
        //delete "."
295
        while (inRefPart.endsWith(".")){
296
            inRefPart = CdmUtils.removeTrailingDots(inRefPart);
297
        }
298
        return inRefPart;
299
    }
300

  
271 301
    private String addInRefPages(Reference reference, String title) {
272 302
        String pages = getPages(reference);
273 303
        if (isNotBlank(pages)){

Also available in: Unified diff