Project

General

Profile

Download (1.06 KB) Statistics
| Branch: | Tag: | Revision:
1
package eu.etaxonomy.cdm.api.cache;
2

    
3
import java.util.UUID;
4

    
5
import org.springframework.beans.factory.annotation.Autowired;
6
import org.springframework.stereotype.Component;
7

    
8
import eu.etaxonomy.cdm.model.common.CdmBase;
9
import eu.etaxonomy.cdm.model.common.Language;
10
import eu.etaxonomy.cdm.persistence.dao.hibernate.common.CdmGenericDaoImpl;
11

    
12
/**
13
 * CDM Entity Cacher class which uses CDM DAOs to find / load cdm entities
14
 *
15
 * @author cmathew
16
 *
17
 * @param <T>
18
 */
19
@Component
20
public class CdmDaoCacher<T extends CdmBase> extends CdmCacher<T> {
21

    
22
	@Autowired
23
	CdmGenericDaoImpl genericDao;
24

    
25
	/* (non-Javadoc)
26
	 * @see eu.etaxonomy.cdm.api.cache.CdmCacher#initDefaultTerms()
27
	 */
28
	@Override
29
	protected void initDefaultTerms() {
30
	    // adding default language to the cdm cacher
31
	    if(Language.ENGLISH() != null) {
32
	        put(Language.uuidEnglish,Language.ENGLISH());
33
	    }
34
    }
35

    
36
	/* (non-Javadoc)
37
	 * @see eu.etaxonomy.cdm.api.cache.CdmCacher#findByUuid(java.util.UUID)
38
	 */
39
	@Override
40
	protected T findByUuid(UUID uuid) {
41
		return (T)genericDao.findByUuidWithoutFlush(uuid);
42
	}
43

    
44
}
(2-2/2)