Project

General

Profile

Download (11.3 KB) Statistics
| Branch: | Tag: | Revision:
1
// $Id$
2
/**
3
* Copyright (C) 2007 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.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 eu.etaxonomy.cdm.api.service.pager.Pager;
20
import eu.etaxonomy.cdm.model.common.TermVocabulary;
21
import eu.etaxonomy.cdm.model.common.VersionableEntity;
22
import eu.etaxonomy.cdm.model.description.DescriptionBase;
23
import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
24
import eu.etaxonomy.cdm.model.description.Feature;
25
import eu.etaxonomy.cdm.model.description.FeatureNode;
26
import eu.etaxonomy.cdm.model.description.FeatureTree;
27
import eu.etaxonomy.cdm.model.description.PresenceAbsenceTermBase;
28
import eu.etaxonomy.cdm.model.description.Scope;
29
import eu.etaxonomy.cdm.model.description.TaxonDescription;
30
import eu.etaxonomy.cdm.model.description.TaxonNameDescription;
31
import eu.etaxonomy.cdm.model.location.NamedArea;
32
import eu.etaxonomy.cdm.model.media.Media;
33
import eu.etaxonomy.cdm.model.name.TaxonNameBase;
34
import eu.etaxonomy.cdm.model.taxon.Taxon;
35
import eu.etaxonomy.cdm.persistence.dao.BeanInitializer;
36
import eu.etaxonomy.cdm.persistence.query.OrderHint;
37

    
38
public interface IDescriptionService extends IIdentifiableEntityService<DescriptionBase> {
39
	
40
	/**
41
	 * 
42
	 * @return
43
	 * @deprecated use TermService#getVocabulary(VocabularyType) instead
44
	 */
45
	public TermVocabulary<Feature> getDefaultFeatureVocabulary();
46

    
47
	/**
48
	 * @deprecated use TermService#getVocabulary(VocabularyType) instead
49
	 */
50
	public TermVocabulary<Feature> getFeatureVocabulary(UUID uuid);
51

    
52
	/**
53
	 * Gets a DescriptionElementBase instance matching the supplied uuid
54
	 * 
55
	 * @param uuid the uuid of the DescriptionElement of interest
56
	 * @return a DescriptionElement, or null if the DescriptionElement does not exist
57
	 */
58
	public DescriptionElementBase getDescriptionElementByUuid(UUID uuid);
59
	
60
	/**
61
	 * Loads and existing DescriptionElementBase instance matching the supplied uuid,
62
	 * and recursively initializes all bean properties given in the
63
	 * <code>propertyPaths</code> parameter.
64
	 * <p>
65
	 * For detailed description and examples <b>please refer to:</b> 
66
	 * {@link BeanInitializer#initialize(Object, List)}
67
	 * 
68
	 * @param uuid the uuid of the DescriptionElement of interest
69
	 * @return a DescriptionElement, or null if the DescriptionElement does not exist
70
	 */
71
	public DescriptionElementBase loadDescriptionElement(UUID uuid,List<String> propertyPaths);
72
	
73
	/**
74
	 * Persists a <code>DescriptionElementBase</code>
75
	 * @param descriptionElement
76
	 * @return
77
	 */
78
	public UUID saveDescriptionElement(DescriptionElementBase descriptionElement);
79
	
80
	/**
81
	 * Delete an existing description element
82
	 * 
83
	 * @param descriptionElement the description element to be deleted
84
	 * @return the unique identifier of the deleted entity
85
	 */
86
	public UUID deleteDescriptionElement(DescriptionElementBase descriptionElement);
87
	
88
	/**
89
	 * List the descriptions of type <T>, filtered using the following parameters
90
	 *  
91
	 * @param type The type of description returned (Taxon, TaxonName, or Specimen)
92
	 * @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)
93
	 * @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)
94
	 * @param feature Restrict the description to those <i>elements</i> which are scoped by one of the Features passed (can be null or empty)
95
	 * @param pageSize The maximum number of descriptions returned (can be null for all descriptions)
96
	 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
97
	 * @param orderHints may be null
98
	 * @param propertyPaths properties to initialize - see {@link BeanInitializer#initialize(Object, List)}
99
	 * @return a Pager containing DescriptionBase instances
100
	 */
101
	public Pager<DescriptionBase> page(Class<? extends DescriptionBase> type, Boolean hasMedia, Boolean hasText, Set<Feature> feature, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);
102
	
103
	/**
104
	 * Count the descriptions of type <TYPE>, filtered using the following parameters
105
	 * 
106
	 * @param type The type of description returned (Taxon, TaxonName, or Specimen)
107
	 * @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)
108
	 * @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)
109
	 * @param feature Restrict the description to those <i>elements</i> which are scoped by one of the Features passed (can be null or empty)
110
	 * @return a count of DescriptionBase instances
111
	 */
112
	public int count(Class<? extends DescriptionBase> type, Boolean hasImages, Boolean hasText, Set<Feature> feature);
113
	
