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.Generic;
|
17
|
//import eu.etaxonomy.cdm.model.reference.Thesis;
|
18
|
import eu.etaxonomy.cdm.model.reference.ReferenceBase;
|
19
|
|
20
|
public class ThesisDefaultCacheStrategy <T extends ReferenceBase> extends NomRefDefaultCacheStrategyBase<T> implements INomenclaturalReferenceCacheStrategy<T> {
|
21
|
private static final Logger logger = Logger.getLogger(ThesisDefaultCacheStrategy.class);
|
22
|
|
23
|
|
24
|
private String prefixEdition = "ed.";
|
25
|
private String prefixSeries = "ser.";
|
26
|
private String prefixVolume = "vol.";
|
27
|
private String blank = " ";
|
28
|
private String comma = ",";
|
29
|
private String dot =".";
|
30
|
|
31
|
final static UUID uuid = UUID.fromString("95cceb30-6b16-4dc3-8243-c15e746565bc");
|
32
|
|
33
|
/* (non-Javadoc)
|
34
|
* @see eu.etaxonomy.cdm.strategy.StrategyBase#getUuid()
|
35
|
*/
|
36
|
@Override
|
37
|
protected UUID getUuid() {
|
38
|
return uuid;
|
39
|
}
|
40
|
|
41
|
|
42
|
/**
|
43
|
* Factory method
|
44
|
* @return
|
45
|
*/
|
46
|
public static ThesisDefaultCacheStrategy NewInstance(){
|
47
|
return new ThesisDefaultCacheStrategy();
|
48
|
}
|
49
|
|
50
|
/**
|
51
|
* Constructor
|
52
|
*/
|
53
|
private ThesisDefaultCacheStrategy(){
|
54
|
super();
|
55
|
}
|
56
|
|
57
|
@Override
|
58
|
protected String getNomRefTitleWithoutYearAndAuthor(T thesis){
|
59
|
//FIXME this is only a very fast copy and paste from "Generic". Must still be cleaned !
|
60
|
|
61
|
if (thesis == null){
|
62
|
return null;
|
63
|
}
|
64
|
|
65
|
//TODO
|
66
|
String titelAbbrev = CdmUtils.Nz(thesis.getTitle()).trim();
|
67
|
|
68
|
String nomRefCache = "";
|
69
|
|
70
|
//titelAbbrev
|
71
|
if (!"".equals(titelAbbrev)){
|
72
|
nomRefCache = titelAbbrev + blank;
|
73
|
}
|
74
|
|
75
|
|
76
|
//delete .
|
77
|
while (nomRefCache.endsWith(".")){
|
78
|
nomRefCache = nomRefCache.substring(0, nomRefCache.length()-1);
|
79
|
}
|
80
|
|
81
|
return nomRefCache.trim();
|
82
|
}
|
83
|
|
84
|
}
|