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