2 * Copyright (C) 2007 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
6 * The contents of this file are subject to the Mozilla Public License Version 1.1
7 * See LICENSE.TXT at the top of this package for the full license terms.
10 package eu
.etaxonomy
.cdm
.api
.service
;
12 import java
.io
.IOException
;
13 import java
.util
.EnumSet
;
14 import java
.util
.List
;
16 import java
.util
.UUID
;
18 import eu
.etaxonomy
.cdm
.api
.service
.config
.IFindTaxaAndNamesConfigurator
;
19 import eu
.etaxonomy
.cdm
.api
.service
.config
.IncludedTaxonConfiguration
;
20 import eu
.etaxonomy
.cdm
.api
.service
.config
.MatchingTaxonConfigurator
;
21 import eu
.etaxonomy
.cdm
.api
.service
.config
.SynonymDeletionConfigurator
;
22 import eu
.etaxonomy
.cdm
.api
.service
.config
.TaxonDeletionConfigurator
;
23 import eu
.etaxonomy
.cdm
.api
.service
.dto
.IdentifiedEntityDTO
;
24 import eu
.etaxonomy
.cdm
.api
.service
.dto
.IncludedTaxaDTO
;
25 import eu
.etaxonomy
.cdm
.api
.service
.dto
.MarkedEntityDTO
;
26 import eu
.etaxonomy
.cdm
.api
.service
.dto
.TaxonRelationshipsDTO
;
27 import eu
.etaxonomy
.cdm
.api
.service
.exception
.DataChangeNoRollbackException
;
28 import eu
.etaxonomy
.cdm
.api
.service
.exception
.HomotypicalGroupChangeException
;
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
.LuceneParseException
;
32 import eu
.etaxonomy
.cdm
.api
.service
.search
.SearchResult
;
33 import eu
.etaxonomy
.cdm
.api
.service
.util
.TaxonRelationshipEdge
;
34 import eu
.etaxonomy
.cdm
.exception
.UnpublishedException
;
35 import eu
.etaxonomy
.cdm
.model
.common
.IdentifiableEntity
;
36 import eu
.etaxonomy
.cdm
.model
.common
.Language
;
37 import eu
.etaxonomy
.cdm
.model
.common
.MarkerType
;
38 import eu
.etaxonomy
.cdm
.model
.common
.RelationshipBase
.Direction
;
39 import eu
.etaxonomy
.cdm
.model
.description
.DescriptionElementBase
;
40 import eu
.etaxonomy
.cdm
.model
.description
.Feature
;
41 import eu
.etaxonomy
.cdm
.model
.description
.PresenceAbsenceTerm
;
42 import eu
.etaxonomy
.cdm
.model
.location
.NamedArea
;
43 import eu
.etaxonomy
.cdm
.model
.media
.Media
;
44 import eu
.etaxonomy
.cdm
.model
.name
.HomotypicalGroup
;
45 import eu
.etaxonomy
.cdm
.model
.name
.Rank
;
46 import eu
.etaxonomy
.cdm
.model
.name
.TaxonName
;
47 import eu
.etaxonomy
.cdm
.model
.reference
.Reference
;
48 import eu
.etaxonomy
.cdm
.model
.taxon
.Classification
;
49 import eu
.etaxonomy
.cdm
.model
.taxon
.Synonym
;
50 import eu
.etaxonomy
.cdm
.model
.taxon
.SynonymType
;
51 import eu
.etaxonomy
.cdm
.model
.taxon
.Taxon
;
52 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonBase
;
53 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonNode
;
54 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonRelationship
;
55 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonRelationshipType
;
56 import eu
.etaxonomy
.cdm
.model
.term
.DefinedTerm
;
57 import eu
.etaxonomy
.cdm
.persistence
.dao
.initializer
.IBeanInitializer
;
58 import eu
.etaxonomy
.cdm
.persistence
.dto
.UuidAndTitleCache
;
59 import eu
.etaxonomy
.cdm
.persistence
.query
.MatchMode
;
60 import eu
.etaxonomy
.cdm
.persistence
.query
.OrderHint
;
61 import eu
.etaxonomy
.cdm
.persistence
.query
.TaxonTitleType
;
64 public interface ITaxonService
65 extends IIdentifiableEntityService
<TaxonBase
>, IPublishableService
<TaxonBase
>{
70 * NOTE: Also taxa with <code>publish=false</code> are returned.
73 public TaxonBase
load(UUID uuid
, List
<String
> propertyPaths
);
76 * Returns a list of taxa that matches the name string and the sec reference
77 * @param name the name string to search for
78 * @param sec the taxons sec reference
79 * @return a list of taxa matching the name and the sec reference
81 public List
<TaxonBase
> searchByName(String name
, boolean includeUnpublished
, Reference sec
);
84 * Swaps given synonym and accepted taxon.
87 * <li>A new accepted taxon with the synonyms name is created</li>
88 * <li>The synonym is deleted from the old accepted taxons synonym list</li>
89 * <li>A new synonym with the name of the old accepted taxon is created</li>
90 * <li>The newly created synonym get related to the newly created accepted taxon</li>
94 * @param acceptedTaxon
97 public UpdateResult
swapSynonymAndAcceptedTaxon(Synonym synonym
, Taxon acceptedTaxon
);
100 * Changes a synonym into an accepted taxon and removes
101 * the synonym relationship to the given accepted taxon.
102 * Other synonyms homotypic to the synonym to change are
103 * moved to the same new accepted taxon as homotypic
104 * synonyms. The new accepted taxon has the same name and
105 * the same sec reference as the old synonym.<BR>
106 * If the given accepted taxon and the synonym are homotypic
107 * to each other an exception may be thrown as taxonomically it doesn't
108 * make sense to have two accepted taxa in the same homotypic group
109 * but also it is than difficult to decide how to handle other names
110 * in the homotypic group. It is up to the implementing class to
111 * handle this situation via an exception or in another way.
115 * the synonym to change into an accepted taxon
116 * @param acceptedTaxon
117 * an accepted taxon, the synonym had a relationship to
118 * @param deleteSynonym
119 * if true the method tries to delete the old synonym from the database
121 * the newly created accepted taxon
122 * @throws IllegalArgumentException
123 * if the given accepted taxon and the synonym are homotypic
124 * to each other an exception may be thrown as taxonomically it doesn't
125 * make sense to have two accepted taxa in the same homotypic group
126 * but also it is than difficult to decide how to handle other names
127 * in the homotypic group. It is up to the implementing class to
128 * handle this situation via an exception or in another way.
130 public UpdateResult
changeSynonymToAcceptedTaxon(Synonym synonym
, Taxon acceptedTaxon
, boolean deleteSynonym
) throws HomotypicalGroupChangeException
;
134 * @param acceptedTaxonUuid
135 * @param newParentNodeUuid
136 * @param deleteSynonym
138 * @throws HomotypicalGroupChangeException
140 public UpdateResult
changeSynonymToAcceptedTaxon(UUID synonymUuid
, UUID acceptedTaxonUuid
, UUID newParentNodeUuid
,
141 boolean deleteSynonym
)
142 throws HomotypicalGroupChangeException
;
145 * Change a synonym into a related concept
148 * the synonym to change into the concept taxon
150 * the taxon the newly created concept should be related to
151 * @param taxonRelationshipType
152 * the type of relationship
154 * @param microReference
156 * update result with the newly created concept
158 public UpdateResult
changeSynonymToRelatedTaxon(Synonym synonym
, Taxon toTaxon
, TaxonRelationshipType taxonRelationshipType
, Reference reference
, String microReference
);
162 * Change a related concept into synonym
165 * the concept taxon to change into a synonym
167 * the taxon the newly created synonym should be related to
168 * @param oldRelationshipType
169 * the type of old concept relationship
170 * @param synonymRelationshipType
171 * the type of new synonym relationship
174 * update result with the newly created synonym
175 * @throws DataChangeNoRollbackException
177 public UpdateResult
changeRelatedTaxonToSynonym(Taxon fromTaxon
, Taxon toTaxon
,
178 TaxonRelationshipType oldRelationshipType
,
179 SynonymType synonymType
) throws DataChangeNoRollbackException
;
182 * Changes the homotypic group of a synonym into the new homotypic group.
183 * All relations to taxa are updated correctly depending on the homotypic
184 * group of the accepted taxon. <BR>
185 * All existing basionym relationships to and from this name are removed.<BR>
186 * If the parameter <code>targetTaxon</code> is defined, the synonym is
187 * added to this taxon irrespctive of if it has been related to this
189 * If <code>setBasionymRelationIfApplicable</code> is true a basionym relationship
190 * between the existing basionym(s) of the new homotypic group and the synonyms name
194 * @param newHomotypicalGroup
196 * @param setBasionymRelationIfApplicable
198 public void changeHomotypicalGroupOfSynonym(Synonym synonym
, HomotypicalGroup newHomotypicalGroup
,
199 Taxon targetTaxon
, boolean setBasionymRelationIfApplicable
);
202 * See {@link #moveSynonymToAnotherTaxon(Synonym, Taxon, boolean, SynonymType, Reference, String, boolean)}
205 * @param moveHomotypicGroup
206 * @param newSynonymType
208 * @throws HomotypicalGroupChangeException
210 public UpdateResult
moveSynonymToAnotherTaxon(Synonym oldSynonym
, Taxon newTaxon
, boolean moveHomotypicGroup
,
211 SynonymType newSynonymType
) throws HomotypicalGroupChangeException
;
215 * Moves a synonym to another taxon and removes the old synonym relationship.
217 * @param oldSynonym the old synonym to move.
218 * @param newTaxon the taxon the synonym will be moved to
219 * @param moveHomotypicGroup if the synonym belongs to a homotypic group with other synonyms and
220 * <code>moveHomotypicGroup</code> is <code>true</code> all these synonyms are moved to the new taxon,
221 * if <code>false</code> a {@link HomotypicalGroupChangeException} is thrown.
222 * <code>moveHomotypicGroup</code> has no effect if the synonym is the only synonym in it's homotypic group.
223 * @param newSynonymType the synonym type of the new synonyms. Default is
224 * {@link SynonymType#HETEROTYPIC_SYNONYM_OF() heterotypic}.
225 * @param newSecundum The secundum for the new synonyms).
226 * @param newSecundumDetail The secundum micro reference for the new synonym(s).
227 * @param keepSecundumIfUndefined if no <code>newSecundum</code> and/or no <code>newSecundumDetail</code>
228 * is defined they are taken from the old synonym(s) if <code>keepSecundumIfUndefined</code> is
229 * <code>true</code>. If <code>false</code> the secundum and the secundum detail will be taken
230 * only from the <code>newSecundum</code> and <code>newSecundumDetail</code> even if they are
231 * undefined (<code>null</code>).
232 * @return The new synonym relationship. If <code>moveHomotypicGroup</code> is <code>true</code> additionally
233 * created new synonym relationships must be retrieved separately from the new taxon.
234 * @throws HomotypicalGroupChangeException Exception is thrown if (1) synonym is homotypic to the old accepted taxon or
235 * (2) synonym is in homotypic group with other synonyms and <code>moveHomotypicGroup</code> is false
237 public UpdateResult
moveSynonymToAnotherTaxon(Synonym oldSynonym
, Taxon newTaxon
, boolean moveHomotypicGroup
,
238 SynonymType newSynonymType
, Reference newSecundum
,
239 String newSecundumDetail
, boolean keepSecundumIfUndefined
) throws HomotypicalGroupChangeException
;
244 * @param newTaxonUUID
245 * @param moveHomotypicGroup
246 * @param newSynonymType
248 * @param referenceDetail
249 * @param keepReference
251 * @throws HomotypicalGroupChangeException
253 * @see {@link #moveSynonymToAnotherTaxon(Synonym, Taxon, boolean, SynonymType, Reference, String, boolean)}
255 public UpdateResult
moveSynonymToAnotherTaxon(Synonym oldSynonym
,
256 UUID newTaxonUUID
, boolean moveHomotypicGroup
,
257 SynonymType newSynonymType
,
258 Reference newSecundum
, String newSecundumDetail
, boolean keepSecundumIfUndefined
)
259 throws HomotypicalGroupChangeException
;
262 * Returns the TaxonRelationships (of where relationship.type == type, if this argument is supplied)
263 * where the supplied taxon is relatedTo.
265 * @param taxon The taxon that is relatedTo
266 * @param type The type of TaxonRelationship (can be null)
267 * @param includeUnpublished should unpublished related taxa also be returned?
268 * @param pageSize The maximum number of relationships returned (can be null for all relationships)
269 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
270 * @param orderHints Properties to order by
271 * @param propertyPaths Properties to initialize in the returned entities, following the syntax described in {@link IBeanInitializer#initialize(Object, List)}
272 * @return a List of TaxonRelationship instances
274 public List
<TaxonRelationship
> listToTaxonRelationships(Taxon taxon
, TaxonRelationshipType type
,
275 boolean includeUnpublished
, Integer pageSize
, Integer pageNumber
, List
<OrderHint
> orderHints
, List
<String
> propertyPaths
);
279 * Returns the TaxonRelationships (of where relationship.type == type, if this arguement is supplied)
280 * where the supplied taxon is relatedTo.
282 * @param taxon The taxon that is relatedTo
283 * @param type The type of TaxonRelationship (can be null)
284 * @param includeUnpublished should unpublished related taxa also be returned?
285 * @param pageSize The maximum number of relationships returned (can be null for all relationships)
286 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
287 * @param orderHints Properties to order by
288 * @param propertyPaths Properties to initialize in the returned entities, following the syntax described in {@link IBeanInitializer#initialize(Object, List)}
289 * @return a Pager of TaxonRelationship instances
291 public Pager
<TaxonRelationship
> pageToTaxonRelationships(Taxon taxon
, TaxonRelationshipType type
,
292 boolean includeUnpublished
, Integer pageSize
, Integer pageNumber
, List
<OrderHint
> orderHints
, List
<String
> propertyPaths
);
295 * Returns the TaxonRelationships (of where relationship.type == type, if this argument is supplied)
296 * where the supplied taxon is relatedFrom.
298 * @param taxon The taxon that is relatedFrom
299 * @param type The type of TaxonRelationship (can be null)
300 * @param includeUnpublished should unpublished related taxa also be returned?
301 * @param pageSize The maximum number of relationships returned (can be null for all relationships)
302 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
303 * @param orderHints Properties to order by
304 * @param propertyPaths Properties to initialize in the returned entities, following the syntax described in {@link IBeanInitializer#initialize(Object, List)}
305 * @return a List of TaxonRelationship instances
307 public List
<TaxonRelationship
> listFromTaxonRelationships(Taxon taxon
, TaxonRelationshipType type
,
308 boolean includeUnpublished
, Integer pageSize
, Integer pageNumber
, List
<OrderHint
> orderHints
, List
<String
> propertyPaths
);
312 * Returns the TaxonRelationships (of where relationship.type == type, if this argument is supplied)
313 * where the supplied taxon is relatedFrom.
315 * @param taxon The taxon that is relatedFrom
316 * @param type The type of TaxonRelationship (can be null)
317 * @param includeUnpublished should unpublished related taxa also be returned?
318 * @param pageSize The maximum number of relationships returned (can be null for all relationships)
319 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
320 * @param orderHints Properties to order by
321 * @param propertyPaths Properties to initialize in the returned entities, following the syntax described in {@link IBeanInitializer#initialize(Object, List)}
322 * @return a Pager of TaxonRelationship instances
324 public Pager
<TaxonRelationship
> pageFromTaxonRelationships(Taxon taxon
, TaxonRelationshipType type
,
325 boolean includeUnpublished
, Integer pageSize
, Integer pageNumber
, List
<OrderHint
> orderHints
, List
<String
> propertyPaths
);
328 * lists all taxa which are related to the <code>taxon</code> given as
332 * @param includeRelationships
334 * <code>1</code> for one level, <code>null</code> for infinite
335 * depth, <code>0</code> will completely omit collecting related taxa.
338 * @param propertyPaths
341 public Set
<Taxon
> listRelatedTaxa(Taxon taxon
, Set
<TaxonRelationshipEdge
> includeRelationships
, Integer maxDepth
,
342 boolean includeUnpublished
, Integer limit
, Integer start
, List
<String
> propertyPaths
);
346 * Returns all or a page of all taxon concept relationships in the database.
347 * The result can be filtered by relationship types.
349 * @param types The taxon relationship type filter, if <code>null</code> no filter is set, if empty the result will also be empty
350 * @param pageSize the page size
351 * @param pageStart the number of the start page
352 * @param orderHints the order hints
353 * @param propertyPaths the property path to initialize the resulting objects
354 * @return list of taxon relationships matching the filter criteria
356 public List
<TaxonRelationship
> listTaxonRelationships(Set
<TaxonRelationshipType
> types
,
357 Integer pageSize
, Integer pageStart
, List
<OrderHint
> orderHints
, List
<String
> propertyPaths
);
360 * Lists all classifications the given taxon/synonym is used in{@link Synonym}
365 * @param propertyPaths
368 public List
<Classification
> listClassifications(TaxonBase taxonBase
, Integer limit
, Integer start
, List
<String
> propertyPaths
);
371 * Returns the Synonyms (with the given synonym relationship type, if this argument is supplied)
372 * that do have the supplied taxon as accepted taxon.
374 * @param taxon The accepted taxon
375 * @param type The type of Synonym (can be null)
376 * @param pageSize The maximum number of synonyms returned (can be null for returning synonyms)
377 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
378 * * @param orderHints Properties to order by
379 * @param propertyPaths Properties to initialize in the returned entities, following the syntax described in {@link IBeanInitializer#initialize(Object, List)}
380 * @return a Pager of {@link Synonym} instances
382 public Pager
<Synonym
> getSynonyms(Taxon taxon
, SynonymType type
, Integer pageSize
, Integer pageNumber
, List
<OrderHint
> orderHints
, List
<String
> propertyPaths
);
385 * This method returns in the first entry the list of synonyms of the
386 * homotypic group of the accepted taxon. All other entries represent the lists of heterotypic
387 * synonym groups. For detailed information about these 2 groups see
388 * {@link #getHomotypicSynonymsByHomotypicGroup(Taxon, List)} and
389 * {@link #getHeterotypicSynonymyGroups(Taxon, List)}
391 * @see #getSynonyms()
392 * @see SynonymType#HETEROTYPIC_SYNONYM_OF()
393 * @see eu.etaxonomy.cdm.model.name.HomotypicalGroup
395 * @param taxon the accepted taxon
396 * @param propertyPaths the property path
397 * @return the list of groups of synonyms
399 public List
<List
<Synonym
>> getSynonymsByHomotypicGroup(Taxon taxon
, List
<String
> propertyPaths
);
403 * Returns the list of all synonyms that share the same homotypical group with the given taxon.
404 * Only those homotypic synonyms are returned that do have a synonym relationship with the accepted taxon.
406 * @param propertyPaths
409 public List
<Synonym
> getHomotypicSynonymsByHomotypicGroup(Taxon taxon
, List
<String
> propertyPaths
);
412 * Returns the ordered list of all {@link eu.etaxonomy.cdm.model.name.HomotypicalGroup homotypical groups}
413 * that contain {@link Synonym synonyms} that are heterotypic to the given taxon.
414 * {@link eu.etaxonomy.cdm.model.name.TaxonName Taxon names} of heterotypic synonyms
415 * belong to a homotypical group which cannot be the homotypical group to which the
416 * taxon name of the given taxon belongs. This method does not return the homotypic group the given
417 * taxon belongs to.<BR>
418 * This method does neglect the type of synonym relationship that is defined between the given taxon
419 * and the synonym. So the synonym relationship may be homotypic however a synonym is returned
420 * in one of the result lists as long as the synonym does not belong to the same homotypic group as
421 * the given taxon.<BR>
422 * The list returned is ordered according to the date of publication of the
423 * first published name within each homotypical group.
425 * @see #getHeterotypicSynonymyGroups()
426 * @see #getSynonyms()
427 * @see SynonymType#HETEROTYPIC_SYNONYM_OF()
428 * @see eu.etaxonomy.cdm.model.name.HomotypicalGroup
431 * @param propertyPaths
434 public List
<List
<Synonym
>> getHeterotypicSynonymyGroups(Taxon taxon
, List
<String
> propertyPaths
);
437 * Returns a Paged List of TaxonBase instances where the default field matches the String queryString (as interpreted by the Lucene QueryParser)
439 * @param clazz filter the results by class (or pass null to return all TaxonBase instances)
441 * @param pageSize The maximum number of taxa returned (can be null for all matching taxa)
442 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
444 * Supports path like <code>orderHints.propertyNames</code> which
445 * include *-to-one properties like createdBy.username or
446 * authorTeam.persistentTitleCache
447 * @param propertyPaths properties to be initialized
448 * @return a Pager Taxon instances
449 * @see <a href="http://lucene.apache.org/java/2_4_0/queryparsersyntax.html">Apache Lucene - Query Parser Syntax</a>
452 public Pager
<TaxonBase
> search(Class
<?
extends TaxonBase
> clazz
, String queryString
, Integer pageSize
, Integer pageNumber
, List
<OrderHint
> orderHints
, List
<String
> propertyPaths
);
455 * Returns a list of TaxonBase instances where the
456 * taxon.name properties match the parameters passed. In order to search for any string value, pass '*', passing the string value of
457 * <i>null</i> will search for those taxa with a value of null in that field
459 * @param clazz optionally filter by class (can be null to return all taxa)
461 * @param infragenericEpithet
462 * @param specificEpithet
463 * @param infraspecificEpithet
465 * @param pageSize The maximum number of taxa returned (can be null for all matching taxa)
466 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
467 * @return a list of TaxonBase instances
469 public Pager
<TaxonBase
> findTaxaByName(Class
<?
extends TaxonBase
> clazz
, String uninomial
, String infragenericEpithet
, String specificEpithet
, String infraspecificEpithet
, String authorship
, Rank rank
, Integer pageSize
, Integer pageNumber
);
472 * Returns a list of TaxonBase instances where the
473 * taxon.name properties match the parameters passed. In order to search for any string value, pass '*', passing the string value of
474 * <i>null</i> will search for those taxa with a value of null in that field
476 * @param clazz optionally filter by class
478 * @param infragenericEpithet
479 * @param specificEpithet
480 * @param infraspecificEpithet
482 * @param pageSize The maximum number of taxa returned (can be null for all matching taxa)
483 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
484 * @return a List of TaxonBase instances
486 public List
<TaxonBase
> listTaxaByName(Class
<?
extends TaxonBase
> clazz
, String uninomial
, String infragenericEpithet
, String specificEpithet
, String infraspecificEpithet
, String authorship
, Rank rank
, Integer pageSize
, Integer pageNumber
);
489 * Returns a list of IdentifiableEntity instances (in particular, TaxonName and TaxonBase instances)
490 * that match the properties specified in the configurator.
491 * @param configurator
494 public Pager
<IdentifiableEntity
> findTaxaAndNames(IFindTaxaAndNamesConfigurator configurator
);
497 * performes a union searches for TaxonBase instances on all available
498 * free text indexes. At the time of writing this documentation it combines
499 * {@link #findByDescriptionElementFullText(Class, String, Classification, List, List, boolean, Integer, Integer, List, List)}
500 * and {@link #findByFullText(Class, String, Classification, List, boolean, Integer, Integer, List, List)
504 * @param classification
505 * Additional filter criterion: If a taxonomic classification
506 * three is specified here the result set will only contain taxa
507 * of the given classification
509 * Additional filter criterion: Search only in these languages.
510 * Not all text fields in the cdm model are multilingual, thus
511 * this setting will only apply to the multilingiual fields.
512 * Other fields are searched nevertheless if this parameter is
514 * @param highlightFragments
517 * The maximum number of objects returned (can be null for all
520 * The offset (in pageSize chunks) from the start of the result
523 * Supports path like <code>orderHints.propertyNames</code> which
524 * include *-to-one properties like createdBy.username or
525 * authorTeam.persistentTitleCache
526 * @param propertyPaths
527 * properties to initialize - see
528 * {@link IBeanInitializer#initialize(Object, List)}
529 * @return a paged list of instances of type T matching the queryString and
530 * the additional filter criteria
532 * @throws LuceneCorruptIndexException
533 * @throws IOException
534 * @throws LuceneParseException
535 * @throws LuceneMultiSearchException
536 * @deprecated this search should fully be covered by the new method
537 * {@link #findTaxaAndNamesByFullText(EnumSet, String, Classification, Set, List, boolean, Integer, Integer, List, List)}
538 * , maybe we should rename this latter method to give it a more meaningful name
541 public Pager
<SearchResult
<TaxonBase
>> findByEverythingFullText(String queryString
,
542 Classification classification
, TaxonNode subtree
, boolean includeUnpublished
, List
<Language
> languages
, boolean highlightFragments
,
543 Integer pageSize
, Integer pageNumber
, List
<OrderHint
> orderHints
, List
<String
> propertyPaths
) throws IOException
, LuceneParseException
, LuceneMultiSearchException
;
546 * Searches for TaxonBase instances using the TaxonBase free text index.
548 * <h4>This is an experimental feature, it may be moved, modified, or even
549 * removed in future releases!!!</h4>
552 * Additional filter criterion: The specific TaxonBase subclass
556 * @param classification
557 * Additional filter criterion: If a taxonomic classification
558 * three is specified here the result set will only contain taxa
559 * of the given classification
561 * Additional filter criterion: Search only in these languages.
562 * Not all text fields in the cdm model are multilingual, thus
563 * this setting will only apply to the multilingiual fields.
564 * Other fields are searched nevertheless if this parameter is
566 * @param highlightFragments
569 * The maximum number of objects returned (can be null for all
572 * The offset (in pageSize chunks) from the start of the result
575 * Supports path like <code>orderHints.propertyNames</code> which
576 * include *-to-one properties like createdBy.username or
577 * authorTeam.persistentTitleCache
578 * @param propertyPaths
579 * properties to initialize - see
580 * {@link IBeanInitializer#initialize(Object, List)}
581 * @return a paged list of instances of type T matching the queryString and
582 * the additional filter criteria
583 * @throws LuceneCorruptIndexException
584 * @throws IOException
585 * @throws LuceneParseException
587 public Pager
<SearchResult
<TaxonBase
>> findByFullText(Class
<?
extends TaxonBase
> clazz
, String queryString
,
588 Classification classification
, TaxonNode subtree
,
589 boolean includeUnpublished
, List
<Language
> languages
,
590 boolean highlightFragments
, Integer pageSize
, Integer pageNumber
,
591 List
<OrderHint
> orderHints
, List
<String
> propertyPaths
)
592 throws IOException
, LuceneParseException
;
597 * @param statusFilter
598 * @param classification
599 * Additional filter criterion: If a taxonomic classification
600 * three is specified here the result set will only contain taxa
601 * of the given classification
602 * @param highlightFragments
604 * The maximum number of objects returned (can be null for all
607 * The offset (in pageSize chunks) from the start of the result
610 * Supports path like <code>orderHints.propertyNames</code> which
611 * include *-to-one properties like createdBy.username or
612 * authorTeam.persistentTitleCache
613 * @param propertyPath
614 * Common properties to initialize the instances of the
615 * CDM types ({@link Taxon} and {@link Synonym}
616 * this method can return - see {@link IBeanInitializer#initialize(Object, List)}
617 * @return a paged list of instances of {@link Taxon} instances
618 * @throws IOException
619 * @throws LuceneParseException
621 //TODO needed? currently only used in test
622 public Pager
<SearchResult
<TaxonBase
>> findByDistribution(List
<NamedArea
> areaFilter
, List
<PresenceAbsenceTerm
> statusFilter
,
623 Classification classification
, TaxonNode subtree
,
624 Integer pageSize
, Integer pageNumber
,
625 List
<OrderHint
> orderHints
, List
<String
> propertyPaths
) throws IOException
, LuceneParseException
;
628 * Searches for TaxonBase instances using the TaxonBase free text index.
632 * <h4>This is an experimental feature, it may be moved, modified, or even
633 * removed in future releases!!!</h4>
635 * Additional filter criterion: defaults to [doTaxa] if set null
638 * @param classification
639 * Additional filter criterion: If a taxonomic classification
640 * three is specified here the result set will only contain taxa
641 * of the given classification
644 * @param distributionStatus
646 * Additional filter criterion: Search only in these languages.
647 * Not all text fields in the cdm model are multilingual, thus
648 * this setting will only apply to the multilingiual fields.
649 * Other fields are searched nevertheless if this parameter is
651 * @param highlightFragments
654 * The maximum number of objects returned (can be null for all
657 * The offset (in pageSize chunks) from the start of the result
660 * Supports path like <code>orderHints.propertyNames</code> which
661 * include *-to-one properties like createdBy.username or
662 * authorTeam.persistentTitleCache
663 * @param propertyPath
664 * Common properties to initialize the instances of the
665 * CDM types ({@link Taxon} and {@link Synonym}
666 * this method can return - see {@link IBeanInitializer#initialize(Object, List)}
667 * @return a paged list of instances of {@link Taxon}, {@link Synonym}, matching the queryString and
668 * the additional filter criteria
669 * @throws LuceneCorruptIndexException
670 * @throws IOException
671 * @throws LuceneParseException
672 * @throws LuceneMultiSearchException
674 public Pager
<SearchResult
<TaxonBase
>> findTaxaAndNamesByFullText(
675 EnumSet
<TaxaAndNamesSearchMode
> searchModes
,
676 String queryString
, Classification classification
, TaxonNode subtree
,
677 Set
<NamedArea
> namedAreas
, Set
<PresenceAbsenceTerm
> distributionStatus
,
678 List
<Language
> languages
, boolean highlightFragments
, Integer pageSize
, Integer pageNumber
, List
<OrderHint
> orderHints
,
679 List
<String
> propertyPaths
) throws IOException
, LuceneParseException
, LuceneMultiSearchException
;
682 * Searches for TaxonBase instances by using the DescriptionElement free text index.
684 * <h4>This is an experimental feature, it may be moved, modified, or even
685 * removed in future releases!!!</h4>
688 * Additional filter criterion:
690 * the query string to filter by
691 * @param classification
692 * Additional filter criterion: If a taxonomic classification
693 * tree is specified here the result set will only contain taxa
694 * of the given classification
696 * Additional filter criterion: If a taxonomic classification
697 * subtree is specified here the result set will only contain taxa
698 * of the given subtree
702 * Additional filter criterion: Search only in these languages.
703 * Not all text fields in the CDM model are multi-lingual, thus
704 * this setting will only apply to the multi-lingual fields.
705 * Other fields are searched nevertheless if this parameter is
707 * @param highlightFragments
710 * The maximum number of objects returned (can be null for all
713 * The offset (in pageSize chunks) from the start of the result
716 * Supports path like <code>orderHints.propertyNames</code> which
717 * include *-to-one properties like createdBy.username or
718 * authorTeam.persistentTitleCache
719 * @param propertyPaths
720 * properties to initialize - see
721 * {@link IBeanInitializer#initialize(Object, List)}
722 * @return a paged list of instances of type T matching the queryString and
723 * the additional filter criteria
724 * @throws IOException
725 * @throws LuceneCorruptIndexException
726 * @throws LuceneParseException
728 public Pager
<SearchResult
<TaxonBase
>> findByDescriptionElementFullText(Class
<?
extends DescriptionElementBase
> clazz
,
729 String queryString
, Classification classification
, TaxonNode subtree
, List
<Feature
> features
, List
<Language
> languages
, boolean highlightFragments
, Integer pageSize
, Integer pageNumber
, List
<OrderHint
> orderHints
, List
<String
> propertyPaths
) throws IOException
, LuceneParseException
;
732 * Lists all Media found in an any TaxonDescription associated with this
736 * @param includeRelationships
737 * the given list of TaxonRelationshipEdges will be taken into
738 * account when retrieving media associated with the given taxon.
740 * @param limitToGalleries
741 * whether to take only TaxonDescription into account which are
744 * @deprecated use {@link #listMedia(Taxon, Set, boolean, boolean, List)} instead
747 public List
<Media
> listTaxonDescriptionMedia(Taxon taxon
, Set
<TaxonRelationshipEdge
> includeRelationships
, boolean limitToGalleries
, List
<String
> propertyPath
);
750 * Lists all Media found in an any TaxonDescription, NameDescription,
751 * SpecimenOrObservationBase, DnaSample Chromatograms, etc. associated with this taxon.
754 * @param includeRelationships
755 * the given list of TaxonRelationshipEdges will be taken into
756 * account when retrieving media associated with the given taxon.
758 * @param limitToGalleries
759 * whether to take only descriptions into account which are
760 * marked as gallery, can be NULL
761 * @param includeTaxonDescriptions
762 * whether to take TaxonDescriptions into account, can be NULL
763 * @param includeOccurrences
764 * whether to take TaxonDescriptions into account, can be NULL
765 * @param includeTaxonNameDescriptions
766 * whether to take TaxonNameDescriptions into account, can be NULL
767 * @param propertyPath
770 public List
<Media
> listMedia(Taxon taxon
, Set
<TaxonRelationshipEdge
> includeRelationships
,
771 Boolean limitToGalleries
, Boolean includeTaxonDescriptions
, Boolean includeOccurrences
,
772 Boolean includeTaxonNameDescriptions
, List
<String
> propertyPath
);
774 public List
<TaxonBase
> findTaxaByID(Set
<Integer
> listOfIDs
);
777 * Returns the TaxonBase with the given UUID
778 * using the given match mode and initialization strategy
781 * @param propertyPaths
784 public TaxonBase
findTaxonByUuid(UUID uuid
, List
<String
> propertyPaths
);
787 * Counts the number of synonyms
788 * @param onlyAttachedToTaxon if <code>true</code> only those synonyms being attached to
789 * an accepted taxon are counted
790 * @return the number of synonyms
792 public long countSynonyms(boolean onlyAttachedToTaxon
);
794 public List
<TaxonName
> findIdenticalTaxonNames(List
<String
> propertyPath
);
796 public List
<TaxonName
> findIdenticalTaxonNameIds(List
<String
> propertyPath
);
798 // public String getPhylumName(TaxonName name);
801 * Returns all {@link Taxon taxa} which are {@link TaxonRelationshipType#CONGRUENT_TO() congruent} or
802 * {@link TaxonRelationshipType#INCLUDES() included} in the taxon represented by the given taxon uuid.
803 * The result also returns the path to these taxa represented by the uuids of
804 * the {@link TaxonRelationshipType taxon relationships types} and doubtful information.
805 * If classificationUuids is set only taxa of classifications are returned which are included
806 * in the given {@link Classification classifications}. ALso the path to these taxa may not include
807 * taxa from other classifications.
808 * @param taxonUuid uuid of the original taxon
809 * @param classificationUuids List of uuids of classifications used as a filter
810 * @param includeDoubtful set to <code>true</code> if also doubtfully included taxa should be included in the result
811 * @return a DTO which includes a list of taxa with the pathes from the original taxon to the given taxon as well
812 * as doubtful and date information. The original taxon is included in the result.
814 public IncludedTaxaDTO
listIncludedTaxa(UUID taxonUuid
, IncludedTaxonConfiguration configuration
);
818 * Removes a synonym.<BR><BR>
820 * In detail it removes
821 * <li>the synonym concept</li>
823 * If <code>removeNameIfPossible</code> is true
824 * it also removes the synonym name if it is not used in any other context
825 * (part of a concept, in DescriptionElementSource, part of a name relationship, used inline, ...)<BR><BR>
826 * If <code>newHomotypicGroupIfNeeded</code> is <code>true</code> and the synonym name
827 * is not deleted and the name is homotypic to the taxon
828 * the name is moved to a new homotypic group.<BR><BR>
830 * If synonym is <code>null</code> the method has no effect.
834 * @param removeNameIfPossible
835 * @return deleteResult
838 public DeleteResult
deleteSynonym(Synonym synonym
, SynonymDeletionConfigurator config
);
843 * The method essentially loads the synonym and calls the
844 * {@link #deleteSynonym(Synonym, SynonymDeletionConfigurator) deleteSynonym} method
850 public DeleteResult
deleteSynonym(UUID synonymUuid
, SynonymDeletionConfigurator config
);
856 public Taxon
findBestMatchingTaxon(String taxonName
);
858 public Taxon
findBestMatchingTaxon(MatchingTaxonConfigurator config
);
860 public Synonym
findBestMatchingSynonym(String taxonName
, boolean includeUnpublished
);
862 public List
<UuidAndTitleCache
<?
extends IdentifiableEntity
>> findTaxaAndNamesForEditor(IFindTaxaAndNamesConfigurator configurator
);
865 * Creates the specified inferred synonyms for the taxon in the classification, but do not insert it to the database
868 * @return list of inferred synonyms
870 public List
<Synonym
> createInferredSynonyms(Taxon taxon
, Classification tree
, SynonymType type
, boolean doWithMisappliedNames
);
873 * Creates all inferred synonyms for the taxon in the classification, but do not insert it to the database
877 * @return list of inferred synonyms
879 public List
<Synonym
> createAllInferredSynonyms(Taxon taxon
, Classification tree
, boolean doWithMisappliedNames
);
881 public Taxon
findAcceptedTaxonFor(UUID synonymUuid
, UUID classificationUuid
, boolean includeUnpublished
,
882 List
<String
> propertyPaths
) throws UnpublishedException
;
884 public List
<TaxonBase
> findTaxaByName(MatchingTaxonConfigurator config
);
888 * @param clazz the optional {@link TaxonBase} subclass
889 * @param identifier the identifier string
890 * @param identifierType the identifier type
891 * @param subtreeFilter filter on a classification subtree (TaxonNode)
892 * @param matchmode the match mode for the identifier string
893 * @param includeEntity should the taxon as an object be included in the result
894 * @param pageSize page size
895 * @param pageNumber page number
896 * @param propertyPaths property path for initializing the returned taxon object (requires includeEntity=true)
897 * @return the resulting {@link IdentifiedEntityDTO} pager
898 * @see IIdentifiableEntityService#findByIdentifier(Class, String, DefinedTerm, MatchMode, boolean, Integer, Integer, List)
900 public <S
extends TaxonBase
> Pager
<IdentifiedEntityDTO
<S
>> findByIdentifier(
901 Class
<S
> clazz
, String identifier
, DefinedTerm identifierType
, TaxonNode subtreeFilter
,
902 MatchMode matchmode
, boolean includeEntity
, Integer pageSize
,
903 Integer pageNumber
, List
<String
> propertyPaths
);
906 * Returns a pager for {@link MarkedEntityDTO DTOs} that hold the marker including type, title and uuid
907 * and the according {@link TaxonBase} information (uuid, title and the taxon object itself (optional)).
909 * @param clazz The optional {@link TaxonBase} subclass
910 * @param markerType the obligatory marker type, if not given, the results will always be empty
911 * @param markerValue the optional
912 * @param subtreeFilter filter on a classification subtree (TaxonNode)
913 * @param includeEntity should the taxon as an object be included in the result
914 * @param titleType which label to give the returned entity, taxon.titleCache, name.titleCache or name.nameCache
915 * @param pageSize page size
916 * @param pageNumber page number
917 * @param propertyPaths property path for initializing the returned taxon object (requires includeEntity=true)
918 * @return the resulting {@link MarkedEntityDTO} pager
919 * @see IIdentifiableEntityService#findByMarker(Class, MarkerType, Boolean, boolean, Integer, Integer, List)
921 public <S
extends TaxonBase
> Pager
<MarkedEntityDTO
<S
>> findByMarker(
922 Class
<S
> clazz
, MarkerType markerType
, Boolean markerValue
,
923 TaxonNode subtreeFilter
, boolean includeEntity
, TaxonTitleType titleType
,
924 Integer pageSize
, Integer pageNumber
, List
<String
> propertyPaths
);
928 * @param acceptedTaxonUuid
931 public UpdateResult
swapSynonymAndAcceptedTaxon(UUID synonymUUid
, UUID acceptedTaxonUuid
);
936 * @param classificationUuid
939 public DeleteResult
deleteTaxon(UUID taxonUuid
, TaxonDeletionConfigurator config
, UUID classificationUuid
);
942 public UpdateResult
moveFactualDateToAnotherTaxon(UUID fromTaxonUuid
,
949 * @param taxonRelationshipType
951 * @param microcitation
954 public UpdateResult
changeSynonymToRelatedTaxon(UUID synonymUuid
, UUID toTaxonUuid
, TaxonRelationshipType taxonRelationshipType
,
955 Reference citation
, String microcitation
);
958 * @param fromTaxonUuid
960 * @param oldRelationshipType
963 * @throws DataChangeNoRollbackException
965 public UpdateResult
changeRelatedTaxonToSynonym(UUID fromTaxonUuid
, UUID toTaxonUuid
,
966 TaxonRelationshipType oldRelationshipType
, SynonymType synonymType
) throws DataChangeNoRollbackException
;
969 * Returns a list of taxon relationships for a given taxon as DTO.
974 * @param groupMisapplications
975 * @param includeUnpublished
980 public TaxonRelationshipsDTO
listTaxonRelationships(UUID taxonUuid
,
981 Set
<TaxonRelationshipType
> directTypes
,
982 Set
<TaxonRelationshipType
> inversTypes
, Direction direction
, boolean groupMisapplications
,
983 boolean includeUnpublished
, Integer pageSize
, Integer pageNumber
);