Project

General

Profile

« Previous | Next » 

Revision da04d3c7

Added by Andreas Müller over 3 years ago

ref #6623 include microReference in DefaultReferenceCacheStrategy.getCitation(...)

View differences:

cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/cdmLight/CdmLightClassificationExport.java
1235 1235
                    int index = 1;
1236 1236
                    for (IdentifiableSource source: typeDesignation.getSources()){
1237 1237
                        if (source.getCitation() != null){
1238
                            stringbuilder.append(((DefaultReferenceCacheStrategy)source.getCitation().getCacheStrategy()).getCitation(source.getCitation()));
1238
                            DefaultReferenceCacheStrategy cacheStrategy = ((DefaultReferenceCacheStrategy)source.getCitation().getCacheStrategy());
1239
                            stringbuilder.append(cacheStrategy.getCitation(source.getCitation(), source.getCitationMicroReference()));
1239 1240
                        }
1240 1241
                        if (index < typeDesignation.getSources().size()) {
1241 1242
                            stringbuilder.append( ", ");
cdmlib-model/src/main/java/eu/etaxonomy/cdm/strategy/cache/reference/DefaultReferenceCacheStrategy.java
227 227

  
228 228
    //TODO see comment on createShortCitation(...)
229 229
    @Override
230
    public String getCitation(Reference reference) {
230
    public String getCitation(Reference reference, String microReference) {
231 231
        // mostly copied from nomRefCacheStrat, refCache, journalCache
232 232

  
233 233
        if (reference == null){
......
252 252

  
253 253
        String year = reference.getYear();
254 254
        if (isNotBlank(year)){
255
            stringBuilder.append(nextConcat + year);
255
            result.append(nextConcat + year);
256
        }
257
        if (isNotBlank(microReference)){
258
            result.append(": " + microReference);
256 259
        }
257 260

  
258 261
        return result.toString();
......
260 263

  
261 264
    //TODO this method seems to be used only for type designations and/or cdmlight, it should be unified with getCitation()
262 265
    /**
263
     * Creates a citation in form Author (year: detail).
264
     * If reference has protected titlecache only the titlecache is returned (may change in future)
266
     * Creates a citation in form <i>author year: detail</i> or <i>author (year: detail)</i>.
267
     * <BR>
268
     * If reference has protected titlecache only the titlecache is returned (may change in future).
269
     * <BR>
270
     * The author team is abbreviated with <code>et al.</code> if more than 2 authors exist in the team.
265 271
     *
266 272
     * @param reference the reference to format
267 273
     * @param citationDetail the microreference (page, figure, etc.), if <code>null</code> also the colon separator is not used
cdmlib-model/src/main/java/eu/etaxonomy/cdm/strategy/cache/reference/IReferenceCacheStrategy.java
21 21

  
22 22
	/**
23 23
	 * Returns a short version of the reference, suitable for citation (e.g. ${authorname}, ${year})
24
	 * @return
24
	 * @deprecated consider using {@link #createShortCitation(Reference, String, Boolean)}. These methods
25
	 * will probably be merged in future
25 26
	 */
26
	public String getCitation(Reference reference);
27
    @Deprecated
28
	public String getCitation(Reference reference, String microReference);
27 29

  
28 30
	/**
29 31
	 * Returns the full abbreviated title string which
......
36 38
	public String getFullAbbrevTitleString(Reference reference);
37 39

  
38 40

  
41
    //TODO this method seems to be used only for type designations and/or cdmlight, it should be unified with getCitation()
42
    /**
43
     * Creates a citation in form <i>author year: detail</i> or <i>author (year: detail)</i>.
44
     * <BR>
45
     * If reference has protected titlecache only the titlecache is returned (may change in future).
46
     * <BR>
47
     * The author team is abbreviated with <code>et al.</code> if more than 2 authors exist in the team.
48
     *
49
     * @param reference the reference to format
50
     * @param citationDetail the microreference (page, figure, etc.), if <code>null</code> also the colon separator is not used
51
     * @param withYearBrackets if <code>false</code> the result comes without brackets (default is <code>false</code>)
52
     * @return
53
     */
54
    public String createShortCitation(Reference reference, String citationDetail, Boolean withYearBrackets);
55

  
56

  
57

  
39 58
}
cdmlib-model/src/main/java/eu/etaxonomy/cdm/strategy/cache/taxon/TaxonBaseDefaultCacheStrategy.java
133 133
                    ref.getAuthorship() != null &&
134 134
                    isNotBlank(ref.getAuthorship().getTitleCache()) &&
135 135
                    isNotBlank(ref.getYear())){
136
                secRef = ref.getCacheStrategy().getCitation(ref);
136
                secRef = ref.getCacheStrategy().getCitation(ref, taxonBase.getSecMicroReference());
137 137
            }else{
138 138
                secRef = ref.getTitleCache();
139 139
            }

Also available in: Unified diff