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