Project

General

Profile

Download (1.63 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.occurrence;
10

    
11
import java.util.UUID;
12

    
13
import org.apache.log4j.Logger;
14

    
15
import eu.etaxonomy.cdm.model.occurrence.MediaSpecimen;
16

    
17
/**
18
 * A default cache strategy for {@link MediaSpecimen}.
19
 * TODO This is a <b>preliminary</b> implementation to have at least one default cache strategy.
20
 * It will need improvement later on.
21
 *
22
 *  #5573, #7612
23
 *
24
 * Also see DerivedUnitFacadeCacheStrategy in Service Layer.
25
 *
26
 * @author a.mueller
27
 * @since 08.01.2021
28
 */
29
public class MediaSpecimenDefaultCacheStrategy
30
        extends OccurrenceCacheStrategyBase<MediaSpecimen>{
31

    
32
    private static final long serialVersionUID = 798148956185549004L;
33
    @SuppressWarnings("unused")
34
	private static final Logger logger = Logger.getLogger(MediaSpecimenDefaultCacheStrategy.class);
35

    
36
	private static final UUID uuid = UUID.fromString("2df06501-0e2f-4255-b1e6-091be7293f7c");
37

    
38
	@Override
39
	protected UUID getUuid() {
40
		return uuid;
41
	}
42

    
43
	@Override
44
    protected String doGetTitleCache(MediaSpecimen specimen) {
45
	    //add code if it exists
46
        String result = getCollectionAndAccession(specimen);
47
		String mediaTitle = specimen.getMediaSpecimen() == null? null : specimen.getMediaSpecimen().getTitleCache();
48
		if (isNotBlank(mediaTitle)){
49
		    if (isNotBlank(result)){
50
		        result += " (" + mediaTitle +")";
51
		    }else{
52
		        result = mediaTitle;
53
		    }
54
		}
55

    
56
		return result;
57
	}
58
}
(3-3/4)