Project

General

Profile

Download (17.3 KB) Statistics
| Branch: | Tag: | Revision:
1
/**
2
* Copyright (C) 2007 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.persistence.dao.description;
11

    
12
import java.util.List;
13
import java.util.Set;
14
import java.util.UUID;
15

    
16
import eu.etaxonomy.cdm.model.common.DefinedTerm;
17
import eu.etaxonomy.cdm.model.common.MarkerType;
18
import eu.etaxonomy.cdm.model.description.CommonTaxonName;
19
import eu.etaxonomy.cdm.model.description.DescriptionBase;
20
import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
21
import eu.etaxonomy.cdm.model.description.Distribution;
22
import eu.etaxonomy.cdm.model.description.Feature;
23
import eu.etaxonomy.cdm.model.description.PresenceAbsenceTerm;
24
import eu.etaxonomy.cdm.model.description.TaxonDescription;
25
import eu.etaxonomy.cdm.model.description.TaxonNameDescription;
26
import eu.etaxonomy.cdm.model.location.NamedArea;
27
import eu.etaxonomy.cdm.model.media.Media;
28
import eu.etaxonomy.cdm.model.name.TaxonNameBase;
29
import eu.etaxonomy.cdm.model.taxon.Taxon;
30
import eu.etaxonomy.cdm.persistence.dao.common.IIdentifiableDao;
31
import eu.etaxonomy.cdm.persistence.dao.initializer.IBeanInitializer;
32
import eu.etaxonomy.cdm.persistence.dao.media.IMediaDao;
33
import eu.etaxonomy.cdm.persistence.dto.TermDto;
34
import eu.etaxonomy.cdm.persistence.query.MatchMode;
35
import eu.etaxonomy.cdm.persistence.query.OrderHint;
36

    
37
public interface IDescriptionDao extends IIdentifiableDao<DescriptionBase> {
38
    /**
39
     * List the descriptions of type <TYPE>, filtered using the following parameters
40
     *
41
     * @param type The type of description returned (Taxon, TaxonName, or Specimen)
42
     * @param hasMedia Restrict the description to those that do (true) or don't (false) contain <i>elements</i> that have one or more media (can be null)
43
     * @param hasText Restrict the description to those that do (true) or don't (false) contain TextData <i>elements</i> that have some textual content (can be null)
44
     * @param feature Restrict the description to those <i>elements</i> which are scoped by one of the Features passed (can be null or empty)
45
     * @param pageSize The maximum number of descriptions returned (can be null for all descriptions)
46
     * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
47
     * @param orderHints may be null
48
     * @param propertyPaths properties to initialize - see {@link IBeanInitializer#initialize(Object, List)}
49
     * @return a List of DescriptionBase instances
50
     */
51
     List<DescriptionBase> listDescriptions(Class<? extends DescriptionBase> type, Boolean hasMedia, Boolean hasText, Set<Feature> feature, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);
52

    
53
    /**
54
     * Count the descriptions of type <TYPE>, filtered using the following parameters
55
     *
56
     * @param type The type of description returned (Taxon, TaxonName, or Specimen)
57
     * @param hasMedia Restrict the description to those that do (true) or don't (false) contain <i>elements</i> that have one or more media (can be null)
58
     * @param hasText Restrict the description to those that do (true) or don't (false) contain TextData <i>elements</i> that have some textual content (can be null)
59
     * @param feature Restrict the description to those <i>elements</i> which are scoped by one of the Features passed (can be null or empty)
60
     * @return a count of DescriptionBase instances
61
     */
62
     int countDescriptions(Class<? extends DescriptionBase> type, Boolean hasImages, Boolean hasText, Set<Feature> feature);
63

    
64
    /**
65
     * Returns a count of TaxonDescription instances, optionally filtered by parameters passed to this method
66
     *
67
     * @param taxon Restrict the results to those descriptions that refer to a specific taxon (can be null for all TaxonDescription instances)
68
     * @param scopes Restrict the results to those descriptions which are scoped by one of the Scope instances passed (can be null or empty)
69
     * @param geographicalScope Restrict the results to those descriptions which have a geographical scope that overlaps with the NamedArea instances passed (can be null or empty)
70
     * @param markerType Restrict the results to those descriptions which are marked as true by one of the given marker types (can be null or empty)
71
     * @return a count of TaxonDescription instances
72
     */
