1 |
93f50b5e
|
Cherian Mathew
|
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 |
|
|
* @param <T>
|
15 |
|
|
*/
|
16 |
|
|
public interface ICdmCacher<T extends CdmBase> {
|
17 |
|
|
|
18 |
|
|
/**
|
19 |
|
|
* Load a CDM Entity object with given UUID.
|
20 |
|
|
* This method checks the (default) cache for the entity,
|
21 |
|
|
* else retrieves the entity from the service layer.
|
22 |
|
|
*
|
23 |
|
|
* NOTE : Currently this method can only be used for CDM Term
|
24 |
|
|
* (DefinedTermBase) entities.
|
25 |
|
|
*
|
26 |
|
|
* @param uuid of CDM Entity to return
|
27 |
|
|
* @return
|
28 |
|
|
*/
|
29 |
|
|
public T load(UUID uuid);
|
30 |
|
|
|
31 |
|
|
/**
|
32 |
|
|
* Get a CDM Entity object with given UUID from the (default) cache.
|
33 |
|
|
*
|
34 |
|
|
* @param uuid
|
35 |
|
|
* @return
|
36 |
|
|
*/
|
37 |
|
|
public T getFromCache(UUID uuid);
|
38 |
|
|
|
39 |
|
|
/**
|
40 |
|
|
* Check if a CDM Entity with given UUID exists in the cache.
|
41 |
|
|
*
|
42 |
|
|
* @param uuid of CDM Entity to check
|
43 |
|
|
* @return true if CDM Entity with given UUID exists in the cache, o/w false
|
44 |
|
|
*/
|
45 |
|
|
public boolean exists(UUID uuid);
|
46 |
|
|
|
47 |
|
|
/**
|
48 |
|
|
* Check if a CDM Entity with given UUID exists in the cache
|
49 |
|
|
* and that it is not null.
|
50 |
|
|
*
|
51 |
|
|
* @param uuid of CDM Entity to check
|
52 |
|
|
* @return true if CDM Entity with given UUID exists in the cache and that it is not null, o/w false
|
53 |
|
|
*/
|
54 |
|
|
public boolean existsAndIsNotNull(UUID uuid);
|
55 |
|
|
|
56 |
|
|
}
|