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 CdDvdDefaultCacheStrategy extends NomRefDefaultCacheStrategyBase implements INomenclaturalReferenceCacheStrategy {
|
19
|
private static final Logger logger = Logger.getLogger(CdDvdDefaultCacheStrategy.class);
|
20
|
|
21
|
private String prefixEdition = "ed.";
|
22
|
private String prefixSeries = "ser.";
|
23
|
private String prefixVolume = "vol.";
|
24
|
private String blank = " ";
|
25
|
private String comma = ",";
|
26
|
private String dot =".";
|
27
|
|
28
|
final static UUID uuid = UUID.fromString("68076ca5-d517-489c-8ae2-01d3c38cc788");
|
29
|
|
30
|
@Override
|
31
|
protected UUID getUuid() {
|
32
|
return uuid;
|
33
|
}
|
34
|
|
35
|
/**
|
36
|
* Factory method
|
37
|
* @return
|
38
|
*/
|
39
|
public static CdDvdDefaultCacheStrategy NewInstance(){
|
40
|
return new CdDvdDefaultCacheStrategy();
|
41
|
}
|
42
|
|
43
|
/**
|
44
|
* Constructor
|
45
|
*/
|
46
|
private CdDvdDefaultCacheStrategy(){
|
47
|
super();
|
48
|
}
|
49
|
|
50
|
@Override
|
51
|
protected String getTitleWithoutYearAndAuthor(Reference ref, boolean isAbbrev){
|
52
|
if (ref == null){
|
53
|
return null;
|
54
|
}
|
55
|
String nomRefCache = "";
|
56
|
//TODO
|
57
|
String titel = CdmUtils.getPreferredNonEmptyString(ref.getTitle(), ref.getAbbrevTitle(), isAbbrev, true);
|
58
|
// String publisher = CdmUtils.Nz(nomenclaturalReference.getPublisher());
|
59
|
|
60
|
boolean needsComma = false;
|
61
|
//titelAbbrev
|
62
|
String titelAbbrevPart = "";
|
63
|
if (titel.length() > 0){
|
64
|
nomRefCache = titel + blank;
|
65
|
}
|
66
|
// //publisher
|
67
|
// String publisherPart = "";
|
68
|
// if (!"".equals(publisher)){
|
69
|
// publisherPart = publisher;
|
70
|
// needsComma = true;
|
71
|
// }
|
72
|
// nomRefCache += publisherPart;
|
73
|
|
74
|
|
75
|
//delete .
|
76
|
while (nomRefCache.endsWith(".")){
|
77
|
nomRefCache = nomRefCache.substring(0, nomRefCache.length()-1);
|
78
|
}
|
79
|
return nomRefCache.trim();
|
80
|
}
|
81
|
|
82
|
private boolean isNumeric(String string){
|
83
|
if (string == null){
|
84
|
return false;
|
85
|
}
|
86
|
try {
|
87
|
Double.valueOf(string);
|
88
|
return true;
|
89
|
} catch (NumberFormatException e) {
|
90
|
return false;
|
91
|
}
|
92
|
|
93
|
}
|
94
|
|
95
|
}
|