1
|
/**
|
2
|
* Copyright (C) 2009 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.api.service;
|
11
|
|
12
|
import java.io.IOException;
|
13
|
import java.util.Collection;
|
14
|
import java.util.List;
|
15
|
import java.util.Map;
|
16
|
import java.util.Set;
|
17
|
import java.util.UUID;
|
18
|
|
19
|
import org.apache.lucene.index.CorruptIndexException;
|
20
|
import org.hibernate.search.spatial.impl.Rectangle;
|
21
|
|
22
|
import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
|
23
|
import eu.etaxonomy.cdm.api.facade.DerivedUnitFacadeNotSupportedException;
|
24
|
import eu.etaxonomy.cdm.api.service.config.FindOccurrencesConfigurator;
|
25
|
import eu.etaxonomy.cdm.api.service.config.IIdentifiableEntityServiceConfigurator;
|
26
|
import eu.etaxonomy.cdm.api.service.config.SpecimenDeleteConfigurator;
|
27
|
import eu.etaxonomy.cdm.api.service.dto.FieldUnitDTO;
|
28
|
import eu.etaxonomy.cdm.api.service.dto.PreservedSpecimenDTO;
|
29
|
import eu.etaxonomy.cdm.api.service.pager.Pager;
|
30
|
import eu.etaxonomy.cdm.api.service.search.LuceneParseException;
|
31
|
import eu.etaxonomy.cdm.api.service.search.SearchResult;
|
32
|
import eu.etaxonomy.cdm.api.service.util.TaxonRelationshipEdge;
|
33
|
import eu.etaxonomy.cdm.model.common.Language;
|
34
|
import eu.etaxonomy.cdm.model.description.DescriptionBase;
|
35
|
import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
|
36
|
import eu.etaxonomy.cdm.model.description.IndividualsAssociation;
|
37
|
import eu.etaxonomy.cdm.model.description.TaxonDescription;
|
38
|
import eu.etaxonomy.cdm.model.location.Country;
|
39
|
import eu.etaxonomy.cdm.model.media.Media;
|
40
|
import eu.etaxonomy.cdm.model.molecular.DnaSample;
|
41
|
import eu.etaxonomy.cdm.model.molecular.Sequence;
|
42
|
import eu.etaxonomy.cdm.model.name.HomotypicalGroup;
|
43
|
import eu.etaxonomy.cdm.model.name.SpecimenTypeDesignation;
|
44
|
import eu.etaxonomy.cdm.model.name.TaxonName;
|
45
|
import eu.etaxonomy.cdm.model.occurrence.DerivationEvent;
|
46
|
import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
|
47
|
import eu.etaxonomy.cdm.model.occurrence.DeterminationEvent;
|
48
|
import eu.etaxonomy.cdm.model.occurrence.FieldUnit;
|
49
|
import eu.etaxonomy.cdm.model.occurrence.GatheringEvent;
|
50
|
import eu.etaxonomy.cdm.model.occurrence.MediaSpecimen;
|
51
|
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
|
52
|
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationType;
|
53
|
import eu.etaxonomy.cdm.model.taxon.Taxon;
|
54
|
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
|
55
|
import eu.etaxonomy.cdm.model.taxon.TaxonRelationship;
|
56
|
import eu.etaxonomy.cdm.persistence.dao.initializer.IBeanInitializer;
|
57
|
import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache;
|
58
|
import eu.etaxonomy.cdm.persistence.query.OrderHint;
|
59
|
|
60
|
/**
|
61
|
* @author a.babadshanjan
|
62
|
* @created 01.09.2008
|
63
|
*/
|
64
|
public interface IOccurrenceService extends IIdentifiableEntityService<SpecimenOrObservationBase> {
|
65
|
|
66
|
public Country getCountryByIso(String iso639);
|
67
|
|
68
|
public List<Country> getCountryByName(String name);
|
69
|
|
70
|
/**
|
71
|
* Returns a paged list of occurrences that have been determined to belong
|
72
|
* to the taxon concept determinedAs, optionally restricted to objects
|
73
|
* belonging to a class that that extends SpecimenOrObservationBase. This
|
74
|
* will also consider specimens that are determined as a taxon concept
|
75
|
* belonging to the synonymy of the given taxon concept.
|
76
|
* <p>
|
77
|
* In contrast to {@link #listByAnyAssociation(Class, Taxon, List)} this
|
78
|
* method only takes SpecimenOrObservationBase instances into account which
|
79
|
* are actually determined as the taxon specified by
|
80
|
* <code>determinedAs</code>.
|
81
|
*
|
82
|
* @param type
|
83
|
* The type of entities to return (can be null to count all
|
84
|
* entities of type <T>)
|
85
|
* @param determinedAs
|
86
|
* the taxon concept that the occurrences have been determined to
|
87
|
* belong to
|
88
|
* @param pageSize
|
89
|
* The maximum number of objects returned (can be null for all
|
90
|
* matching objects)
|
91
|
* @param pageNumber
|
92
|
* The offset (in pageSize chunks) from the start of the result
|
93
|
* set (0 - based, can be null, equivalent of starting at the
|
94
|
* beginning of the recordset)
|
95
|
* @param orderHints
|
96
|
* Supports path like <code>orderHints.propertyNames</code> which
|
97
|
* include *-to-one properties like createdBy.username or
|
98
|
* authorTeam.persistentTitleCache
|
99
|
* @param propertyPaths
|
100
|
* properties to be initialized
|
101
|
* @return
|
102
|
*/
|
103
|
public Pager<SpecimenOrObservationBase> list(Class<? extends SpecimenOrObservationBase> type, TaxonBase determinedAs, Integer limit, Integer start, List<OrderHint> orderHints, List<String> propertyPaths);
|
104
|
|
105
|
/**
|
106
|
* Returns a paged list of occurrences that have been determined to belong
|
107
|
* to the taxon name determinedAs, optionally restricted to objects
|
108
|
* belonging to a class that that extends SpecimenOrObservationBase.
|
109
|
* <p>
|
110
|
* In contrast to {@link #listByAnyAssociation(Class, Taxon, List)} this
|
111
|
* method only takes SpecimenOrObservationBase instances into account which
|
112
|
* are actually determined as the taxon specified by
|
113
|
* <code>determinedAs</code>.
|
114
|
*
|
115
|
* @param type
|
116
|
* The type of entities to return (can be null to count all
|
117
|
* entities of type <T>)
|
118
|
* @param determinedAs
|
119
|
* the taxon name that the occurrences have been determined to
|
120
|
* belong to
|
121
|
* @param pageSize
|
122
|
* The maximum number of objects returned (can be null for all
|
123
|
* matching objects)
|
124
|
* @param pageNumber
|
125
|
* The offset (in pageSize chunks) from the start of the result
|
126
|
* set (0 - based, can be null, equivalent of starting at the
|
127
|
* beginning of the recordset)
|
128
|
* @param orderHints
|
129
|
* Supports path like <code>orderHints.propertyNames</code> which
|
130
|
* include *-to-one properties like createdBy.username or
|
131
|
* authorTeam.persistentTitleCache
|
132
|
* @param propertyPaths
|
133
|
* properties to be initialized
|
134
|
* @return
|
135
|
*/
|
136
|
public Pager<SpecimenOrObservationBase> list(Class<? extends SpecimenOrObservationBase> type, TaxonName determinedAs, Integer limit, Integer start, List<OrderHint> orderHints, List<String> propertyPaths);
|
137
|
|
138
|
/**
|
139
|
* Returns a List of Media that are associated with a given occurence
|
140
|
*
|
141
|
* @param occurence the occurence associated with these media
|
142
|
* @param pageSize The maximum number of media returned (can be null for all related media)
|
143
|
* @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
|
144
|
* @param propertyPaths properties to initialize - see {@link IBeanInitializer#initialize(Object, List)}
|
145
|
* @return a Pager of media instances
|
146
|
*/
|
147
|
public Pager<Media> getMedia(SpecimenOrObservationBase occurence, Integer pageSize, Integer pageNumber, List<String> propertyPaths);
|
148
|
|
149
|
/**
|
150
|
* Returns all media attached to this occurence and its children. Also takes
|
151
|
* {@link MediaSpecimen} and molecular images into account.
|
152
|
*
|
153
|
* @param occurence the occurence and its children from which the media to get
|
154
|
* @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
|
155
|
* @param propertyPaths properties to initialize - see {@link IBeanInitializer#initialize(Object, List)}
|
156
|
* @return a Pager of media instances
|
157
|
*/
|
158
|
public Pager<Media> getMediainHierarchy(SpecimenOrObservationBase rootOccurence, Integer pageSize, Integer pageNumber, List<String> propertyPaths);
|
159
|
|
160
|
/**
|
161
|
* Returns a count of determinations that have been made for a given occurence and for a given taxon concept
|
162
|
*
|
163
|
* @param occurence the occurence associated with these determinations (can be null for all occurrences)
|
164
|
* @param taxonbase the taxon concept associated with these determinations (can be null for all taxon concepts)
|
165
|
* @return a count of determination events
|
166
|
*/
|
167
|
public int countDeterminations(SpecimenOrObservationBase occurence,TaxonBase taxonbase);
|
168
|
|
169
|
/**
|
170
|
* Returns a List of determinations that have been made for a given occurence
|
171
|
*
|
172
|
* @param occurence the occurence associated with these determinations (can be null for all occurrences)
|
173
|
* @param taxonbase the taxon concept associated with these determinations (can be null for all taxon concepts)
|
174
|
* @param pageSize The maximum number of determinations returned (can be null for all related determinations)
|
175
|
* @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
|
176
|
* @return a Pager of determination instances
|
177
|
*/
|
178
|
public Pager<DeterminationEvent> getDeterminations(SpecimenOrObservationBase occurence, TaxonBase taxonBase, Integer pageSize, Integer pageNumber, List<String> propertyPaths);
|
179
|
|
180
|
/**
|
181
|
* Returns a list of derivation events that have involved creating new DerivedUnits from this occurence
|
182
|
*
|
183
|
* @param occurence the occurence that was a source of these derivation events
|
184
|
* @param pageSize The maximum number of derivation events returned (can be null for all related derivation events)
|
185
|
* @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
|
186
|
* @return a Pager of derivation events
|
187
|
*/
|
188
|
public Pager<DerivationEvent> getDerivationEvents(SpecimenOrObservationBase occurence, Integer pageSize, Integer pageNumber, List<String> propertyPaths);
|
189
|
|
190
|
/**
|
191
|
* Returns a Paged List of SpecimenOrObservationBase instances where the default field matches the String queryString (as interpreted by the Lucene QueryParser)
|
192
|
*
|
193
|
* @param clazz filter the results by class (or pass null to return all SpecimenOrObservationBase instances)
|
194
|
* @param queryString
|
195
|
* @param pageSize The maximum number of occurrences returned (can be null for all matching occurrences)
|
196
|
* @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
|
197
|
* @param orderHints
|
198
|
* Supports path like <code>orderHints.propertyNames</code> which
|
199
|
* include *-to-one properties like createdBy.username or
|
200
|
* authorTeam.persistentTitleCache
|
201
|
* @param propertyPaths properties to be initialized
|
202
|
* @return a Pager SpecimenOrObservationBase instances
|
203
|
* @see <a href="http://lucene.apache.org/java/2_4_0/queryparsersyntax.html">Apache Lucene - Query Parser Syntax</a>
|
204
|
*/
|
205
|
@Override
|
206
|
public Pager<SpecimenOrObservationBase> search(Class<? extends SpecimenOrObservationBase> clazz, String query, Integer pageSize,Integer pageNumber, List<OrderHint> orderHints,List<String> propertyPaths);
|
207
|
|
208
|
/**
|
209
|
* Retrieves the {@link UUID} and the string representation (title cache) of all
|
210
|
* {@link FieldUnit}s found in the data base.
|
211
|
* @return a list of {@link UuidAndTitleCache}
|
212
|
*/
|
213
|
public List<UuidAndTitleCache<FieldUnit>> getFieldUnitUuidAndTitleCache();
|
214
|
|
215
|
/**
|
216
|
* Retrieves the {@link UUID} and the string representation (title cache) of all
|
217
|
* {@link DerivedUnit}s found in the data base.
|
218
|
* @return a list of {@link UuidAndTitleCache}
|
219
|
*/
|
220
|
public List<UuidAndTitleCache<DerivedUnit>> getDerivedUnitUuidAndTitleCache(Integer limit, String pattern);
|
221
|
|
222
|
public DerivedUnitFacade getDerivedUnitFacade(DerivedUnit derivedUnit, List<String> propertyPaths) throws DerivedUnitFacadeNotSupportedException;
|
223
|
|
224
|
public List<DerivedUnitFacade> listDerivedUnitFacades(DescriptionBase description, List<String> propertyPaths);
|
225
|
|
226
|
/**
|
227
|
* Lists all instances of {@link SpecimenOrObservationBase} which are
|
228
|
* associated with the <code>taxon</code> specified as parameter.
|
229
|
* SpecimenOrObservationBase instances can be associated to taxa in multiple
|
230
|
* ways, all these possible relations are taken into account:
|
231
|
* <ul>
|
232
|
* <li>The {@link IndividualsAssociation} elements in a
|
233
|
* {@link TaxonDescription} contain {@link DerivedUnit}s</li>
|
234
|
* <li>{@link SpecimenTypeDesignation}s may be associated with any
|
235
|
* {@link HomotypicalGroup} related to the specific {@link Taxon}.</li>
|
236
|
* <li>A {@link Taxon} may be referenced by the {@link DeterminationEvent}
|
237
|
* of the {@link SpecimenOrObservationBase}</li>
|
238
|
* </ul>
|
239
|
* Further more there also can be taxa which are associated with the taxon
|
240
|
* in question (parameter associatedTaxon) by {@link TaxonRelationship}s. If
|
241
|
* the parameter <code>includeRelationships</code> is containing elements,
|
242
|
* these according {@TaxonRelationshipType}s and
|
243
|
* directional information will be used to collect further
|
244
|
* {@link SpecimenOrObservationBase} instances found this way.
|
245
|
*
|
246
|
* @param <T>
|
247
|
* @param type
|
248
|
* @param associatedTaxon
|
249
|
* @param Set<TaxonRelationshipVector> includeRelationships. TaxonRelationships will not be taken into account if this is <code>NULL</code>.
|
250
|
* @param maxDepth TODO
|
251
|
* @param pageSize
|
252
|
* @param pageNumber
|
253
|
* @param orderHints
|
254
|
* @param propertyPaths
|
255
|
* @return
|
256
|
*/
|
257
|
public <T extends SpecimenOrObservationBase> List<T> listByAssociatedTaxon(Class<T> type, Set<TaxonRelationshipEdge> includeRelationships,
|
258
|
Taxon associatedTaxon, Integer maxDepth, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);
|
259
|
|
260
|
/**
|
261
|
* Lists all instances of {@link FieldUnit} which are
|
262
|
* associated <b>directly or indirectly</b>with the <code>taxon</code> specified
|
263
|
* as parameter. "Indirectly" means that a sub derivate of the FieldUnit is
|
264
|
* directly associated with the given taxon.
|
265
|
* SpecimenOrObservationBase instances can be associated to taxa in multiple
|
266
|
* ways, all these possible relations are taken into account:
|
267
|
* <ul>
|
268
|
* <li>The {@link IndividualsAssociation} elements in a
|
269
|
* {@link TaxonDescription} contain {@link DerivedUnit}s</li>
|
270
|
* <li>{@link SpecimenTypeDesignation}s may be associated with any
|
271
|
* {@link HomotypicalGroup} related to the specific {@link Taxon}.</li>
|
272
|
* <li>A {@link Taxon} may be referenced by the {@link DeterminationEvent}
|
273
|
* of the {@link SpecimenOrObservationBase}</li>
|
274
|
* </ul>
|
275
|
* Further more there also can be taxa which are associated with the taxon
|
276
|
* in question (parameter associatedTaxon) by {@link TaxonRelationship}s. If
|
277
|
* the parameter <code>includeRelationships</code> is containing elements,
|
278
|
* these according {@TaxonRelationshipType}s and
|
279
|
* directional information will be used to collect further
|
280
|
* {@link SpecimenOrObservationBase} instances found this way.
|
281
|
*
|
282
|
* @param <T>
|
283
|
* @param type
|
284
|
* @param associatedTaxon
|
285
|
* @param Set<TaxonRelationshipVector> includeRelationships. TaxonRelationships will not be taken into account if this is <code>NULL</code>.
|
286
|
* @param maxDepth TODO
|
287
|
* @param pageSize
|
288
|
* @param pageNumber
|
289
|
* @param orderHints
|
290
|
* @param propertyPaths
|
291
|
* @return
|
292
|
*/
|
293
|
public Collection<SpecimenOrObservationBase> listFieldUnitsByAssociatedTaxon(Taxon associatedTaxon, List<OrderHint> orderHints, List<String> propertyPaths);
|
294
|
|
295
|
/**
|
296
|
* See {@link #listFieldUnitsByAssociatedTaxon(Set, Taxon, Integer, Integer, Integer, List, List)}
|
297
|
*/
|
298
|
public Pager<SpecimenOrObservationBase> pageFieldUnitsByAssociatedTaxon(Set<TaxonRelationshipEdge> includeRelationships,
|
299
|
Taxon associatedTaxon, Integer maxDepth, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);
|
300
|
|
301
|
/**
|
302
|
* See {@link #listByAssociatedTaxon(Class, Set, Taxon, Integer, Integer, Integer, List, List)}
|
303
|
*
|
304
|
* @param type
|
305
|
* @param includeRelationships
|
306
|
* @param associatedTaxon
|
307
|
* @param maxDepth
|
308
|
* @param pageSize
|
309
|
* @param pageNumber
|
310
|
* @param orderHints
|
311
|
* @param propertyPaths
|
312
|
* @return a Pager
|
313
|
*/
|
314
|
public <T extends SpecimenOrObservationBase> Pager<T> pageByAssociatedTaxon(Class<T> type, Set<TaxonRelationshipEdge> includeRelationships,
|
315
|
Taxon associatedTaxon, Integer maxDepth, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);
|
316
|
|
317
|
/**
|
318
|
* Retrieves all {@link FieldUnit}s for the {@link SpecimenOrObservationBase} with the given {@link UUID}.<br>
|
319
|
* @param specimenUuid the UUID of the specimen
|
320
|
* @param propertyPaths the property path
|
321
|
* @return either a collection of FieldUnits this specimen was derived from, the FieldUnit itself
|
322
|
* if this was a FieldUnit or an empty collection if no FieldUnits were found
|
323
|
*/
|
324
|
public Collection<FieldUnit> getFieldUnits(UUID specimenUuid, List<String> propertyPaths);
|
325
|
|
326
|
/**
|
327
|
* @param clazz
|
328
|
* @param queryString
|
329
|
* @param languages
|
330
|
* @param highlightFragments
|
331
|
* @param pageSize
|
332
|
* @param pageNumber
|
333
|
* @param orderHints
|
334
|
* @param propertyPaths
|
335
|
* @return
|
336
|
* @throws CorruptIndexException
|
337
|
* @throws IOException
|
338
|
* @throws ParseException
|
339
|
*/
|
340
|
Pager<SearchResult<SpecimenOrObservationBase>> findByFullText(Class<? extends SpecimenOrObservationBase> clazz,
|
341
|
String queryString, Rectangle boundingBox, List<Language> languages, boolean highlightFragments,
|
342
|
Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths)
|
343
|
throws IOException, LuceneParseException;
|
344
|
/**
|
345
|
* See {@link #listByAssociatedTaxon(Class, Set, String, Integer, Integer, Integer, List, List)}
|
346
|
*
|
347
|
* @param type
|
348
|
* @param includeRelationships
|
349
|
* @param associatedTaxon
|
350
|
* @param maxDepth
|
351
|
* @param pageSize
|
352
|
* @param pageNumber
|
353
|
* @param orderHints
|
354
|
* @param propertyPaths
|
355
|
* @return a Pager
|
356
|
*/
|
357
|
public <T extends SpecimenOrObservationBase> Pager<T> pageByAssociatedTaxon(Class<T> type, Set<TaxonRelationshipEdge> includeRelationships,
|
358
|
String taxonUUID, Integer maxDepth, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);
|
359
|
|
360
|
/**
|
361
|
* Moves the given {@link Sequence} from one {@link DnaSample} to another
|
362
|
* @param from the DnaSample from which the sequence will be removed
|
363
|
* @param to the DnaSample which to which the sequence will be added
|
364
|
* @param sequence the Sequence to move
|
365
|
* @return <code>true</code> if successfully moved, <code>false</code> otherwise
|
366
|
*/
|
367
|
public UpdateResult moveSequence(DnaSample from, DnaSample to, Sequence sequence);
|
368
|
|
369
|
|
370
|
/**
|
371
|
* @param fromUuid
|
372
|
* @param toUuid
|
373
|
* @param sequenceUuid
|
374
|
* @return
|
375
|
*/
|
376
|
public UpdateResult moveSequence(UUID fromUuid, UUID toUuid, UUID sequenceUuid);
|
377
|
|
378
|
/**
|
379
|
* Moves the given {@link DerivedUnit} from one {@link SpecimenOrObservationBase} to another.
|
380
|
* @param from the SpecimenOrObservationBase from which the DerivedUnit will be removed
|
381
|
* @param to the SpecimenOrObservationBase to which the DerivedUnit will be added
|
382
|
* @param derivate the DerivedUnit to move
|
383
|
* @return <code>true</code> if successfully moved, <code>false</code> otherwise
|
384
|
*/
|
385
|
public UpdateResult moveDerivate(UUID specimenFromUuid, UUID specimenToUuid, UUID derivateUuid);
|
386
|
|
387
|
/**
|
388
|
* @param from
|
389
|
* @param to
|
390
|
* @param derivate
|
391
|
* @return
|
392
|
*/
|
393
|
public boolean moveDerivate(SpecimenOrObservationBase<?> from, SpecimenOrObservationBase<?> to, DerivedUnit derivate);
|
394
|
|
395
|
/**
|
396
|
* Assembles a {@link FieldUnitDTO} for the given field unit uuid which is associated to the {@link Taxon}.<br>
|
397
|
* <br>
|
398
|
* For the meaning of "associated" see also {@link #listFieldUnitsByAssociatedTaxon(Set, Taxon, Integer, Integer, Integer, List, List)}
|
399
|
* @param fieldUnit
|
400
|
* @param associatedTaxonUuid
|
401
|
* @return a DTO with all the assembled information
|
402
|
*/
|
403
|
public FieldUnitDTO assembleFieldUnitDTO(FieldUnit fieldUnit, UUID associatedTaxonUuid);
|
404
|
|
405
|
/**
|
406
|
* Assembles a {@link PreservedSpecimenDTO} for the given derived unit.
|
407
|
* @param derivedUnit
|
408
|
* @return a DTO with all the assembled information
|
409
|
*/
|
410
|
public PreservedSpecimenDTO assemblePreservedSpecimenDTO(DerivedUnit derivedUnit);
|
411
|
|
412
|
/**
|
413
|
* Deletes the specified specimen according to the setting in the {@link SpecimenDeleteConfigurator}.<br>
|
414
|
* @param specimen the specimen which shoul be deleted
|
415
|
* @param config specifies options if and how the specimen should be deleted like e.g. including all
|
416
|
* of its children
|
417
|
* @return the {@link DeleteResult} which holds information about the outcome of this operation
|
418
|
*/
|
419
|
public DeleteResult delete(SpecimenOrObservationBase<?> specimen, SpecimenDeleteConfigurator config);
|
420
|
|
421
|
/**
|
422
|
* Deletes the specified specimen belonging to the given {@link UUID}
|
423
|
* according to the setting in the {@link SpecimenDeleteConfigurator}.
|
424
|
*
|
425
|
* @param specimen
|
426
|
* the specimen which shoul be deleted
|
427
|
* @param config
|
428
|
* specifies options if and how the specimen should be deleted
|
429
|
* like e.g. including all of its children
|
430
|
* @return the {@link DeleteResult} which holds information about the
|
431
|
* outcome of this operation
|
432
|
*/
|
433
|
public DeleteResult delete(UUID specimenUuid, SpecimenDeleteConfigurator config);
|
434
|
|
435
|
/**
|
436
|
* Retrieves all {@link IndividualsAssociation} with the given specimen.<br>
|
437
|
* @param specimen the specimen for which the associations are retrieved
|
438
|
* @param limit
|
439
|
* @param start
|
440
|
* @param orderHints
|
441
|
* @param propertyPaths
|
442
|
* @return collection of all associations
|
443
|
*/
|
444
|
public Collection<IndividualsAssociation> listIndividualsAssociations(SpecimenOrObservationBase<?> specimen, Integer limit, Integer start, List<OrderHint> orderHints, List<String> propertyPaths);
|
445
|
|
446
|
|
447
|
/**
|
448
|
* Retrieves all taxa linked via {@link IndividualsAssociation} with the given specimen.<br>
|
449
|
* @param specimen the specimen which is linked to the taxa
|
450
|
* @param limit
|
451
|
* @param start
|
452
|
* @param orderHints
|
453
|
* @param propertyPaths
|
454
|
* @return a collection of associated taxa
|
455
|
*/
|
456
|
public Collection<TaxonBase<?>> listIndividualsAssociationTaxa(SpecimenOrObservationBase<?> specimen, Integer limit,
|
457
|
Integer start, List<OrderHint> orderHints, List<String> propertyPaths);
|
458
|
|
459
|
/**
|
460
|
* Retrieves all associated taxa for the given specimen (via type designations, determination, individuals associations)
|
461
|
* @param specimen
|
462
|
* @param limit
|
463
|
* @param start
|
464
|
* @param orderHints
|
465
|
* @param propertyPaths
|
466
|
* @return
|
467
|
*/
|
468
|
public Collection<TaxonBase<?>> listAssociatedTaxa(SpecimenOrObservationBase<?> specimen, Integer limit, Integer start, List<OrderHint> orderHints, List<String> propertyPaths);
|
469
|
|
470
|
/**
|
471
|
* Retrieves all taxa that the given specimen is determined as
|
472
|
* @param specimen
|
473
|
* @param limit
|
474
|
* @param start
|
475
|
* @param orderHints
|
476
|
* @param propertyPaths
|
477
|
* @return collection of all taxa the given specimen is determined as
|
478
|
*/
|
479
|
public Collection<TaxonBase<?>> listDeterminedTaxa(SpecimenOrObservationBase<?> specimen, Integer limit, Integer start,
|
480
|
List<OrderHint> orderHints, List<String> propertyPaths);
|
481
|
|
482
|
/**
|
483
|
* Retrieves all {@link DeterminationEvent}s which have the given specimen set as identified unit.
|
484
|
* @param specimen
|
485
|
* @param limit
|
486
|
* @param start
|
487
|
* @param orderHints
|
488
|
* @param propertyPaths
|
489
|
* @return collection of all determination events with the given specimen
|
490
|
*/
|
491
|
public Collection<DeterminationEvent> listDeterminationEvents(SpecimenOrObservationBase<?> specimen, Integer limit, Integer start, List<OrderHint> orderHints, List<String> propertyPaths);
|
492
|
|
493
|
/**
|
494
|
* Retrieves all taxa with a {@link SpecimenTypeDesignation} with the given specimen as a type specimen.
|
495
|
* @param specimen the type specimen
|
496
|
* @param specimen
|
497
|
* @param limit
|
498
|
* @param start
|
499
|
* @param orderHints
|
500
|
* @param propertyPaths
|
501
|
* @return a collection of all taxa where the given specimen is the type specimen
|
502
|
*/
|
503
|
public Collection<TaxonBase<?>> listTypeDesignationTaxa(DerivedUnit specimen, Integer limit,
|
504
|
Integer start, List<OrderHint> orderHints, List<String> propertyPaths);
|
505
|
|
506
|
/**
|
507
|
* Retrieves all {@link SpecimenTypeDesignation}s which have the given specimens as a type specimen.
|
508
|
* @param specimens the type specimens
|
509
|
* @param limit
|
510
|
* @param start
|
511
|
* @param orderHints
|
512
|
* @param propertyPaths
|
513
|
* @return map of all designations with the given type specimens
|
514
|
*/
|
515
|
public Map<DerivedUnit, Collection<SpecimenTypeDesignation>> listTypeDesignations(Collection<DerivedUnit> specimens, Integer limit, Integer start, List<OrderHint> orderHints, List<String> propertyPaths);
|
516
|
|
517
|
/**
|
518
|
* Retrieves all {@link SpecimenTypeDesignation}s which have the given specimen as a type specimen.
|
519
|
* @param specimen the type specimen
|
520
|
* @param limit
|
521
|
* @param start
|
522
|
* @param orderHints
|
523
|
* @param propertyPaths
|
524
|
* @return collection of all designations with the given type specimen
|
525
|
*/
|
526
|
public Collection<SpecimenTypeDesignation> listTypeDesignations(DerivedUnit specimen, Integer limit, Integer start, List<OrderHint> orderHints, List<String> propertyPaths);
|
527
|
|
528
|
/**
|
529
|
* Retrieves all {@link DescriptionBase}s that have the given specimen set as described specimen.
|
530
|
* @param specimen the described specimen
|
531
|
* @param limit
|
532
|
* @param start
|
533
|
* @param orderHints
|
534
|
* @param propertyPaths
|
535
|
* @return collection of all descriptions with the given described specimen
|
536
|
*/
|
537
|
public Collection<DescriptionBase<?>> listDescriptionsWithDescriptionSpecimen(SpecimenOrObservationBase<?> specimen, Integer limit, Integer start, List<OrderHint> orderHints, List<String> propertyPaths);
|
538
|
|
539
|
/**
|
540
|
* Gets all description elements that are used for describing the character
|
541
|
* states of the given specimen
|
542
|
*
|
543
|
* @param specimen
|
544
|
* the specimen for which the character state description
|
545
|
* elements should be retrieved
|
546
|
* @return a collection of all character state description elements for this
|
547
|
* specimen
|
548
|
*/
|
549
|
public Collection<DescriptionElementBase> getCharacterDataForSpecimen(SpecimenOrObservationBase<?> specimen);
|
550
|
|
551
|
/**
|
552
|
* Gets all description elements that are used for describing the character
|
553
|
* states of the given specimen
|
554
|
*
|
555
|
* @param specimenUuid
|
556
|
* the specimen {@link UUID} for which the character state description
|
557
|
* elements should be retrieved
|
558
|
* @return a collection of all character state description elements for this
|
559
|
* specimen
|
560
|
*/
|
561
|
public Collection<DescriptionElementBase> getCharacterDataForSpecimen(UUID specimenUuid);
|
562
|
|
563
|
/**
|
564
|
* Returns the most significant identifier for the given {@link DerivedUnit}.
|
565
|
* @param derivedUnit the derived unit to check
|
566
|
* @return the identifier string
|
567
|
*/
|
568
|
public String getMostSignificantIdentifier(DerivedUnit derivedUnit);
|
569
|
|
570
|
/**
|
571
|
* Returns the number of specimens that match the given parameters
|
572
|
* <br>
|
573
|
* <b>NOTE - issue #6484:</b> the parameters {@link FindOccurrencesConfigurator#getAssignmentStatus()}
|
574
|
* and {@link FindOccurrencesConfigurator#isRetrieveIndirectlyAssociatedSpecimens()} are not evaluated
|
575
|
* in the count method
|
576
|
* @param clazz the class to match
|
577
|
* @param queryString the queryString to match
|
578
|
* @param type the {@link SpecimenOrObservationType} to match
|
579
|
* @param associatedTaxon the taxon these specimens are in any way associated to via
|
580
|
* determination, type designations, individuals associations, etc.
|
581
|
* @param matchmode determines how the query string should be matched
|
582
|
* @param limit
|
583
|
* the maximum number of entities returned (can be null to return
|
584
|
* all entities)
|
585
|
* @param start
|
586
|
* @param orderHints
|
587
|
* Supports path like <code>orderHints.propertyNames</code> which
|
588
|
* include *-to-one properties like createdBy.username or
|
589
|
* authorTeam.persistentTitleCache
|
590
|
* @return the number of found specimens
|
591
|
*/
|
592
|
public int countOccurrences(IIdentifiableEntityServiceConfigurator<SpecimenOrObservationBase> config);
|
593
|
|
594
|
/**
|
595
|
* Return the all {@link SpecimenOrObservationBase}s of the complete
|
596
|
* derivative hierarchy i.e. all parent and child derivatives and the given
|
597
|
* specimen itself.
|
598
|
*
|
599
|
* @param specimen
|
600
|
* a specimen or observation
|
601
|
* @return the derivative hierarchy as an unordered list of all specimens or observation
|
602
|
*/
|
603
|
public List<SpecimenOrObservationBase<?>> getAllHierarchyDerivatives(SpecimenOrObservationBase<?> specimen);
|
604
|
|
605
|
/**
|
606
|
* Returns all child derivatives of the given specimen.
|
607
|
* @param specimen a specimen or observation
|
608
|
* @return an unordered list of all child derivatives
|
609
|
*/
|
610
|
public List<DerivedUnit> getAllChildDerivatives(SpecimenOrObservationBase<?> specimen);
|
611
|
|
612
|
/**
|
613
|
* Returns all child derivatives of the given specimen.
|
614
|
* @param specimen the UUID of a specimen or observation
|
615
|
* @return an unordered list of all child derivatives
|
616
|
*/
|
617
|
public List<DerivedUnit> getAllChildDerivatives(UUID specimenUuid);
|
618
|
|
619
|
/**
|
620
|
* Returns all {@link FieldUnit}s that are referencing this {@link GatheringEvent}
|
621
|
* @param gatheringEventUuid the {@link UUID} of the gathering event
|
622
|
* @return a list of field units referencing the gathering event
|
623
|
*/
|
624
|
public List<FieldUnit> getFieldUnitsForGatheringEvent(UUID gatheringEventUuid);
|
625
|
|
626
|
}
|