1
|
/**
|
2
|
* Copyright (C) 2007 EDIT
|
3
|
* European Distributed Institute of Taxonomy
|
4
|
* http://www.e-taxonomy.eu
|
5
|
*
|
6
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
7
|
* See LICENSE.TXT at the top of this package for the full license terms.
|
8
|
*/
|
9
|
package eu.etaxonomy.cdm.strategy.cache.reference;
|
10
|
|
11
|
import java.util.UUID;
|
12
|
|
13
|
import org.apache.log4j.Logger;
|
14
|
|
15
|
import eu.etaxonomy.cdm.common.CdmUtils;
|
16
|
import eu.etaxonomy.cdm.model.reference.Reference;
|
17
|
|
18
|
public class ThesisDefaultCacheStrategy <T extends Reference> extends NomRefDefaultCacheStrategyBase<T> implements INomenclaturalReferenceCacheStrategy<T> {
|
19
|
private static final Logger logger = Logger.getLogger(ThesisDefaultCacheStrategy.class);
|
20
|
|
21
|
|
22
|
private String prefixEdition = "ed.";
|
23
|
private String prefixSeries = "ser.";
|
24
|
private String prefixVolume = "vol.";
|
25
|
private String blank = " ";
|
26
|
private String comma = ",";
|
27
|
private String dot =".";
|
28
|
|
29
|
final static UUID uuid = UUID.fromString("95cceb30-6b16-4dc3-8243-c15e746565bc");
|
30
|
|
31
|
/* (non-Javadoc)
|
32
|
* @see eu.etaxonomy.cdm.strategy.StrategyBase#getUuid()
|
33
|
*/
|
34
|
@Override
|
35
|
protected UUID getUuid() {
|
36
|
return uuid;
|
37
|
}
|
38
|
|
39
|
|
40
|
/**
|
41
|
* Factory method
|
42
|
* @return
|
43
|
*/
|
44
|
public static ThesisDefaultCacheStrategy NewInstance(){
|
45
|
return new ThesisDefaultCacheStrategy();
|
46
|
}
|
47
|
|
48
|
/**
|
49
|
* Constructor
|
50
|
*/
|
51
|
private ThesisDefaultCacheStrategy(){
|
52
|
super();
|
53
|
}
|
54
|
|
55
|
|
56
|
@Override
|
57
|
public String getAbbrevTitleCache(T thesis) {
|
58
|
return getTitleWithoutYearAndAuthor(thesis, true);
|
59
|
}
|
60
|
|
61
|
@Override
|
62
|
protected String getTitleWithoutYearAndAuthor(T thesis, boolean isAbbrev){
|
63
|
//FIXME this is only a very fast copy and paste from "Generic". Must still be cleaned !
|
64
|
|
65
|
if (thesis == null){
|
66
|
return null;
|
67
|
}
|
68
|
|
69
|
//titelAbbrev
|
70
|
//TODO
|
71
|
String titelAbbrev = CdmUtils.getPreferredNonEmptyString(thesis.getTitle(), thesis.getAbbrevTitle(), isAbbrev, true);
|
72
|
|
73
|
//titelAbbrev
|
74
|
String nomRefCache = titelAbbrev + blank;
|
75
|
|
76
|
//delete .
|
77
|
while (nomRefCache.endsWith(".")){
|
78
|
nomRefCache = nomRefCache.substring(0, nomRefCache.length()-1);
|
79
|
}
|
80
|
|
81
|
return nomRefCache.trim();
|
82
|
}
|
83
|
|
84
|
|
85
|
}
|