CdmServiceCacher : Added class to load / cache CDM entities using services
[taxeditor.git] / eu.etaxonomy.taxeditor.cdmlib / src / main / java / eu / etaxonomy / cdm / api / cache / CdmServiceCacher.java
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.api.service.ITermService;
9 import eu.etaxonomy.cdm.model.common.CdmBase;
10
11 /**
12 * Class which uses CDM services to cache cdm entities
13 *
14 * FIXME: Currently only handles terms entities. It would be
15 * interesting to have a generic method which finds the
16 * correct service to load / cache the entity.
17 *
18 * @author cmathew
19 *
20 * @param <T>
21 */
22 @Component
23 public class CdmServiceCacher<T extends CdmBase> extends CdmCacher<T> {
24
25 @Autowired
26 ITermService termService;
27
28 @Override
29 protected T findByUuid(UUID uuid) {
30 return (T)termService.findWithoutFlush(uuid);
31 }
32
33 }