(no commit message)
[cdmlib.git] / cdmlib-services / src / main / java / eu / etaxonomy / cdm / api / service / AgentServiceImpl.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.ArrayList;
13 import java.util.Collection;
14 import java.util.List;
15 import java.util.Map;
16 import java.util.UUID;
17
18 import org.apache.log4j.Logger;
19 import org.springframework.beans.factory.annotation.Autowired;
20 import org.springframework.stereotype.Service;
21 import org.springframework.transaction.annotation.Transactional;
22
23 import eu.etaxonomy.cdm.model.agent.Agent;
24 import eu.etaxonomy.cdm.model.agent.Institution;
25 import eu.etaxonomy.cdm.persistence.dao.agent.IAgentDao;
26 import eu.etaxonomy.cdm.persistence.dao.common.ICdmEntityDao;
27
28
29
30 /**
31 * @author a.mueller
32 *
33 */
34 @Service
35 @Transactional
36 public class AgentServiceImpl<T extends Agent> extends IdentifiableServiceBase<T> implements IAgentService<T> {
37 private static final Logger logger = Logger.getLogger(AgentServiceImpl.class);
38
39 private IAgentDao agentDao;
40 @Autowired
41 protected void setDao(IAgentDao dao) {
42 this.dao = (ICdmEntityDao)dao;
43 this.agentDao = dao;
44 }
45
46 public List<T> findAgentsByTitle(String title) {
47 return super.findCdmObjectsByTitle(title);
48 }
49
50 public T getAgentByUuid(UUID uuid) {
51 return super.getCdmObjectByUuid(uuid);
52 }
53
54 public UUID saveAgent(T agent) {
55 return super.saveCdmObject(agent);
56 }
57
58 @Transactional(readOnly = false)
59 public Map<UUID, T> saveAgentAll(Collection<T> agentCollection){
60 return saveCdmObjectAll(agentCollection);
61 }
62
63
64 public List<? extends Agent> getAllAgents(int limit, int start){
65 return agentDao.list(limit, start);
66 }
67
68 public List<Agent> searchInstitutionByCode(String code) {
69 return agentDao.getInstitutionByCode(code);
70 }
71
72 public void generateTitleCache() {
73 // TODO Auto-generated method stub
74
75 }
76
77
78 }