2 * Copyright (C) 2008 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
7 package eu
.etaxonomy
.cdm
.persistence
.dao
.occurrence
;
11 import org
.springframework
.dao
.DataAccessException
;
13 import eu
.etaxonomy
.cdm
.model
.common
.UuidAndTitleCache
;
14 import eu
.etaxonomy
.cdm
.model
.description
.IndividualsAssociation
;
15 import eu
.etaxonomy
.cdm
.model
.description
.TaxonDescription
;
16 import eu
.etaxonomy
.cdm
.model
.media
.Media
;
17 import eu
.etaxonomy
.cdm
.model
.name
.HomotypicalGroup
;
18 import eu
.etaxonomy
.cdm
.model
.occurrence
.DerivationEvent
;
19 import eu
.etaxonomy
.cdm
.model
.occurrence
.DerivedUnit
;
20 import eu
.etaxonomy
.cdm
.model
.occurrence
.DeterminationEvent
;
21 import eu
.etaxonomy
.cdm
.model
.occurrence
.FieldUnit
;
22 import eu
.etaxonomy
.cdm
.model
.occurrence
.SpecimenOrObservationBase
;
23 import eu
.etaxonomy
.cdm
.model
.taxon
.Taxon
;
24 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonBase
;
25 import eu
.etaxonomy
.cdm
.persistence
.dao
.common
.IIdentifiableDao
;
26 import eu
.etaxonomy
.cdm
.persistence
.dao
.initializer
.IBeanInitializer
;
27 import eu
.etaxonomy
.cdm
.persistence
.query
.OrderHint
;
30 * @author a.babadshanjan
33 public interface IOccurrenceDao
extends IIdentifiableDao
<SpecimenOrObservationBase
> {
36 * Returns the number of occurences belonging to a certain subclass - which must extend SpecimenOrObservationBase
37 * @param clazz optionally restrict the counted occurrences to those of a certain subclass of SpecimenOrObservationBase
38 * @param determinedAs the taxon concept that these specimens are determined to belong to
41 public int count(Class
<?
extends SpecimenOrObservationBase
> clazz
,TaxonBase determinedAs
);
44 * Returns a sublist of SpecimenOrObservationBase instances stored in the database. A maximum
45 * of 'limit' objects are returned, starting at object with index 'start'. Only occurrences which
46 * have been determined to belong to the supplied concept are returned.
49 * @param determinedAs the taxon concept that these specimens are determined to belong to
51 * the maximum number of entities returned (can be null to return
55 * Supports path like <code>orderHints.propertyNames</code> which
56 * include *-to-one properties like createdBy.username or
57 * authorTeam.persistentTitleCache
59 * @throws DataAccessException
61 public List
<SpecimenOrObservationBase
> list(Class
<?
extends SpecimenOrObservationBase
> type
, TaxonBase determinedAs
, Integer limit
, Integer start
, List
<OrderHint
> orderHints
, List
<String
> propertyPaths
);
64 * Returns a count of Media that are associated with a given occurence
66 * @param occurence the occurence associated with these media
67 * @return a count of media instances
69 public int countMedia(SpecimenOrObservationBase occurence
);
72 * Returns a List of Media that are associated with a given occurence
74 * @param occurence the occurence associated with these media
75 * @param pageSize The maximum number of media returned (can be null for all related media)
76 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
77 * @param propertyPaths properties to initialize - see {@link IBeanInitializer#initialize(Object, List)}
78 * @return a List of media instances
80 public List
<Media
> getMedia(SpecimenOrObservationBase occurence
, Integer pageSize
, Integer pageNumber
, List
<String
> propertyPaths
);
83 * Returns a count of determinations that have been made for a given occurence and for a given taxon concept
85 * @param occurence the occurence associated with these determinations (can be null for all occurrences)
86 * @param taxonbase the taxon concept associated with these determinations (can be null for all taxon concepts)
87 * @return a count of determination events
89 public int countDeterminations(SpecimenOrObservationBase occurence
,TaxonBase taxonbase
);
92 * Returns a List of determinations that have been made for a given occurence and for a given taxon concept
94 * @param occurence the occurence associated with these determinations (can be null for all occurrences)
95 * @param taxonbase the taxon concept associated with these determinations (can be null for all taxon concepts)
96 * @param pageSize The maximum number of determinations returned (can be null for all related determinations)
97 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
98 * @param propertyPaths properties to initialize - see {@link IBeanInitializer#initialize(Object, List)}
99 * @return a List of determination instances
101 public List
<DeterminationEvent
> getDeterminations(SpecimenOrObservationBase occurence
,TaxonBase taxonbase
, Integer pageSize
, Integer pageNumber
, List
<String
> propertyPaths
);
104 * Returns a count of derivation events that have involved creating new DerivedUnits from this occurence
106 * @param occurence the occurence that was a source of these derivation events
107 * @return a count of derivation events
109 public int countDerivationEvents(SpecimenOrObservationBase occurence
);
112 * Returns a list of derivation events that have involved creating new DerivedUnits from this occurence
114 * @param occurence the occurence that was a source of these derivation events
115 * @param pageSize The maximum number of derivation events returned (can be null for all related derivation events)
116 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
117 * @param propertyPaths properties to initialize - see {@link IBeanInitializer#initialize(Object, List)}
118 * @return a List of derivation events
120 public List
<DerivationEvent
> getDerivationEvents(SpecimenOrObservationBase occurence
, Integer pageSize
, Integer pageNumber
, List
<String
> propertyPaths
);
122 public List
<UuidAndTitleCache
<FieldUnit
>> getFieldUnitUuidAndTitleCache();
124 public List
<UuidAndTitleCache
<DerivedUnit
>> getDerivedUnitUuidAndTitleCache();
127 * Lists all instances of {@link SpecimenOrObservationBase} which are associated with the <code>taxon</code> specified as parameter.
128 * SpecimenOrObservationBase instances can be associated to taxa in multiple ways, all these possible relations are taken into account:
130 * <li>The {@link IndividualsAssociation} elements in a {@link TaxonDescription} contain {@link DerivedUnit}s</li>
131 * <li>{@link SpecimenTypeDesignation}s may be associated with any {@link HomotypicalGroup} related to the specific {@link Taxon}.</li>
132 * <li>A {@link Taxon} may be referenced by the {@link DeterminationEvent} of the {@link SpecimenOrObservationBase}</li>
137 * @param associatedTaxon
141 * @param propertyPaths
144 public <T
extends SpecimenOrObservationBase
> List
<T
> listByAssociatedTaxon(Class
<T
> type
, Taxon associatedTaxon
,
145 Integer limit
, Integer start
, List
<OrderHint
> orderHints
, List
<String
> propertyPaths
);