1
|
/**
|
2
|
* Copyright (C) 2008 EDIT
|
3
|
* European Distributed Institute of Taxonomy
|
4
|
* http://www.e-taxonomy.eu
|
5
|
*/
|
6
|
|
7
|
package eu.etaxonomy.cdm.persistence.dao.occurrence;
|
8
|
|
9
|
import java.util.Collection;
|
10
|
import java.util.List;
|
11
|
import java.util.UUID;
|
12
|
|
13
|
import org.springframework.dao.DataAccessException;
|
14
|
|
15
|
import eu.etaxonomy.cdm.model.description.DescriptionBase;
|
16
|
import eu.etaxonomy.cdm.model.description.IndividualsAssociation;
|
17
|
import eu.etaxonomy.cdm.model.description.TaxonDescription;
|
18
|
import eu.etaxonomy.cdm.model.media.Media;
|
19
|
import eu.etaxonomy.cdm.model.name.HomotypicalGroup;
|
20
|
import eu.etaxonomy.cdm.model.name.SpecimenTypeDesignation;
|
21
|
import eu.etaxonomy.cdm.model.name.TaxonName;
|
22
|
import eu.etaxonomy.cdm.model.occurrence.DerivationEvent;
|
23
|
import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
|
24
|
import eu.etaxonomy.cdm.model.occurrence.DeterminationEvent;
|
25
|
import eu.etaxonomy.cdm.model.occurrence.FieldUnit;
|
26
|
import eu.etaxonomy.cdm.model.occurrence.GatheringEvent;
|
27
|
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
|
28
|
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationType;
|
29
|
import eu.etaxonomy.cdm.model.taxon.Taxon;
|
30
|
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
|
31
|
import eu.etaxonomy.cdm.persistence.dao.common.IIdentifiableDao;
|
32
|
import eu.etaxonomy.cdm.persistence.dao.initializer.IBeanInitializer;
|
33
|
import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache;
|
34
|
import eu.etaxonomy.cdm.persistence.query.MatchMode;
|
35
|
import eu.etaxonomy.cdm.persistence.query.OrderHint;
|
36
|
|
37
|
/**
|
38
|
* @author a.babadshanjan
|
39
|
* @created 01.09.2008
|
40
|
*/
|
41
|
public interface IOccurrenceDao extends IIdentifiableDao<SpecimenOrObservationBase> {
|
42
|
|
43
|
/**
|
44
|
* Returns the number of occurences belonging to a certain subclass - which must extend SpecimenOrObservationBase
|
45
|
* @param clazz optionally restrict the counted occurrences to those of a certain subclass of SpecimenOrObservationBase
|
46
|
* @param determinedAs the taxon name that these specimens are determined to belong to
|
47
|
* @return
|
48
|
*/
|
49
|
public int count(Class<? extends SpecimenOrObservationBase> clazz,TaxonName determinedAs);
|
50
|
|
51
|
/**
|
52
|
* Returns a sublist of SpecimenOrObservationBase instances stored in the database. A maximum
|
53
|
* of 'limit' objects are returned, starting at object with index 'start'. Only occurrences which
|
54
|
* have been determined to belong to the supplied name are returned.
|
55
|
*
|
56
|
* @param type
|
57
|
* @param determinedAs the taxon name that these specimens are determined to belong to
|
58
|
* @param limit
|
59
|
* the maximum number of entities returned (can be null to return
|
60
|
* all entities)
|
61
|
* @param start
|
62
|
* @param orderHints
|
63
|
* Supports path like <code>orderHints.propertyNames</code> which
|
64
|
* include *-to-one properties like createdBy.username or
|
65
|
* authorTeam.persistentTitleCache
|
66
|
* @return
|
67
|
* @throws DataAccessException
|
68
|
*/
|
69
|
public List<SpecimenOrObservationBase> list(Class<? extends SpecimenOrObservationBase> type, TaxonName determinedAs, Integer limit, Integer start, List<OrderHint> orderHints, List<String> propertyPaths);
|
70
|
|
71
|
/**
|
72
|
* Returns the number of occurences belonging to a certain subclass - which must extend SpecimenOrObservationBase
|
73
|
* @param clazz optionally restrict the counted occurrences to those of a certain subclass of SpecimenOrObservationBase
|
74
|
* @param determinedAs the taxon concept that these specimens are determined to belong to
|
75
|
* @return
|
76
|
*/
|
77
|
public int count(Class<? extends SpecimenOrObservationBase> clazz,TaxonBase determinedAs);
|
78
|
|
79
|
/**
|
80
|
* Returns a sublist of SpecimenOrObservationBase instances stored in the database. A maximum
|
81
|
* of 'limit' objects are returned, starting at object with index 'start'. Only occurrences which
|
82
|
* have been determined to belong to the supplied concept are returned.
|
83
|
*
|
84
|
* @param type
|
85
|
* @param determinedAs the taxon concept that these specimens are determined to belong to
|
86
|
* @param limit
|
87
|
* the maximum number of entities returned (can be null to return
|
88
|
* all entities)
|
89
|
* @param start
|
90
|
* @param orderHints
|
91
|
* Supports path like <code>orderHints.propertyNames</code> which
|
92
|
* include *-to-one properties like createdBy.username or
|
93
|
* authorTeam.persistentTitleCache
|
94
|
* @return
|
95
|
* @throws DataAccessException
|
96
|
*/
|
97
|
public List<SpecimenOrObservationBase> list(Class<? extends SpecimenOrObservationBase> type, TaxonBase determinedAs, Integer limit, Integer start, List<OrderHint> orderHints, List<String> propertyPaths);
|
98
|
|
99
|
/**
|
100
|
* Queries the database for specimens which match the given criteria<br>
|
101
|
* <b>Note:</b> Specifying a taxon will already check the name of this
|
102
|
* taxon, its synonymy and the synonym names for determinations of the
|
103
|
* specimen. So specifying a taxon name is only necessary if it does not
|
104
|
* belong to the before-mentioned group of names.
|
105
|
*
|
106
|
* @param clazz
|
107
|
* the class to match
|
108
|
* @param queryString
|
109
|
* the queryString to match
|
110
|
* @param type
|
111
|
* the {@link SpecimenOrObservationType} to match
|
112
|
* @param associatedTaxon
|
113
|
* the taxon these specimens are in any way associated to via
|
114
|
* determination, type designations, individuals associations,
|
115
|
* etc.
|
116
|
* @param associatedTaxonName
|
117
|
* the taxon name that the specimens have been determined as
|
118
|
* @param matchmode
|
119
|
* determines how the query string should be matched
|
120
|
* @param limit
|
121
|
* the maximum number of entities returned (can be null to return
|
122
|
* all entities)
|
123
|
* @param start
|
124
|
* @param orderHints
|
125
|
* Supports path like <code>orderHints.propertyNames</code> which
|
126
|
* include *-to-one properties like createdBy.username or
|
127
|
* authorTeam.persistentTitleCache
|
128
|
* @param propertyPaths
|
129
|
* @return a list of specimens that match the given parameters
|
130
|
*/
|
131
|
public <T extends SpecimenOrObservationBase> List<T> findOccurrences(Class<T> clazz, String queryString,
|
132
|
String significantIdentifier, SpecimenOrObservationType type, Taxon determinedAs,
|
133
|
TaxonName associatedTaxonName, MatchMode matchmode, Integer limit, Integer start,
|
134
|
List<OrderHint> orderHints, List<String> propertyPaths);
|
135
|
|
136
|
/**
|
137
|
* @see IOccurrenceDao#findOccurrences(Class, String, String, SpecimenOrObservationType, Taxon, TaxonName, MatchMode, Integer, Integer, List, List)
|
138
|
* @param clazz
|
139
|
* @param queryString
|
140
|
* @param significantIdentifier
|
141
|
* @param type
|
142
|
* @param determinedAs
|
143
|
* @param associatedTaxonName
|
144
|
* @param matchmode
|
145
|
* @param limit
|
146
|
* @param start
|
147
|
* @param orderHints
|
148
|
* @param propertyPaths
|
149
|
* @return
|
150
|
*/
|
151
|
public <T extends SpecimenOrObservationBase> List<UuidAndTitleCache<SpecimenOrObservationBase>> findOccurrencesUuidAndTitleCache(
|
152
|
Class<T> clazz, String queryString,
|
153
|
String significantIdentifier, SpecimenOrObservationType type, Taxon determinedAs,
|
154
|
TaxonName associatedTaxonName, MatchMode matchmode, Integer limit, Integer start,
|
155
|
List<OrderHint> orderHints);
|
156
|
|
157
|
/**
|
158
|
* Returns the number of specimens that match the given parameters
|
159
|
* <b>Note:</b> Specifying a taxon will already check the name of this
|
160
|
* taxon, its synonymy and the synonym names for determinations of the
|
161
|
* specimen. So specifying a taxon name is only necessary if it does not
|
162
|
* belong to the before-mentioned group of names.
|
163
|
*
|
164
|
* @param clazz
|
165
|
* the class to match
|
166
|
* @param queryString
|
167
|
* the queryString to match
|
168
|
* @param type
|
169
|
* the {@link SpecimenOrObservationType} to match
|
170
|
* @param associatedTaxon
|
171
|
* the taxon these specimens are in any way associated to via
|
172
|
* determination, type designations, individuals associations,
|
173
|
* etc.
|
174
|
* @param associatedTaxonName
|
175
|
* the taxon name that the specimens have been determined as
|
176
|
* @param matchmode
|
177
|
* determines how the query string should be matched
|
178
|
* @param limit
|
179
|
* the maximum number of entities returned (can be null to return
|
180
|
* all entities)
|
181
|
* @param start
|
182
|
* @param orderHints
|
183
|
* Supports path like <code>orderHints.propertyNames</code> which
|
184
|
* include *-to-one properties like createdBy.username or
|
185
|
* authorTeam.persistentTitleCache
|
186
|
* @return the number of found specimens
|
187
|
*/
|
188
|
public <T extends SpecimenOrObservationBase> int countOccurrences(Class<T> clazz, String queryString,
|
189
|
String significantIdentifier, SpecimenOrObservationType recordBasis, Taxon associatedTaxon,
|
190
|
TaxonName associatedTaxonName, MatchMode matchmode, Integer limit, Integer start,
|
191
|
List<OrderHint> orderHints, List<String> propertyPaths);
|
192
|
|
193
|
/**
|
194
|
* Returns a count of Media that are associated with a given occurence
|
195
|
*
|
196
|
* @param occurence the occurence associated with these media
|
197
|
* @return a count of media instances
|
198
|
*/
|
199
|
public int countMedia(SpecimenOrObservationBase occurence);
|
200
|
|
201
|
/**
|
202
|
* Returns a List of Media that are associated with a given occurence
|
203
|
*
|
204
|
* @param occurence the occurence associated with these media
|
205
|
* @param pageSize The maximum number of media returned (can be null for all related media)
|
206
|
* @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
|
207
|
* @param propertyPaths properties to initialize - see {@link IBeanInitializer#initialize(Object, List)}
|
208
|
* @return a List of media instances
|
209
|
*/
|
210
|
public List<Media> getMedia(SpecimenOrObservationBase occurence, Integer pageSize, Integer pageNumber, List<String> propertyPaths);
|
211
|
|
212
|
/**
|
213
|
* Returns a count of determinations that have been made for a given occurence and for a given taxon concept
|
214
|
*
|
215
|
* @param occurence the occurence associated with these determinations (can be null for all occurrences)
|
216
|
* @param taxonbase the taxon concept associated with these determinations (can be null for all taxon concepts)
|
217
|
* @return a count of determination events
|
218
|
*/
|
219
|
public int countDeterminations(SpecimenOrObservationBase occurence,TaxonBase taxonbase);
|
220
|
|
221
|
/**
|
222
|
* Returns a List of determinations that have been made for a given occurence and for a given taxon concept
|
223
|
*
|
224
|
* @param occurence the occurence associated with these determinations (can be null for all occurrences)
|
225
|
* @param taxonbase the taxon concept associated with these determinations (can be null for all taxon concepts)
|
226
|
* @param pageSize The maximum number of determinations returned (can be null for all related determinations)
|
227
|
* @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
|
228
|
* @param propertyPaths properties to initialize - see {@link IBeanInitializer#initialize(Object, List)}
|
229
|
* @return a List of determination instances
|
230
|
*/
|
231
|
public List<DeterminationEvent> getDeterminations(SpecimenOrObservationBase occurence,TaxonBase taxonbase, Integer pageSize, Integer pageNumber, List<String> propertyPaths);
|
232
|
|
233
|
/**
|
234
|
* Returns a count of derivation events that have involved creating new DerivedUnits from this occurence
|
235
|
*
|
236
|
* @param occurence the occurence that was a source of these derivation events
|
237
|
* @return a count of derivation events
|
238
|
*/
|
239
|
public int countDerivationEvents(SpecimenOrObservationBase occurence);
|
240
|
|
241
|
/**
|
242
|
* Returns a list of derivation events that have involved creating new DerivedUnits from this occurence
|
243
|
*
|
244
|
* @param occurence the occurence that was a source of these derivation events
|
245
|
* @param pageSize The maximum number of derivation events returned (can be null for all related derivation events)
|
246
|
* @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
|
247
|
* @param propertyPaths properties to initialize - see {@link IBeanInitializer#initialize(Object, List)}
|
248
|
* @return a List of derivation events
|
249
|
*/
|
250
|
public List<DerivationEvent> getDerivationEvents(SpecimenOrObservationBase occurence, Integer pageSize, Integer pageNumber, List<String> propertyPaths);
|
251
|
|
252
|
/**
|
253
|
* Retrieves the {@link UUID} and the string representation (title cache) of all
|
254
|
* {@link FieldUnit}s found in the data base.
|
255
|
* @return a list of {@link UuidAndTitleCache}
|
256
|
*/
|
257
|
public List<UuidAndTitleCache<FieldUnit>> getFieldUnitUuidAndTitleCache();
|
258
|
|
259
|
/**
|
260
|
* Retrieves the {@link UUID} and the string representation (title cache) of all
|
261
|
* {@link DerivedUnit}s found in the data base.
|
262
|
* @return a list of {@link UuidAndTitleCache}
|
263
|
*/
|
264
|
public List<UuidAndTitleCache<DerivedUnit>> getDerivedUnitUuidAndTitleCache(Integer limit, String pattern);
|
265
|
|
266
|
/**
|
267
|
* Lists all instances of {@link SpecimenOrObservationBase} which are determined as the <code>taxon name</code> specified as parameter.
|
268
|
*
|
269
|
* @param <T>
|
270
|
* @param type
|
271
|
* @param associatedTaxonName
|
272
|
* @param limit
|
273
|
* @param start
|
274
|
* @param orderHints
|
275
|
* @param propertyPaths
|
276
|
* @return
|
277
|
*/
|
278
|
public <T extends SpecimenOrObservationBase> List<T> listByAssociatedTaxonName(Class<T> type,
|
279
|
TaxonName associatedTaxonName, Integer limit, Integer start, List<OrderHint> orderHints, List<String> propertyPaths);
|
280
|
|
281
|
/**
|
282
|
* Lists all instances of {@link SpecimenOrObservationBase} which are associated with the <code>taxon</code> specified as parameter.
|
283
|
* SpecimenOrObservationBase instances can be associated to taxa in multiple ways, all these possible relations are taken into account:
|
284
|
* <ul>
|
285
|
* <li>The {@link IndividualsAssociation} elements in a {@link TaxonDescription} contain {@link DerivedUnit}s</li>
|
286
|
* <li>{@link SpecimenTypeDesignation}s may be associated with any {@link HomotypicalGroup} related to the specific {@link Taxon}.</li>
|
287
|
* <li>A {@link Taxon} or a {@link TaxonName} may be referenced by the {@link DeterminationEvent} of the {@link SpecimenOrObservationBase}</li>
|
288
|
* </ul>
|
289
|
*
|
290
|
* @param <T>
|
291
|
* @param type
|
292
|
* @param associatedTaxon
|
293
|
* @param limit
|
294
|
* @param start
|
295
|
* @param orderHints
|
296
|
* @param propertyPaths
|
297
|
* @return
|
298
|
*/
|
299
|
public <T extends SpecimenOrObservationBase> List<T> listByAssociatedTaxon(Class<T> type, Taxon associatedTaxon,
|
300
|
Integer limit, Integer start, List<OrderHint> orderHints, List<String> propertyPaths);
|
301
|
|
302
|
/**
|
303
|
* @see IOccurrenceDao#listByAssociatedTaxon(Class, Taxon, Integer, Integer, List, List)
|
304
|
* @param type
|
305
|
* @param associatedTaxon
|
306
|
* @param limit
|
307
|
* @param start
|
308
|
* @param orderHints
|
309
|
* @param propertyPaths
|
310
|
* @return
|
311
|
*/
|
312
|
public <T extends SpecimenOrObservationBase> List<UuidAndTitleCache<SpecimenOrObservationBase>> listUuidAndTitleCacheByAssociatedTaxon(Class<T> type, Taxon associatedTaxon,
|
313
|
Integer limit, Integer start, List<OrderHint> orderHints);
|
314
|
|
315
|
/**
|
316
|
* Retrieves all {@link IndividualsAssociation} with the given specimen.<br>
|
317
|
* @param specimen the specimen for which the associations are retrieved
|
318
|
* @param limit
|
319
|
* @param start
|
320
|
* @param orderHints
|
321
|
* @param propertyPaths
|
322
|
* @return collection of all associations
|
323
|
*/
|
324
|
public Collection<IndividualsAssociation> listIndividualsAssociations(SpecimenOrObservationBase<?> specimen, Integer limit, Integer start, List<OrderHint> orderHints, List<String> propertyPaths);
|
325
|
|
326
|
/**
|
327
|
* Retrieves all {@link SpecimenTypeDesignation}s which have the given specimen as a type specimen.
|
328
|
* @param specimen the type specimen
|
329
|
* @param limit
|
330
|
* @param start
|
331
|
* @param orderHints
|
332
|
* @param propertyPaths
|
333
|
* @return collection of all designations with the given type specimen
|
334
|
*/
|
335
|
|
336
|
/**
|
337
|
* Retrieves all {@link DeterminationEvent}s which have the given specimen set as identified unit.
|
338
|
* @param specimen
|
339
|
* @param limit
|
340
|
* @param start
|
341
|
* @param orderHints
|
342
|
* @param propertyPaths
|
343
|
* @return collection of all determinations with the given specimen
|
344
|
*/
|
345
|
public Collection<DeterminationEvent> listDeterminationEvents(SpecimenOrObservationBase<?> specimen, Integer limit, Integer start, List<OrderHint> orderHints, List<String> propertyPaths);
|
346
|
|
347
|
/**
|
348
|
* Retrieves all {@link SpecimenTypeDesignation}s which have the given specimen as a type specimen.
|
349
|
* @param specimen the type specimen
|
350
|
* @param limit
|
351
|
* @param start
|
352
|
* @param orderHints
|
353
|
* @param propertyPaths
|
354
|
* @return collection of all designations with the given type specimen
|
355
|
*/
|
356
|
public Collection<SpecimenTypeDesignation> listTypeDesignations(SpecimenOrObservationBase<?> specimen, Integer limit, Integer start, List<OrderHint> orderHints, List<String> propertyPaths);
|
357
|
|
358
|
/**
|
359
|
* Retrieves all {@link DescriptionBase}s that have the given specimen set as described specimen.
|
360
|
* @param specimen the described specimen
|
361
|
* @param limit
|
362
|
* @param start
|
363
|
* @param orderHints
|
364
|
* @param propertyPaths
|
365
|
* @return collection of all descriptions with the given described specimen
|
366
|
*/
|
367
|
public Collection<DescriptionBase<?>> listDescriptionsWithDescriptionSpecimen(SpecimenOrObservationBase<?> specimen, Integer limit, Integer start, List<OrderHint> orderHints, List<String> propertyPaths);
|
368
|
|
369
|
/**
|
370
|
* Retrieves all {@link SpecimenOrObservationBase}s that have the given {@link SpecimenOrObservationType}.
|
371
|
* @param type
|
372
|
* @param limit
|
373
|
* @param start
|
374
|
* @param orderHints
|
375
|
* @param propertyPaths
|
376
|
* @return collection of specimen with the given type
|
377
|
*/
|
378
|
public Collection<SpecimenOrObservationBase> listBySpecimenOrObservationType(SpecimenOrObservationType type, Integer limit, Integer start, List<OrderHint> orderHints, List<String> propertyPaths);
|
379
|
|
380
|
/**
|
381
|
*
|
382
|
* Returns all {@link FieldUnit}s that are referencing this {@link GatheringEvent}
|
383
|
* @param gatheringEventUuid the {@link UUID} of the gathering event
|
384
|
* @param limit
|
385
|
* @param start
|
386
|
* @param orderHints
|
387
|
* @param propertyPaths
|
388
|
* @return a list of field units referencing the gathering event
|
389
|
*/
|
390
|
public List<FieldUnit> getFieldUnitsForGatheringEvent(UUID gatheringEventUuid, Integer limit, Integer start, List<OrderHint> orderHints, List<String> propertyPaths);
|
391
|
}
|