Project

General

Profile

Download (1.88 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.old;
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 {
19

    
20
    private static final long serialVersionUID = -4945361847684714758L;
21

    
22
    @SuppressWarnings("unused")
23
	private static final Logger logger = Logger.getLogger(ThesisDefaultCacheStrategy.class);
24

    
25
	private String blank = " ";
26

    
27
	final static UUID uuid = UUID.fromString("95cceb30-6b16-4dc3-8243-c15e746565bc");
28

    
29
	@Override
30
	protected UUID getUuid() {
31
		return uuid;
32
	}
33

    
34

    
35
	/**
36
	 * Factory method
37
	 * @return
38
	 */
39
	public static ThesisDefaultCacheStrategy NewInstance(){
40
		return new ThesisDefaultCacheStrategy();
41
	}
42

    
43
	/**
44
	 * Constructor
45
	 */
46
	private ThesisDefaultCacheStrategy(){
47
		super();
48
	}
49

    
50

    
51
	@Override
52
	public String getFullAbbrevTitleString(Reference thesis) {
53
	    //shouldn't this be getTitleCache(thesis, true) ?
54
        return getTitleWithoutYearAndAuthor(thesis, true);
55
	}
56

    
57
	@Override
58
	protected String getTitleWithoutYearAndAuthor(Reference thesis, boolean isAbbrev){
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
		//titelAbbrev
66
		//TODO
67
		String titelAbbrev = CdmUtils.getPreferredNonEmptyString(thesis.getTitle(), thesis.getAbbrevTitle(), isAbbrev, true);
68

    
69
		//titelAbbrev
70
		String nomRefCache = titelAbbrev + blank;
71

    
72
		//delete .
73
		while (nomRefCache.endsWith(".")){
74
			nomRefCache = nomRefCache.substring(0, nomRefCache.length()-1);
75
		}
76

    
77
		return nomRefCache.trim();
78
	}
79

    
80

    
81
}
(11-11/12)