Project

General

Profile

Download (14.2 KB) Statistics
| Branch: | Tag: | Revision:
1 c2f269f9 Andreas Kohlbecker
// $Id$
2 25663b56 Andreas Müller
/**
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 2d993c6e Andreas Müller
package eu.etaxonomy.cdm.api.service;
12
13
import java.util.List;
14
15 24700eab a.babadshanjan
import eu.etaxonomy.cdm.api.service.config.ITaxonServiceConfigurator;
16 d57c0df0 ben.clark
import eu.etaxonomy.cdm.api.service.pager.Pager;
17 24700eab a.babadshanjan
import eu.etaxonomy.cdm.model.common.IdentifiableEntity;
18
import eu.etaxonomy.cdm.model.common.OrderedTermVocabulary;
19 7a931ddb a.babadshanjan
import eu.etaxonomy.cdm.model.common.RelationshipBase;
20 3d99737b Katja Luther
import eu.etaxonomy.cdm.model.media.MediaRepresentation;
21 d57c0df0 ben.clark
import eu.etaxonomy.cdm.model.name.Rank;
22 2d993c6e Andreas Müller
import eu.etaxonomy.cdm.model.reference.ReferenceBase;
23 02cf6cb7 Andreas Müller
import eu.etaxonomy.cdm.model.taxon.Synonym;
24 d57c0df0 ben.clark
import eu.etaxonomy.cdm.model.taxon.SynonymRelationship;
25 02cf6cb7 Andreas Müller
import eu.etaxonomy.cdm.model.taxon.SynonymRelationshipType;
26 2d993c6e Andreas Müller
import eu.etaxonomy.cdm.model.taxon.Taxon;
27
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
28 d57c0df0 ben.clark
import eu.etaxonomy.cdm.model.taxon.TaxonRelationship;
29
import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType;
30 3cc31c85 Andreas Kohlbecker
import eu.etaxonomy.cdm.persistence.dao.BeanInitializer;
31 855f3dd0 Andreas Müller
import eu.etaxonomy.cdm.persistence.fetch.CdmFetch;
32 d44277a9 ben.clark
import eu.etaxonomy.cdm.persistence.query.OrderHint;
33 2d993c6e Andreas Müller
34
35
public interface ITaxonService extends IIdentifiableEntityService<TaxonBase>{
36 add8b0a9 Andreas Müller
37 643cfd14 a.babadshanjan
	/**
38
	 * Computes all taxon bases.
39 d57c0df0 ben.clark
	 * FIXME could substitute with list(Synonym.class, limit, start)
40 643cfd14 a.babadshanjan
	 * @param limit
41
	 * @param start
42
	 * @return
43
	 */
44 58452b54 Katja Luther
	public List<Synonym> getAllSynonyms(int limit, int start);
45 643cfd14 a.babadshanjan
	
46
	/**
47
	 * Computes all taxon bases.
48 d57c0df0 ben.clark
	 * FIXME could substitute with list(Taxon.class, limit,start)
49 643cfd14 a.babadshanjan
	 * @param limit
50
	 * @param start
51
	 * @return
52
	 */
53 58452b54 Katja Luther
	public List<Taxon> getAllTaxa(int limit, int start);	
54 07eb2b2b a.babadshanjan
	
55 855f3dd0 Andreas Müller
	/**
56
	 * Computes all Taxon instances that do not have a taxonomic parent and has at least one child.
57
	 * @param sec The concept reference that the taxon belongs to
58
	 * @return The List<Taxon> of root taxa.
59 01c21ead n.hoffmann
	 * @deprecated obsolete when using taxonomicTree
60 855f3dd0 Andreas Müller
	 */
61 d93c0aaf Andreas Müller
	public List<Taxon> getRootTaxa(ReferenceBase sec);
62
	
63 855f3dd0 Andreas Müller
64
	/**
65
	 * Computes all Taxon instances that do not have a taxonomic parent.
66
	 * @param sec The concept reference that the taxon belongs to
67
	 * 
68
	 * @param onlyWithChildren if true only taxa are returned that have taxonomic children. <Br>Default: true.
69
	 * @return The List<Taxon> of root taxa.
70 01c21ead n.hoffmann
	 * @deprecated obsolete when using taxonomicTree
71 855f3dd0 Andreas Müller
	 */
72 58452b54 Katja Luther
	public List<Taxon> getRootTaxa(ReferenceBase sec, CdmFetch cdmFetch, boolean onlyWithChildren);
73 349fae93 Andreas Müller
74 2950108e Andreas Müller
	/**
75
	 * Computes all Taxon instances that do not have a taxonomic parent.
76
	 * @param sec The concept reference that the taxon belongs to
77
	 * @param onlyWithChildren if true only taxa are returned that have taxonomic children. <Br>Default: true.
78
	 * @param withMisapplications if false taxa that have at least one misapplied name relationship in which they are
79
	 * the misapplied name are not returned.<Br>Default: true.
80
	 * @return The List<Taxon> of root taxa.
81 01c21ead n.hoffmann
	 * @deprecated obsolete when using taxonomicTree
82 2950108e Andreas Müller
	 */
