Project

General

Profile

Download (26.6 KB) Statistics
| Branch: | Tag: | Revision:
1
// $Id$
2
/**
3
* Copyright (C) 2009 EDIT
4
* European Distributed Institute of Taxonomy
5
* http://www.e-taxonomy.eu
6
*
7
* The contents of this file are subject to the Mozilla Public License Version 1.1
8
* See LICENSE.TXT at the top of this package for the full license terms.
9
*/
10

    
11
package eu.etaxonomy.cdm.api.service;
12

    
13
import java.io.IOException;
14
import java.util.Collection;
15
import java.util.List;
16
import java.util.Set;
17
import java.util.UUID;
18

    
19
import org.apache.lucene.index.CorruptIndexException;
20
import org.apache.lucene.queryParser.ParseException;
21
import org.hibernate.search.spatial.impl.Rectangle;
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.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.SearchResult;
31
import eu.etaxonomy.cdm.api.service.util.TaxonRelationshipEdge;
32
import eu.etaxonomy.cdm.model.common.CdmBase;
33
import eu.etaxonomy.cdm.model.common.ICdmBase;
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.Country;
40
import eu.etaxonomy.cdm.model.media.Media;
41
import eu.etaxonomy.cdm.model.molecular.AmplificationResult;
42
import eu.etaxonomy.cdm.model.molecular.DnaSample;
43
import eu.etaxonomy.cdm.model.molecular.Sequence;
44
import eu.etaxonomy.cdm.model.molecular.SingleRead;
45
import eu.etaxonomy.cdm.model.name.HomotypicalGroup;
46
import eu.etaxonomy.cdm.model.name.SpecimenTypeDesignation;
47
import eu.etaxonomy.cdm.model.occurrence.DerivationEvent;
48
import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
49
import eu.etaxonomy.cdm.model.occurrence.DeterminationEvent;
50
import eu.etaxonomy.cdm.model.occurrence.FieldUnit;
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.TaxonRelationship;
57
import eu.etaxonomy.cdm.persistence.dao.initializer.IBeanInitializer;
58
import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache;
59
import eu.etaxonomy.cdm.persistence.query.OrderHint;
60

    
61
/**
62
 * @author a.babadshanjan
63
 * @created 01.09.2008
64
 */