73
    int countTaxonDescriptions(Taxon taxon, Set<DefinedTerm> scopes, Set<NamedArea> geographicalScope, Set<MarkerType> markerType);
74

    
75
    /**
76
     * Returns description elements of type <TYPE>, belonging to a given description, optionally filtered by one or more features
77
     *
78
     * @param description The description which these description elements belong to (can be null to count all description elements)
79
     * @param features Restrict the results to those description elements which are scoped by one of the Features passed (can be null or empty)
80
     * @param type The type of description
81
     * @param pageSize The maximum number of description elements returned (can be null for all description elements)
82
     * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
83
     * @param propertyPaths Properties to initialize in the returned entities, following the syntax described in {@link IBeanInitializer#initialize(Object, List)}
84
     * @return a List of DescriptionElementBase instances
85
     * @deprecated use {@link #getDescriptionElements(DescriptionBase, Class, Set, Class, Integer, Integer, List)} instead
86
     */
87
     @Deprecated
88
     <T extends DescriptionElementBase> List<T> getDescriptionElements(DescriptionBase description,Set<Feature> features, Class<T> type, Integer pageSize, Integer pageNumber, List<String> propertyPaths);
89

    
90
    /**
91
     * Returns description elements of type <TYPE>, belonging to a given
92
     * description, optionally filtered by one or more features
93
     *
94
     * @param description
95
     *            The description which these description elements belong to
96
     *            (can be null to count all description elements)
97
     * @param descriptionType
98
     *            A filter DescriptionElements which belong to of a specific class
99
     *            of Descriptions
100
     * @param features
101
     *            Restrict the results to those description elements which are
102
     *            scoped by one of the Features passed (can be null or empty)
103
     * @param type
104
     *            A filter for DescriptionElements of a specific class
105
     * @param pageSize
106
     *            The maximum number of description elements returned (can be
107
     *            null for all description elements)
108
     * @param pageNumber
109
     *            The offset (in pageSize chunks) from the start of the result
110
     *            set (0 - based)
111
     * @param propertyPaths
112
     *            Properties to initialize in the returned entities, following
113
     *            the syntax described in
114
     *            {@link IBeanInitializer#initialize(Object, List)}
115
     * @return a List of DescriptionElementBase instances
116
     */
117
    <T extends DescriptionElementBase> List<T> getDescriptionElements(DescriptionBase description, Class<? extends DescriptionBase> descriptionType, Set<Feature> features, Class<T> type, Integer pageSize, Integer pageNumber, List<String> propertyPaths);
118

    
119

    
120
    /**
121
     * Returns a count of description elements of type <TYPE>, belonging to a given description, optionally filtered by one or more features
122
     *
123
     * @param description The description which these description elements belong to (can be null to count all description elements)
124
     * @param features Restrict the results to those description elements which are scoped by one of the Features passed (can be null or empty)
125
     * @param type A filter for DescriptionElements of a specific class
126
     * @return a count of DescriptionElementBase instances
127
     * @deprecated use {@link #countDescriptionElements(DescriptionBase, Class, Set, Class)} instead
128
     */
129
    @Deprecated
130
    <T extends DescriptionElementBase> int countDescriptionElements(DescriptionBase description, Set<Feature> features, Class<T> type);
131

    
132
    /**
133
     * Returns a count of description elements of type <TYPE>, belonging to a
134
     * given description, optionally filtered by one or more features
135
     *
136
     * @param description
137
     *            The description which these description elements belong to
138
     *            (can be null to count all description elements)
139
     * @param descriptionType
140
     *            A filter DescriptionElements which belong to of a specific
141
     *            class of Descriptions
142
     * @param features
143
     *            Restrict the results to those description elements which are
144
     *            scoped by one of the Features passed (can be null or empty)
145
     * @param type
146
     *            The type of description
147
     * @return a count of DescriptionElementBase instances
148
     */