83 58452b54 Katja Luther
	public List<Taxon> getRootTaxa(ReferenceBase sec, boolean onlyWithChildren, boolean withMisapplications);
84 349fae93 Andreas Müller
85 7a1d87e3 a.babadshanjan
	/**
86
	 * Computes all Taxon instances which name is of a certain Rank.
87
	 * @param rank The rank of the taxon name
88
	 * @param sec The concept reference that the taxon belongs to
89
	 * @param onlyWithChildren if true only taxa are returned that have taxonomic children. <Br>Default: true.
90
	 * @param withMisapplications if false taxa that have at least one misapplied name relationship in which they are
91
	 * the misapplied name are not returned.<Br>Default: true.
92 9b62c409 Andreas Kohlbecker
	 * @param propertyPaths
93
	 *            properties to be initialized, For detailed description and
94
	 *            examples <b>please refer to:</b>
95
	 *            {@link BeanInitializer#initialize(Object, List)}. <Br>
96
	 *            Default: true.
97 7a1d87e3 a.babadshanjan
	 * @return The List<Taxon> of root taxa.
98 01c21ead n.hoffmann
	 * @deprecated obsolete when using taxonomicTree
99 7a1d87e3 a.babadshanjan
	 */
100 58452b54 Katja Luther
	public List<Taxon> getRootTaxa(Rank rank, ReferenceBase sec, boolean onlyWithChildren, boolean withMisapplications, List<String> propertyPaths);
101 2d993c6e Andreas Müller
	
102 7a931ddb a.babadshanjan
	/**
103
	 * Computes all relationships.
104
	 * @param limit
105
	 * @param start
106
	 * @return
107
	 */
108 58452b54 Katja Luther
    public List<RelationshipBase> getAllRelationships(int limit, int start);
109 7a931ddb a.babadshanjan
110 24700eab a.babadshanjan
	/**
111
	 * Returns TaxonRelationshipType vocabulary
112
	 * @return
113 f3ba008a n.hoffmann
	 * @deprecated use TermService#getVocabulary(VocabularyType) instead
114 24700eab a.babadshanjan
	 */
115
	public OrderedTermVocabulary<TaxonRelationshipType> getTaxonRelationshipTypeVocabulary();
116
117
	/** */
118 58452b54 Katja Luther
	public List<TaxonBase> searchTaxaByName(String name, ReferenceBase sec);
119 a400a105 m.doering
		
120 bb4f5701 n.hoffmann
	/**
121
	 * Changes an accepted taxon to a synonym of another taxon. 
122
	 * 
123
	 * @param oldTaxon
124
	 * 				the accepted taxon that will be changed into a synonym
125
	 * @param newAcceptedTaxon
126
	 * 				the accepted taxon, the old taxon will become a synonym of
127
	 * @param synonymType
128 af8f90fb n.hoffmann
	 * 				<code>SynonymRelationshipType</code> to indicate whether hetero or homotypic
129 bb4f5701 n.hoffmann
	 * @param citation
130
	 * 				the reference for this assumption
131
	 * @param citationMicroReference
132
	 * 				the micro citation
133
	 * @return
134
	 * 				the newly created synonym
135
	 */
136 02cf6cb7 Andreas Müller
	public Synonym makeTaxonSynonym (Taxon oldTaxon, Taxon newAcceptedTaxon, SynonymRelationshipType synonymType, ReferenceBase citation, String citationMicroReference);
137 2d993c6e Andreas Müller
	
138 f4cfc931 n.hoffmann
	/**
139 af8f90fb n.hoffmann
	 * Swaps given synonym and accepted taxon. 
140
	 * In particular:
141
	 * <ul> 
142
	 * 		<li>A new accepted taxon with the synonyms name is created</li>
143
	 * 		<li>The synonym is deleted from the old accepted taxons synonym list</li>
144
	 * 		<li>A new synonym with the name of the old accepted taxon is created</li>
145
	 * 		<li>The newly created synonym get related to the newly created accepted taxon</li>
146
	 * </ul>
147 f4cfc931 n.hoffmann
	 * 
148
	 * @param synonym 
149
	 * @param acceptedTaxon
150
	 * @param synonymRelationshipType the relationship type the newly created synonym will have. Defaults to SYNONYM_OF
151
	 */
152 2b72538e n.hoffmann
	public void swapSynonymAndAcceptedTaxon(Synonym synonym, Taxon acceptedTaxon, SynonymRelationshipType synonymRelationshipType );
