Project

General

Profile

Download (1.32 KB) Statistics
| Branch: | Tag: | Revision:
1
/**
2
* Copyright (C) 2017 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.cache;
10

    
11
import eu.etaxonomy.cdm.model.common.CdmBase;
12

    
13
/**
14
 * @author a.kohlbecker
15
 * @since 09.11.2017
16
 *
17
 */
18
/**
19
 * @author a.kohlbecker
20
 * @since Jan 4, 2018
21
 *
22
 */
23
public interface EntityCache {
24

    
25
    /**
26
     * @param value
27
     *
28
     * @return the cached entity if it is found in the cache otherwise null
29
     */
30
    public <CDM extends CdmBase> CDM find(CDM value);
31

    
32
    public boolean update();
33

    
34
    public <CDM extends CdmBase> void add(CDM value);
35

    
36
    /**
37
     * @param type
38
     * @param id
39
     * @return
40
     */
41
    public <CDM extends CdmBase> CDM find(Class<CDM> type, int id);
42

    
43

    
44
    /**
45
     * Find the <code>value</code> in the cache and update it in case it
46
     * has an later <code>updatedWhen</code> value.
47
     * The properties of later updated entity will be copied over to the cached entity before it is returned.
48
     *
49
     * @param value the value to be searched in the cache
50
     *
51
     * @return the cached entity if it is found in the cache otherwise null
52
     */
53
    public <CDM extends CdmBase> CDM findAndUpdate(CDM value);
54

    
55

    
56
}
(2-2/2)