149
    <T extends DescriptionElementBase> int countDescriptionElements(DescriptionBase description, Class<? extends DescriptionBase> descriptionType, Set<Feature> features, Class<T> type);
150

    
151
    /**
152
     * Returns a List of TaxonDescription instances, optionally filtered by parameters passed to this method
153
     *
154
     * @param taxon The taxon which the description refers to (can be null for all TaxonDescription instances)
155
     * @param scopes Restrict the results to those descriptions which are scoped by one of the Scope instances passed (can be null or empty)
156
     * @param geographicalScope Restrict the results to those descriptions which have a geographical scope that overlaps with the NamedArea instances passed (can be null or empty)
157
     * @param markerTypes Restrict the results to those descriptions which are marked as true by one of the given marker types (can be null or empty)
158
     * @param pageSize The maximum number of descriptions returned (can be null for all descriptions)
159
     * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
160
     * @param propertyPaths Properties to initialize in the returned entities, following the syntax described in {@link IBeanInitializer#initialize(Object, List)}
161
     * @return a List of TaxonDescription instances
162
     */
163
    List<TaxonDescription> listTaxonDescriptions(Taxon taxon, Set<DefinedTerm> scopes, Set<NamedArea> geographicalScope, Set<MarkerType> markerTypes, Integer pageSize, Integer pageNumber, List<String> propertyPaths);
164

    
165
    /**
166
     * Returns a List of Media instances, optionally filtered by parameters passed to this method.
167
     * Maybe in future a similar method is implemented in {@link IMediaDao} which allows more
168
     * media sources to be included.
169
     *
170
     * @param taxonUuid The taxon uuid of the taxon which the description refers to (can be null for all TaxonDescription instances)
171
     * @param restrictToGalleries if true, only returns media from TaxonDescriptions with isImageGallery = true
172
     * @param markerTypes Restrict the results to those descriptions which are marked as true by one of the given marker types (can be null or empty)
173
     * @param pageSize The maximum number of descriptions returned (can be null for all descriptions)
174
     * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
175
     * @param propertyPaths Properties to initialize in the returned entities, following the syntax described in {@link IBeanInitializer#initialize(Object, List)}
176
     * @return a List of Media instances
177
     */
178
    List<Media> listTaxonDescriptionMedia(UUID taxonUuid, Boolean restrictToGalleries, Set<MarkerType> markerTypes, Integer pageSize, Integer pageNumber, List<String> propertyPaths);
179

    
180
    /**
181
     * Returns a count of Media instances, optionally filtered by parameters passed to this method
182
     * Maybe in future a similar method is implemented in {@link IMediaDao} which allows more
183
     * media sources to be included.
184
     *
185
     * @param taxonUuid The taxon uuid of the taxon which the description refers to (can be null for all TaxonDescription instances)
186
     * @param restrictToGalleries if true, only returns media from TaxonDescriptions with isImageGallery = true
187
     * @param markerTypes Restrict the results to those descriptions which are marked as true by one of the given marker types (can be null or empty)
188
     * @return a count of Media instances
189
     */
190
    int countTaxonDescriptionMedia(UUID taxonUuid, Boolean restrictToGalleries, Set<MarkerType> markerTypes);
191

    
192

    
193
    /**
194
     * Returns a List of TaxonNameDescription instances, optionally filtered by the name which they refer to
195
     *
196
     * @param name Restrict the results to those descripDescriptionElementBasetions that refer to a specific name (can be null for all TaxonNameDescription instances)
197
     * @param pageSize The maximum number of descriptions returned (can be null for all descriptions)
198
     * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
199
     * @param propertyPaths Properties to initialize in the returned entities, following the syntax described in {@link IBeanInitializer#initialize(Object, List)}
200
     * @return a List of TaxonNameBase instances
201
     */
202
    List<TaxonNameDescription> getTaxonNameDescriptions(TaxonNameBase name, Integer pageSize, Integer pageNumber, List<String> propertyPaths);
