(no commit message)
[cdmlib.git] / cdmlib-services / src / main / java / eu / etaxonomy / cdm / api / service / TermServiceImpl.java
1 /**
2 * Copyright (C) 2007 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
10 package eu.etaxonomy.cdm.api.service;
11
12 import java.util.List;
13 import java.util.Set;
14 import java.util.UUID;
15
16 import org.apache.log4j.Logger;
17 import org.springframework.beans.factory.annotation.Autowired;
18 import org.springframework.stereotype.Service;
19 import org.springframework.transaction.annotation.Transactional;
20
21 import eu.etaxonomy.cdm.model.common.DefinedTermBase;
22 import eu.etaxonomy.cdm.model.common.OrderedTermVocabulary;
23 import eu.etaxonomy.cdm.model.common.TermVocabulary;
24 import eu.etaxonomy.cdm.model.name.Rank;
25 import eu.etaxonomy.cdm.persistence.dao.common.IDefinedTermDao;
26 import eu.etaxonomy.cdm.persistence.dao.common.ITermVocabularyDao;
27 import eu.etaxonomy.cdm.persistence.dao.name.ITaxonNameDao;
28
29 @Service
30 @Transactional(readOnly = true)
31 public class TermServiceImpl extends ServiceBase<DefinedTermBase> implements ITermService{
32 static Logger logger = Logger.getLogger(TermServiceImpl.class);
33
34 protected ITermVocabularyDao vocabularyDao;
35
36 @Autowired
37 protected void setVocabularyDao(ITermVocabularyDao vocabularyDao) {
38 this.vocabularyDao = vocabularyDao;
39 }
40
41 @Autowired
42 protected void setDao(IDefinedTermDao dao) {
43 this.dao = dao;
44 }
45
46 /* (non-Javadoc)
47 * @see eu.etaxonomy.cdm.api.service.ITermService#getTermByUri(java.lang.String)
48 */
49 public DefinedTermBase getTermByUri(String uri) {
50 //FIXME transformation from URI to UUID
51 return DefinedTermBase.findByUuid(UUID.fromString(uri));
52 }
53
54 /* (non-Javadoc)
55 * @see eu.etaxonomy.cdm.api.service.ITermService#getTermByUuid(java.util.UUID)
56 */
57 public DefinedTermBase getTermByUuid(UUID uuid) {
58 return DefinedTermBase.findByUuid(uuid);
59 }
60
61 /* (non-Javadoc)
62 * @see eu.etaxonomy.cdm.api.service.ITermService#getVocabulary(java.util.UUID)
63 */
64 public TermVocabulary getVocabulary(UUID vocabularyUuid) {
65 TermVocabulary vocabulary = (OrderedTermVocabulary)vocabularyDao.findByUuid(vocabularyUuid);
66 return vocabulary;
67 }
68
69 /* (non-Javadoc)
70 * @see eu.etaxonomy.cdm.api.service.ITermService#listVocabularies(java.lang.Class)
71 */
72 public Set<TermVocabulary> listVocabularies(Class termClass) {
73 logger.error("Method not implemented yet");
74 return null;
75 }
76
77
78 }