Project

General

Profile

Download (1.77 KB) Statistics
| Branch: | Tag: | Revision:
1
package eu.etaxonomy.cdm.model;
2

    
3
import java.util.UUID;
4

    
5
import eu.etaxonomy.cdm.model.common.CdmBase;
6

    
7
/**
8
 * @author cmathew
9
 *
10
 * Cache class for CDM Entities based on Ehcache.
11
 * The class manages a singleton {@link net.sf.ehcache.CacheManager} having a
12
 * {@link net.sf.ehcache.Cache} initialised with a default configuration.
13
 *
14
 * FIXME: This interface should actually be in an external project which also
15
 * includes the implemented cachers.
16
 *
17
 * @param <T>
18
 */
19
public interface ICdmUuidCacher extends ICdmCacher {
20

    
21
    /**
22
     * Puts the (Key,Value) pair of ({@link java.util.UUID}, {@link eu.etaxonomy.cdm.model.common.CdmBase}),
23
     * in the cache
24
     *
25
     * @param uuid
26
     * @param cdmEntity
27
     */
28
    public void put(UUID uuid, CdmBase cdmEntity);
29

    
30
	/**
31
	 * Load a CDM Entity object with given UUID.
32
	 * This method checks the (default) cache for the entity,
33
	 * else retrieves the entity from the service layer.
34
	 *
35
	 * NOTE : Currently this method can only be used for CDM Term
36
	 * (DefinedTermBase) entities.
37
	 *
38
	 * @param uuid of CDM Entity to return
39
	 * @return
40
	 */
41
	public CdmBase load(UUID uuid);
42

    
43
	/**
44
	 * Get a CDM Entity object with given UUID from the (default) cache.
45
	 *
46
	 * @param uuid
47
	 * @return
48
	 */
49
	public CdmBase getFromCache(UUID uuid);
50

    
51

    
52

    
53
	/**
54
	 * Check if a CDM Entity with given UUID exists in the cache.
55
	 *
56
	 * @param uuid of CDM Entity to check
57
	 * @return true if CDM Entity with given UUID exists in the cache, o/w false
58
	 */
59
	public boolean exists(UUID uuid);
60

    
61
	/**
62
	 * Check if a CDM Entity with given UUID exists in the cache
63
	 * and that it is not null.
64
	 *
65
	 * @param uuid of CDM Entity to check
66
	 * @return true if CDM Entity with given UUID exists in the cache and that it is not null, o/w false
67
	 */
68
	public boolean existsAndIsNotNull(UUID uuid);
69

    
70
}
(6-6/8)