65
public interface IOccurrenceService extends IIdentifiableEntityService<SpecimenOrObservationBase> {
66

    
67
    public Country getCountryByIso(String iso639);
68

    
69
    public List<Country> getCountryByName(String name);
70

    
71
    /**
72
     * Returns a paged list of occurrences that have been determined to belong
73
     * to the taxon concept determinedAs, optionally restricted to objects
74
     * belonging to a class that that extends SpecimenOrObservationBase.
75
     * <p>
76
     * In contrast to {@link #listByAnyAssociation(Class, Taxon, List)} this
77
     * method only takes SpecimenOrObservationBase instances into account which
78
     * are actually determined as the taxon specified by
79
     * <code>determinedAs</code>.
80
     *
81
     * @param type
82
     *            The type of entities to return (can be null to count all
83
     *            entities of type <T>)
84
     * @param determinedAs
85
     *            the taxon concept that the occurrences have been determined to
86
     *            belong to
87
     * @param pageSize
88
     *            The maximum number of objects returned (can be null for all
89
     *            matching objects)
90
     * @param pageNumber
91
     *            The offset (in pageSize chunks) from the start of the result
92
     *            set (0 - based, can be null, equivalent of starting at the
93
     *            beginning of the recordset)
94
     * @param orderHints
95
     *            Supports path like <code>orderHints.propertyNames</code> which
96
     *            include *-to-one properties like createdBy.username or
97
     *            authorTeam.persistentTitleCache
98
     * @param propertyPaths
99
     *            properties to be initialized
100
     * @return
101
     */
102
    public Pager<SpecimenOrObservationBase> list(Class<? extends SpecimenOrObservationBase> type, TaxonBase determinedAs, Integer limit, Integer start, List<OrderHint> orderHints, List<String> propertyPaths);
103

    
104
    /**
105
     * Returns a List of Media that are associated with a given occurence
106
     *
107
     * @param occurence the occurence associated with these media
108
     * @param pageSize The maximum number of media returned (can be null for all related media)
109
     * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
110
     * @param propertyPaths properties to initialize - see {@link IBeanInitializer#initialize(Object, List)}
111
     * @return a Pager of media instances
112
     */
113
    public Pager<Media> getMedia(SpecimenOrObservationBase occurence, Integer pageSize, Integer pageNumber, List<String> propertyPaths);
114

    
115
    /**
116
     * Returns all media attached to this occurence and its children. Also takes
117
     * {@link MediaSpecimen} and molecular images into account.
118
     *
119
     * @param occurence the occurence and its children from which the media to get
120
     * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
121
     * @param propertyPaths properties to initialize - see {@link IBeanInitializer#initialize(Object, List)}
122
     * @return a Pager of media instances
123
     */
124
    public Pager<Media> getMediainHierarchy(SpecimenOrObservationBase rootOccurence, Integer pageSize, Integer pageNumber, List<String> propertyPaths);
125

    
126
    /**
127
     * Returns a count of determinations that have been made for a given occurence and for a given taxon concept
128
     *
129
     * @param occurence the occurence associated with these determinations (can be null for all occurrences)
130
     * @param taxonbase the taxon concept associated with these determinations (can be null for all taxon concepts)
131
     * @return a count of determination events
132
     */
133
    public int countDeterminations(SpecimenOrObservationBase occurence,TaxonBase taxonbase);
134

    
135
    /**
136
     * Returns a List of determinations that have been made for a given occurence
137
     *
138
     * @param occurence the occurence associated with these determinations (can be null for all occurrences)
139
     * @param taxonbase the taxon concept associated with these determinations (can be null for all taxon concepts)
140
     * @param pageSize The maximum number of determinations returned (can be null for all related determinations)
141
     * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
142
     * @return a Pager of determination instances
143
     */
144
    public Pager<DeterminationEvent> getDeterminations(SpecimenOrObservationBase occurence, TaxonBase taxonBase, Integer pageSize, Integer pageNumber, List<String> propertyPaths);
145

    
146
    /**
147
     * Returns a list of derivation events that have involved creating new DerivedUnits from this occurence
148
     *
149
     * @param occurence the occurence that was a source of these derivation events
150
     * @param pageSize The maximum number of derivation events returned (can be null for all related derivation events)
151
     * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
152
     * @return a Pager of derivation events
153
     */
154
    public Pager<DerivationEvent> getDerivationEvents(SpecimenOrObservationBase occurence, Integer pageSize, Integer pageNumber, List<String> propertyPaths);
155

    
156
    /**
157
     * Returns a Paged List of SpecimenOrObservationBase instances where the default field matches the String queryString (as interpreted by the Lucene QueryParser)
158
     *
159
     * @param clazz filter the results by class (or pass null to return all SpecimenOrObservationBase instances)
160
     * @param queryString
161
     * @param pageSize The maximum number of occurrences returned (can be null for all matching occurrences)
162
     * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
163
     * @param orderHints
164
     *            Supports path like <code>orderHints.propertyNames</code> which
165
     *            include *-to-one properties like createdBy.username or
166
     *            authorTeam.persistentTitleCache
167
     * @param propertyPaths properties to be initialized
168
     * @return a Pager SpecimenOrObservationBase instances
169
     * @see <a href="http://lucene.apache.org/java/2_4_0/queryparsersyntax.html">Apache Lucene - Query Parser Syntax</a>
170
     */
171
    @Override
172
    public Pager<SpecimenOrObservationBase> search(Class<? extends SpecimenOrObservationBase> clazz, String query, Integer pageSize,Integer pageNumber, List<OrderHint> orderHints,List<String> propertyPaths);
173

    
174
    /**
175
     * Retrieves the {@link UUID} and the string representation (title cache) of all
176
     * {@link FieldUnit}s found in the data base.
177
     * @return a list of {@link UuidAndTitleCache}
178
     */
179
    public List<UuidAndTitleCache<FieldUnit>> getFieldUnitUuidAndTitleCache();
180

    
181
    /**
182
     * Retrieves the {@link UUID} and the string representation (title cache) of all
183
     * {@link DerivedUnit}s found in the data base.
184
     * @return a list of {@link UuidAndTitleCache}
185
     */
186
    public List<UuidAndTitleCache<DerivedUnit>> getDerivedUnitUuidAndTitleCache();
187

    
188
    public DerivedUnitFacade getDerivedUnitFacade(DerivedUnit derivedUnit, List<String> propertyPaths) throws DerivedUnitFacadeNotSupportedException;
189

    
190
    public List<DerivedUnitFacade> listDerivedUnitFacades(DescriptionBase description, List<String> propertyPaths);
191

    
192
    /**
193
     * Lists all instances of {@link SpecimenOrObservationBase} which are
194
     * associated with the <code>taxon</code> specified as parameter.
195
     * SpecimenOrObservationBase instances can be associated to taxa in multiple
196
     * ways, all these possible relations are taken into account:
197
     * <ul>
198
     * <li>The {@link IndividualsAssociation} elements in a
199
     * {@link TaxonDescription} contain {@link DerivedUnit}s</li>
200
     * <li>{@link SpecimenTypeDesignation}s may be associated with any
201
     * {@link HomotypicalGroup} related to the specific {@link Taxon}.</li>
202
     * <li>A {@link Taxon} may be referenced by the {@link DeterminationEvent}
203
     * of the {@link SpecimenOrObservationBase}</li>
204
     * </ul>
205
     * Further more there also can be taxa which are associated with the taxon
206
     * in question (parameter associatedTaxon) by {@link TaxonRelationship}s. If
207
     * the parameter <code>includeRelationships</code> is containing elements,
208
     * these according {@TaxonRelationshipType}s and
209
     * directional information will be used to collect further
210
     * {@link SpecimenOrObservationBase} instances found this way.
211
     *
212
     * @param <T>
213
     * @param type
214
     * @param associatedTaxon
215
     * @param Set<TaxonRelationshipVector> includeRelationships. TaxonRelationships will not be taken into account if this is <code>NULL</code>.
216
     * @param maxDepth TODO
217
     * @param pageSize
218
     * @param pageNumber
219
     * @param orderHints
220
     * @param propertyPaths
221
     * @return
222
     */
223
    public <T extends SpecimenOrObservationBase> List<T> listByAssociatedTaxon(Class<T> type, Set<TaxonRelationshipEdge> includeRelationships,
224
            Taxon associatedTaxon, Integer maxDepth, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);
225

    
226
    /**
227
     * Lists all instances of {@link FieldUnit} which are
228
     * associated <b>directly or indirectly</b>with the <code>taxon</code> specified
229
     * as parameter. "Indirectly" means that a sub derivate of the FieldUnit is
230
     * directly associated with the given taxon.
231
     * SpecimenOrObservationBase instances can be associated to taxa in multiple
232
     * ways, all these possible relations are taken into account:
233
     * <ul>
234
     * <li>The {@link IndividualsAssociation} elements in a
235
     * {@link TaxonDescription} contain {@link DerivedUnit}s</li>
236
     * <li>{@link SpecimenTypeDesignation}s may be associated with any
237
     * {@link HomotypicalGroup} related to the specific {@link Taxon}.</li>
238
     * <li>A {@link Taxon} may be referenced by the {@link DeterminationEvent}
239
     * of the {@link SpecimenOrObservationBase}</li>
240
     * </ul>
241
     * Further more there also can be taxa which are associated with the taxon
242
     * in question (parameter associatedTaxon) by {@link TaxonRelationship}s. If
243
     * the parameter <code>includeRelationships</code> is containing elements,
244
     * these according {@TaxonRelationshipType}s and
245
     * directional information will be used to collect further
246
     * {@link SpecimenOrObservationBase} instances found this way.
247
     *
248
     * @param <T>
249
     * @param type
250
     * @param associatedTaxon
251
     * @param Set<TaxonRelationshipVector> includeRelationships. TaxonRelationships will not be taken into account if this is <code>NULL</code>.
252
     * @param maxDepth TODO
253
     * @param pageSize
254
     * @param pageNumber
255
     * @param orderHints
256
     * @param propertyPaths
257
     * @return
258
     */
259
    public Collection<SpecimenOrObservationBase> listFieldUnitsByAssociatedTaxon(Taxon associatedTaxon, List<OrderHint> orderHints, List<String> propertyPaths);
260

    
261
    /**
262
     * See {@link #listFieldUnitsByAssociatedTaxon(Set, Taxon, Integer, Integer, Integer, List, List)}
263
     */
264
    public Pager<SpecimenOrObservationBase> pageFieldUnitsByAssociatedTaxon(Set<TaxonRelationshipEdge> includeRelationships,
265
            Taxon associatedTaxon, Integer maxDepth, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);
266

    
267
    /**
268
     * See {@link #listByAssociatedTaxon(Class, Set, Taxon, Integer, Integer, Integer, List, List)}
269
     *
270
     * @param type
271
     * @param includeRelationships
272
     * @param associatedTaxon
273
     * @param maxDepth
274
     * @param pageSize
275
     * @param pageNumber
276
     * @param orderHints
277
     * @param propertyPaths
278
     * @return a Pager
279
     */
280
    public <T extends SpecimenOrObservationBase> Pager<T> pageByAssociatedTaxon(Class<T> type, Set<TaxonRelationshipEdge> includeRelationships,
281
            Taxon associatedTaxon, Integer maxDepth, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);
282

    
283
    /**
284
     * Retrieves all {@link FieldUnit}s for the {@link SpecimenOrObservationBase} with the given {@link UUID}.<br>
285
     * @param specimenUuid the UUID of the specimen
286
     * @return either a collection of FieldUnits this specimen was derived from, the FieldUnit itself
287
     * if this was a FieldUnit or an empty collection if no FieldUnits were found
288
     */
289
    public Collection<FieldUnit> getFieldUnits(UUID specimenUuid);
290

    
291
    /**
292
     * @param clazz
293
     * @param queryString
294
     * @param languages
295
     * @param highlightFragments
296
     * @param pageSize
297
     * @param pageNumber
298
     * @param orderHints
299
     * @param propertyPaths
300
     * @return
301
     * @throws CorruptIndexException
302
     * @throws IOException
303
     * @throws ParseException
304
     */
305
    Pager<SearchResult<SpecimenOrObservationBase>> findByFullText(Class<? extends SpecimenOrObservationBase> clazz,
306
            String queryString, Rectangle boundingBox, List<Language> languages, boolean highlightFragments, Integer pageSize,
307
            Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths) throws CorruptIndexException,
308
            IOException, ParseException;
309
    /**
310
     * See {@link #listByAssociatedTaxon(Class, Set, String, Integer, Integer, Integer, List, List)}
311
     *
312
     * @param type
313
     * @param includeRelationships
314
     * @param associatedTaxon
315
     * @param maxDepth
316
     * @param pageSize
317
     * @param pageNumber
318
     * @param orderHints
319
     * @param propertyPaths
320
     * @return a Pager
321
     */
322
    public <T extends SpecimenOrObservationBase> Pager<T>  pageByAssociatedTaxon(Class<T> type, Set<TaxonRelationshipEdge> includeRelationships,
323
            String taxonUUID, Integer maxDepth, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);
324

    
325
    /**
326
     * Moves the given {@link Sequence} from one {@link DnaSample} to another
327
     * @param from the DnaSample from which the sequence will be removed
328
     * @param to the DnaSample which to which the sequence will be added
329
     * @param sequence the Sequence to move
330
     * @return <code>true</code> if successfully moved, <code>false</code> otherwise
331
     */
332
    public UpdateResult moveSequence(DnaSample from, DnaSample to, Sequence sequence);
333

    
334

    
335
    /**
336
     * @param fromUuid
337
     * @param toUuid
338
     * @param sequenceUuid
339
     * @return
340
     */
341
    public UpdateResult moveSequence(UUID fromUuid, UUID toUuid, UUID sequenceUuid);
342

    
343
    /**
344
     * Moves the given {@link DerivedUnit} from one {@link SpecimenOrObservationBase} to another.
345
     * @param from the SpecimenOrObservationBase from which the DerivedUnit will be removed
346
     * @param to the SpecimenOrObservationBase to which the DerivedUnit will be added
347
     * @param derivate the DerivedUnit to move
348
     * @return <code>true</code> if successfully moved, <code>false</code> otherwise
349
     */
350
    public UpdateResult moveDerivate(UUID specimenFromUuid, UUID specimenToUuid, UUID derivateUuid);
351

    
352
    /**
353
     * @param from
354
     * @param to
355
     * @param derivate
356
     * @return
357
     */
358
    public boolean moveDerivate(SpecimenOrObservationBase<?> from, SpecimenOrObservationBase<?> to, DerivedUnit derivate);
359

    
360
    /**
361
     * Assembles a {@link FieldUnitDTO} for the given field unit uuid which is associated to the {@link Taxon}.<br>
362
     * <br>
363
     * For the meaning of "associated" see also {@link #listFieldUnitsByAssociatedTaxon(Set, Taxon, Integer, Integer, Integer, List, List)}
364
     * @param fieldUnit
365
     * @param associatedTaxonUuid
366
     * @return a DTO with all the assembled information
367
     */
368
    public FieldUnitDTO assembleFieldUnitDTO(FieldUnit fieldUnit, UUID associatedTaxonUuid);
369

    
370
    /**
371
     * Assembles a {@link PreservedSpecimenDTO} for the given derived unit.
372
     * @param derivedUnit
373
     * @return a DTO with all the assembled information
374
     */
375
    public PreservedSpecimenDTO assemblePreservedSpecimenDTO(DerivedUnit derivedUnit);
376

    
377
    /**
378
     * Returns a collection of {@link ICdmBase}s that are not persisted via cascading when saving the given specimen (mostly DefinedTerms).
379
     * @param specimen the specimen that is checked for non-cascaded elements.
380
     * @return collection of non-cascaded element associated with the specimen
381
     */
382
    public Collection<ICdmBase> getNonCascadedAssociatedElements(SpecimenOrObservationBase<?> specimen);
383

    
384
    /**
385
     * Deletes the specified specimen according to the setting in the {@link SpecimenDeleteConfigurator}.<br>
386
     * @param specimen the specimen which shoul be deleted
387
     * @param config specifies options if and how the specimen should be deleted like e.g. including all
388
     * of its children
389
     * @return the {@link DeleteResult} which holds information about the outcome of this operation
390
     */
391
    public DeleteResult delete(SpecimenOrObservationBase<?> specimen, SpecimenDeleteConfigurator config);
392

    
393
    /**
394
     * Deletes the specified specimen and all sub derivates.<br>
395
     * <b>Note:</b> Be sure to allow child deletion in the config.
396
     * @param from the specimen which should be deleted with all its sub derivates
397
     * @param config the {@link SpecimenDeleteConfigurator} to specify how the deletion should be handled
398
     * @return the {@link DeleteResult} which holds information about the outcome of this operation
399
     */
400
    public DeleteResult deleteDerivateHierarchy(CdmBase from, SpecimenDeleteConfigurator config);
401

    
402
    /**
403
     * Deletes the specified specimen and all sub derivates by first loading the corresponding uuids
404
     * and then calling {@link #deleteDerivateHierarchy(CdmBase, SpecimenDeleteConfigurator) deleteDerivateHierarchy}
405
     * @param fromUuid uuid of the specimen which should be deleted with all its sub derivates
406
     * @param config the {@link SpecimenDeleteConfigurator} to specify how the deletion should be handled
407
     * @return {@link DeleteResult} which holds information about the outcome of this operation
408
     */
409
    public DeleteResult deleteDerivateHierarchy(UUID fromUuid, SpecimenDeleteConfigurator config);
410

    
411
    /**
412
     * Retrieves all {@link IndividualsAssociation} with the given specimen.<br>
413
     * @param specimen the specimen for which the associations are retrieved
414
     * @param limit
415
     * @param start
416
     * @param orderHints
417
     * @param propertyPaths
418
     * @return collection of all associations
419
     */
420
    public Collection<IndividualsAssociation> listIndividualsAssociations(SpecimenOrObservationBase<?> specimen, Integer limit, Integer start, List<OrderHint> orderHints, List<String> propertyPaths);
421

    
422
    /**
423
     * Retrieves all associated taxa for the given specimen
424
     * @param specimen
425
     * @param limit
426
     * @param start
427
     * @param orderHints
428
     * @param propertyPaths
429
     * @return
430
     */
431
    public Collection<TaxonBase<?>> listAssociatedTaxa(SpecimenOrObservationBase<?> specimen, Integer limit, Integer start, List<OrderHint> orderHints, List<String> propertyPaths);
432

    
433
    /**
434
     * Retrieves all {@link SpecimenTypeDesignation}s which have the given specimen as a type specimen.
435
     * @param specimen the type specimen
436
     * @param limit
437
     * @param start
438
     * @param orderHints
439
     * @param propertyPaths
440
     * @return collection of all designations with the given type specimen
441
     */
442
    public Collection<SpecimenTypeDesignation> listTypeDesignations(SpecimenOrObservationBase<?> specimen, Integer limit, Integer start, List<OrderHint> orderHints, List<String> propertyPaths);
443

    
444
    /**
445
     * Retrieves all {@link DescriptionBase}s that have the given specimen set as described specimen.
446
     * @param specimen the described specimen
447
     * @param limit
448
     * @param start
449
     * @param orderHints
450
     * @param propertyPaths
451
     * @return collection of all descriptions with the given described specimen
452
     */
453
    public Collection<DescriptionBase<?>> listDescriptionsWithDescriptionSpecimen(SpecimenOrObservationBase<?> specimen, Integer limit, Integer start, List<OrderHint> orderHints, List<String> propertyPaths);
454

    
455
    /**
456
     * Gets all description elements that are used for describing the character
457
     * states of the given specimen
458
     *
459
     * @param specimen
460
     *            the specimen for which the character state description
461
     *            elements should be retrieved
462
     * @return a collection of all character state description elements for this
463
     *         specimen
464
     */
465
    public Collection<DescriptionElementBase> getCharacterDataForSpecimen(SpecimenOrObservationBase<?> specimen);
466

    
467
    /**
468
     * Gets all description elements that are used for describing the character
469
     * states of the given specimen
470
     *
471
     * @param specimenUuid
472
     *            the specimen {@link UUID} for which the character state description
473
     *            elements should be retrieved
474
     * @return a collection of all character state description elements for this
475
     *         specimen
476
     */
477
    public Collection<DescriptionElementBase> getCharacterDataForSpecimen(UUID specimenUuid);
478

    
479
    /**
480
     * Returns the most significant identifier for the given {@link DerivedUnit}.
481
     * @param derivedUnit the derived unit to check
482
     * @return the identifier string
483
     */
484
    public String getMostSignificantIdentifier(DerivedUnit derivedUnit);
485

    
486
    /**
487
     * Returns the number of specimens that match the given parameters
488
     * @param clazz the class to match
489
     * @param queryString the queryString to match
490
     * @param type the {@link SpecimenOrObservationType} to match
491
     * @param associatedTaxon the taxon these specimens are in any way associated to via
492
     * determination, type designations, individuals associations, etc.
493
     * @param matchmode determines how the query string should be matched
494
     * @param limit
495
     *            the maximum number of entities returned (can be null to return
496
     *            all entities)
497
     * @param start
498
     * @param orderHints
499
     *            Supports path like <code>orderHints.propertyNames</code> which
500
     *            include *-to-one properties like createdBy.username or
501
     *            authorTeam.persistentTitleCache
502
     * @return the number of found specimens
503
     */
504
    public int countOccurrences(IIdentifiableEntityServiceConfigurator<SpecimenOrObservationBase> config);
505

    
506
    /**
507
     * Return the all {@link SpecimenOrObservationBase}s of the complete
508
     * derivative hierarchy i.e. all parent and child derivatives and the given
509
     * specimen itself.
510
     *
511
     * @param specimen
512
     *            a specimen or observation
513
     * @return the derivative hierarchy as an unordered list of all specimens or observation
514
     */
515
    public List<SpecimenOrObservationBase<?>> getAllHierarchyDerivatives(SpecimenOrObservationBase<?> specimen);
516

    
517
    /**
518
     * Returns all child derivatives of the given specimen.
519
     * @param specimen a specimen or observation
520
     * @return an unordered list of all child derivatives
521
     */
522
    public List<DerivedUnit> getAllChildDerivatives(SpecimenOrObservationBase<?> specimen);
523

    
524
    /**
525
     * Deletes a {@link SingleRead} from the given {@link Sequence} and its {@link AmplificationResult}.
526
     * @param singleRead the single read to delete
527
     * @param sequence the sequence to which the single read belongs
528
     * @return the {@link DeleteResult} which holds information about the outcome of this operation
529
     */
530
    public DeleteResult deleteSingleRead(SingleRead singleRead, Sequence sequence);
531

    
532
    /**
533
     * Deletes a {@link SingleRead} from the given {@link Sequence} and its {@link AmplificationResult},
534
     * by first loading the corresponding uuids and then calling {@link #deleteSingleRead(SingleRead, Sequence) deleteSingleRead}
535
     * @param singleReadUuid uuid of the single read to delete
536
     * @param sequenceUuid uuid of the sequence to which the single read belongs
537
     * @return the {@link DeleteResult} which holds information about the outcome of this operation
538
     */
539
    public DeleteResult deleteSingleRead(UUID singleReadUuid, UUID sequenceUuid);
540

    
541
}
(50-50/92)