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
|
package eu.etaxonomy.cdm.persistence.dao.name;
|
10
|
|
11
|
import java.util.Collection;
|
12
|
import java.util.HashMap;
|
13
|
import java.util.List;
|
14
|
import java.util.Optional;
|
15
|
import java.util.Set;
|
16
|
import java.util.UUID;
|
17
|
|
18
|
import org.hibernate.criterion.Criterion;
|
19
|
|
20
|
import eu.etaxonomy.cdm.model.name.HybridRelationship;
|
21
|
import eu.etaxonomy.cdm.model.name.HybridRelationshipType;
|
22
|
import eu.etaxonomy.cdm.model.name.INonViralName;
|
23
|
import eu.etaxonomy.cdm.model.name.IZoologicalName;
|
24
|
import eu.etaxonomy.cdm.model.name.NameRelationship;
|
25
|
import eu.etaxonomy.cdm.model.name.NameRelationshipType;
|
26
|
import eu.etaxonomy.cdm.model.name.Rank;
|
27
|
import eu.etaxonomy.cdm.model.name.SpecimenTypeDesignationStatus;
|
28
|
import eu.etaxonomy.cdm.model.name.TaxonName;
|
29
|
import eu.etaxonomy.cdm.model.name.TypeDesignationBase;
|
30
|
import eu.etaxonomy.cdm.model.name.TypeDesignationStatusBase;
|
31
|
import eu.etaxonomy.cdm.persistence.dao.common.IIdentifiableDao;
|
32
|
import eu.etaxonomy.cdm.persistence.dao.common.Restriction;
|
33
|
import eu.etaxonomy.cdm.persistence.dao.initializer.IBeanInitializer;
|
34
|
import eu.etaxonomy.cdm.persistence.dto.TaxonNameParts;
|
35
|
import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache;
|
36
|
import eu.etaxonomy.cdm.persistence.query.MatchMode;
|
37
|
import eu.etaxonomy.cdm.persistence.query.OrderHint;
|
38
|
|
39
|
/**
|
40
|
* @author a.mueller
|
41
|
*
|
42
|
*/
|
43
|
public interface ITaxonNameDao extends IIdentifiableDao<TaxonName> {
|
44
|
|
45
|
/**
|
46
|
* Return a count of names related to or from this name, optionally filtered
|
47
|
* by relationship type. The direction of the relationships taken in to account is depending on
|
48
|
* the <code>direction</code> parameter.
|
49
|
*
|
50
|
* @param name
|
51
|
* the name
|
52
|
* @param direction
|
53
|
* specifies the direction of the relationship
|
54
|
* @param type
|
55
|
* the relationship type (or null to return all relationships)
|
56
|
* @return a count of NameRelationship instances
|
57
|
*/
|
58
|
public int countNameRelationships(TaxonName name, NameRelationship.Direction direction, NameRelationshipType type);
|
59
|
|
60
|
/**
|
61
|
* Return a List of relationships related to or from this name, optionally filtered
|
62
|
* by relationship type. The direction of the relationships taken in to account is depending on
|
63
|
* the <code>direction</code> parameter.
|
64
|
* If both name and direction is null all name relationships will be returned.
|
65
|
*
|
66
|
* @param name
|
67
|
* the name
|
68
|
* @param direction
|
69
|
* specifies the direction of the relationship, may be null to return all relationships
|
70
|
* @param type
|
71
|
* the relationship type (or null to return all relationships)
|
72
|
* @param pageSize
|
73
|
* The maximum number of relationships returned (can be null for
|
74
|
* all relationships)
|
75
|
* @param pageNumber
|
76
|
* The offset (in pageSize chunks) from the start of the result
|
77
|
* set (0 - based) of the result set (0 - based)
|
78
|
* @param orderHints may be null
|
79
|
* @param propertyPaths properties to initialize - see {@link IBeanInitializer#initialize(Object, List)}
|
80
|
* @return a List of NameRelationship instances
|
81
|
*/
|
82
|
public List<NameRelationship> getNameRelationships(TaxonName name, NameRelationship.Direction direction,
|
83
|
NameRelationshipType type, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints,
|
84
|
List<String> propertyPaths);
|
85
|
|
86
|
/**
|
87
|
* Return a count of hybrids related to this name, optionally filtered by
|
88
|
* hybrid relationship type
|
89
|
*
|
90
|
* @param name
|
91
|
* the name
|
92
|
* @param type
|
93
|
* the hybrid relationship type (or null to return all hybrid)
|
94
|
* @return a count of HybridRelationship instances
|
95
|
*/
|
96
|
public int countHybridNames(INonViralName name, HybridRelationshipType type);
|
97
|
|
98
|
/**
|
99
|
* Return a List of hybrids related to this name, optionally filtered by
|
100
|
* hybrid relationship type
|
101
|
*
|
102
|
* @param name
|
103
|
* the name
|
104
|
* @param type
|
105
|
* the hybrid relationship type (or null to return all hybrids)
|
106
|
* @param pageSize
|
107
|
* The maximum number of hybrid relationships returned (can be
|
108
|
* null for all relationships)
|
109
|
* @param pageNumber
|
110
|
* The offset (in pageSize chunks) from the start of the result
|
111
|
* set (0 - based)
|
112
|
* @return a List of HybridRelationship instances
|
113
|
*/
|
114
|
public List<HybridRelationship> getHybridNames(INonViralName name, HybridRelationshipType type, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);
|
115
|
|
116
|
/**
|
117
|
* Return a count of types related to this name, optionally filtered by type
|
118
|
* designation status
|
119
|
*
|
120
|
* @param name
|
121
|
* the name
|
122
|
* @param status
|
123
|
* the type designation status (or null to return all types)
|
124
|
* @return a count of TypeDesignationBase instances
|
125
|
*/
|
126
|
public long countTypeDesignations(TaxonName name,
|
127
|
SpecimenTypeDesignationStatus status);
|
128
|
|
129
|
/**
|
130
|
* Return a List of types related to this name, optionally filtered by type
|
131
|
* designation status
|
132
|
*
|
133
|
* @param name
|
134
|
* the name
|
135
|
* @param type
|
136
|
* limit the result set to a specific subtype of TypeDesignationBase, may be null
|
137
|
* @param status
|
138
|
* the type designation status (or null to return all types)
|
139
|
* @param pageSize
|
140
|
* The maximum number of types returned (can be null for all
|
141
|
* types)
|
142
|
* @param pageNumber
|
143
|
* The offset (in pageSize chunks) from the start of the result
|
144
|
* set (0 - based)
|
145
|
* @param propertyPaths
|
146
|
* @return a List of TypeDesignationBase instances
|
147
|
*/
|
148
|
public <T extends TypeDesignationBase> List<T> getTypeDesignations(TaxonName name,
|
149
|
Class<T> type,
|
150
|
TypeDesignationStatusBase status, Integer pageSize, Integer pageNumber,
|
151
|
List<String> propertyPaths);
|
152
|
|
153
|
/**
|
154
|
* Return a list ids of specimens that are type specimens for the given name
|
155
|
* @param name
|
156
|
* @param status
|
157
|
* @param pageSize
|
158
|
* @param pageNumber
|
159
|
* @return
|
160
|
*/
|
161
|
public List<Integer> getTypeSpecimenIdsForTaxonName(TaxonName name,
|
162
|
TypeDesignationStatusBase status, Integer pageSize, Integer pageNumber);
|
163
|
|
164
|
/**
|
165
|
* Return a List of types related to this name, optionally filtered by type
|
166
|
* designation status
|
167
|
*
|
168
|
* @param name
|
169
|
* the name
|
170
|
* @param status
|
171
|
* the type designation status (or null to return all types)
|
172
|
* @param pageSize
|
173
|
* The maximum number of types returned (can be null for all
|
174
|
* types)
|
175
|
* @param pageNumber
|
176
|
* The offset (in pageSize chunks) from the start of the result
|
177
|
* set (0 - based)
|
178
|
* @param propertyPaths
|
179
|
* @return a List of TypeDesignationBase instances
|
180
|
* @deprecated use {@link #getTypeDesignations(TaxonName, Class, TypeDesignationStatusBase, Integer, Integer, List)} instead
|
181
|
*/
|
182
|
@Deprecated
|
183
|
public List<TypeDesignationBase> getTypeDesignations(TaxonName name,
|
184
|
TypeDesignationStatusBase status, Integer pageSize, Integer pageNumber,
|
185
|
List<String> propertyPaths);
|
186
|
|
187
|
/**
|
188
|
* Returns a List of TaxonName instances that match the properties
|
189
|
* passed
|
190
|
*
|
191
|
* @param uninomial
|
192
|
* @param infraGenericEpithet
|
193
|
* @param specificEpithet
|
194
|
* @param infraspecificEpithet
|
195
|
* @param rank
|
196
|
* @param pageSize
|
197
|
* The maximum number of names returned (can be null for all
|
198
|
* names)
|
199
|
* @param pageNumber
|
200
|
* The offset (in pageSize chunks) from the start of the result
|
201
|
* set (0 - based)
|
202
|
* @param propertyPaths
|
203
|
* @param orderHints
|
204
|
* @return a List of TaxonName instances
|
205
|
*/
|
206
|
public List<TaxonName> searchNames(String uninomial,
|
207
|
String infraGenericEpithet, String specificEpithet,
|
208
|
String infraspecificEpithet, Rank rank, Integer pageSize,
|
209
|
Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);
|
210
|
|
211
|
/**
|
212
|
* Returns a count of TaxonName instances that match the properties
|
213
|
* passed
|
214
|
*
|
215
|
* @param uninomial
|
216
|
* @param infraGenericEpithet
|
217
|
* @param specificEpithet
|
218
|
* @param infraspecificEpithet
|
219
|
* @param rank
|
220
|
* @return a count of TaxonName instances
|
221
|
*/
|
222
|
public long countNames(String uninomial, String infraGenericEpithet,
|
223
|
String specificEpithet, String infraspecificEpithet, Rank rank);
|
224
|
|
225
|
/**
|
226
|
* Returns a count of TaxonName instances that match the properties passed
|
227
|
*
|
228
|
* @param queryString
|
229
|
* @param matchMode
|
230
|
* @param criteria
|
231
|
*/
|
232
|
public long countNames(String queryString, MatchMode matchMode, List<Criterion> criteria);
|
233
|
|
234
|
/**
|
235
|
* Returns a List of TaxonName instances which nameCache matches the
|
236
|
* query string
|
237
|
*
|
238
|
* @param queryString
|
239
|
* @param pageSize
|
240
|
* The maximum number of names returned (can be null for all
|
241
|
* names)
|
242
|
* @param pageNumber
|
243
|
* The offset (in pageSize chunks) from the start of the result
|
244
|
* set (0 - based)
|
245
|
* @return a List of TaxonName instances
|
246
|
*/
|
247
|
public List<TaxonName> searchNames(String queryString,
|
248
|
Integer pageSize, Integer pageNumber);
|
249
|
|
250
|
|
251
|
|
252
|
/**
|
253
|
* Returns a count of TaxonName instances which nameCache matches the
|
254
|
* String queryString
|
255
|
*
|
256
|
* @param queryString
|
257
|
* @return a count of TaxonName instances
|
258
|
*/
|
259
|
public long countNames(String queryString);
|
260
|
|
261
|
/**
|
262
|
* @param queryString
|
263
|
* @param matchmode
|
264
|
* @param pageSize
|
265
|
* @param pageNumber
|
266
|
* @param criteria
|
267
|
* @param propertyPaths TODO
|
268
|
* @return
|
269
|
*/
|
270
|
public List<TaxonName> findByName(boolean doIncludeAuthors,
|
271
|
String queryString,
|
272
|
MatchMode matchmode, Integer pageSize, Integer pageNumber,
|
273
|
List<Criterion> criteria, List<String> propertyPaths);
|
274
|
|
275
|
/**
|
276
|
* @param queryString
|
277
|
* @param matchmode
|
278
|
* @param pageSize
|
279
|
* @param pageNumber
|
280
|
* @param criteria
|
281
|
* @param propertyPaths TODO
|
282
|
* @return
|
283
|
*/
|
284
|
public List<TaxonName> findByFullTitle(String queryString,
|
285
|
MatchMode matchmode, Integer pageSize, Integer pageNumber,
|
286
|
List<Criterion> criteria, List<String> propertyPaths);
|
287
|
|
288
|
/**
|
289
|
* @param queryString
|
290
|
* @param matchmode
|
291
|
* @param pageSize
|
292
|
* @param pageNumber
|
293
|
* @param criteria
|
294
|
* @param propertyPaths TODO
|
295
|
* @return
|
296
|
*/
|
297
|
public List<TaxonName> findByTitle(String queryString,
|
298
|
MatchMode matchmode, Integer pageSize, Integer pageNumber,
|
299
|
List<Criterion> criteria, List<String> propertyPaths);
|
300
|
|
301
|
/**
|
302
|
* Returns a taxon name corresponding to the given uuid
|
303
|
*
|
304
|
* @param uuid
|
305
|
* The uuid of the taxon name requested
|
306
|
* @param criteria
|
307
|
* Custom criteria to be added to the default list of applied criteria.
|
308
|
* @param propertyPaths
|
309
|
*
|
310
|
* @return
|
311
|
*/
|
312
|
public TaxonName findByUuid(UUID uuid, List<Criterion> criteria, List<String> propertyPaths);
|
313
|
|
314
|
/**
|
315
|
* @param queryString
|
316
|
* @param matchmode
|
317
|
* @param criteria
|
318
|
* @return
|
319
|
*/
|
320
|
public Integer countByName(String queryString,
|
321
|
MatchMode matchmode, List<Criterion> criteria);
|
322
|
|
323
|
public List<UuidAndTitleCache> getUuidAndTitleCacheOfNames(Integer limit, String pattern);
|
324
|
|
325
|
/**
|
326
|
* @param clazz
|
327
|
* @param queryString
|
328
|
* @param matchmode
|
329
|
* @param pageSize
|
330
|
* @param pageNumber
|
331
|
* @param criteria
|
332
|
* @param orderHints
|
333
|
* @param propertyPaths TODO
|
334
|
* @return
|
335
|
*/
|
336
|
public List<TaxonName> findByName(Class<TaxonName> clazz, String queryString,
|
337
|
MatchMode matchmode, List<Criterion> criteria,Integer pageSize, Integer pageNumber,
|
338
|
List<OrderHint> orderHints, List<String> propertyPaths);
|
339
|
|
340
|
/**
|
341
|
* @param clazz
|
342
|
* @param queryString
|
343
|
* @param matchmode
|
344
|
* @param criteria
|
345
|
* @return
|
346
|
*/
|
347
|
public long countByName(Class<TaxonName> clazz, String queryString, MatchMode matchmode, List<Criterion> criteria);
|
348
|
|
349
|
public IZoologicalName findZoologicalNameByUUID(UUID uuid);
|
350
|
|
351
|
List<HashMap<String, String>> getNameRecords();
|
352
|
|
353
|
/**
|
354
|
* Supports using wildcards in the query parameters.
|
355
|
* If a name part passed to the method contains the
|
356
|
* asterisk character ('*') it will be translated into '%' the related field is search with a LIKE clause.
|
357
|
* <p>
|
358
|
* A query parameter which is passed as <code>NULL</code> value will be ignored.
|
359
|
* A parameter passed as {@link Optional} object containing a <code>NULL</code> value will be used
|
360
|
* to filter select taxon names where the according field is <code>null</code>.
|
361
|
*
|
362
|
* @param genusOrUninomial
|
363
|
* @param infraGenericEpithet
|
364
|
* @param specificEpithet
|
365
|
* @param infraSpecificEpithet
|
366
|
* @param rank
|
367
|
* Only name having the specified rank are taken into account.
|
368
|
* @param excludedNamesUuids
|
369
|
* Names to be excluded from the result set
|
370
|
* @return
|
371
|
*/
|
372
|
public List<TaxonNameParts> findTaxonNameParts(Optional<String> genusOrUninomial, Optional<String> infraGenericEpithet, Optional<String> specificEpithet,
|
373
|
Optional<String> infraSpecificEpithet, Rank rank, Collection<UUID> excludedNamesUuids, Integer pageSize, Integer pageIndex, List<OrderHint> orderHints);
|
374
|
/**
|
375
|
* Count method complementing {@link #findTaxonNameParts(Optional, Optional, Optional, Optional, Rank)}
|
376
|
*
|
377
|
* @param genusOrUninomial
|
378
|
* @param infraGenericEpithet
|
379
|
* @param specificEpithet
|
380
|
* @param infraSpecificEpithet
|
381
|
* @param rank
|
382
|
* Only name having the specified rank are taken into account.
|
383
|
* @param excludedNamesUuids
|
384
|
* Names to be excluded from the result set
|
385
|
* @return
|
386
|
*/
|
387
|
public long countTaxonNameParts(Optional<String> genusOrUninomial, Optional<String> infraGenericEpithet, Optional<String> specificEpithet, Optional<String> infraSpecificEpithet,
|
388
|
Rank rank, Collection<UUID> excludedNames);
|
389
|
|
390
|
public <S extends TaxonName>List<S> list(Class<S> type, List<Restriction<?>> restrictions, Integer limit, Integer start,
|
391
|
List<OrderHint> orderHints, List<String> propertyPaths, boolean includePublished);
|
392
|
|
393
|
long count(Class<? extends TaxonName> type, List<Restriction<?>> restrictions, boolean includePublished);
|
394
|
|
395
|
/**
|
396
|
* Returns the number of name relationships of the given name relationship types or
|
397
|
* all types if types is <code>null</code>.
|
398
|
* @param types
|
399
|
* @return the number of name relationships
|
400
|
*/
|
401
|
public long countNameRelationships(Set<NameRelationshipType> types);
|
402
|
|
403
|
public List<NameRelationship> getNameRelationships(Set<NameRelationshipType> types, Integer pageSize,
|
404
|
Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);
|
405
|
|
406
|
/**
|
407
|
* Returns the number of hybrid relationships of the given hybrid relationship types or
|
408
|
* all types if types is <code>null</code>.
|
409
|
* @param types
|
410
|
* @return the number of hybrid relationships
|
411
|
*/
|
412
|
public long countHybridRelationships(Set<HybridRelationshipType> types);
|
413
|
|
414
|
public List<HybridRelationship> getHybridRelationships(Set<HybridRelationshipType> types, Integer pageSize,
|
415
|
Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);
|
416
|
|
417
|
/**
|
418
|
* @param clazz
|
419
|
* @param queryString
|
420
|
* @param matchmode
|
421
|
* @param criteria
|
422
|
* @return
|
423
|
*/
|
424
|
public long countByFullTitle(Class<TaxonName> clazz, String queryString, MatchMode matchmode,
|
425
|
List<Criterion> criteria);
|
426
|
}
|