Project

General

Profile

Download (2.45 KB) Statistics
| Branch: | Tag: | Revision:
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 <T extends Reference> extends NomRefDefaultCacheStrategyBase<T>  implements  INomenclaturalReferenceCacheStrategy<T> {
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
	/* (non-Javadoc)
31
	 * @see eu.etaxonomy.cdm.strategy.StrategyBase#getUuid()
32
	 */
33
	@Override
34
	protected UUID getUuid() {
35
		return uuid; 
36
	}
37
	
38
	
39
	/**
40
	 * Factory method
41
	 * @return
42
	 */
43
	public static CdDvdDefaultCacheStrategy NewInstance(){
44
		return new CdDvdDefaultCacheStrategy<Reference>();
45
	}
46
	
47
	/**
48
	 * Constructor
49
	 */
50
	private CdDvdDefaultCacheStrategy(){
51
		super();
52
	}
53
	
54
	@Override
55
	protected String getTitleWithoutYearAndAuthor(T ref, boolean isAbbrev){
56
		if (ref == null){
57
			return null;
58
		}
59
		String nomRefCache = "";
60
		//TODO
61
		String titel = CdmUtils.getPreferredNonEmptyString(ref.getTitle(), ref.getAbbrevTitle(), isAbbrev, true);
62
//		String publisher = CdmUtils.Nz(nomenclaturalReference.getPublisher());
63
		
64
		boolean needsComma = false;
65
		//titelAbbrev
66
		String titelAbbrevPart = "";
67
		if (titel.length() > 0){
68
			nomRefCache = titel + blank; 
69
		}
70
//		//publisher
71
//		String publisherPart = "";
72
//		if (!"".equals(publisher)){
73
//			publisherPart = publisher;
74
//			needsComma = true;
75
//		}
76
//		nomRefCache += publisherPart;
77

    
78
		
79
		//delete .
80
		while (nomRefCache.endsWith(".")){
81
			nomRefCache = nomRefCache.substring(0, nomRefCache.length()-1);
82
		}
83
		return nomRefCache.trim();
84
	}
85
	
86
	private boolean isNumeric(String string){
87
		if (string == null){
88
			return false;
89
		}
90
		try {
91
			Double.valueOf(string);
92
			return true;
93
		} catch (NumberFormatException e) {
94
			return false;
95
		}
96
		
97
	}
98

    
99
}
(4-4/12)