203

    
204
    /**
205
     * Returns a count of TaxonNameDescription instances, optionally filtered by the name which they refer to
206
     *
207
     * @param name Restrict the results to those descriptions that refer to a specific name (can be null for all TaxonNameDescription instances)
208
     * @return a count of TaxonNameBase instances
209
     */
210
    int countTaxonNameDescriptions(TaxonNameBase name);
211

    
212
    /**
213
     * Returns a List of distinct TaxonDescription instances which have Distribution elements that refer to one of the NamedArea instances passed (optionally
214
     * filtered by a type of PresenceAbsenceTerm e.g. PRESENT / ABSENT / NATIVE / CULTIVATED etc)
215
     *
216
     * @param namedAreas The set of NamedArea instances
217
     * @param presence Restrict the descriptions to those which have Distribution elements are of this status (can be null)
218
     * @param pageSize The maximum number of descriptions returned (can be null for all descriptions)
219
     * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
220
     * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
221
     * @param propertyPaths Properties to initialize in the returned entities, following the syntax described in {@link IBeanInitializer#initialize(Object, List)}
222
     * @return a List of TaxonDescription instances
223
     */
224
    List<TaxonDescription> searchDescriptionByDistribution(Set<NamedArea> namedAreas, PresenceAbsenceTerm presence, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);
225

    
226
    /**
227
     * Returns a list of CommonTaxonName instances that match a search string
228
     * @param searchString
229
     * @param pageSize
230
     * @param pageNumber
231
     * @return
232
     */
233
    List<CommonTaxonName> searchDescriptionByCommonName(String queryString, MatchMode matchMode, Integer pageSize, Integer pageNumber);
234

    
235

    
236
    /**
237
     * @param queryString
238
     * @param matchMode
239
     * @return
240
     */
241
    Integer countDescriptionByCommonName(String queryString, MatchMode matchMode);
242

    
243
    /**
244
     * Returns a count of distinct TaxonDescription instances which have Distribution elements that refer to one of the NamedArea instances passed (optionally
245
     * filtered by a type of PresenceAbsenceTerm e.g. PRESENT / ABSENT / NATIVE / CULTIVATED etc)
246
     *
247
     * @param namedAreas The set of NamedArea instances
248
     * @param presence Restrict the descriptions to those which have Distribution elements are of this status (can be null)
249
     * @return a count of TaxonDescription instances
250
     */
251
    int countDescriptionByDistribution(Set<NamedArea> namedAreas, PresenceAbsenceTerm presence);
252

    
253
    /**
254
     * @param taxon
255
     * @param features
256
     *            Restrict the results to those description elements which are
257
     *            scoped by one of the Features passed (can be null or empty)
258
     * @param type A filter for DescriptionElements of a specific class
259
     * @param pageSize
260
     * @param pageNumber
261
     * @param propertyPaths
262
     * @return the list of matching DescriptionElementBase instances
263
     */
264
    <T extends DescriptionElementBase> List<T> getDescriptionElementForTaxon(UUID taxonUuid,
265
            Set<Feature> features,
266
            Class<T> type, Integer pageSize,
267
            Integer pageNumber, List<String> propertyPaths);
268

    
269
    /**
270
     * @param taxon
271
     * @param features
272
     *            Restrict the results to those description elements which are
273
     *            scoped by one of the Features passed (can be null or empty)
274
     * @param type A filter for DescriptionElements of a specific class
275
     * @return the count of matching TaxonDescription instances
276
     */
277
    <T extends DescriptionElementBase> long countDescriptionElementForTaxon(UUID taxonUuid,
278
            Set<Feature> features, Class<T> type);
279

    
280
    /**
281
     * Method to list all {@link NamedAreas} instances which are currently used
282
     * by {@link Distribution} elements.
283
     * @param includeAllParents if set to true all parent areas will be included in the result set
284
     * @param pageSize
285
     * @param pageNumber
286
     *
287
     * @return
288
     */
289
    List<TermDto> listNamedAreasInUse(boolean includeAllParents, Integer pageSize, Integer pageNumber);
290
}
(1-1/10)