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.persistence.dao.hibernate.name;
|
11
|
|
12
|
import java.util.List;
|
13
|
|
14
|
import org.apache.log4j.Logger;
|
15
|
import org.hibernate.Criteria;
|
16
|
import org.hibernate.Query;
|
17
|
import org.springframework.stereotype.Repository;
|
18
|
|
19
|
import eu.etaxonomy.cdm.model.name.TypeDesignationBase;
|
20
|
import eu.etaxonomy.cdm.model.name.TypeDesignationStatusBase;
|
21
|
import eu.etaxonomy.cdm.persistence.dao.hibernate.common.SourcedEntityDaoImpl;
|
22
|
import eu.etaxonomy.cdm.persistence.dao.name.ITypeDesignationDao;
|
23
|
|
24
|
/**
|
25
|
* @author a.mueller
|
26
|
*/
|
27
|
@Repository
|
28
|
public class TypeDesignationDaoHibernateImpl
|
29
|
extends SourcedEntityDaoImpl<TypeDesignationBase<?>>
|
30
|
implements ITypeDesignationDao {
|
31
|
|
32
|
@SuppressWarnings("unused")
|
33
|
private static final Logger logger = Logger.getLogger(TypeDesignationDaoHibernateImpl.class);
|
34
|
|
35
|
public TypeDesignationDaoHibernateImpl() {
|
36
|
super((Class)(TypeDesignationBase.class));
|
37
|
}
|
38
|
|
39
|
//TODO limit start
|
40
|
@Override
|
41
|
public List<TypeDesignationBase<?>> getAllTypeDesignations(Integer limit, Integer start) {
|
42
|
Criteria crit = getSession().createCriteria(TypeDesignationBase.class);
|
43
|
if(limit != null){
|
44
|
crit.setMaxResults(limit);
|
45
|
}
|
46
|
if(start != null){
|
47
|
crit.setFirstResult(start);
|
48
|
}
|
49
|
@SuppressWarnings("unchecked")
|
50
|
List<TypeDesignationBase<?>> results = crit.list();
|
51
|
return results;
|
52
|
}
|
53
|
|
54
|
@Override
|
55
|
public List<TypeDesignationStatusBase> getTypeDesignationStatusInUse() {
|
56
|
Query query = getSession().createQuery("select distinct tdb.typeStatus from TypeDesignationBase tdb");
|
57
|
@SuppressWarnings("unchecked")
|
58
|
List<TypeDesignationStatusBase> terms = query.list();
|
59
|
return terms;
|
60
|
}
|
61
|
|
62
|
}
|