Project

General

Profile

Download (33.1 KB) Statistics
| Branch: | Tag: | Revision:
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
import org.springframework.transaction.annotation.Transactional;
22

    
23
import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
24
import eu.etaxonomy.cdm.api.facade.DerivedUnitFacadeNotSupportedException;
25
import eu.etaxonomy.cdm.api.service.config.FindOccurrencesConfigurator;
26
import eu.etaxonomy.cdm.api.service.config.IIdentifiableEntityServiceConfigurator;
27
import eu.etaxonomy.cdm.api.service.config.SpecimenDeleteConfigurator;
28
import eu.etaxonomy.cdm.api.service.dto.DerivedUnitDTO;
29
import eu.etaxonomy.cdm.api.service.dto.FieldUnitDTO;
30
import eu.etaxonomy.cdm.api.service.pager.Pager;
31
import eu.etaxonomy.cdm.api.service.search.LuceneParseException;
32
import eu.etaxonomy.cdm.api.service.search.SearchResult;
33
import eu.etaxonomy.cdm.api.service.util.TaxonRelationshipEdge;
34
import eu.etaxonomy.cdm.model.common.Language;
35
import eu.etaxonomy.cdm.model.description.DescriptionBase;
36
import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
37
import eu.etaxonomy.cdm.model.description.IndividualsAssociation;
38
import eu.etaxonomy.cdm.model.description.TaxonDescription;
39
import eu.etaxonomy.cdm.model.location.Point;
40
import eu.etaxonomy.cdm.model.media.Media;
41
import eu.etaxonomy.cdm.model.molecular.DnaSample;
42
import eu.etaxonomy.cdm.model.molecular.Sequence;
43
import eu.etaxonomy.cdm.model.name.HomotypicalGroup;
44
import eu.etaxonomy.cdm.model.name.SpecimenTypeDesignation;
45
import eu.etaxonomy.cdm.model.name.TaxonName;
46
import eu.etaxonomy.cdm.model.occurrence.DerivationEvent;
47
import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
48
import eu.etaxonomy.cdm.model.occurrence.DeterminationEvent;
49
import eu.etaxonomy.cdm.model.occurrence.FieldUnit;
50
import eu.etaxonomy.cdm.model.occurrence.GatheringEvent;
51
import eu.etaxonomy.cdm.model.occurrence.MediaSpecimen;
52
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
53
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationType;
54
import eu.etaxonomy.cdm.model.taxon.Taxon;
55
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
56
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
57
import eu.etaxonomy.cdm.model.taxon.TaxonRelationship;
58
import eu.etaxonomy.cdm.persistence.dao.initializer.IBeanInitializer;
59
import eu.etaxonomy.cdm.persistence.dto.SpecimenNodeWrapper;
60
import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache;
61
import eu.etaxonomy.cdm.persistence.query.OrderHint;
62

    
63
/**
64
 * @author a.babadshanjan
65
 * @since 01.09.2008
66
 */
