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
.io
.IOException
;
14 import java
.util
.EnumSet
;
15 import java
.util
.List
;
17 import java
.util
.UUID
;
19 import org
.apache
.lucene
.index
.CorruptIndexException
;
20 import org
.apache
.lucene
.queryParser
.ParseException
;
22 import eu
.etaxonomy
.cdm
.api
.service
.config
.IFindTaxaAndNamesConfigurator
;
23 import eu
.etaxonomy
.cdm
.api
.service
.config
.MatchingTaxonConfigurator
;
24 import eu
.etaxonomy
.cdm
.api
.service
.config
.SynonymDeletionConfigurator
;
25 import eu
.etaxonomy
.cdm
.api
.service
.config
.TaxonDeletionConfigurator
;
26 import eu
.etaxonomy
.cdm
.api
.service
.exception
.DataChangeNoRollbackException
;
27 import eu
.etaxonomy
.cdm
.api
.service
.exception
.HomotypicalGroupChangeException
;
28 import eu
.etaxonomy
.cdm
.api
.service
.exception
.ReferencedObjectUndeletableException
;
29 import eu
.etaxonomy
.cdm
.api
.service
.pager
.Pager
;
30 import eu
.etaxonomy
.cdm
.api
.service
.search
.LuceneMultiSearchException
;
31 import eu
.etaxonomy
.cdm
.api
.service
.search
.SearchResult
;
32 import eu
.etaxonomy
.cdm
.api
.service
.util
.TaxonRelationshipEdge
;
33 import eu
.etaxonomy
.cdm
.model
.common
.IdentifiableEntity
;
34 import eu
.etaxonomy
.cdm
.model
.common
.Language
;
35 import eu
.etaxonomy
.cdm
.model
.common
.OrderedTermVocabulary
;
36 import eu
.etaxonomy
.cdm
.model
.common
.RelationshipBase
;
37 import eu
.etaxonomy
.cdm
.model
.common
.RelationshipBase
.Direction
;
38 import eu
.etaxonomy
.cdm
.model
.common
.UuidAndTitleCache
;
39 import eu
.etaxonomy
.cdm
.model
.description
.DescriptionElementBase
;
40 import eu
.etaxonomy
.cdm
.model
.description
.Feature
;
41 import eu
.etaxonomy
.cdm
.model
.description
.PresenceAbsenceTermBase
;
42 import eu
.etaxonomy
.cdm
.model
.location
.NamedArea
;
43 import eu
.etaxonomy
.cdm
.model
.media
.Media
;
44 import eu
.etaxonomy
.cdm
.model
.media
.MediaRepresentation
;
45 import eu
.etaxonomy
.cdm
.model
.name
.HomotypicalGroup
;
46 import eu
.etaxonomy
.cdm
.model
.name
.Rank
;
47 import eu
.etaxonomy
.cdm
.model
.name
.TaxonNameBase
;
48 import eu
.etaxonomy
.cdm
.model
.reference
.Reference
;
49 import eu
.etaxonomy
.cdm
.model
.taxon
.Classification
;
50 import eu
.etaxonomy
.cdm
.model
.taxon
.Synonym
;
51 import eu
.etaxonomy
.cdm
.model
.taxon
.SynonymRelationship
;
52 import eu
.etaxonomy
.cdm
.model
.taxon
.SynonymRelationshipType
;
53 import eu
.etaxonomy
.cdm
.model
.taxon
.Taxon
;
54 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonBase
;
55 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonRelationship
;
56 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonRelationshipType
;
57 import eu
.etaxonomy
.cdm
.persistence
.dao
.initializer
.IBeanInitializer
;
58 import eu
.etaxonomy
.cdm
.persistence
.fetch
.CdmFetch
;
59 import eu
.etaxonomy
.cdm
.persistence
.query
.OrderHint
;
62 public interface ITaxonService
extends IIdentifiableEntityService
<TaxonBase
>{
65 * Computes all taxon bases.
70 * FIXME could substitute with list(Synonym.class, limit, start)
72 public List
<Synonym
> getAllSynonyms(int limit
, int start
);
75 * Computes all taxon bases.
80 * FIXME could substitute with list(Taxon.class, limit,start)
82 public List
<Taxon
> getAllTaxa(int limit
, int start
);
85 * Computes all Taxon instances that do not have a taxonomic parent.
86 * @param sec The concept reference that the taxon belongs to
88 * @param onlyWithChildren if true only taxa are returned that have taxonomic children. <Br>Default: true.
89 * @return The List<Taxon> of root taxa.
90 * @deprecated obsolete when using classification
93 public List
<Taxon
> getRootTaxa(Reference sec
, CdmFetch cdmFetch
, boolean onlyWithChildren
);
96 * Computes all Taxon instances which name is of a certain Rank.
97 * @param rank The rank of the taxon name
98 * @param sec The concept reference that the taxon belongs to
99 * @param onlyWithChildren if true only taxa are returned that have taxonomic children. <Br>Default: true.
100 * @param withMisapplications if false taxa that have at least one misapplied name relationship in which they are
101 * the misapplied name are not returned.<Br>Default: true.
102 * @param propertyPaths
103 * properties to be initialized, For detailed description and
104 * examples <b>please refer to:</b>
105 * {@link IBeanInitializer#initialize(Object, List)}. <Br>
107 * @return The List<Taxon> of root taxa.
108 * @deprecated obsolete when using classification
111 public List
<Taxon
> getRootTaxa(Rank rank
, Reference sec
, boolean onlyWithChildren
, boolean withMisapplications
, List
<String
> propertyPaths
);
114 * Computes all relationships.
118 * FIXME candidate for harmonization - rename to listRelationships
120 public List
<RelationshipBase
> getAllRelationships(int limit
, int start
);
123 * Returns TaxonRelationshipType vocabulary
125 * @deprecated use TermService#getVocabulary(VocabularyType) instead
128 public OrderedTermVocabulary
<TaxonRelationshipType
> getTaxonRelationshipTypeVocabulary();
131 * Returns a list of taxa that matches the name string and the sec reference
132 * @param name the name string to search for
133 * @param sec the taxons sec reference
134 * @return a list of taxa matching the name and the sec reference
136 public List
<TaxonBase
> searchTaxaByName(String name
, Reference sec
);
139 * Swaps given synonym and accepted taxon.
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>
149 * @param acceptedTaxon
150 * @param synonymRelationshipType the relationship type the newly created synonym will have. Defaults to SYNONYM_OF
152 public void swapSynonymAndAcceptedTaxon(Synonym synonym
, Taxon acceptedTaxon
);
155 * Changes a synonym into an accepted taxon and removes
156 * the synonym relationship to the given accepted taxon.
157 * Other synonyms homotypic to the synonym to change are
158 * moved to the same new accepted taxon as homotypic
159 * synonyms. The new accepted taxon has the same name and
160 * the same sec reference as the old synonym.<BR>
161 * If the given accepted taxon and the synonym are homotypic
162 * to each other an exception may be thrown as taxonomically it doesn't
163 * make sense to have two accepted taxa in the same homotypic group
164 * but also it is than difficult to decide how to handle other names
165 * in the homotypic group. It is up to the implementing class to
166 * handle this situation via an exception or in another way.
170 * the synonym to change into an accepted taxon
171 * @param acceptedTaxon
172 * an accepted taxon, the synonym had a relationship to
173 * @param deleteSynonym
174 * if true the method tries to delete the old synonym from the database
175 * @param copyCitationInfo
176 * if true the citation and the microcitation of newly created synonyms
177 * is taken from the old synonym relationships.
179 * if given this citation is added to the newly created synonym
180 * relationships as citation. Only used if copyCitationInfo is <code> false</code>
181 * @param microCitation
182 * if given this microCitation is added to the newly created synonym
183 * relationships as microCitation.Only used if copyCitationInfo is <code> false</code>
185 * the newly created accepted taxon
186 * @throws IllegalArgumentException
187 * if the given accepted taxon and the synonym are homotypic
188 * to each other an exception may be thrown as taxonomically it doesn't
189 * make sense to have two accepted taxa in the same homotypic group
190 * but also it is than difficult to decide how to handle other names
191 * in the homotypic group. It is up to the implementing class to
192 * handle this situation via an exception or in another way.
194 public Taxon
changeSynonymToAcceptedTaxon(Synonym synonym
, Taxon acceptedTaxon
, boolean deleteSynonym
, boolean copyCitationInfo
, Reference citation
, String microCitation
) throws HomotypicalGroupChangeException
;
197 * TODO still needed and correct?
198 * Change a synonym into a related concept
201 * the synonym to change into the concept taxon
203 * the taxon the newly created concept should be related to
204 * @param taxonRelationshipType
205 * the type of relationship
207 * @param microReference
209 * the newly created concept
211 public Taxon
changeSynonymToRelatedTaxon(Synonym synonym
, Taxon toTaxon
, TaxonRelationshipType taxonRelationshipType
, Reference reference
, String microReference
);
214 * Deletes all synonym relationships of a given synonym. If taxon is given
215 * only those relationships to the taxon are deleted.
221 * @deprecated This method must no longer being used since the
222 * SynonymRelationship is annotated at the {@link Taxon} and at
223 * the {@link Synonym} with <code>orphanDelete=true</code>. Just
224 * remove the from and to entities from the relationship and
225 * hibernate will care for the deletion. Using this method can cause
226 * <code>StaleStateException</code> (see http://dev.e-taxonomy.eu/trac/ticket/3797)
230 public long deleteSynonymRelationships(Synonym syn
, Taxon taxon
);
233 * Deletes a taxon from the underlying database according to the given {@link TaxonDeletionConfigurator configurator}.
236 * @throws ReferencedObjectUndeletableException
238 public UUID
deleteTaxon(Taxon taxon
, TaxonDeletionConfigurator config
, Classification classification
) throws DataChangeNoRollbackException
;
241 * Changes the homotypic group of a synonym into the new homotypic group.
242 * All relations to taxa are updated correctly depending on the homotypic
243 * group of the accepted taxon. <BR>
244 * All existing basionym relationships to and from this name are removed.<BR>
245 * If the parameter <code>targetTaxon</code> is defined, the synonym is
246 * added to this taxon irrespctive of if it has been related to this
248 * If <code>removeFromOtherTaxa</code> is true and <code>targetTaxon</code> is
249 * defined all relationships to other taxa are deleted.<BR>
250 * If <code>setBasionymRelationIfApplicable</code> is true a basionym relationship
251 * between the existing basionym(s) of the new homotypic group and the synonyms name
255 * @param newHomotypicalGroup
257 * @param setBasionymRelationIfApplicable
259 public void changeHomotypicalGroupOfSynonym(Synonym synonym
, HomotypicalGroup newHomotypicalGroup
, Taxon targetTaxon
,
260 boolean removeFromOtherTaxa
, boolean setBasionymRelationIfApplicable
);
264 * Moves a synonym to another taxon and removes the old synonym relationship.
266 * @param oldSynonymRelation the old synonym relationship defining the synonym to move and the old accepted taxon.
267 * @param newTaxon the taxon the synonym will be moved to
268 * @param moveHomotypicGroup if the synonym belongs to a homotypical group with other synonyms and
269 * <code>moveHomotypicGroup</code> is <code>true</code> all these synonyms are moved to the new taxon,
270 * if <code>false</code> a {@link HomotypicalGroupChangeException} is thrown.
271 * <code>MoveHomotypicGroup</code> has no effect if the synonym is the only synonym in it's homotypic group.
272 * @param newSynonymRelationshipType the synonym relationship type of the new synonym relations. Default is
273 * {@link SynonymRelationshipType#HETEROTYPIC_SYNONYM_OF() heterotypic}.
274 * @param newReference The reference for the new synonym relation(s).
275 * @param newReferenceDetail The reference detail for the new synonym relation(s).
276 * @param keepReference if no <code>newReference</code> and/or no <code>newReferenceDetail</code>
277 * is defined they are taken from the old synonym relation(s) if <code>keepReference</code> is
278 * <code>true</code>. If <code>false</code> the reference and the reference detail will be taken
279 * only from the <code>newReference</code> and <code>newReferenceDetail</code>.
280 * @return The new synonym relationship. If <code>moveHomotypicGroup</code> is <code>true</code> additionally
281 * created new synonym relationships must be retrieved separately from the new taxon.
282 * @throws HomotypicalGroupChangeException Exception is thrown if (1) synonym is homotypic to the old accepted taxon or
283 * (2) synonym is in homotypic group with other synonyms and <code>moveHomotypicGroup</code> is false
285 public SynonymRelationship
moveSynonymToAnotherTaxon(SynonymRelationship oldSynonymRelation
, Taxon newTaxon
, boolean moveHomotypicGroup
,
286 SynonymRelationshipType newSynonymRelationshipType
, Reference newReference
, String newReferenceDetail
, boolean keepReference
) throws HomotypicalGroupChangeException
;
289 * Returns the TaxonRelationships (of where relationship.type == type, if this argument is supplied)
290 * where the supplied taxon is relatedTo.
292 * @param taxon The taxon that is relatedTo
293 * @param type The type of TaxonRelationship (can be null)
294 * @param pageSize The maximum number of relationships returned (can be null for all relationships)
295 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
296 * @param orderHints Properties to order by
297 * @param propertyPaths Properties to initialize in the returned entities, following the syntax described in {@link IBeanInitializer#initialize(Object, List)}
298 * @return a List of TaxonRelationship instances
300 public List
<TaxonRelationship
> listToTaxonRelationships(Taxon taxon
, TaxonRelationshipType type
, Integer pageSize
, Integer pageNumber
, List
<OrderHint
> orderHints
, List
<String
> propertyPaths
);
305 * Returns the TaxonRelationships (of where relationship.type == type, if this arguement is supplied)
306 * where the supplied taxon is relatedTo.
308 * @param taxon The taxon that is relatedTo
309 * @param type The type of TaxonRelationship (can be null)
310 * @param pageSize The maximum number of relationships returned (can be null for all relationships)
311 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
312 * @param orderHints Properties to order by
313 * @param propertyPaths Properties to initialize in the returned entities, following the syntax described in {@link IBeanInitializer#initialize(Object, List)}
314 * @return a Pager of TaxonRelationship instances
316 public Pager
<TaxonRelationship
> pageToTaxonRelationships(Taxon taxon
, TaxonRelationshipType type
, Integer pageSize
, Integer pageNumber
, List
<OrderHint
> orderHints
, List
<String
> propertyPaths
);
319 * Returns the TaxonRelationships (of where relationship.type == type, if this argument is supplied)
320 * where the supplied taxon is relatedFrom.
322 * @param taxon The taxon that is relatedFrom
323 * @param type The type of TaxonRelationship (can be null)
324 * @param pageSize The maximum number of relationships returned (can be null for all relationships)
325 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
326 * @param orderHints Properties to order by
327 * @param propertyPaths Properties to initialize in the returned entities, following the syntax described in {@link IBeanInitializer#initialize(Object, List)}
328 * @return a List of TaxonRelationship instances
330 public List
<TaxonRelationship
> listFromTaxonRelationships(Taxon taxon
, TaxonRelationshipType type
, Integer pageSize
, Integer pageNumber
, List
<OrderHint
> orderHints
, List
<String
> propertyPaths
);
334 * Returns the TaxonRelationships (of where relationship.type == type, if this argument is supplied)
335 * where the supplied taxon is relatedFrom.
337 * @param taxon The taxon that is relatedFrom
338 * @param type The type of TaxonRelationship (can be null)
339 * @param pageSize The maximum number of relationships returned (can be null for all relationships)
340 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
341 * @param orderHints Properties to order by
342 * @param propertyPaths Properties to initialize in the returned entities, following the syntax described in {@link IBeanInitializer#initialize(Object, List)}
343 * @return a Pager of TaxonRelationship instances
345 public Pager
<TaxonRelationship
> pageFromTaxonRelationships(Taxon taxon
, TaxonRelationshipType type
, Integer pageSize
, Integer pageNumber
, List
<OrderHint
> orderHints
, List
<String
> propertyPaths
);
348 * lists all taxa which are related to the <code>taxon</code> given as
352 * @param includeRelationships
354 * <code>1</code> for one level, <code>null</code> for infinite
355 * depth, <code>0</code> will completely omit collecting related taxa.
358 * @param propertyPaths
361 public Set
<Taxon
> listRelatedTaxa(Taxon taxon
, Set
<TaxonRelationshipEdge
> includeRelationships
, Integer maxDepth
,
362 Integer limit
, Integer start
, List
<String
> propertyPaths
);
365 * lists all accepted taxa for the given {@link Synonym}
370 * @param propertyPaths
373 public List
<Classification
> listClassifications(TaxonBase taxonBase
, Integer limit
, Integer start
, List
<String
> propertyPaths
);
376 * Returns the SynonymRelationships (of where relationship.type == type, if this argument is supplied)
377 * where the supplied synonym is relatedFrom.
379 * @param taxon The synonym that is relatedFrom
380 * @param type The type of SynonymRelationship (can be null)
381 * @param pageSize The maximum number of relationships returned (can be null for all relationships)
382 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
383 * * @param orderHints Properties to order by
384 * @param propertyPaths Properties to initialize in the returned entities, following the syntax described in {@link IBeanInitializer#initialize(Object, List)}
385 * @return a Pager of SynonymRelationship instances
387 public Pager
<SynonymRelationship
> getSynonyms(Synonym synonym
, SynonymRelationshipType type
, Integer pageSize
, Integer pageNumber
, List
<OrderHint
> orderHints
, List
<String
> propertyPaths
);
390 * Returns the SynonymRelationships (of where relationship.type == type, if this argument is supplied)
391 * where the supplied taxon is relatedTo.
393 * @param taxon The taxon that is relatedTo
394 * @param type The type of SynonymRelationship (can be null)
395 * @param pageSize The maximum number of relationships returned (can be null for all relationships)
396 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
397 * * @param orderHints Properties to order by
398 * @param propertyPaths Properties to initialize in the returned entities, following the syntax described in {@link IBeanInitializer#initialize(Object, List)}
399 * @return a Pager of SynonymRelationship instances
401 public Pager
<SynonymRelationship
> getSynonyms(Taxon taxon
, SynonymRelationshipType type
, Integer pageSize
, Integer pageNumber
, List
<OrderHint
> orderHints
, List
<String
> propertyPaths
);
404 * Returns the list of all synonyms that share the same homotypical group with the given taxon.
405 * Only those homotypic synonyms are returned that do have a synonym relationship with the accepted taxon.
407 * @param propertyPaths
410 public List
<Synonym
> getHomotypicSynonymsByHomotypicGroup(Taxon taxon
, List
<String
> propertyPaths
);
413 * Returns the ordered list of all {@link eu.etaxonomy.cdm.model.name.HomotypicalGroup homotypical groups}
414 * that contain {@link Synonym synonyms} that are heterotypic to the given taxon.
415 * {@link eu.etaxonomy.cdm.model.name.TaxonNameBase Taxon names} of heterotypic synonyms
416 * belong to a homotypical group which cannot be the homotypical group to which the
417 * taxon name of the given taxon belongs. This method does not return the homotypic group the given
418 * taxon belongs to.<BR>
419 * This method does neglect the type of synonym relationship that is defined between the given taxon
420 * and the synonym. So the synonym relationship may be homotypic however a synonym is returned
421 * in one of the result lists as long as the synonym does not belong to the same homotypic group as
422 * the given taxon.<BR>
423 * The list returned is ordered according to the date of publication of the
424 * first published name within each homotypical group.
426 * @see #getHeterotypicSynonymyGroups()
427 * @see #getSynonyms()
428 * @see SynonymRelationshipType#HETEROTYPIC_SYNONYM_OF()
429 * @see eu.etaxonomy.cdm.model.name.HomotypicalGroup
432 * @param propertyPaths
435 public List
<List
<Synonym
>> getHeterotypicSynonymyGroups(Taxon taxon
, List
<String
> propertyPaths
);
438 * Returns a Paged List of TaxonBase instances where the default field matches the String queryString (as interpreted by the Lucene QueryParser)
440 * @param clazz filter the results by class (or pass null to return all TaxonBase instances)
442 * @param pageSize The maximum number of taxa returned (can be null for all matching taxa)
443 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
445 * Supports path like <code>orderHints.propertyNames</code> which
446 * include *-to-one properties like createdBy.username or
447 * authorTeam.persistentTitleCache
448 * @param propertyPaths properties to be initialized
449 * @return a Pager Taxon instances
450 * @see <a href="http://lucene.apache.org/java/2_4_0/queryparsersyntax.html">Apache Lucene - Query Parser Syntax</a>
453 public Pager
<TaxonBase
> search(Class
<?
extends TaxonBase
> clazz
, String queryString
, Integer pageSize
, Integer pageNumber
, List
<OrderHint
> orderHints
, List
<String
> propertyPaths
);
456 * Returns a list of TaxonBase instances where the
457 * taxon.name properties match the parameters passed. In order to search for any string value, pass '*', passing the string value of
458 * <i>null</i> will search for those taxa with a value of null in that field
460 * @param clazz optionally filter by class (can be null to return all taxa)
462 * @param infragenericEpithet
463 * @param specificEpithet
464 * @param infraspecificEpithet
466 * @param pageSize The maximum number of taxa returned (can be null for all matching taxa)
467 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
468 * @return a list of TaxonBase instances
470 public Pager
<TaxonBase
> findTaxaByName(Class
<?
extends TaxonBase
> clazz
, String uninomial
, String infragenericEpithet
, String specificEpithet
, String infraspecificEpithet
, Rank rank
, Integer pageSize
, Integer pageNumber
);
473 * Returns a list of TaxonBase instances where the
474 * taxon.name properties match the parameters passed. In order to search for any string value, pass '*', passing the string value of
475 * <i>null</i> will search for those taxa with a value of null in that field
477 * @param clazz optionally filter by class
479 * @param infragenericEpithet
480 * @param specificEpithet
481 * @param infraspecificEpithet
483 * @param pageSize The maximum number of taxa returned (can be null for all matching taxa)
484 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
485 * @return a List of TaxonBase instances
487 public List
<TaxonBase
> listTaxaByName(Class
<?
extends TaxonBase
> clazz
, String uninomial
, String infragenericEpithet
, String specificEpithet
, String infraspecificEpithet
, Rank rank
, Integer pageSize
, Integer pageNumber
);
490 * Returns a list of IdentifiableEntity instances (in particular, TaxonNameBase and TaxonBase instances)
491 * that match the properties specified in the configurator.
492 * @param configurator
495 public Pager
<IdentifiableEntity
> findTaxaAndNames(IFindTaxaAndNamesConfigurator configurator
);
498 * performes a union searches for TaxonBase instances on all available
499 * free text indexes. At the time of writing this documentation it combines
500 * {@link #findByDescriptionElementFullText(Class, String, Classification, List, List, boolean, Integer, Integer, List, List)}
501 * and {@link #findByFullText(Class, String, Classification, List, boolean, Integer, Integer, List, List)
505 * @param classification
506 * Additional filter criterion: If a taxonomic classification
507 * three is specified here the result set will only contain taxa
508 * of the given classification
510 * Additional filter criterion: Search only in these languages.
511 * Not all text fields in the cdm model are multilingual, thus
512 * this setting will only apply to the multilingiual fields.
513 * Other fields are searched nevertheless if this parameter is
515 * @param highlightFragments
518 * The maximum number of objects returned (can be null for all
521 * The offset (in pageSize chunks) from the start of the result
524 * Supports path like <code>orderHints.propertyNames</code> which
525 * include *-to-one properties like createdBy.username or
526 * authorTeam.persistentTitleCache
527 * @param propertyPaths
528 * properties to initialize - see
529 * {@link IBeanInitializer#initialize(Object, List)}
530 * @return a paged list of instances of type T matching the queryString and
531 * the additional filter criteria
533 * @throws CorruptIndexException
534 * @throws IOException
535 * @throws ParseException
536 * @throws LuceneMultiSearchException
537 * @deprecated this search should fully be covered by the new method
538 * {@link #findTaxaAndNamesByFullText(EnumSet, String, Classification, Set, List, boolean, Integer, Integer, List, List)}
539 * , maybe we should rename this latter method to give it a more meaningful name
542 public Pager
<SearchResult
<TaxonBase
>> findByEverythingFullText(String queryString
,
543 Classification classification
, List
<Language
> languages
, boolean highlightFragments
,
544 Integer pageSize
, Integer pageNumber
, List
<OrderHint
> orderHints
, List
<String
> propertyPaths
) throws CorruptIndexException
, IOException
, ParseException
, LuceneMultiSearchException
;
547 * Searches for TaxonBase instances using the TaxonBase free text index.
549 * <h4>This is an experimental feature, it may be moved, modified, or even
550 * removed in future releases!!!</h4>
553 * Additional filter criterion: The specific TaxonBase subclass
557 * @param classification
558 * Additional filter criterion: If a taxonomic classification
559 * three is specified here the result set will only contain taxa
560 * of the given classification
562 * Additional filter criterion: Search only in these languages.
563 * Not all text fields in the cdm model are multilingual, thus
564 * this setting will only apply to the multilingiual fields.
565 * Other fields are searched nevertheless if this parameter is
567 * @param highlightFragments
570 * The maximum number of objects returned (can be null for all
573 * The offset (in pageSize chunks) from the start of the result
576 * Supports path like <code>orderHints.propertyNames</code> which
577 * include *-to-one properties like createdBy.username or
578 * authorTeam.persistentTitleCache
579 * @param propertyPaths
580 * properties to initialize - see
581 * {@link IBeanInitializer#initialize(Object, List)}
582 * @return a paged list of instances of type T matching the queryString and
583 * the additional filter criteria
584 * @throws CorruptIndexException
585 * @throws IOException
586 * @throws ParseException
588 public Pager
<SearchResult
<TaxonBase
>> findByFullText(Class
<?
extends TaxonBase
> clazz
, String queryString
, Classification classification
,
589 List
<Language
> languages
, boolean highlightFragments
, Integer pageSize
, Integer pageNumber
, List
<OrderHint
> orderHints
,
590 List
<String
> propertyPaths
) throws CorruptIndexException
, IOException
, ParseException
;
595 * @param statusFilter
596 * @param classification
597 * Additional filter criterion: If a taxonomic classification
598 * three is specified here the result set will only contain taxa
599 * of the given classification
600 * @param highlightFragments
602 * The maximum number of objects returned (can be null for all
605 * The offset (in pageSize chunks) from the start of the result
608 * Supports path like <code>orderHints.propertyNames</code> which
609 * include *-to-one properties like createdBy.username or
610 * authorTeam.persistentTitleCache
611 * @param propertyPath
612 * Common properties to initialize the instances of the
613 * CDM types ({@link Taxon} and {@link Synonym}
614 * this method can return - see {@link IBeanInitializer#initialize(Object, List)}
615 * @return a paged list of instances of {@link Taxon} instances
616 * @throws IOException
617 * @throws ParseException
619 public Pager
<SearchResult
<TaxonBase
>> findByDistribution(List
<NamedArea
> areaFilter
, List
<PresenceAbsenceTermBase
<?
>> statusFilter
,
620 Classification classification
,
621 Integer pageSize
, Integer pageNumber
,
622 List
<OrderHint
> orderHints
, List
<String
> propertyPaths
) throws IOException
, ParseException
;
625 * Searches for TaxonBase instances using the TaxonBase free text index.
629 * <h4>This is an experimental feature, it may be moved, modified, or even
630 * removed in future releases!!!</h4>
632 * Additional filter criterion: defaults to [doTaxa] if set null
635 * @param classification
636 * Additional filter criterion: If a taxonomic classification
637 * three is specified here the result set will only contain taxa
638 * of the given classification
641 * Additional filter criterion: Search only in these languages.
642 * Not all text fields in the cdm model are multilingual, thus
643 * this setting will only apply to the multilingiual fields.
644 * Other fields are searched nevertheless if this parameter is
646 * @param highlightFragments
649 * The maximum number of objects returned (can be null for all
652 * The offset (in pageSize chunks) from the start of the result
655 * Supports path like <code>orderHints.propertyNames</code> which
656 * include *-to-one properties like createdBy.username or
657 * authorTeam.persistentTitleCache
658 * @param propertyPath
659 * Common properties to initialize the instances of the
660 * CDM types ({@link Taxon} and {@link Synonym}
661 * this method can return - see {@link IBeanInitializer#initialize(Object, List)}
662 * @return a paged list of instances of {@link Taxon}, {@link Synonym}, matching the queryString and
663 * the additional filter criteria
664 * @throws CorruptIndexException
665 * @throws IOException
666 * @throws ParseException
667 * @throws LuceneMultiSearchException
669 public Pager
<SearchResult
<TaxonBase
>> findTaxaAndNamesByFullText(
670 EnumSet
<TaxaAndNamesSearchMode
> searchModes
,
671 String queryString
, Classification classification
, Set
<NamedArea
> namedAreas
, Set
<PresenceAbsenceTermBase
<?
>> distributionStatus
,
672 List
<Language
> languages
, boolean highlightFragments
, Integer pageSize
, Integer pageNumber
, List
<OrderHint
> orderHints
,
673 List
<String
> propertyPaths
) throws CorruptIndexException
, IOException
, ParseException
, LuceneMultiSearchException
;
676 * Searches for TaxonBase instances by using the DescriptionElement free text index.
678 * <h4>This is an experimental feature, it may be moved, modified, or even
679 * removed in future releases!!!</h4>
682 * Additional filter criterion:
684 * the query string to filter by
685 * @param classification
686 * Additional filter criterion: If a taxonomic classification
687 * three is specified here the result set will only contain taxa
688 * of the given classification
692 * Additional filter criterion: Search only in these languages.
693 * Not all text fields in the cdm model are multilingual, thus
694 * this setting will only apply to the multilingiual fields.
695 * Other fields are searched nevertheless if this parameter is
697 * @param highlightFragments
700 * The maximum number of objects returned (can be null for all
703 * The offset (in pageSize chunks) from the start of the result
706 * Supports path like <code>orderHints.propertyNames</code> which
707 * include *-to-one properties like createdBy.username or
708 * authorTeam.persistentTitleCache
709 * @param propertyPaths
710 * properties to initialize - see
711 * {@link IBeanInitializer#initialize(Object, List)}
712 * @return a paged list of instances of type T matching the queryString and
713 * the additional filter criteria
714 * @throws IOException
715 * @throws CorruptIndexException
716 * @throws ParseException
718 public Pager
<SearchResult
<TaxonBase
>> findByDescriptionElementFullText(Class
<?
extends DescriptionElementBase
> clazz
, String queryString
, Classification classification
, List
<Feature
> features
, List
<Language
> languages
, boolean highlightFragments
, Integer pageSize
, Integer pageNumber
, List
<OrderHint
> orderHints
, List
<String
> propertyPaths
) throws CorruptIndexException
, IOException
, ParseException
;
726 * @param widthOrDuration
730 * @deprecated use {@link #listMedia(Taxon, Set, boolean, boolean, List)} instead
733 public List
<MediaRepresentation
> getAllMedia(Taxon taxon
, int size
, int height
, int widthOrDuration
, String
[] mimeTypes
);
737 * Lists all Media found in an any TaxonDescription associated with this
741 * @param includeRelationships
742 * the given list of TaxonRelationshipEdges will be taken into
743 * account when retrieving media associated with the given taxon.
745 * @param limitToGalleries
746 * whether to take only TaxonDescription into account which are
749 * @deprecated use {@link #listMedia(Taxon, Set, boolean, boolean, List)} instead
752 public List
<Media
> listTaxonDescriptionMedia(Taxon taxon
, Set
<TaxonRelationshipEdge
> includeRelationships
, boolean limitToGalleries
, List
<String
> propertyPath
);
755 * Lists all Media found in an any TaxonDescription, NameDescription,
756 * SpecimenOrObservationBase, DnaSample Chromatograms, etc. associated with this taxon.
759 * @param includeRelationships
760 * the given list of TaxonRelationshipEdges will be taken into
761 * account when retrieving media associated with the given taxon.
763 * @param limitToGalleries
764 * whether to take only descriptions into account which are
765 * marked as gallery, can be NULL
766 * @param includeTaxonDescriptions
767 * whether to take TaxonDescriptions into account, can be NULL
768 * @param includeOccurrences
769 * whether to take TaxonDescriptions into account, can be NULL
770 * @param includeTaxonNameDescriptions
771 * whether to take TaxonNameDescriptions into account, can be NULL
772 * @param propertyPath
775 public List
<Media
> listMedia(Taxon taxon
, Set
<TaxonRelationshipEdge
> includeRelationships
,
776 Boolean limitToGalleries
, Boolean includeTaxonDescriptions
, Boolean includeOccurrences
,
777 Boolean includeTaxonNameDescriptions
, List
<String
> propertyPath
);
779 public List
<TaxonBase
> findTaxaByID(Set
<Integer
> listOfIDs
);
782 * Returns the TaxonBase with the given UUID
783 * using the given match mode and initialization strategy
786 * @param propertyPaths
789 public TaxonBase
findTaxonByUuid(UUID uuid
, List
<String
> propertyPaths
);
791 public int countAllRelationships();
793 public List
<TaxonNameBase
> findIdenticalTaxonNames(List
<String
> propertyPath
);
794 public List
<TaxonNameBase
> findIdenticalTaxonNameIds(List
<String
> propertyPath
);
795 public String
getPhylumName(TaxonNameBase name
);
797 public long deleteSynonymRelationships(Synonym syn
);
804 * Removes a synonym.<BR><BR>
806 * In detail it removes
807 * <li>all synonym relationship to the given taxon or to all taxa if taxon is <code>null</code></li>
808 * <li>the synonym concept if it is not referenced by any synonym relationship anymore</li>
810 * If <code>removeNameIfPossible</code> is true
811 * it also removes the synonym name if it is not used in any other context
812 * (part of a concept, in DescriptionElementSource, part of a name relationship, used inline, ...)<BR><BR>
813 * If <code>newHomotypicGroupIfNeeded</code> is <code>true</code> and the synonym name is not deleted and
814 * the name is homotypic to the taxon the name is moved to a new homotypical group.<BR><BR>
816 * If synonym is <code>null</code> the method has no effect.
820 * @param removeNameIfPossible
821 * @throws DataChangeNoRollbackException
823 public void deleteSynonym(Synonym synonym
, SynonymDeletionConfigurator config
);
827 * Returns the SynonymRelationships (of where relationship.type == type, if this argument is supplied)
828 * depending on direction, where the supplied taxon is relatedTo or the supplied synonym is relatedFrom.
830 * @param taxonBase The taxon or synonym that is relatedTo or relatedFrom
831 * @param type The type of SynonymRelationship (can be null)
832 * @param pageSize The maximum number of relationships returned (can be null for all relationships)
833 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
834 * @param orderHints Properties to order by
835 * @param propertyPaths Properties to initialize in the returned entities, following the syntax described in {@link IBeanInitializer#initialize(Object, List)}
836 * @param direction The direction of the relationship
837 * @return a List of SynonymRelationship instances
839 public List
<SynonymRelationship
> listSynonymRelationships(
840 TaxonBase taxonBase
, SynonymRelationshipType type
, Integer pageSize
, Integer pageNumber
,
841 List
<OrderHint
> orderHints
, List
<String
> propertyPaths
, Direction direction
);
847 public Taxon
findBestMatchingTaxon(String taxonName
);
849 public Taxon
findBestMatchingTaxon(MatchingTaxonConfigurator config
);
851 public Synonym
findBestMatchingSynonym(String taxonName
);
853 public List
<UuidAndTitleCache
<TaxonBase
>> getUuidAndTitleCacheTaxon();
855 public List
<UuidAndTitleCache
<TaxonBase
>> getUuidAndTitleCacheSynonym();
857 public List
<UuidAndTitleCache
<TaxonBase
>> findTaxaAndNamesForEditor(IFindTaxaAndNamesConfigurator configurator
);
860 * Creates the specified inferred synonyms for the taxon in the classification, but do not insert it to the database
863 * @return list of inferred synonyms
865 public List
<Synonym
> createInferredSynonyms(Taxon taxon
, Classification tree
, SynonymRelationshipType type
, boolean doWithMisappliedNames
);
868 * Creates all inferred synonyms for the taxon in the classification, but do not insert it to the database
872 * @return list of inferred synonyms
874 public List
<Synonym
> createAllInferredSynonyms(Taxon taxon
, Classification tree
, boolean doWithMisappliedNames
);
880 * Removes a synonym.<BR><BR>
882 * In detail it removes
883 * <li>all synonym relationship to the given taxon or to all taxa if taxon is <code>null</code></li>
884 * <li>the synonym concept if it is not referenced by any synonym relationship anymore</li>
886 * If <code>config.removeNameIfPossible</code> is true
887 * it also removes the synonym name if it is not used in any other context
888 * (part of a concept, in DescriptionElementSource, part of a name relationship, used inline, ...)<BR><BR>
889 * If <code>config.newHomotypicGroupIfNeeded</code> is <code>true</code> and the synonym name is not deleted and
890 * the name is homotypic to the taxon the name is moved to a new homotypical group.<BR><BR>
892 * If synonym is <code>null</code> the method has no effect.
897 * @throws DataChangeNoRollbackException
899 void deleteSynonym(Synonym synonym
, Taxon taxon
,
900 SynonymDeletionConfigurator config
);