114
	/**
115
	 * Returns description elements of type <TYPE>, belonging to a given description, optionally filtered by one or more features
116
	 * 
117
	 * @param description The description which these description elements belong to (can be null to count all description elements)
118
	 * @param features Restrict the results to those description elements which are scoped by one of the Features passed (can be null or empty)
119
	 * @param type The type of description
120
	 * @param class 
121
	 * @param pageSize The maximum number of description elements returned (can be null for all description elements)
122
	 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
123
	 * @param propertyPaths Properties to initialize in the returned entities, following the syntax described in {@link BeanInitializer#initialize(Object, List)}
124
	 * @return a Pager containing DescriptionElementBase instances
125
	 */
126
	public Pager<DescriptionElementBase> getDescriptionElements(DescriptionBase description,Set<Feature> features, Class<? extends DescriptionElementBase> type, Integer pageSize, Integer pageNumber, List<String> propertyPaths);
127
	
128
	/**
129
	 * Returns a List of TaxonDescription instances, optionally filtered by parameters passed to this method
130
	 * 
131
	 * @param taxon The taxon which the description refers to (can be null for all TaxonDescription instances)
132
	 * @param scopes Restrict the results to those descriptions which are scoped by one of the Scope instances passed (can be null or empty)
133
	 * @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)
134
	 * @param pageSize The maximum number of descriptions returned (can be null for all descriptions)
135
	 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
136
	 * @param propertyPaths Properties to initialize in the returned entities, following the syntax described in {@link BeanInitializer#initialize(Object, List)}
137
	 * @return a Pager containing TaxonDescription instances
138
	 */
139
	public Pager<TaxonDescription> getTaxonDescriptions(Taxon taxon, Set<Scope> scopes, Set<NamedArea> geographicalScope, Integer pageSize, Integer pageNumber, List<String> propertyPaths);
140
	
141
	/**
142
	 * Returns a List of TaxonNameDescription instances, optionally filtered by the name which they refer to
143
	 * 
144
	 * @param name Restrict the results to those descriptions that refer to a specific name (can be null for all TaxonNameDescription instances)
145
	 * @param pageSize The maximum number of descriptions returned (can be null for all descriptions)
146
	 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
147
	 * @param propertyPaths Properties to initialize in the returned entities, following the syntax described in {@link BeanInitializer#initialize(Object, List)}
148
	 * @return a Pager containing TaxonNameBase instances
149
	 */
150
	public Pager<TaxonNameDescription> getTaxonNameDescriptions(TaxonNameBase name, Integer pageSize, Integer pageNumber, List<String> propertyPaths);
151
	
152
	/**
153
	 * Returns a List of distinct TaxonDescription instances which have Distribution elements that refer to one of the NamedArea instances passed (optionally
154
	 * filtered by a type of PresenceAbsenceTerm e.g. PRESENT / ABSENT / NATIVE / CULTIVATED etc)
155
	 * 
156
	 * @param namedAreas The set of NamedArea instances
157
	 * @param presence Restrict the descriptions to those which have Distribution elements are of this status (can be null)
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 pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
161
	 * @param propertyPaths Properties to initialize in the returned entities, following the syntax described in {@link BeanInitializer#initialize(Object, List)}
162
	 * @return a Pager containing TaxonDescription instances
163
	 */
164
	public Pager<TaxonDescription> searchDescriptionByDistribution(Set<NamedArea> namedAreas, PresenceAbsenceTermBase presence, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);
165
	
166
	/**
167
	 * Returns a Paged List of DescriptionElementBase instances where the default field matches the String queryString (as interpreted by the Lucene QueryParser)
168
	 * 
169
	 * @param clazz filter the results by class (or pass null to return all DescriptionElementBase instances)
170
	 * @param queryString
171
	 * @param pageSize The maximum number of descriptionElements returned (can be null for all matching descriptionElements)
172
	 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
173
	 * @param orderHints
174
	 *            Supports path like <code>orderHints.propertyNames</code> which
175
	 *            include *-to-one properties like createdBy.username or
176
	 *            authorTeam.persistentTitleCache
177
	 * @param propertyPaths properties to be initialized
178
	 * @return a Pager DescriptionElementBase instances
179
	 * @see <a href="http://lucene.apache.org/java/2_4_0/queryparsersyntax.html">Apache Lucene - Query Parser Syntax</a>
180
	 */
181
	public Pager<DescriptionElementBase> search(Class<? extends DescriptionElementBase> clazz, String queryString, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);
182
	
183
	/**
184
     * Returns a List of Media that are associated with a given description element
185
     * 
186
	 * @param descriptionElement the description element associated with these media
187
	 * @param pageSize The maximum number of media returned (can be null for all related media)
188
	 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
189
	 * @param propertyPaths properties to initialize - see {@link BeanInitializer#initialize(Object, List)}
190
     * @return a Pager containing media instances
191
     */
192
    public Pager<Media> getMedia(DescriptionElementBase descriptionElement, Integer pageSize, Integer pageNumber, List<String> propertyPaths);
193
}
(18-18/48)