153 f4cfc931 n.hoffmann
	
154 af8f90fb n.hoffmann
	/**
155
	 * Change a synonym into an accepted taxon and removes existing synonym relationship to the given accepted taxon.
156
	 * 
157
	 * @param synonym
158
	 * 				the synonym to change into an accepted taxon
159
	 * @param acceptedTaxon
160
	 * 				an accepted taxon, the synonym had a relationship to
161
	 * @return
162
	 * 				the newly created accepted taxon
163
	 */
164
	public Taxon makeSynonymAcceptedTaxon(Synonym synonym, Taxon acceptedTaxon);
165
	
166 d57c0df0 ben.clark
	/**
167 d40f8755 Andreas Kohlbecker
	 * Returns the TaxonRelationships (of where relationship.type == type, if this argument is supplied) 
168 d57c0df0 ben.clark
	 * where the supplied taxon is relatedTo.
169
	 * 
170
	 * @param taxon The taxon that is relatedTo
171
	 * @param type The type of TaxonRelationship (can be null)
172
	 * @param pageSize The maximum number of relationships returned (can be null for all relationships)
173
	 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
174 d44277a9 ben.clark
	 * @param orderHints Properties to order by
175
	 * @param propertyPaths Properties to initialize in the returned entities, following the syntax described in {@link BeanInitializer#initialize(Object, List)}
176 d40f8755 Andreas Kohlbecker
	 * @return a List of TaxonRelationship instances
177
	 */
178
	public List<TaxonRelationship> listToTaxonRelationships(Taxon taxon, TaxonRelationshipType type, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);
179 f4cfc931 n.hoffmann
		
180 d40f8755 Andreas Kohlbecker
	/**
181 f4cfc931 n.hoffmann
	 * Returns the TaxonRelationships (of where relationship.type == type, if this arguement is supplied) 
182 d40f8755 Andreas Kohlbecker
	 * where the supplied taxon is relatedTo.
183
	 * 
184
	 * @param taxon The taxon that is relatedTo
185
	 * @param type The type of TaxonRelationship (can be null)
186
	 * @param pageSize The maximum number of relationships returned (can be null for all relationships)
187
	 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
188
	 * @param orderHints Properties to order by
189
	 * @param propertyPaths Properties to initialize in the returned entities, following the syntax described in {@link BeanInitializer#initialize(Object, List)}
190
	 * @return a Pager of TaxonRelationship instances
191
	 */
192
	public Pager<TaxonRelationship> pageToTaxonRelationships(Taxon taxon, TaxonRelationshipType type, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);
193
	
194
	/**
195
	 * Returns the TaxonRelationships (of where relationship.type == type, if this argument is supplied) 
196
	 * where the supplied taxon is relatedFrom.
197
	 * 
198
	 * @param taxon The taxon that is relatedFrom
199
	 * @param type The type of TaxonRelationship (can be null)
200
	 * @param pageSize The maximum number of relationships returned (can be null for all relationships)
201
	 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
202
	 * @param orderHints Properties to order by
203
	 * @param propertyPaths Properties to initialize in the returned entities, following the syntax described in {@link BeanInitializer#initialize(Object, List)}
204
	 * @return a List of TaxonRelationship instances
205
	 */
206
	public List<TaxonRelationship> listFromTaxonRelationships(Taxon taxon, TaxonRelationshipType type, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);
207
	
208
	/**
209
	 * Returns the TaxonRelationships (of where relationship.type == type, if this argument is supplied) 
210
	 * where the supplied taxon is relatedFrom.
211
	 * 
212
	 * @param taxon The taxon that is relatedFrom
213
	 * @param type The type of TaxonRelationship (can be null)
214
	 * @param pageSize The maximum number of relationships returned (can be null for all relationships)
215
	 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
216
	 * @param orderHints Properties to order by
217
	 * @param propertyPaths Properties to initialize in the returned entities, following the syntax described in {@link BeanInitializer#initialize(Object, List)}
218 d57c0df0 ben.clark
	 * @return a Pager of TaxonRelationship instances
219
	 */
220 d40f8755 Andreas Kohlbecker
	public Pager<TaxonRelationship> pageFromTaxonRelationships(Taxon taxon, TaxonRelationshipType type, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);
221 d57c0df0 ben.clark
	
222 219ab499 ben.clark
	/**
223
	 * Returns the SynonymRelationships (of where relationship.type == type, if this argument is supplied) 
224
	 * where the supplied synonym is relatedFrom.
225
	 * 
226
	 * @param taxon The synonym that is relatedFrom
227
	 * @param type The type of SynonymRelationship (can be null)
228
	 * @param pageSize The maximum number of relationships returned (can be null for all relationships)
229
	 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
230
	 * * @param orderHints Properties to order by
231
	 * @param propertyPaths Properties to initialize in the returned entities, following the syntax described in {@link BeanInitializer#initialize(Object, List)}
232
	 * @return a Pager of SynonymRelationship instances
233
	 */
