Project

General

Profile

Download (2.03 KB) Statistics
| Branch: | Tag: | Revision:
1 5644153a Andreas Müller
/**
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 1d36aa54 Andreas Müller
import eu.etaxonomy.cdm.model.reference.Reference;
17 5644153a Andreas Müller
18 70c786d3 Andreas Müller
public class ThesisDefaultCacheStrategy extends NomRefDefaultCacheStrategyBase implements  INomenclaturalReferenceCacheStrategy {
19 5644153a Andreas Müller
	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 b606df4d Andreas Müller
52
53
	@Override
54 70c786d3 Andreas Müller
	public String getAbbrevTitleCache(Reference thesis) {
55 b606df4d Andreas Müller
		return getTitleWithoutYearAndAuthor(thesis, true);
56
	}
57 5644153a Andreas Müller
	
58
	@Override
59 70c786d3 Andreas Müller
	protected String getTitleWithoutYearAndAuthor(Reference thesis, boolean isAbbrev){
60 5644153a Andreas Müller
		//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 b606df4d Andreas Müller
		//titelAbbrev
67 5644153a Andreas Müller
		//TODO
68 b606df4d Andreas Müller
		String titelAbbrev = CdmUtils.getPreferredNonEmptyString(thesis.getTitle(), thesis.getAbbrevTitle(), isAbbrev, true);
69 5644153a Andreas Müller
		
70
		//titelAbbrev
71 b606df4d Andreas Müller
		String nomRefCache = titelAbbrev + blank;
72 5644153a Andreas Müller
	
73
		//delete .
74
		while (nomRefCache.endsWith(".")){
75
			nomRefCache = nomRefCache.substring(0, nomRefCache.length()-1);
76
		}
77
		
78
		return nomRefCache.trim();
79
	}
80
81 b606df4d Andreas Müller
82 5644153a Andreas Müller
}