3 * Copyright (C) 2007 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
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.
11 package eu
.etaxonomy
.cdm
.api
.service
;
13 import java
.util
.List
;
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
;
35 public interface ITaxonService
extends IIdentifiableEntityService
<TaxonBase
>{
38 * Computes all taxon bases.
39 * FIXME could substitute with list(Synonym.class, limit, start)
44 public List
<Synonym
> getAllSynonyms(int limit
, int start
);
47 * Computes all taxon bases.
48 * FIXME could substitute with list(Taxon.class, limit,start)
53 public List
<Taxon
> getAllTaxa(int limit
, int start
);
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
61 public List
<Taxon
> getRootTaxa(ReferenceBase sec
);
65 * Computes all Taxon instances that do not have a taxonomic parent.
66 * @param sec The concept reference that the taxon belongs to
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
72 public List
<Taxon
> getRootTaxa(ReferenceBase sec
, CdmFetch cdmFetch
, boolean onlyWithChildren
);
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
83 public List
<Taxon
> getRootTaxa(ReferenceBase sec
, boolean onlyWithChildren
, boolean withMisapplications
);
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>
97 * @return The List<Taxon> of root taxa.
98 * @deprecated obsolete when using taxonomicTree
100 public List
<Taxon
> getRootTaxa(Rank rank
, ReferenceBase sec
, boolean onlyWithChildren
, boolean withMisapplications
, List
<String
> propertyPaths
);
103 * Computes all relationships.
108 public List
<RelationshipBase
> getAllRelationships(int limit
, int start
);
111 * Returns TaxonRelationshipType vocabulary
113 * @deprecated use TermService#getVocabulary(VocabularyType) instead
115 public OrderedTermVocabulary
<TaxonRelationshipType
> getTaxonRelationshipTypeVocabulary();
118 public List
<TaxonBase
> searchTaxaByName(String name
, ReferenceBase sec
);
121 * Changes an accepted taxon to a synonym of another taxon.
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
128 * <code>SynonymRelationshipType</code> to indicate wether hetero or homotypic
130 * the reference for this assumption
131 * @param citationMicroReference
134 * the newly created synonym
136 public Synonym
makeTaxonSynonym (Taxon oldTaxon
, Taxon newAcceptedTaxon
, SynonymRelationshipType synonymType
, ReferenceBase citation
, String citationMicroReference
);
139 * Sets the synonyms name as the accepted taxons name. Deletes the synonym from the accepted taxon synonym list
140 * and attaches a new synonym created with the former name of the accepted taxon
143 * @param acceptedTaxon
144 * @param synonymRelationshipType the relationship type the newly created synonym will have. Defaults to SYNONYM_OF
146 public void makeSynonymAcceptedTaxon(Synonym synonym
, Taxon acceptedTaxon
, SynonymRelationshipType synonymRelationshipType
);
149 * Returns the TaxonRelationships (of where relationship.type == type, if this argument is supplied)
150 * where the supplied taxon is relatedTo.
152 * @param taxon The taxon that is relatedTo
153 * @param type The type of TaxonRelationship (can be null)
154 * @param pageSize The maximum number of relationships returned (can be null for all relationships)
155 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
156 * @param orderHints Properties to order by
157 * @param propertyPaths Properties to initialize in the returned entities, following the syntax described in {@link BeanInitializer#initialize(Object, List)}
158 * @return a List of TaxonRelationship instances
160 public List
<TaxonRelationship
> listToTaxonRelationships(Taxon taxon
, TaxonRelationshipType type
, Integer pageSize
, Integer pageNumber
, List
<OrderHint
> orderHints
, List
<String
> propertyPaths
);
163 * Returns the TaxonRelationships (of where relationship.type == type, if this arguement is supplied)
164 * where the supplied taxon is relatedTo.
166 * @param taxon The taxon that is relatedTo
167 * @param type The type of TaxonRelationship (can be null)
168 * @param pageSize The maximum number of relationships returned (can be null for all relationships)
169 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
170 * @param orderHints Properties to order by
171 * @param propertyPaths Properties to initialize in the returned entities, following the syntax described in {@link BeanInitializer#initialize(Object, List)}
172 * @return a Pager of TaxonRelationship instances
174 public Pager
<TaxonRelationship
> pageToTaxonRelationships(Taxon taxon
, TaxonRelationshipType type
, Integer pageSize
, Integer pageNumber
, List
<OrderHint
> orderHints
, List
<String
> propertyPaths
);
177 * Returns the TaxonRelationships (of where relationship.type == type, if this argument is supplied)
178 * where the supplied taxon is relatedFrom.
180 * @param taxon The taxon that is relatedFrom
181 * @param type The type of TaxonRelationship (can be null)
182 * @param pageSize The maximum number of relationships returned (can be null for all relationships)
183 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
184 * @param orderHints Properties to order by
185 * @param propertyPaths Properties to initialize in the returned entities, following the syntax described in {@link BeanInitializer#initialize(Object, List)}
186 * @return a List of TaxonRelationship instances
188 public List
<TaxonRelationship
> listFromTaxonRelationships(Taxon taxon
, TaxonRelationshipType type
, Integer pageSize
, Integer pageNumber
, List
<OrderHint
> orderHints
, List
<String
> propertyPaths
);
191 * Returns the TaxonRelationships (of where relationship.type == type, if this argument is supplied)
192 * where the supplied taxon is relatedFrom.
194 * @param taxon The taxon that is relatedFrom
195 * @param type The type of TaxonRelationship (can be null)
196 * @param pageSize The maximum number of relationships returned (can be null for all relationships)
197 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
198 * @param orderHints Properties to order by
199 * @param propertyPaths Properties to initialize in the returned entities, following the syntax described in {@link BeanInitializer#initialize(Object, List)}
200 * @return a Pager of TaxonRelationship instances
202 public Pager
<TaxonRelationship
> pageFromTaxonRelationships(Taxon taxon
, TaxonRelationshipType type
, Integer pageSize
, Integer pageNumber
, List
<OrderHint
> orderHints
, List
<String
> propertyPaths
);
205 * Returns the SynonymRelationships (of where relationship.type == type, if this argument is supplied)
206 * where the supplied synonym is relatedFrom.
208 * @param taxon The synonym that is relatedFrom
209 * @param type The type of SynonymRelationship (can be null)
210 * @param pageSize The maximum number of relationships returned (can be null for all relationships)
211 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
212 * * @param orderHints Properties to order by
213 * @param propertyPaths Properties to initialize in the returned entities, following the syntax described in {@link BeanInitializer#initialize(Object, List)}
214 * @return a Pager of SynonymRelationship instances
216 public Pager
<SynonymRelationship
> getSynonyms(Synonym synonym
, SynonymRelationshipType type
, Integer pageSize
, Integer pageNumber
, List
<OrderHint
> orderHints
, List
<String
> propertyPaths
);
219 * Returns the SynonymRelationships (of where relationship.type == type, if this argument is supplied)
220 * where the supplied taxon is relatedTo.
222 * @param taxon The taxon that is relatedTo
223 * @param type The type of SynonymRelationship (can be null)
224 * @param pageSize The maximum number of relationships returned (can be null for all relationships)
225 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
226 * * @param orderHints Properties to order by
227 * @param propertyPaths Properties to initialize in the returned entities, following the syntax described in {@link BeanInitializer#initialize(Object, List)}
228 * @return a Pager of SynonymRelationship instances
230 public Pager
<SynonymRelationship
> getSynonyms(Taxon taxon
, SynonymRelationshipType type
, Integer pageSize
, Integer pageNumber
, List
<OrderHint
> orderHints
, List
<String
> propertyPaths
);
232 public List
<Synonym
> getHomotypicSynonymsByHomotypicGroup(Taxon taxon
, List
<String
> propertyPaths
);
234 public List
<List
<Synonym
>> getHeterotypicSynonymyGroups(Taxon taxon
, List
<String
> propertyPaths
);
237 * Returns a Paged List of TaxonBase instances where the default field matches the String queryString (as interpreted by the Lucene QueryParser)
239 * @param clazz filter the results by class (or pass null to return all TaxonBase instances)
241 * @param pageSize The maximum number of taxa returned (can be null for all matching taxa)
242 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
244 * Supports path like <code>orderHints.propertyNames</code> which
245 * include *-to-one properties like createdBy.username or
246 * authorTeam.persistentTitleCache
247 * @param propertyPaths properties to be initialized
248 * @return a Pager Taxon instances
249 * @see <a href="http://lucene.apache.org/java/2_4_0/queryparsersyntax.html">Apache Lucene - Query Parser Syntax</a>
251 public Pager
<TaxonBase
> search(Class
<?
extends TaxonBase
> clazz
, String queryString
, Integer pageSize
, Integer pageNumber
, List
<OrderHint
> orderHints
, List
<String
> propertyPaths
);
254 * Returns a list of TaxonBase instances where the
255 * taxon.name properties match the parameters passed.
257 * @param clazz optionally filter by class
259 * @param infragenericEpithet
260 * @param specificEpithet
261 * @param infraspecificEpithet
263 * @param pageSize The maximum number of taxa returned (can be null for all matching taxa)
264 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
265 * @return a Pager of TaxonBase instances
267 public Pager
<TaxonBase
> findTaxaByName(Class
<?
extends TaxonBase
> clazz
, String uninomial
, String infragenericEpithet
, String specificEpithet
, String infraspecificEpithet
, Rank rank
, Integer pageSize
, Integer pageNumber
);
270 * Returns a list of IdentifiableEntity instances (in particular, TaxonNameBase and TaxonBase instances)
271 * that match the properties specified in the configurator.
272 * @param configurator
275 public Pager
<IdentifiableEntity
> findTaxaAndNames(ITaxonServiceConfigurator configurator
);
282 * @param widthOrDuration
286 public List
<MediaRepresentation
> getAllMedia(Taxon taxon
, int size
, int height
, int widthOrDuration
, String
[] mimeTypes
, List
<String
> propertyPaths
);