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
.IncludedTaxonConfiguration
;
24 import eu
.etaxonomy
.cdm
.api
.service
.config
.MatchingTaxonConfigurator
;
25 import eu
.etaxonomy
.cdm
.api
.service
.config
.SynonymDeletionConfigurator
;
26 import eu
.etaxonomy
.cdm
.api
.service
.config
.TaxonDeletionConfigurator
;
27 import eu
.etaxonomy
.cdm
.api
.service
.dto
.IncludedTaxaDTO
;
28 import eu
.etaxonomy
.cdm
.api
.service
.exception
.DataChangeNoRollbackException
;
29 import eu
.etaxonomy
.cdm
.api
.service
.exception
.HomotypicalGroupChangeException
;
30 import eu
.etaxonomy
.cdm
.api
.service
.pager
.Pager
;
31 import eu
.etaxonomy
.cdm
.api
.service
.search
.LuceneMultiSearchException
;
32 import eu
.etaxonomy
.cdm
.api
.service
.search
.SearchResult
;
33 import eu
.etaxonomy
.cdm
.api
.service
.util
.TaxonRelationshipEdge
;
34 import eu
.etaxonomy
.cdm
.model
.common
.IdentifiableEntity
;
35 import eu
.etaxonomy
.cdm
.model
.common
.Language
;
36 import eu
.etaxonomy
.cdm
.model
.common
.OrderedTermVocabulary
;
37 import eu
.etaxonomy
.cdm
.model
.common
.RelationshipBase
;
38 import eu
.etaxonomy
.cdm
.model
.common
.RelationshipBase
.Direction
;
39 import eu
.etaxonomy
.cdm
.model
.common
.UuidAndTitleCache
;
40 import eu
.etaxonomy
.cdm
.model
.description
.DescriptionElementBase
;
41 import eu
.etaxonomy
.cdm
.model
.description
.Feature
;
42 import eu
.etaxonomy
.cdm
.model
.description
.PresenceAbsenceTermBase
;
43 import eu
.etaxonomy
.cdm
.model
.location
.NamedArea
;
44 import eu
.etaxonomy
.cdm
.model
.media
.Media
;
45 import eu
.etaxonomy
.cdm
.model
.media
.MediaRepresentation
;
46 import eu
.etaxonomy
.cdm
.model
.name
.HomotypicalGroup
;
47 import eu
.etaxonomy
.cdm
.model
.name
.Rank
;
48 import eu
.etaxonomy
.cdm
.model
.name
.TaxonNameBase
;
49 import eu
.etaxonomy
.cdm
.model
.reference
.Reference
;
50 import eu
.etaxonomy
.cdm
.model
.taxon
.Classification
;
51 import eu
.etaxonomy
.cdm
.model
.taxon
.Synonym
;
52 import eu
.etaxonomy
.cdm
.model
.taxon
.SynonymRelationship
;
53 import eu
.etaxonomy
.cdm
.model
.taxon
.SynonymRelationshipType
;
54 import eu
.etaxonomy
.cdm
.model
.taxon
.Taxon
;
55 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonBase
;
56 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonRelationship
;
57 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonRelationshipType
;
58 import eu
.etaxonomy
.cdm
.persistence
.dao
.initializer
.IBeanInitializer
;
59 import eu
.etaxonomy
.cdm
.persistence
.fetch
.CdmFetch
;
60 import eu
.etaxonomy
.cdm
.persistence
.query
.OrderHint
;
63 public interface ITaxonService
extends IIdentifiableEntityService
<TaxonBase
>{
66 * Computes all Taxon instances that do not have a taxonomic parent.
67 * @param sec The concept reference that the taxon belongs to
69 * @param onlyWithChildren if true only taxa are returned that have taxonomic children. <Br>Default: true.
70 * @return The List<Taxon> of root taxa.
71 * @deprecated obsolete when using classification
74 public List
<Taxon
> getRootTaxa(Reference sec
, CdmFetch cdmFetch
, boolean onlyWithChildren
);
77 * Computes all Taxon instances which name is of a certain Rank.
78 * @param rank The rank of the taxon name
79 * @param sec The concept reference that the taxon belongs to
80 * @param onlyWithChildren if true only taxa are returned that have taxonomic children. <Br>Default: true.
81 * @param withMisapplications if false taxa that have at least one misapplied name relationship in which they are
82 * the misapplied name are not returned.<Br>Default: true.
83 * @param propertyPaths
84 * properties to be initialized, For detailed description and
85 * examples <b>please refer to:</b>
86 * {@link IBeanInitializer#initialize(Object, List)}. <Br>
88 * @return The List<Taxon> of root taxa.
89 * @deprecated obsolete when using classification
92 public List
<Taxon
> getRootTaxa(Rank rank
, Reference sec
, boolean onlyWithChildren
, boolean withMisapplications
, List
<String
> propertyPaths
);
95 * Computes all relationships.
99 * FIXME candidate for harmonization - rename to listRelationships
101 public List
<RelationshipBase
> getAllRelationships(int limit
, int start
);
104 * Returns TaxonRelationshipType vocabulary
106 * @deprecated use TermService#getVocabulary(VocabularyType) instead
109 public OrderedTermVocabulary
<TaxonRelationshipType
> getTaxonRelationshipTypeVocabulary();
112 * Returns a list of taxa that matches the name string and the sec reference
113 * @param name the name string to search for
114 * @param sec the taxons sec reference
115 * @return a list of taxa matching the name and the sec reference
117 public List
<TaxonBase
> searchTaxaByName(String name
, Reference sec
);
120 * Swaps given synonym and accepted taxon.
123 * <li>A new accepted taxon with the synonyms name is created</li>
124 * <li>The synonym is deleted from the old accepted taxons synonym list</li>
125 * <li>A new synonym with the name of the old accepted taxon is created</li>
126 * <li>The newly created synonym get related to the newly created accepted taxon</li>
130 * @param acceptedTaxon
131 * @param synonymRelationshipType the relationship type the newly created synonym will have. Defaults to SYNONYM_OF
133 public void swapSynonymAndAcceptedTaxon(Synonym synonym
, Taxon acceptedTaxon
);
136 * Changes a synonym into an accepted taxon and removes
137 * the synonym relationship to the given accepted taxon.
138 * Other synonyms homotypic to the synonym to change are
139 * moved to the same new accepted taxon as homotypic
140 * synonyms. The new accepted taxon has the same name and
141 * the same sec reference as the old synonym.<BR>
142 * If the given accepted taxon and the synonym are homotypic
143 * to each other an exception may be thrown as taxonomically it doesn't
144 * make sense to have two accepted taxa in the same homotypic group
145 * but also it is than difficult to decide how to handle other names
146 * in the homotypic group. It is up to the implementing class to
147 * handle this situation via an exception or in another way.
151 * the synonym to change into an accepted taxon
152 * @param acceptedTaxon
153 * an accepted taxon, the synonym had a relationship to
154 * @param deleteSynonym
155 * if true the method tries to delete the old synonym from the database
156 * @param copyCitationInfo
157 * if true the citation and the microcitation of newly created synonyms
158 * is taken from the old synonym relationships.
160 * if given this citation is added to the newly created synonym
161 * relationships as citation. Only used if copyCitationInfo is <code> false</code>
162 * @param microCitation
163 * if given this microCitation is added to the newly created synonym
164 * relationships as microCitation.Only used if copyCitationInfo is <code> false</code>
166 * the newly created accepted taxon
167 * @throws IllegalArgumentException
168 * if the given accepted taxon and the synonym are homotypic
169 * to each other an exception may be thrown as taxonomically it doesn't
170 * make sense to have two accepted taxa in the same homotypic group
171 * but also it is than difficult to decide how to handle other names
172 * in the homotypic group. It is up to the implementing class to
173 * handle this situation via an exception or in another way.
175 public Taxon
changeSynonymToAcceptedTaxon(Synonym synonym
, Taxon acceptedTaxon
, boolean deleteSynonym
, boolean copyCitationInfo
, Reference citation
, String microCitation
) throws HomotypicalGroupChangeException
;
178 * TODO still needed and correct?
179 * Change a synonym into a related concept
182 * the synonym to change into the concept taxon
184 * the taxon the newly created concept should be related to
185 * @param taxonRelationshipType
186 * the type of relationship
188 * @param microReference
190 * the newly created concept
192 public Taxon
changeSynonymToRelatedTaxon(Synonym synonym
, Taxon toTaxon
, TaxonRelationshipType taxonRelationshipType
, Reference reference
, String microReference
);
195 * TODO still needed and correct?
196 * Change a synonym into a related concept
199 * the synonym to change into the concept taxon
201 * the taxon the newly created concept should be related to
202 * @param taxonRelationshipType
203 * the type of relationship
205 * @param microReference
207 * the newly created concept
208 * @throws DataChangeNoRollbackException
210 public Synonym
changeRelatedTaxonToSynonym(Taxon fromTaxon
, Taxon toTaxon
,
211 TaxonRelationshipType oldRelationshipType
,
212 SynonymRelationshipType synonymRelationshipType
) throws DataChangeNoRollbackException
;
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}.
238 public DeleteResult
deleteTaxon(Taxon taxon
, TaxonDeletionConfigurator config
, Classification classification
) ;
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 * This method returns in the first entry the list of synonyms of the
405 * homotypic group of the accepted taxon. All other entries represent the lists of heterotypic
406 * synonym groups. For detailed information about these 2 groups see
407 * {@link #getHomotypicSynonymsByHomotypicGroup(Taxon, List)} and
408 * {@link #getHeterotypicSynonymyGroups(Taxon, List)}
410 * @see #getSynonyms()
411 * @see SynonymRelationshipType#HETEROTYPIC_SYNONYM_OF()
412 * @see eu.etaxonomy.cdm.model.name.HomotypicalGroup
414 * @param taxon the accepted taxon
415 * @param propertyPaths the property path
416 * @return the list of groups of synonyms
418 public List
<List
<Synonym
>> getSynonymsByHomotypicGroup(Taxon taxon
, List
<String
> propertyPaths
);
422 * Returns the list of all synonyms that share the same homotypical group with the given taxon.
423 * Only those homotypic synonyms are returned that do have a synonym relationship with the accepted taxon.
425 * @param propertyPaths
428 public List
<Synonym
> getHomotypicSynonymsByHomotypicGroup(Taxon taxon
, List
<String
> propertyPaths
);
431 * Returns the ordered list of all {@link eu.etaxonomy.cdm.model.name.HomotypicalGroup homotypical groups}
432 * that contain {@link Synonym synonyms} that are heterotypic to the given taxon.
433 * {@link eu.etaxonomy.cdm.model.name.TaxonNameBase Taxon names} of heterotypic synonyms
434 * belong to a homotypical group which cannot be the homotypical group to which the
435 * taxon name of the given taxon belongs. This method does not return the homotypic group the given
436 * taxon belongs to.<BR>
437 * This method does neglect the type of synonym relationship that is defined between the given taxon
438 * and the synonym. So the synonym relationship may be homotypic however a synonym is returned
439 * in one of the result lists as long as the synonym does not belong to the same homotypic group as
440 * the given taxon.<BR>
441 * The list returned is ordered according to the date of publication of the
442 * first published name within each homotypical group.
444 * @see #getHeterotypicSynonymyGroups()
445 * @see #getSynonyms()
446 * @see SynonymRelationshipType#HETEROTYPIC_SYNONYM_OF()
447 * @see eu.etaxonomy.cdm.model.name.HomotypicalGroup
450 * @param propertyPaths
453 public List
<List
<Synonym
>> getHeterotypicSynonymyGroups(Taxon taxon
, List
<String
> propertyPaths
);
456 * Returns a Paged List of TaxonBase instances where the default field matches the String queryString (as interpreted by the Lucene QueryParser)
458 * @param clazz filter the results by class (or pass null to return all TaxonBase instances)
460 * @param pageSize The maximum number of taxa returned (can be null for all matching taxa)
461 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
463 * Supports path like <code>orderHints.propertyNames</code> which
464 * include *-to-one properties like createdBy.username or
465 * authorTeam.persistentTitleCache
466 * @param propertyPaths properties to be initialized
467 * @return a Pager Taxon instances
468 * @see <a href="http://lucene.apache.org/java/2_4_0/queryparsersyntax.html">Apache Lucene - Query Parser Syntax</a>
471 public Pager
<TaxonBase
> search(Class
<?
extends TaxonBase
> clazz
, String queryString
, Integer pageSize
, Integer pageNumber
, List
<OrderHint
> orderHints
, List
<String
> propertyPaths
);
474 * Returns a list of TaxonBase instances where the
475 * taxon.name properties match the parameters passed. In order to search for any string value, pass '*', passing the string value of
476 * <i>null</i> will search for those taxa with a value of null in that field
478 * @param clazz optionally filter by class (can be null to return all taxa)
480 * @param infragenericEpithet
481 * @param specificEpithet
482 * @param infraspecificEpithet
484 * @param pageSize The maximum number of taxa returned (can be null for all matching taxa)
485 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
486 * @return a list of TaxonBase instances
488 public Pager
<TaxonBase
> findTaxaByName(Class
<?
extends TaxonBase
> clazz
, String uninomial
, String infragenericEpithet
, String specificEpithet
, String infraspecificEpithet
, Rank rank
, Integer pageSize
, Integer pageNumber
);
491 * Returns a list of TaxonBase instances where the
492 * taxon.name properties match the parameters passed. In order to search for any string value, pass '*', passing the string value of
493 * <i>null</i> will search for those taxa with a value of null in that field
495 * @param clazz optionally filter by class
497 * @param infragenericEpithet
498 * @param specificEpithet
499 * @param infraspecificEpithet
501 * @param pageSize The maximum number of taxa returned (can be null for all matching taxa)
502 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
503 * @return a List of TaxonBase instances
505 public List
<TaxonBase
> listTaxaByName(Class
<?
extends TaxonBase
> clazz
, String uninomial
, String infragenericEpithet
, String specificEpithet
, String infraspecificEpithet
, Rank rank
, Integer pageSize
, Integer pageNumber
);
508 * Returns a list of IdentifiableEntity instances (in particular, TaxonNameBase and TaxonBase instances)
509 * that match the properties specified in the configurator.
510 * @param configurator
513 public Pager
<IdentifiableEntity
> findTaxaAndNames(IFindTaxaAndNamesConfigurator configurator
);
516 * performes a union searches for TaxonBase instances on all available
517 * free text indexes. At the time of writing this documentation it combines
518 * {@link #findByDescriptionElementFullText(Class, String, Classification, List, List, boolean, Integer, Integer, List, List)}
519 * and {@link #findByFullText(Class, String, Classification, List, boolean, Integer, Integer, List, List)
523 * @param classification
524 * Additional filter criterion: If a taxonomic classification
525 * three is specified here the result set will only contain taxa
526 * of the given classification
528 * Additional filter criterion: Search only in these languages.
529 * Not all text fields in the cdm model are multilingual, thus
530 * this setting will only apply to the multilingiual fields.
531 * Other fields are searched nevertheless if this parameter is
533 * @param highlightFragments
536 * The maximum number of objects returned (can be null for all
539 * The offset (in pageSize chunks) from the start of the result
542 * Supports path like <code>orderHints.propertyNames</code> which
543 * include *-to-one properties like createdBy.username or
544 * authorTeam.persistentTitleCache
545 * @param propertyPaths
546 * properties to initialize - see
547 * {@link IBeanInitializer#initialize(Object, List)}
548 * @return a paged list of instances of type T matching the queryString and
549 * the additional filter criteria
551 * @throws CorruptIndexException
552 * @throws IOException
553 * @throws ParseException
554 * @throws LuceneMultiSearchException
555 * @deprecated this search should fully be covered by the new method
556 * {@link #findTaxaAndNamesByFullText(EnumSet, String, Classification, Set, List, boolean, Integer, Integer, List, List)}
557 * , maybe we should rename this latter method to give it a more meaningful name
560 public Pager
<SearchResult
<TaxonBase
>> findByEverythingFullText(String queryString
,
561 Classification classification
, List
<Language
> languages
, boolean highlightFragments
,
562 Integer pageSize
, Integer pageNumber
, List
<OrderHint
> orderHints
, List
<String
> propertyPaths
) throws CorruptIndexException
, IOException
, ParseException
, LuceneMultiSearchException
;
565 * Searches for TaxonBase instances using the TaxonBase free text index.
567 * <h4>This is an experimental feature, it may be moved, modified, or even
568 * removed in future releases!!!</h4>
571 * Additional filter criterion: The specific TaxonBase subclass
575 * @param classification
576 * Additional filter criterion: If a taxonomic classification
577 * three is specified here the result set will only contain taxa
578 * of the given classification
580 * Additional filter criterion: Search only in these languages.
581 * Not all text fields in the cdm model are multilingual, thus
582 * this setting will only apply to the multilingiual fields.
583 * Other fields are searched nevertheless if this parameter is
585 * @param highlightFragments
588 * The maximum number of objects returned (can be null for all
591 * The offset (in pageSize chunks) from the start of the result
594 * Supports path like <code>orderHints.propertyNames</code> which
595 * include *-to-one properties like createdBy.username or
596 * authorTeam.persistentTitleCache
597 * @param propertyPaths
598 * properties to initialize - see
599 * {@link IBeanInitializer#initialize(Object, List)}
600 * @return a paged list of instances of type T matching the queryString and
601 * the additional filter criteria
602 * @throws CorruptIndexException
603 * @throws IOException
604 * @throws ParseException
606 public Pager
<SearchResult
<TaxonBase
>> findByFullText(Class
<?
extends TaxonBase
> clazz
, String queryString
, Classification classification
,
607 List
<Language
> languages
, boolean highlightFragments
, Integer pageSize
, Integer pageNumber
, List
<OrderHint
> orderHints
,
608 List
<String
> propertyPaths
) throws CorruptIndexException
, IOException
, ParseException
;
613 * @param statusFilter
614 * @param classification
615 * Additional filter criterion: If a taxonomic classification
616 * three is specified here the result set will only contain taxa
617 * of the given classification
618 * @param highlightFragments
620 * The maximum number of objects returned (can be null for all
623 * The offset (in pageSize chunks) from the start of the result
626 * Supports path like <code>orderHints.propertyNames</code> which
627 * include *-to-one properties like createdBy.username or
628 * authorTeam.persistentTitleCache
629 * @param propertyPath
630 * Common properties to initialize the instances of the
631 * CDM types ({@link Taxon} and {@link Synonym}
632 * this method can return - see {@link IBeanInitializer#initialize(Object, List)}
633 * @return a paged list of instances of {@link Taxon} instances
634 * @throws IOException
635 * @throws ParseException
637 public Pager
<SearchResult
<TaxonBase
>> findByDistribution(List
<NamedArea
> areaFilter
, List
<PresenceAbsenceTermBase
<?
>> statusFilter
,
638 Classification classification
,
639 Integer pageSize
, Integer pageNumber
,
640 List
<OrderHint
> orderHints
, List
<String
> propertyPaths
) throws IOException
, ParseException
;
643 * Searches for TaxonBase instances using the TaxonBase free text index.
647 * <h4>This is an experimental feature, it may be moved, modified, or even
648 * removed in future releases!!!</h4>
650 * Additional filter criterion: defaults to [doTaxa] if set null
653 * @param classification
654 * Additional filter criterion: If a taxonomic classification
655 * three is specified here the result set will only contain taxa
656 * of the given classification
659 * Additional filter criterion: Search only in these languages.
660 * Not all text fields in the cdm model are multilingual, thus
661 * this setting will only apply to the multilingiual fields.
662 * Other fields are searched nevertheless if this parameter is
664 * @param highlightFragments
667 * The maximum number of objects returned (can be null for all
670 * The offset (in pageSize chunks) from the start of the result
673 * Supports path like <code>orderHints.propertyNames</code> which
674 * include *-to-one properties like createdBy.username or
675 * authorTeam.persistentTitleCache
676 * @param propertyPath
677 * Common properties to initialize the instances of the
678 * CDM types ({@link Taxon} and {@link Synonym}
679 * this method can return - see {@link IBeanInitializer#initialize(Object, List)}
680 * @return a paged list of instances of {@link Taxon}, {@link Synonym}, matching the queryString and
681 * the additional filter criteria
682 * @throws CorruptIndexException
683 * @throws IOException
684 * @throws ParseException
685 * @throws LuceneMultiSearchException
687 public Pager
<SearchResult
<TaxonBase
>> findTaxaAndNamesByFullText(
688 EnumSet
<TaxaAndNamesSearchMode
> searchModes
,
689 String queryString
, Classification classification
, Set
<NamedArea
> namedAreas
, Set
<PresenceAbsenceTermBase
<?
>> distributionStatus
,
690 List
<Language
> languages
, boolean highlightFragments
, Integer pageSize
, Integer pageNumber
, List
<OrderHint
> orderHints
,
691 List
<String
> propertyPaths
) throws CorruptIndexException
, IOException
, ParseException
, LuceneMultiSearchException
;
694 * Searches for TaxonBase instances by using the DescriptionElement free text index.
696 * <h4>This is an experimental feature, it may be moved, modified, or even
697 * removed in future releases!!!</h4>
700 * Additional filter criterion:
702 * the query string to filter by
703 * @param classification
704 * Additional filter criterion: If a taxonomic classification
705 * three is specified here the result set will only contain taxa
706 * of the given classification
710 * Additional filter criterion: Search only in these languages.
711 * Not all text fields in the cdm model are multilingual, thus
712 * this setting will only apply to the multilingiual fields.
713 * Other fields are searched nevertheless if this parameter is
715 * @param highlightFragments
718 * The maximum number of objects returned (can be null for all
721 * The offset (in pageSize chunks) from the start of the result
724 * Supports path like <code>orderHints.propertyNames</code> which
725 * include *-to-one properties like createdBy.username or
726 * authorTeam.persistentTitleCache
727 * @param propertyPaths
728 * properties to initialize - see
729 * {@link IBeanInitializer#initialize(Object, List)}
730 * @return a paged list of instances of type T matching the queryString and
731 * the additional filter criteria
732 * @throws IOException
733 * @throws CorruptIndexException
734 * @throws ParseException
736 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
;
744 * @param widthOrDuration
748 * @deprecated use {@link #listMedia(Taxon, Set, boolean, boolean, List)} instead
751 public List
<MediaRepresentation
> getAllMedia(Taxon taxon
, int size
, int height
, int widthOrDuration
, String
[] mimeTypes
);
755 * Lists all Media found in an any TaxonDescription associated with this
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 TaxonDescription into account which are
767 * @deprecated use {@link #listMedia(Taxon, Set, boolean, boolean, List)} instead
770 public List
<Media
> listTaxonDescriptionMedia(Taxon taxon
, Set
<TaxonRelationshipEdge
> includeRelationships
, boolean limitToGalleries
, List
<String
> propertyPath
);
773 * Lists all Media found in an any TaxonDescription, NameDescription,
774 * SpecimenOrObservationBase, DnaSample Chromatograms, etc. associated with this taxon.
777 * @param includeRelationships
778 * the given list of TaxonRelationshipEdges will be taken into
779 * account when retrieving media associated with the given taxon.
781 * @param limitToGalleries
782 * whether to take only descriptions into account which are
783 * marked as gallery, can be NULL
784 * @param includeTaxonDescriptions
785 * whether to take TaxonDescriptions into account, can be NULL
786 * @param includeOccurrences
787 * whether to take TaxonDescriptions into account, can be NULL
788 * @param includeTaxonNameDescriptions
789 * whether to take TaxonNameDescriptions into account, can be NULL
790 * @param propertyPath
793 public List
<Media
> listMedia(Taxon taxon
, Set
<TaxonRelationshipEdge
> includeRelationships
,
794 Boolean limitToGalleries
, Boolean includeTaxonDescriptions
, Boolean includeOccurrences
,
795 Boolean includeTaxonNameDescriptions
, List
<String
> propertyPath
);
797 public List
<TaxonBase
> findTaxaByID(Set
<Integer
> listOfIDs
);
800 * Returns the TaxonBase with the given UUID
801 * using the given match mode and initialization strategy
804 * @param propertyPaths
807 public TaxonBase
findTaxonByUuid(UUID uuid
, List
<String
> propertyPaths
);
809 public int countAllRelationships();
811 public List
<TaxonNameBase
> findIdenticalTaxonNames(List
<String
> propertyPath
);
813 public List
<TaxonNameBase
> findIdenticalTaxonNameIds(List
<String
> propertyPath
);
815 public String
getPhylumName(TaxonNameBase name
);
817 public long deleteSynonymRelationships(Synonym syn
);
820 * Returns all {@link Taxon taxa} which are {@link TaxonRelationshipType#CONGRUENT_TO() congruent} or
821 * {@link TaxonRelationshipType#INCLUDES() included} in the taxon represented by the given taxon uuid.
822 * The result also returns the path to these taxa represented by the uuids of
823 * the {@link TaxonRelationshipType taxon relationships types} and doubtful information.
824 * If classificationUuids is set only taxa of classifications are returned which are included
825 * in the given {@link Classification classifications}. ALso the path to these taxa may not include
826 * taxa from other classifications.
827 * @param taxonUuid uuid of the original taxon
828 * @param classificationUuids List of uuids of classifications used as a filter
829 * @param includeDoubtful set to <code>true</code> if also doubtfully included taxa should be included in the result
830 * @return a DTO which includes a list of taxa with the pathes from the original taxon to the given taxon as well
831 * as doubtful and date information. The original taxon is included in the result.
833 public IncludedTaxaDTO
listIncludedTaxa(UUID taxonUuid
, IncludedTaxonConfiguration configuration
);
837 * Removes a synonym.<BR><BR>
839 * In detail it removes
840 * <li>all synonym relationship to the given taxon or to all taxa if taxon is <code>null</code></li>
841 * <li>the synonym concept if it is not referenced by any synonym relationship anymore</li>
843 * If <code>removeNameIfPossible</code> is true
844 * it also removes the synonym name if it is not used in any other context
845 * (part of a concept, in DescriptionElementSource, part of a name relationship, used inline, ...)<BR><BR>
846 * If <code>newHomotypicGroupIfNeeded</code> is <code>true</code> and the synonym name is not deleted and
847 * the name is homotypic to the taxon the name is moved to a new homotypical group.<BR><BR>
849 * If synonym is <code>null</code> the method has no effect.
853 * @param removeNameIfPossible
854 * @return deleteResult
857 public DeleteResult
deleteSynonym(Synonym synonym
, SynonymDeletionConfigurator config
);
861 * Returns the SynonymRelationships (of where relationship.type == type, if this argument is supplied)
862 * depending on direction, where the supplied taxon is relatedTo or the supplied synonym is relatedFrom.
864 * @param taxonBase The taxon or synonym that is relatedTo or relatedFrom
865 * @param type The type of SynonymRelationship (can be null)
866 * @param pageSize The maximum number of relationships returned (can be null for all relationships)
867 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
868 * @param orderHints Properties to order by
869 * @param propertyPaths Properties to initialize in the returned entities, following the syntax described in {@link IBeanInitializer#initialize(Object, List)}
870 * @param direction The direction of the relationship
871 * @return a List of SynonymRelationship instances
873 public List
<SynonymRelationship
> listSynonymRelationships(
874 TaxonBase taxonBase
, SynonymRelationshipType type
, Integer pageSize
, Integer pageNumber
,
875 List
<OrderHint
> orderHints
, List
<String
> propertyPaths
, Direction direction
);
881 public Taxon
findBestMatchingTaxon(String taxonName
);
883 public Taxon
findBestMatchingTaxon(MatchingTaxonConfigurator config
);
885 public Synonym
findBestMatchingSynonym(String taxonName
);
887 public List
<UuidAndTitleCache
<TaxonBase
>> getUuidAndTitleCacheTaxon();
889 public List
<UuidAndTitleCache
<TaxonBase
>> getUuidAndTitleCacheSynonym();
891 public List
<UuidAndTitleCache
<TaxonBase
>> findTaxaAndNamesForEditor(IFindTaxaAndNamesConfigurator configurator
);
894 * Creates the specified inferred synonyms for the taxon in the classification, but do not insert it to the database
897 * @return list of inferred synonyms
899 public List
<Synonym
> createInferredSynonyms(Taxon taxon
, Classification tree
, SynonymRelationshipType type
, boolean doWithMisappliedNames
);
902 * Creates all inferred synonyms for the taxon in the classification, but do not insert it to the database
906 * @return list of inferred synonyms
908 public List
<Synonym
> createAllInferredSynonyms(Taxon taxon
, Classification tree
, boolean doWithMisappliedNames
);
914 * Removes a synonym.<BR><BR>
916 * In detail it removes
917 * <li>all synonym relationship to the given taxon or to all taxa if taxon is <code>null</code></li>
918 * <li>the synonym concept if it is not referenced by any synonym relationship anymore</li>
920 * If <code>config.removeNameIfPossible</code> is true
921 * it also removes the synonym name if it is not used in any other context
922 * (part of a concept, in DescriptionElementSource, part of a name relationship, used inline, ...)<BR><BR>
923 * If <code>config.newHomotypicGroupIfNeeded</code> is <code>true</code> and the synonym name is not deleted and
924 * the name is homotypic to the taxon the name is moved to a new homotypical group.<BR><BR>
926 * If synonym is <code>null</code> the method has no effect.
931 * @return deleteResult
933 DeleteResult
deleteSynonym(Synonym synonym
, Taxon taxon
,
934 SynonymDeletionConfigurator config
);
936 public Pager
<Taxon
> pageAcceptedTaxaFor(UUID synonymUuid
, UUID classificationUuid
, Integer pageSize
, Integer pageNumber
, List
<OrderHint
> orderHints
,
937 List
<String
> propertyPaths
);
939 public List
<Taxon
> listAcceptedTaxaFor(UUID synonymUuid
, UUID classificationUuid
, Integer pageSize
, Integer pageNumber
, List
<OrderHint
> orderHints
,
940 List
<String
> propertyPaths
);
942 public List
<TaxonBase
> findTaxaByName(MatchingTaxonConfigurator config
);