234
	public Pager<SynonymRelationship> getSynonyms(Synonym synonym, SynonymRelationshipType type, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);
235
	
236 d57c0df0 ben.clark
	/**
237 d40f8755 Andreas Kohlbecker
	 * Returns the SynonymRelationships (of where relationship.type == type, if this argument is supplied) 
238 d57c0df0 ben.clark
	 * where the supplied taxon is relatedTo.
239
	 * 
240
	 * @param taxon The taxon that is relatedTo
241
	 * @param type The type of SynonymRelationship (can be null)
242
	 * @param pageSize The maximum number of relationships returned (can be null for all relationships)
243
	 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
244 d44277a9 ben.clark
	 * * @param orderHints Properties to order by
245
	 * @param propertyPaths Properties to initialize in the returned entities, following the syntax described in {@link BeanInitializer#initialize(Object, List)}
246 d57c0df0 ben.clark
	 * @return a Pager of SynonymRelationship instances
247
	 */
248 d44277a9 ben.clark
	public Pager<SynonymRelationship> getSynonyms(Taxon taxon, SynonymRelationshipType type, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);
249 d57c0df0 ben.clark
	
250 9b62c409 Andreas Kohlbecker
	public List<Synonym> getHomotypicSynonymsByHomotypicGroup(Taxon taxon, List<String> propertyPaths);
251
	
252
	public List<List<Synonym>> getHeterotypicSynonymyGroups(Taxon taxon, List<String> propertyPaths);
253
	
254 d57c0df0 ben.clark
	/**
255 aba8d6ad ben.clark
	 * Returns a Paged List of TaxonBase instances where the default field matches the String queryString (as interpreted by the Lucene QueryParser)
256 d57c0df0 ben.clark
	 * 
257 aba8d6ad ben.clark
	 * @param clazz filter the results by class (or pass null to return all TaxonBase instances)
258 d57c0df0 ben.clark
	 * @param queryString
259
	 * @param pageSize The maximum number of taxa returned (can be null for all matching taxa)
260
	 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
261 aba8d6ad ben.clark
	 * @param orderHints
262
	 *            Supports path like <code>orderHints.propertyNames</code> which
263
	 *            include *-to-one properties like createdBy.username or
264
	 *            authorTeam.persistentTitleCache
265
	 * @param propertyPaths properties to be initialized
266 d57c0df0 ben.clark
	 * @return a Pager Taxon instances
267
	 * @see <a href="http://lucene.apache.org/java/2_4_0/queryparsersyntax.html">Apache Lucene - Query Parser Syntax</a>
268
	 */
269 aba8d6ad ben.clark
	public Pager<TaxonBase> search(Class<? extends TaxonBase> clazz, String queryString, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);
270 d57c0df0 ben.clark
	
271
	/**
272 a9e5cd74 ben.clark
	 * Returns a list of TaxonBase instances where the
273 d57c0df0 ben.clark
	 * taxon.name properties match the parameters passed.
274
	 * 
275 a9e5cd74 ben.clark
	 * @param clazz optionally filter by class 
276 d57c0df0 ben.clark
	 * @param uninomial 
277
	 * @param infragenericEpithet
278
	 * @param specificEpithet
279
	 * @param infraspecificEpithet
280
	 * @param rank
281
	 * @param pageSize The maximum number of taxa returned (can be null for all matching taxa)
282
	 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
283
	 * @return a Pager of TaxonBase instances
284
	 */
285 a9e5cd74 ben.clark
	public Pager<TaxonBase> findTaxaByName(Class<? extends TaxonBase> clazz, String uninomial, String infragenericEpithet, String specificEpithet, String infraspecificEpithet, Rank rank, Integer pageSize, Integer pageNumber);
286 24700eab a.babadshanjan
287
	/**
288
	 * Returns a list of IdentifiableEntity instances (in particular, TaxonNameBase and TaxonBase instances)
289
	 * that match the properties specified in the configurator.
290
	 * @param configurator
291
	 * @return
292
	 */
293
	public Pager<IdentifiableEntity> findTaxaAndNames(ITaxonServiceConfigurator configurator);
294 18e91500 n.hoffmann
	
295
	/**
296
	 * 
297 3d99737b Katja Luther
	 * @param taxon
298 01c21ead n.hoffmann
	 * @param size
299
	 * @param height
300
	 * @param widthOrDuration
301
	 * @param mimeTypes
302
	 * @return
303 3d99737b Katja Luther
	 */
304 a4e49cfa Katja Luther
	public List<MediaRepresentation> getAllMedia(Taxon taxon, int size, int height, int widthOrDuration, String[] mimeTypes);
305 2d993c6e Andreas Müller
}