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.List;
|
14
|
|
15
|
import eu.etaxonomy.cdm.api.service.config.ITaxonServiceConfigurator;
|
16
|
import eu.etaxonomy.cdm.api.service.pager.Pager;
|
17
|
import eu.etaxonomy.cdm.model.common.IdentifiableEntity;
|
18
|
import eu.etaxonomy.cdm.model.common.OrderedTermVocabulary;
|
19
|
import eu.etaxonomy.cdm.model.common.RelationshipBase;
|
20
|
import eu.etaxonomy.cdm.model.media.MediaRepresentation;
|
21
|
import eu.etaxonomy.cdm.model.name.Rank;
|
22
|
import eu.etaxonomy.cdm.model.reference.ReferenceBase;
|
23
|
import eu.etaxonomy.cdm.model.taxon.Synonym;
|
24
|
import eu.etaxonomy.cdm.model.taxon.SynonymRelationship;
|
25
|
import eu.etaxonomy.cdm.model.taxon.SynonymRelationshipType;
|
26
|
import eu.etaxonomy.cdm.model.taxon.Taxon;
|
27
|
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
|
28
|
import eu.etaxonomy.cdm.model.taxon.TaxonRelationship;
|
29
|
import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType;
|
30
|
import eu.etaxonomy.cdm.persistence.dao.BeanInitializer;
|
31
|
import eu.etaxonomy.cdm.persistence.fetch.CdmFetch;
|
32
|
import eu.etaxonomy.cdm.persistence.query.OrderHint;
|
33
|
|
34
|
|
35
|
public interface ITaxonService extends IIdentifiableEntityService<TaxonBase>{
|
36
|
|
37
|
/**
|
38
|
* Computes all taxon bases.
|
39
|
* FIXME could substitute with list(Synonym.class, limit, start)
|
40
|
* @param limit
|
41
|
* @param start
|
42
|
* @return
|
43
|
*/
|
44
|
public List<Synonym> getAllSynonyms(int limit, int start);
|
45
|
|
46
|
/**
|
47
|
* Computes all taxon bases.
|
48
|
* FIXME could substitute with list(Taxon.class, limit,start)
|
49
|
* @param limit
|
50
|
* @param start
|
51
|
* @return
|
52
|
*/
|
53
|
public List<Taxon> getAllTaxa(int limit, int start);
|
54
|
|
55
|
/**
|
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
|
* @deprecated obsolete when using taxonomicTree
|
60
|
*/
|
61
|
public List<Taxon> getRootTaxa(ReferenceBase sec);
|
62
|
|
63
|
|
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
|
* @deprecated obsolete when using taxonomicTree
|
71
|
*/
|
72
|
public List<Taxon> getRootTaxa(ReferenceBase sec, CdmFetch cdmFetch, boolean onlyWithChildren);
|
73
|
|
74
|
/**
|
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
|
* @deprecated obsolete when using taxonomicTree
|
82
|
*/
|
83
|
public List<Taxon> getRootTaxa(ReferenceBase sec, boolean onlyWithChildren, boolean withMisapplications);
|
84
|
|
85
|
/**
|
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
|
* @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
|
* @return The List<Taxon> of root taxa.
|
98
|
* @deprecated obsolete when using taxonomicTree
|
99
|
*/
|
100
|
public List<Taxon> getRootTaxa(Rank rank, ReferenceBase sec, boolean onlyWithChildren, boolean withMisapplications, List<String> propertyPaths);
|
101
|
|
102
|
/**
|
103
|
* Computes all relationships.
|
104
|
* @param limit
|
105
|
* @param start
|
106
|
* @return
|
107
|
*/
|
108
|
public List<RelationshipBase> getAllRelationships(int limit, int start);
|
109
|
|
110
|
/**
|
111
|
* Returns TaxonRelationshipType vocabulary
|
112
|
* @return
|
113
|
* @deprecated use TermService#getVocabulary(VocabularyType) instead
|
114
|
*/
|
115
|
public OrderedTermVocabulary<TaxonRelationshipType> getTaxonRelationshipTypeVocabulary();
|
116
|
|
117
|
/** */
|
118
|
public List<TaxonBase> searchTaxaByName(String name, ReferenceBase sec);
|
119
|
|
120
|
/**
|
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
|
* <code>SynonymRelationshipType</code> to indicate whether hetero or homotypic
|
129
|
* @param citation
|
130
|
* the reference for this assumption
|
131
|
* @param citationMicroReference
|
132
|
* the micro citation
|
133
|
* @return
|
134
|
* the newly created synonym
|
135
|
*/
|
136
|
public Synonym makeTaxonSynonym (Taxon oldTaxon, Taxon newAcceptedTaxon, SynonymRelationshipType synonymType, ReferenceBase citation, String citationMicroReference);
|
137
|
|
138
|
/**
|
139
|
* 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
|
*
|
148
|
* @param synonym
|
149
|
* @param acceptedTaxon
|
150
|
* @param synonymRelationshipType the relationship type the newly created synonym will have. Defaults to SYNONYM_OF
|
151
|
*/
|
152
|
public void swapSynonymAndAcceptedTaxon(Synonym synonym, Taxon acceptedTaxon, SynonymRelationshipType synonymRelationshipType );
|
153
|
|
154
|
/**
|
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
|
/**
|
167
|
* Returns the TaxonRelationships (of where relationship.type == type, if this argument is supplied)
|
168
|
* 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
|
* @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
|
* @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
|
|
180
|
/**
|
181
|
* Returns the TaxonRelationships (of where relationship.type == type, if this arguement is supplied)
|
182
|
* 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
|
* @return a Pager of TaxonRelationship instances
|
219
|
*/
|
220
|
public Pager<TaxonRelationship> pageFromTaxonRelationships(Taxon taxon, TaxonRelationshipType type, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);
|
221
|
|
222
|
/**
|
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
|
/**
|
237
|
* Returns the SynonymRelationships (of where relationship.type == type, if this argument is supplied)
|
238
|
* 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
|
* * @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
|
* @return a Pager of SynonymRelationship instances
|
247
|
*/
|
248
|
public Pager<SynonymRelationship> getSynonyms(Taxon taxon, SynonymRelationshipType type, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);
|
249
|
|
250
|
public List<Synonym> getHomotypicSynonymsByHomotypicGroup(Taxon taxon, List<String> propertyPaths);
|
251
|
|
252
|
public List<List<Synonym>> getHeterotypicSynonymyGroups(Taxon taxon, List<String> propertyPaths);
|
253
|
|
254
|
/**
|
255
|
* Returns a Paged List of TaxonBase instances where the default field matches the String queryString (as interpreted by the Lucene QueryParser)
|
256
|
*
|
257
|
* @param clazz filter the results by class (or pass null to return all TaxonBase instances)
|
258
|
* @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
|
* @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
|
* @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
|
public Pager<TaxonBase> search(Class<? extends TaxonBase> clazz, String queryString, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);
|
270
|
|
271
|
/**
|
272
|
* Returns a list of TaxonBase instances where the
|
273
|
* taxon.name properties match the parameters passed.
|
274
|
*
|
275
|
* @param clazz optionally filter by class
|
276
|
* @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
|
public Pager<TaxonBase> findTaxaByName(Class<? extends TaxonBase> clazz, String uninomial, String infragenericEpithet, String specificEpithet, String infraspecificEpithet, Rank rank, Integer pageSize, Integer pageNumber);
|
286
|
|
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
|
|
295
|
/**
|
296
|
*
|
297
|
* @param taxon
|
298
|
* @param size
|
299
|
* @param height
|
300
|
* @param widthOrDuration
|
301
|
* @param mimeTypes
|
302
|
* @return
|
303
|
*/
|
304
|
public List<MediaRepresentation> getAllMedia(Taxon taxon, int size, int height, int widthOrDuration, String[] mimeTypes);
|
305
|
}
|