Project

General

Profile

Download (2.03 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 ThesisDefaultCacheStrategy extends NomRefDefaultCacheStrategyBase implements  INomenclaturalReferenceCacheStrategy {
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
	@Override
32
	protected UUID getUuid() {
33
		return uuid; 
34
	}
35
	
36
	
37
	/**
38
	 * Factory method
39
	 * @return
40
	 */
41
	public static ThesisDefaultCacheStrategy NewInstance(){
42
		return new ThesisDefaultCacheStrategy();
43
	}
44
	
45
	/**
46
	 * Constructor
47
	 */
48
	private ThesisDefaultCacheStrategy(){
49
		super();
50
	}
51

    
52

    
53
	@Override
54
	public String getAbbrevTitleCache(Reference thesis) {
55
		return getTitleWithoutYearAndAuthor(thesis, true);
56
	}
57
	
58
	@Override
59
	protected String getTitleWithoutYearAndAuthor(Reference thesis, boolean isAbbrev){
60
		//FIXME this is only a very fast copy and paste from "Generic". Must still be cleaned !
61
		
62
		if (thesis == null){
63
			return null;
64
		}
65
		
66
		//titelAbbrev
67
		//TODO
68
		String titelAbbrev = CdmUtils.getPreferredNonEmptyString(thesis.getTitle(), thesis.getAbbrevTitle(), isAbbrev, true);
69
		
70
		//titelAbbrev
71
		String nomRefCache = titelAbbrev + blank;
72
	
73
		//delete .
74
		while (nomRefCache.endsWith(".")){
75
			nomRefCache = nomRefCache.substring(0, nomRefCache.length()-1);
76
		}
77
		
78
		return nomRefCache.trim();
79
	}
80

    
81

    
82
}
(13-13/13)