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.taxon;
|
11
|
|
12
|
import java.util.List;
|
13
|
import java.util.Set;
|
14
|
import java.util.UUID;
|
15
|
|
16
|
import org.hibernate.criterion.Criterion;
|
17
|
|
18
|
import eu.etaxonomy.cdm.model.common.RelationshipBase;
|
19
|
import eu.etaxonomy.cdm.model.common.UuidAndTitleCache;
|
20
|
import eu.etaxonomy.cdm.model.common.RelationshipBase.Direction;
|
21
|
import eu.etaxonomy.cdm.model.location.NamedArea;
|
22
|
import eu.etaxonomy.cdm.model.name.NonViralName;
|
23
|
import eu.etaxonomy.cdm.model.name.Rank;
|
24
|
import eu.etaxonomy.cdm.model.name.TaxonNameBase;
|
25
|
import eu.etaxonomy.cdm.model.reference.Reference;
|
26
|
import eu.etaxonomy.cdm.model.taxon.Synonym;
|
27
|
import eu.etaxonomy.cdm.model.taxon.SynonymRelationship;
|
28
|
import eu.etaxonomy.cdm.model.taxon.SynonymRelationshipType;
|
29
|
import eu.etaxonomy.cdm.model.taxon.Taxon;
|
30
|
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
|
31
|
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
|
32
|
import eu.etaxonomy.cdm.model.taxon.TaxonRelationship;
|
33
|
import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType;
|
34
|
import eu.etaxonomy.cdm.model.taxon.Classification;
|
35
|
import eu.etaxonomy.cdm.persistence.dao.BeanInitializer;
|
36
|
import eu.etaxonomy.cdm.persistence.dao.common.IIdentifiableDao;
|
37
|
import eu.etaxonomy.cdm.persistence.dao.common.ITitledDao;
|
38
|
import eu.etaxonomy.cdm.persistence.fetch.CdmFetch;
|
39
|
import eu.etaxonomy.cdm.persistence.query.MatchMode;
|
40
|
import eu.etaxonomy.cdm.persistence.query.OrderHint;
|
41
|
|
42
|
/**
|
43
|
* @author a.mueller
|
44
|
*
|
45
|
*/
|
46
|
public interface ITaxonDao extends IIdentifiableDao<TaxonBase>, ITitledDao<TaxonBase> {
|
47
|
|
48
|
/**
|
49
|
* Returns a list of TaxonBase instances where the taxon.titleCache property matches the name parameter,
|
50
|
* and taxon.sec matches the sec parameter.
|
51
|
* @param name
|
52
|
* @param sec
|
53
|
* @return
|
54
|
*/
|
55
|
public List<TaxonBase> getTaxaByName(String name, Reference sec);
|
56
|
|
57
|
/**
|
58
|
* Returns a list of TaxonBase instances (or Taxon instances, if accepted == true, or Synonym instance, if accepted == false)
|
59
|
* where the taxonBase.name.nameCache property matches the String queryString, and taxon.sec matches the sec parameter.
|
60
|
* @param name
|
61
|
* @param sec
|
62
|
* @return
|
63
|
*/
|
64
|
public List<TaxonBase> getTaxaByName(String queryString, Boolean accepted, Reference sec);
|
65
|
|
66
|
/**
|
67
|
* Returns a list of TaxonBase instances (or Taxon instances, if accepted == true, or Synonym instance, if accepted == false)
|
68
|
* where the taxonBase.name.nameCache property matches the String queryString.
|
69
|
* @param queryString
|
70
|
* @param matchMode
|
71
|
* @param accepted
|
72
|
* @param pageSize
|
73
|
* @param pageNumber
|
74
|
* @return
|
75
|
*/
|
76
|
public List<TaxonBase> getTaxaByName(String queryString, MatchMode matchMode,
|
77
|
Boolean accepted, Integer pageSize, Integer pageNumber);
|
78
|
|
79
|
|
80
|
/**
|
81
|
* Returns a list of TaxonBase instances (or Taxon instances, if accepted == true, or Synonym instance, if accepted == false)
|
82
|
* where the taxonBase.name.nameCache property matches the String queryString.
|
83
|
* @param clazz
|
84
|
* @param queryString
|
85
|
* @param classification TODO
|
86
|
* @param matchMode
|
87
|
* @param namedAreas TODO
|
88
|
* @param pageSize
|
89
|
* @param pageNumber
|
90
|
* @param propertyPaths TODO
|
91
|
* @return list of found taxa
|
92
|
*/
|
93
|
public List<TaxonBase> getTaxaByName(Class<? extends TaxonBase> clazz, String queryString, Classification classification,
|
94
|
MatchMode matchMode, Set<NamedArea> namedAreas, Integer pageSize, Integer pageNumber, List<String> propertyPaths);
|
95
|
|
96
|
/**
|
97
|
* @param clazz
|
98
|
* @param queryString
|
99
|
* @param classification TODO
|
100
|
* @param matchMode
|
101
|
* @param namedAreas
|
102
|
* @param pageSize
|
103
|
* @param pageNumber
|
104
|
* @param propertyPaths
|
105
|
* @return
|
106
|
*/
|
107
|
public long countTaxaByName(Class<? extends TaxonBase> clazz, String queryString, Classification classification,
|
108
|
|
109
|
MatchMode matchMode, Set<NamedArea> namedAreas);
|
110
|
|
111
|
// /**
|
112
|
// * @param queryString
|
113
|
// * @param matchMode
|
114
|
// * @param accepted
|
115
|
// * @return
|
116
|
// */
|
117
|
// public Integer countTaxaByName(String queryString, MatchMode matchMode,
|
118
|
// Boolean accepted);
|
119
|
|
120
|
// /**
|
121
|
// * Returns a count of TaxonBase instances where the
|
122
|
// * taxon.name properties match the parameters passed.
|
123
|
// *
|
124
|
// * @param queryString search string
|
125
|
// * @param matchMode way how search string shall be matched: exact, beginning, or anywhere
|
126
|
// * @param selectModel all taxon base, taxa, or synonyms
|
127
|
// */
|
128
|
// public Integer countTaxaByName(String queryString, MatchMode matchMode, SelectMode selectMode);
|
129
|
|
130
|
/**
|
131
|
* Returns a count of TaxonBase instances where the
|
132
|
* taxon.name properties match the parameters passed.
|
133
|
*
|
134
|
* @param clazz
|
135
|
* @param uninomial
|
136
|
* @param infragenericEpithet
|
137
|
* @param specificEpithet
|
138
|
* @param infraspecificEpithet
|
139
|
* @param rank
|
140
|
* @return a count of TaxonBase instances
|
141
|
*/
|
142
|
public int countTaxaByName(Class<? extends TaxonBase> clazz, String uninomial, String infragenericEpithet,String specificEpithet, String infraspecificEpithet, Rank rank);
|
143
|
|
144
|
/**
|
145
|
* Returns a list of TaxonBase instances where the
|
146
|
* taxon.name properties match the parameters passed. In order to search for any string value, pass '*', passing the string value of
|
147
|
* <i>null</i> will search for those taxa with a value of null in that field
|
148
|
* <p>
|
149
|
* Compare with
|
150
|
* {@link #findByName(String, MatchMode, int, int, boolean)}
|
151
|
* which searches for {@link TaxonNameBase}<strong><code>.titleCache</code>
|
152
|
* </strong>
|
153
|
*
|
154
|
* @param clazz optionally filter by class (can be null to return all taxa)
|
155
|
* @param uninomial
|
156
|
* @param infragenericEpithet
|
157
|
* @param specificEpithet
|
158
|
* @param infraspecificEpithet
|
159
|
* @param rank
|
160
|
* @param pageSize The maximum number of taxa returned (can be null for all matching taxa)
|
161
|
* @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
|
162
|
* @return a list of TaxonBase instances
|
163
|
*/
|
164
|
public List<TaxonBase> findTaxaByName(Class<? extends TaxonBase> clazz, String uninomial, String infragenericEpithet, String specificEpithet, String infraspecificEpithet, Rank rank, Integer pageSize, Integer pageNumber);
|
165
|
|
166
|
/**
|
167
|
* Find taxa by searching for Taxa and Synonyms where the
|
168
|
* {@link TaxonNameBase}<strong><code>.titleCache</code></strong> matches
|
169
|
* the name specified as queryString <code>taxonName</code>
|
170
|
* <P>
|
171
|
* Compare with
|
172
|
* {@link #findTaxaByName(Class, String, String, String, String, Rank, Integer, Integer)}
|
173
|
* which searches for {@link TaxonNameBase}<strong><code>.nameCache</code>
|
174
|
* </strong>
|
175
|
* @param queryString
|
176
|
* the taqxon Name to search for
|
177
|
* @param classification TODO
|
178
|
* @param matchMode
|
179
|
* @param namedAreas TODO
|
180
|
* @param pageNumber
|
181
|
* @param pageSize
|
182
|
* @param onlyAcccepted
|
183
|
* @return
|
184
|
*/
|
185
|
public List<TaxonBase> findByNameTitleCache(Class<? extends TaxonBase>clazz, String queryString, Classification classification, MatchMode matchMode, Set<NamedArea> namedAreas, Integer pageNumber, Integer pageSize, List<String> propertyPaths) ;
|
186
|
|
187
|
public List<TaxonBase> getTaxaByCommonName(String queryString, Classification classification,
|
188
|
MatchMode matchMode, Set<NamedArea> namedAreas, Integer pageSize,
|
189
|
Integer pageNumber, List<String> propertyPaths);
|
190
|
|
191
|
/**
|
192
|
* Computes all Taxon instances that do not have a taxonomic parent and has at least one child.
|
193
|
* @return The List<Taxon> of root taxa.
|
194
|
* @deprecated obsolete when using classification
|
195
|
*/
|
196
|
public List<Taxon> getRootTaxa(Reference sec);
|
197
|
|
198
|
|
199
|
/**
|
200
|
* Computes all Taxon instances that do not have a taxonomic parent.
|
201
|
* @param sec The concept reference that the taxon belongs to
|
202
|
* @param cdmFetch not used yet !! TODO
|
203
|
* @param onlyWithChildren if true only taxa are returned that have taxonomic children. <Br>Default: true.
|
204
|
* @param withMisaplications if false only taxa are returned that have no isMisappliedNameFor relationship.
|
205
|
* <Br>Default: true.
|
206
|
* @return The List<Taxon> of root taxa.
|
207
|
* @deprecated obsolete when using classification
|
208
|
*/
|
209
|
public List<Taxon> getRootTaxa(Reference sec, CdmFetch cdmFetch, Boolean onlyWithChildren, Boolean withMisapplications);
|
210
|
|
211
|
|
212
|
/**
|
213
|
* Computes all Taxon instances which name is of a certain Rank.
|
214
|
*
|
215
|
* @param rank
|
216
|
* The rank of the taxon name
|
217
|
* @param sec
|
218
|
* The concept reference that the taxon belongs to
|
219
|
* @param cdmFetch
|
220
|
* not used yet !! TODO
|
221
|
* @param onlyWithChildren
|
222
|
* if true only taxa are returned that have taxonomic children. <Br>
|
223
|
* Default: true.
|
224
|
* @param withMisaplications
|
225
|
* if false only taxa are returned that have no
|
226
|
* isMisappliedNameFor relationship.
|
227
|
* @param propertyPaths
|
228
|
* properties to be initialized, For detailed description and
|
229
|
* examples <b>please refer to:</b>
|
230
|
* {@link BeanInitializer#initialize(Object, List)}. <Br>
|
231
|
* Default: true.
|
232
|
* @return The List<Taxon> of root taxa.
|
233
|
* @deprecated obsolete when using classification
|
234
|
*/
|
235
|
public List<Taxon>
|
236
|
getRootTaxa(Rank rank, Reference sec, CdmFetch cdmFetch, Boolean onlyWithChildren, Boolean withMisapplications, List<String> propertyPaths);
|
237
|
|
238
|
/**
|
239
|
* TODO necessary?
|
240
|
* @param pagesize max maximum number of returned taxa
|
241
|
* @param page page to start, with 0 being first page
|
242
|
* @return
|
243
|
*/
|
244
|
public List<TaxonBase> getAllTaxonBases(Integer pagesize, Integer page);
|
245
|
|
246
|
|
247
|
/**
|
248
|
* @param limit
|
249
|
* @param start
|
250
|
* @return
|
251
|
*/
|
252
|
public List<Taxon> getAllTaxa(Integer limit, Integer start);
|
253
|
|
254
|
/**
|
255
|
* @param limit
|
256
|
* @param start
|
257
|
* @return
|
258
|
*/
|
259
|
public List<Synonym> getAllSynonyms(Integer limit, Integer start);
|
260
|
|
261
|
public List<RelationshipBase> getAllRelationships(Integer limit, Integer start);
|
262
|
|
263
|
public int countAllRelationships();
|
264
|
|
265
|
/**
|
266
|
* @param queryString
|
267
|
* @param matchMode
|
268
|
* @param onlyAcccepted
|
269
|
* @return
|
270
|
*/
|
271
|
public int countMatchesByName(String queryString, MatchMode matchMode, boolean onlyAcccepted);
|
272
|
|
273
|
/**
|
274
|
* @param queryString
|
275
|
* @param matchMode
|
276
|
* @param onlyAcccepted
|
277
|
* @param criteria
|
278
|
* @return
|
279
|
*/
|
280
|
public int countMatchesByName(String queryString, MatchMode matchMode, boolean onlyAcccepted, List<Criterion> criteria);
|
281
|
|
282
|
/**
|
283
|
* Returns a count of the TaxonRelationships (of where relationship.type ==
|
284
|
* type, if this argument is supplied) where the supplied taxon either is
|
285
|
* relatedFrom or relatedTo depending on the <code>direction</code>
|
286
|
* parameter.
|
287
|
*
|
288
|
* @param taxon
|
289
|
* The taxon that is relatedFrom
|
290
|
* @param type
|
291
|
* The type of TaxonRelationship (can be null)
|
292
|
* @param direction
|
293
|
* specifies the direction of the relationship
|
294
|
* @return the number of TaxonRelationship instances
|
295
|
*/
|
296
|
public int countTaxonRelationships(Taxon taxon, TaxonRelationshipType type,
|
297
|
Direction direction);
|
298
|
|
299
|
/**
|
300
|
* Returns the TaxonRelationships (of where relationship.type == type, if
|
301
|
* this argument is supplied) where the supplied taxon either is
|
302
|
* relatedFrom or relatedTo depending on the <code>direction</code>
|
303
|
* parameter.
|
304
|
*
|
305
|
* @param taxon
|
306
|
* The taxon that is relatedTo
|
307
|
* @param type
|
308
|
* The type of TaxonRelationship (can be null)
|
309
|
* @param pageSize
|
310
|
* The maximum number of relationships returned (can be null for
|
311
|
* all relationships)
|
312
|
* @param pageNumber
|
313
|
* The offset (in pageSize chunks) from the start of the result
|
314
|
* set (0 - based)
|
315
|
* @param orderHints
|
316
|
* Properties to order by
|
317
|
* @param propertyPaths
|
318
|
* Properties to initialize in the returned entities, following
|
319
|
* the syntax described in
|
320
|
* {@link BeanInitializer#initialize(Object, List)}
|
321
|
* @param direction
|
322
|
* specifies the direction of the relationship
|
323
|
* @return a List of TaxonRelationship instances
|
324
|
*/
|
325
|
public List<TaxonRelationship> getTaxonRelationships(Taxon taxon,
|
326
|
TaxonRelationshipType type, Integer pageSize, Integer pageNumber,
|
327
|
List<OrderHint> orderHints, List<String> propertyPaths,
|
328
|
Direction direction);
|
329
|
|
330
|
/**
|
331
|
* Returns a count of the SynonymRelationships (of where relationship.type == type,
|
332
|
* if this arguement is supplied) where the supplied taxon is relatedTo.
|
333
|
*
|
334
|
* @param taxon The taxon that is relatedTo
|
335
|
* @param type The type of SynonymRelationship (can be null)
|
336
|
* @return the number of SynonymRelationship instances
|
337
|
*/
|
338
|
public int countSynonyms(Taxon taxon, SynonymRelationshipType type);
|
339
|
|
340
|
/**
|
341
|
* Returns the SynonymRelationships (of where relationship.type == type, if this arguement is supplied)
|
342
|
* where the supplied taxon is relatedTo.
|
343
|
*
|
344
|
* @param taxon The taxon that is relatedTo
|
345
|
* @param type The type of SynonymRelationship (can be null)
|
346
|
* @param pageSize The maximum number of relationships returned (can be null for all relationships)
|
347
|
* @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
|
348
|
* * @param orderHints Properties to order by
|
349
|
* @param propertyPaths Properties to initialize in the returned entities, following the syntax described in {@link BeanInitializer#initialize(Object, List)}
|
350
|
* @return a List of SynonymRelationship instances
|
351
|
*/
|
352
|
public List<SynonymRelationship> getSynonyms(Taxon taxon, SynonymRelationshipType type, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);
|
353
|
|
354
|
/**
|
355
|
* Returns a count of the SynonymRelationships (of where relationship.type == type,
|
356
|
* if this arguement is supplied) where the supplied synonym is relatedFrom.
|
357
|
*
|
358
|
* @param taxon The synonym that is relatedFrom
|
359
|
* @param type The type of SynonymRelationship (can be null)
|
360
|
* @return the number of SynonymRelationship instances
|
361
|
*/
|
362
|
public int countSynonyms(Synonym synonym, SynonymRelationshipType type);
|
363
|
|
364
|
/**
|
365
|
* Returns the SynonymRelationships (of where relationship.type == type, if this arguement is supplied)
|
366
|
* where the supplied synonym is relatedFrom.
|
367
|
*
|
368
|
* @param taxon The synonym that is relatedFrom
|
369
|
* @param type The type of SynonymRelationship (can be null)
|
370
|
* @param pageSize The maximum number of relationships returned (can be null for all relationships)
|
371
|
* @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
|
372
|
* * @param orderHints Properties to order by
|
373
|
* @param propertyPaths Properties to initialize in the returned entities, following the syntax described in {@link BeanInitializer#initialize(Object, List)}
|
374
|
* @return a List of SynonymRelationship instances
|
375
|
*/
|
376
|
public List<SynonymRelationship> getSynonyms(Synonym synoynm, SynonymRelationshipType type, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);
|
377
|
|
378
|
/**
|
379
|
*
|
380
|
* @return
|
381
|
*/
|
382
|
public List<UuidAndTitleCache<TaxonNode>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(Classification classification);
|
383
|
|
384
|
/**
|
385
|
* Creates all inferred synonyms for the species in the tree and insert it to the database
|
386
|
* @param tree
|
387
|
* @return List of inferred synonyms
|
388
|
*/
|
389
|
//public List<Synonym> insertAllInferredSynonymy(Classification tree);
|
390
|
|
391
|
/**
|
392
|
* Creates all inferred synonyms for the taxon in the classification, but do not insert it to the database
|
393
|
* @param taxon
|
394
|
* @param tree
|
395
|
* @return list of inferred synonyms
|
396
|
*/
|
397
|
public List<Synonym> createAllInferredSynonyms(Taxon taxon, Classification tree);
|
398
|
/**
|
399
|
* Creates the specified inferred synonyms for the taxon in the classification, but do not insert it to the database
|
400
|
* @param taxon
|
401
|
* @param tree
|
402
|
* @return list of inferred synonyms
|
403
|
*/
|
404
|
public List<Synonym> createInferredSynonyms(Taxon taxon, Classification tree, SynonymRelationshipType type);
|
405
|
|
406
|
public List<TaxonNameBase> findIdenticalTaxonNames(List<String> propertyPath);
|
407
|
public String getPhylumName(TaxonNameBase name);
|
408
|
|
409
|
public long countTaxaByCommonName(String searchString,
|
410
|
Classification classification, MatchMode matchMode,
|
411
|
Set<NamedArea> namedAreas);
|
412
|
|
413
|
public long deleteSynonymRelationships(Synonym syn);
|
414
|
|
415
|
public List<UUID> findIdenticalTaxonNameIds(List<String> propertyPath);
|
416
|
|
417
|
public List<TaxonNameBase> findIdenticalNamesNew(List <String> propertyPaths);
|
418
|
|
419
|
|
420
|
public Integer countSynonymRelationships(TaxonBase taxonBase,
|
421
|
SynonymRelationshipType type, Direction relatedfrom);
|
422
|
|
423
|
public List<SynonymRelationship> getSynonymRelationships(TaxonBase taxonBase,
|
424
|
SynonymRelationshipType type, Integer pageSize, Integer pageNumber,
|
425
|
List<OrderHint> orderHints, List<String> propertyPaths,
|
426
|
Direction relatedfrom);
|
427
|
|
428
|
/**
|
429
|
* @return
|
430
|
*/
|
431
|
public List<UuidAndTitleCache<TaxonBase>> getUuidAndTitleCacheTaxon();
|
432
|
|
433
|
/**
|
434
|
* @return
|
435
|
*/
|
436
|
public List<UuidAndTitleCache<TaxonBase>> getUuidAndTitleCacheSynonym();
|
437
|
|
438
|
public List<UuidAndTitleCache<TaxonBase>> getTaxaByNameForEditor(Class<? extends TaxonBase> clazz, String queryString, Classification classification,
|
439
|
MatchMode matchMode, Set<NamedArea> namedAreas, List<String> propertyPaths);
|
440
|
|
441
|
|
442
|
}
|