1
|
/**
|
2
|
* Copyright (C) 2009 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.common;
|
11
|
|
12
|
import org.hibernate.Query;
|
13
|
import org.springframework.stereotype.Repository;
|
14
|
|
15
|
import eu.etaxonomy.cdm.model.common.IIdentifiableEntity;
|
16
|
import eu.etaxonomy.cdm.model.common.LSID;
|
17
|
import eu.etaxonomy.cdm.model.common.LSIDAuthority;
|
18
|
import eu.etaxonomy.cdm.persistence.dao.common.ILsidAuthorityDao;
|
19
|
|
20
|
@Repository
|
21
|
public class LsidAuthorityDaoImpl extends CdmEntityDaoBase<LSIDAuthority> implements
|
22
|
ILsidAuthorityDao {
|
23
|
|
24
|
public LsidAuthorityDaoImpl() {
|
25
|
super(LSIDAuthority.class);
|
26
|
}
|
27
|
|
28
|
public Class<? extends IIdentifiableEntity> getClassForNamespace(LSID lsid) {
|
29
|
Query query = getSession().createQuery("select clazz from LSIDAuthority authority join authority.namespaces clazz where authority.authority = :authority and index(clazz) = :namespace");
|
30
|
query.setParameter("authority",lsid.getAuthority());
|
31
|
query.setParameter("namespace", lsid.getNamespace());
|
32
|
return (Class<? extends IIdentifiableEntity>)query.uniqueResult();
|
33
|
}
|
34
|
}
|