67
public interface IOccurrenceService
68
        extends IIdentifiableEntityService<SpecimenOrObservationBase> {
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 long 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
     * The method will search for specimen associated with the taxon nodes.<br>
262
     * It will search for 3 possible association types: <br>
263
     * - via IndividualAssociations of the taxon<br>
264
     *  - via TypeDesignations of the taxon name<br>
265
     *  - via Determinations of the taxon or taxon name<br>
266
     * <br>
267
     * more are covered in
268
     * {@link IOccurrenceService#findByTitle(IIdentifiableEntityServiceConfigurator)}
269
     * @param taxonNodeUuids
270
     *            a list of {@link UUID}s of the taxon nodes
271
     * @param limit
272
     * @param start
273
     * @return a collection of {@link SpecimenNodeWrapper} containing the
274
     *         {@link TaxonNode} and the corresponding {@link UuidAndTitleCache}
275
     *         object for the specimen found for this taxon node
276
     */
277
    public Collection<SpecimenNodeWrapper> listUuidAndTitleCacheByAssociatedTaxon(List<UUID> taxonNodeUuids,
278
            Integer limit, Integer start);
279

    
280

    
281
    /**
282
     * Lists all instances of {@link FieldUnit} which are
283
     * associated <b>directly or indirectly</b>with the <code>taxon</code> specified
284
     * as parameter. "Indirectly" means that a sub derivate of the FieldUnit is
285
     * directly associated with the given taxon.
286
     * SpecimenOrObservationBase instances can be associated to taxa in multiple
287
     * ways, all these possible relations are taken into account:
288
     * <ul>
289
     * <li>The {@link IndividualsAssociation} elements in a
290
     * {@link TaxonDescription} contain {@link DerivedUnit}s</li>
291
     * <li>{@link SpecimenTypeDesignation}s may be associated with any
292
     * {@link HomotypicalGroup} related to the specific {@link Taxon}.</li>
293
     * <li>A {@link Taxon} may be referenced by the {@link DeterminationEvent}
294
     * of the {@link SpecimenOrObservationBase}</li>
295
     * </ul>
296
     * Further more there also can be taxa which are associated with the taxon
297
     * in question (parameter associatedTaxon) by {@link TaxonRelationship}s. If
298
     * the parameter <code>includeRelationships</code> is containing elements,
299
     * these according {@TaxonRelationshipType}s and
300
     * directional information will be used to collect further
301
     * {@link SpecimenOrObservationBase} instances found this way.
302
     *
303
     * @param <T>
304
     * @param type
305
     * @param associatedTaxon
306
     * @param Set<TaxonRelationshipVector> includeRelationships. TaxonRelationships will not be taken into account if this is <code>NULL</code>.
307
     * @param maxDepth TODO
308
     * @param pageSize
309
     * @param pageNumber
310
     * @param orderHints
311
     * @param propertyPaths
312
     * @return
313
     */
314
    public Collection<SpecimenOrObservationBase> listFieldUnitsByAssociatedTaxon(Taxon associatedTaxon, List<OrderHint> orderHints, List<String> propertyPaths);
315

    
316
    /**
317
     * See {@link #listFieldUnitsByAssociatedTaxon(Set, Taxon, Integer, Integer, Integer, List, List)}
318
     */
319
    public Pager<SpecimenOrObservationBase> pageFieldUnitsByAssociatedTaxon(Set<TaxonRelationshipEdge> includeRelationships,
320
            Taxon associatedTaxon, Integer maxDepth, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);
321

    
322
    /**
323
     * See {@link #listByAssociatedTaxon(Class, Set, Taxon, Integer, Integer, Integer, List, List)}
324
     *
325
     * @param type
326
     * @param includeRelationships
327
     * @param associatedTaxon
328
     * @param maxDepth
329
     * @param pageSize
330
     * @param pageNumber
331
     * @param orderHints
332
     * @param propertyPaths
333
     * @return a Pager
334
     */
335
    public <T extends SpecimenOrObservationBase> Pager<T> pageByAssociatedTaxon(Class<T> type, Set<TaxonRelationshipEdge> includeRelationships,
336
            Taxon associatedTaxon, Integer maxDepth, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);
337

    
338
    /**
339
     * Retrieves all {@link FieldUnit}s for the {@link SpecimenOrObservationBase} with the given {@link UUID}.<br>
340
     * @param specimenUuid the UUID of the specimen
341
     * @param propertyPaths the property path
342
     * @return either a collection of FieldUnits this specimen was derived from, the FieldUnit itself
343
     * if this was a FieldUnit or an empty collection if no FieldUnits were found
344
     */
345
    public Collection<FieldUnit> findFieldUnits(UUID specimenUuid, List<String> propertyPaths);
346

    
347
    /**
348
     * @param clazz
349
     * @param queryString
350
     * @param languages
351
     * @param highlightFragments
352
     * @param pageSize
353
     * @param pageNumber
354
     * @param orderHints
355
     * @param propertyPaths
356
     * @return
357
     * @throws CorruptIndexException
358
     * @throws IOException
359
     * @throws ParseException
360
     */
361
    Pager<SearchResult<SpecimenOrObservationBase>> findByFullText(Class<? extends SpecimenOrObservationBase> clazz,
362
            String queryString, Rectangle boundingBox, List<Language> languages, boolean highlightFragments,
363
            Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths)
364
            throws IOException, LuceneParseException;
365
    /**
366
     * See {@link #listByAssociatedTaxon(Class, Set, String, Integer, Integer, Integer, List, List)}
367
     *
368
     * @param type
369
     * @param includeRelationships
370
     * @param associatedTaxon
371
     * @param maxDepth
372
     * @param pageSize
373
     * @param pageNumber
374
     * @param orderHints
375
     * @param propertyPaths
376
     * @return a Pager
377
     */
378
    public <T extends SpecimenOrObservationBase> Pager<T>  pageByAssociatedTaxon(Class<T> type, Set<TaxonRelationshipEdge> includeRelationships,
379
            String taxonUUID, Integer maxDepth, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);
380

    
381
    /**
382
     * Moves the given {@link Sequence} from one {@link DnaSample} to another
383
     * @param from the DnaSample from which the sequence will be removed
384
     * @param to the DnaSample which to which the sequence will be added
385
     * @param sequence the Sequence to move
386
     * @return <code>true</code> if successfully moved, <code>false</code> otherwise
387
     */
388
    public UpdateResult moveSequence(DnaSample from, DnaSample to, Sequence sequence);
389

    
390

    
391
    /**
392
     * @param fromUuid
393
     * @param toUuid
394
     * @param sequenceUuid
395
     * @return
396
     */
397
    public UpdateResult moveSequence(UUID fromUuid, UUID toUuid, UUID sequenceUuid);
398

    
399
    /**
400
     * Moves the given {@link DerivedUnit} from one {@link SpecimenOrObservationBase} to another.
401
     * @param from the SpecimenOrObservationBase from which the DerivedUnit will be removed
402
     * @param to the SpecimenOrObservationBase to which the DerivedUnit will be added
403
     * @param derivate the DerivedUnit to move
404
     * @return <code>true</code> if successfully moved, <code>false</code> otherwise
405
     */
406
    public UpdateResult moveDerivate(UUID specimenFromUuid, UUID specimenToUuid, UUID derivateUuid);
407

    
408
    /**
409
     * @param from
410
     * @param to
411
     * @param derivate
412
     * @return
413
     */
414
    public boolean moveDerivate(SpecimenOrObservationBase<?> from, SpecimenOrObservationBase<?> to, DerivedUnit derivate);
415

    
416
    /**
417
     * Assembles a {@link FieldUnitDTO} for the given field unit.<br>
418
     *
419
     * @param fieldUnit
420
     * @return a DTO with all the assembled information
421
     */
422
    public FieldUnitDTO assembleFieldUnitDTO(FieldUnit fieldUnit);
423

    
424
    /**
425
     * Assembles a {@link DerivedUnitDTO} for the given derived unit.
426
     * @param derivedUnit
427
     * @return a DTO with all the assembled information
428
     */
429
    public DerivedUnitDTO assembleDerivedUnitDTO(DerivedUnit derivedUnit);
430

    
431
    /**
432
     * Deletes the specified specimen according to the setting in the {@link SpecimenDeleteConfigurator}.<br>
433
     * @param specimen the specimen which shoul be deleted
434
     * @param config specifies options if and how the specimen should be deleted like e.g. including all
435
     * of its children
436
     * @return the {@link DeleteResult} which holds information about the outcome of this operation
437
     */
438
    public DeleteResult delete(SpecimenOrObservationBase<?> specimen, SpecimenDeleteConfigurator config);
439

    
440
    /**
441
     * Deletes the specified specimen belonging to the given {@link UUID}
442
     * according to the setting in the {@link SpecimenDeleteConfigurator}.
443
     *
444
     * @param specimen
445
     *            the specimen which shoul be deleted
446
     * @param config
447
     *            specifies options if and how the specimen should be deleted
448
     *            like e.g. including all of its children
449
     * @return the {@link DeleteResult} which holds information about the
450
     *         outcome of this operation
451
     */
452
    public DeleteResult delete(UUID specimenUuid, SpecimenDeleteConfigurator config);
453

    
454
    /**
455
     * Retrieves all {@link IndividualsAssociation} with the given specimen.<br>
456
     * @param specimen the specimen for which the associations are retrieved
457
     * @param limit
458
     * @param start
459
     * @param orderHints
460
     * @param propertyPaths
461
     * @return collection of all associations
462
     */
463
    public Collection<IndividualsAssociation> listIndividualsAssociations(SpecimenOrObservationBase<?> specimen, Integer limit, Integer start, List<OrderHint> orderHints, List<String> propertyPaths);
464

    
465

    
466
    /**
467
     * Retrieves all taxa linked via {@link IndividualsAssociation} with the given specimen.<br>
468
     * @param specimen the specimen which is linked to the taxa
469
     * @param limit
470
     * @param start
471
     * @param orderHints
472
     * @param propertyPaths
473
     * @return a collection of associated taxa
474
     */
475
    public Collection<TaxonBase<?>> listIndividualsAssociationTaxa(SpecimenOrObservationBase<?> specimen,
476
            Integer limit, Integer start, List<OrderHint> orderHints, List<String> propertyPaths);
477
    /**
478
      * @see #listIndividualsAssociationTaxa(SpecimenOrObservationBase, Integer, Integer, List, List)
479
      */
480
    public Collection<TaxonBase<?>> listIndividualsAssociationTaxa(SpecimenOrObservationBase<?> specimen, boolean includeUnpublished,
481
            Integer limit, Integer start, List<OrderHint> orderHints, List<String> propertyPaths);
482

    
483
    /**
484
     * Retrieves all associated taxa for the given specimen (via type designations, determination, individuals associations)
485
     * @param specimen
486
     * @param limit
487
     * @param start
488
     * @param orderHints
489
     * @param propertyPaths
490
     * @return
491
     */
492
    public Collection<TaxonBase<?>> listAssociatedTaxa(SpecimenOrObservationBase<?> specimen, boolean includeUnpublished,
493
            Integer limit, Integer start, List<OrderHint> orderHints, List<String> propertyPaths);
494
    /**
495
     * @see #listAssociatedTaxa(SpecimenOrObservationBase, Integer, Integer, List, List)axa
496
     */
497
    public Collection<TaxonBase<?>> listAssociatedTaxa(SpecimenOrObservationBase<?> specimen,
498
            Integer limit, Integer start, List<OrderHint> orderHints, List<String> propertyPaths);
499

    
500
    /**
501
     * Retrieves all taxa that the given specimen is determined as
502
     * @param specimen
503
     * @param limit
504
     * @param start
505
     * @param orderHints
506
     * @param propertyPaths
507
     * @return collection of all taxa the given specimen is determined as
508
     */
509
    public Collection<TaxonBase<?>> listDeterminedTaxa(SpecimenOrObservationBase<?> specimen, boolean includeUnpublished,
510
            Integer limit, Integer start, List<OrderHint> orderHints, List<String> propertyPaths);
511
    /**
512
     * @see #listDeterminedTaxa(SpecimenOrObservationBase, Integer, Integer, List, List)
513
     */
514
    public Collection<TaxonBase<?>> listDeterminedTaxa(SpecimenOrObservationBase<?> specimen,
515
            Integer limit, Integer start, List<OrderHint> orderHints, List<String> propertyPaths);
516

    
517
    /**
518
     * Retrieves all {@link DeterminationEvent}s which have the given specimen set as identified unit.
519
     * @param specimen
520
     * @param limit
521
     * @param start
522
     * @param orderHints
523
     * @param propertyPaths
524
     * @return collection of all determination events with the given specimen
525
     */
526
    public Collection<DeterminationEvent> listDeterminationEvents(SpecimenOrObservationBase<?> specimen, Integer limit, Integer start, List<OrderHint> orderHints, List<String> propertyPaths);
527

    
528
    /**
529
     * Retrieves all taxa with a {@link SpecimenTypeDesignation} with the given specimen as a type specimen.
530
     * @param specimen the type specimen
531
     * @param specimen
532
     * @param limit
533
     * @param start
534
     * @param orderHints
535
     * @param propertyPaths
536
     * @return a collection of all taxa where the given specimen is the type specimen
537
     */
538
    public Collection<TaxonBase<?>> listTypeDesignationTaxa(DerivedUnit specimen,
539
            Integer limit, Integer start, List<OrderHint> orderHints, List<String> propertyPaths);
540
    /**
541
     * @see #listTypeDesignationTaxa(DerivedUnit, Integer, Integer, List, List)a
542
     */
543
    public Collection<TaxonBase<?>> listTypeDesignationTaxa(DerivedUnit specimen, boolean includeUnpublished,
544
            Integer limit, Integer start, List<OrderHint> orderHints, List<String> propertyPaths);
545

    
546
    /**
547
     * Retrieves all {@link SpecimenTypeDesignation}s which have the given specimens as a type specimen.
548
     * @param specimens the type specimens
549
     * @param limit
550
     * @param start
551
     * @param orderHints
552
     * @param propertyPaths
553
     * @return map of all designations with the given type specimens
554
     */
555
    public Map<DerivedUnit, Collection<SpecimenTypeDesignation>> listTypeDesignations(Collection<DerivedUnit> specimens, Integer limit, Integer start, List<OrderHint> orderHints, List<String> propertyPaths);
556

    
557
    /**
558
     * Retrieves all {@link SpecimenTypeDesignation}s which have the given specimen as a type specimen.
559
     * @param specimen the type specimen
560
     * @param limit
561
     * @param start
562
     * @param orderHints
563
     * @param propertyPaths
564
     * @return collection of all designations with the given type specimen
565
     */
566
    public Collection<SpecimenTypeDesignation> listTypeDesignations(DerivedUnit specimen, Integer limit, Integer start, List<OrderHint> orderHints, List<String> propertyPaths);
567

    
568
    /**
569
     * Retrieves all {@link DescriptionBase}s that have the given specimen set as described specimen.
570
     * @param specimen the described specimen
571
     * @param limit
572
     * @param start
573
     * @param orderHints
574
     * @param propertyPaths
575
     * @return collection of all descriptions with the given described specimen
576
     */
577
    public Collection<DescriptionBase<?>> listDescriptionsWithDescriptionSpecimen(SpecimenOrObservationBase<?> specimen, Integer limit, Integer start, List<OrderHint> orderHints, List<String> propertyPaths);
578

    
579
    /**
580
     * Gets all description elements that are used for describing the character
581
     * states of the given specimen
582
     *
583
     * @param specimenUuid
584
     *            the specimen {@link UUID} for which the character state description
585
     *            elements should be retrieved
586
     * @return a collection of all character state description elements for this
587
     *         specimen
588
     */
589
    public Collection<DescriptionElementBase> getCharacterDataForSpecimen(UUID specimenUuid);
590

    
591
    /**
592
     * Returns the most significant identifier for the given {@link DerivedUnit}.
593
     * @param derivedUnit the derived unit to check
594
     * @return the identifier string
595
     * @deprecated use {@link DerivedUnit#getMostSignificantIdentifier()} instead
596
     */
597
    @Deprecated
598
    public String getMostSignificantIdentifier(DerivedUnit derivedUnit);
599

    
600
    /**
601
     * Returns the number of specimens that match the given parameters
602
     * <br>
603
     * <b>NOTE - issue #6484:</b> the parameters {@link FindOccurrencesConfigurator#getAssignmentStatus()}
604
     * and {@link FindOccurrencesConfigurator#isRetrieveIndirectlyAssociatedSpecimens()} are not evaluated
605
     * in the count method
606
     * @param clazz the class to match
607
     * @param queryString the queryString to match
608
     * @param type the {@link SpecimenOrObservationType} to match
609
     * @param associatedTaxon the taxon these specimens are in any way associated to via
610
     * determination, type designations, individuals associations, etc.
611
     * @param matchmode determines how the query string should be matched
612
     * @param limit
613
     *            the maximum number of entities returned (can be null to return
614
     *            all entities)
615
     * @param start
616
     * @param orderHints
617
     *            Supports path like <code>orderHints.propertyNames</code> which
618
     *            include *-to-one properties like createdBy.username or
619
     *            authorTeam.persistentTitleCache
620
     * @return the number of found specimens
621
     */
622
    public long countOccurrences(IIdentifiableEntityServiceConfigurator<SpecimenOrObservationBase> config);
623

    
624
    /**
625
     * Return the all {@link SpecimenOrObservationBase}s of the complete
626
     * derivative hierarchy i.e. all parent and child derivatives and the given
627
     * specimen itself.
628
     *
629
     * @param specimen
630
     *            a specimen or observation
631
     * @return the derivative hierarchy as an unordered list of all specimens or observation
632
     */
633
    public List<SpecimenOrObservationBase<?>> getAllHierarchyDerivatives(SpecimenOrObservationBase<?> specimen);
634

    
635
    /**
636
     * Returns all child derivatives of the given specimen.
637
     * @param specimen a specimen or observation
638
     * @return an unordered list of all child derivatives
639
     */
640
    public List<DerivedUnit> getAllChildDerivatives(SpecimenOrObservationBase<?> specimen);
641

    
642
    /**
643
     * Returns all child derivatives of the given specimen.
644
     * @param specimen the UUID of a specimen or observation
645
     * @return an unordered list of all child derivatives
646
     */
647
    public List<DerivedUnit> getAllChildDerivatives(UUID specimenUuid);
648

    
649
    /**
650
     * Returns all {@link FieldUnit}s that are referencing this {@link GatheringEvent}
651
     * @param gatheringEventUuid the {@link UUID} of the gathering event
652
     * @return a list of field units referencing the gathering event
653
     */
654
    public List<FieldUnit> findFieldUnitsForGatheringEvent(UUID gatheringEventUuid);
655

    
656

    
657
    /**
658
     * Returns a list of {@link UuidAndTitleCache} for the specimens found with the
659
     * given configurator
660
     * @param config the configurator for the search
661
     * @return a list of UuidAndTitleCache object
662
     */
663
    @Transactional(readOnly = true)
664
    public Pager<UuidAndTitleCache<SpecimenOrObservationBase>> findByTitleUuidAndTitleCache(
665
            FindOccurrencesConfigurator config);
666

    
667
    /**
668
     * Returns a list of {@link DerivedUnitDTO} for the specimens found with the
669
     * given configurator
670
     * @param config the configurator for the search
671
     * @return a list of {@link DerivedUnitDTO} object
672
     */
673
    @Transactional(readOnly = true)
674
    public List<DerivedUnitDTO> findByTitleDerivedUnitDTO(
675
            FindOccurrencesConfigurator config);
676

    
677

    
678
    FieldUnitDTO findByAccessionNumber(String accessionNumberString, List<OrderHint> orderHints);
679

    
680

    
681
    List<FieldUnitDTO> findFieldUnitDTOByAssociatedTaxon(Set<TaxonRelationshipEdge> includedRelationships,
682
            UUID associatedTaxonUuid, List<String> propertyPaths);
683

    
684
    public List<Point> findPointsForFieldUnitList(List<UUID> fieldUnitUuids);
685

    
686
    /**
687
     * Load the FieldUnitDTO for the given <code>derivedUnitUuid</code> with all intermediate derivatives and {@link eu.etaxonomy.cdm.api.service.dto.GatheringEventDTO}
688

    
689
     * @param derivedUnitUuid
690
     * @return
691
     */
692
    FieldUnitDTO loadFieldUnitDTO(UUID derivedUnitUuid);
693

    
694
}
(48-48/100)