Revision 790060bd
Added by Katja Luther about 8 years ago
cdmlib-persistence/src/main/java/eu/etaxonomy/cdm/persistence/dao/hibernate/taxon/TaxonDaoHibernateImpl.java | ||
---|---|---|
280 | 280 |
// new Boolean(result[3].toString()) is due to the fact that result[3] could be a Boolean ora String |
281 | 281 |
// see FIXME in 'prepareQuery' for more details |
282 | 282 |
if (doTaxa && doSynonyms){ |
283 |
if (result[2].equals("synonym")) {
|
|
283 |
if (result[3].equals("synonym")) {
|
|
284 | 284 |
resultObjects.add( new UuidAndTitleCache(Synonym.class, (UUID) result[0], (Integer) result[1], (String)result[2], new Boolean(result[4].toString()))); |
285 | 285 |
} |
286 | 286 |
else { |
... | ... | |
1959 | 1959 |
} |
1960 | 1960 |
|
1961 | 1961 |
|
1962 |
@Override |
|
1963 |
public List<UuidAndTitleCache<TaxonBase>> getUuidAndTitleCacheTaxon(Integer limit, String pattern) { |
|
1964 |
return getUuidAndTitleCache(limit, pattern, true); |
|
1965 |
} |
|
1966 |
|
|
1967 |
|
|
1968 |
/* public List<UuidAndTitleCache<TaxonBase>> getUuidAndTitleCache(Integer limit, String pattern, boolean isTaxon) { |
|
1969 |
String className; |
|
1970 |
if (isTaxon){ |
|
1971 |
className = Taxon.class.getSimpleName(); |
|
1972 |
} else{ |
|
1973 |
className = Synonym.class.getSimpleName(); |
|
1974 |
} |
|
1975 |
String queryString; |
|
1976 |
|
|
1977 |
if(pattern == null){ |
|
1978 |
queryString = String.format("select uuid, id, titleCache from %s where DTYPE = '%s' ", type.getSimpleName(), className ); |
|
1979 |
} else{ |
|
1980 |
queryString = String.format("select uuid, id, titleCache from %s where DTYPE = '%s' and titleCache like :pattern", type.getSimpleName(), className); |
|
1981 |
} |
|
1982 |
Query query = getSession().createQuery(queryString); |
|
1983 |
if (pattern != null){ |
|
1984 |
pattern = pattern + "%"; |
|
1985 |
query.setParameter("pattern", pattern); |
|
1986 |
} |
|
1987 |
if (limit != null){ |
|
1988 |
query.setMaxResults(limit); |
|
1989 |
} |
|
1990 |
|
|
1991 |
List<UuidAndTitleCache<TaxonBase>> result = getUuidAndTitleCache(query); |
|
1992 |
|
|
1993 |
return result; |
|
1994 |
} |
|
1995 |
@Override |
|
1996 |
public List<UuidAndTitleCache<TaxonBase>> getUuidAndTitleCacheSynonym(Integer limit, String pattern){ |
|
1997 |
|
|
1998 |
return getUuidAndTitleCache(limit, pattern, false); |
|
1999 |
} |
|
2000 |
*/ |
|
1962 | 2001 |
@Override |
1963 | 2002 |
public List<UuidAndTitleCache<TaxonBase>> getUuidAndTitleCacheTaxon() { |
1964 | 2003 |
String queryString = String.format("select uuid, id, titleCache from %s where DTYPE = '%s'", type.getSimpleName(), Taxon.class.getSimpleName()); |
... | ... | |
1978 | 2017 |
|
1979 | 2018 |
return result; |
1980 | 2019 |
} |
1981 |
|
|
1982 |
|
|
1983 | 2020 |
private String[] createHQLString(boolean doTaxa, boolean doSynonyms, boolean doIncludeMisappliedNames, Classification classification, Set<NamedArea> areasExpanded, MatchMode matchMode, String searchField){ |
1984 | 2021 |
|
1985 | 2022 |
boolean doAreaRestriction = areasExpanded.size() > 0; |
Also available in: Unified diff
fix #5672