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
;
17 import java
.util
.UUID
;
19 import eu
.etaxonomy
.cdm
.api
.service
.config
.IFindTaxaAndNamesConfigurator
;
20 import eu
.etaxonomy
.cdm
.api
.service
.config
.IncludedTaxonConfiguration
;
21 import eu
.etaxonomy
.cdm
.api
.service
.config
.MatchingTaxonConfigurator
;
22 import eu
.etaxonomy
.cdm
.api
.service
.config
.SynonymDeletionConfigurator
;
23 import eu
.etaxonomy
.cdm
.api
.service
.config
.TaxonDeletionConfigurator
;
24 import eu
.etaxonomy
.cdm
.api
.service
.dto
.IdentifiedEntityDTO
;
25 import eu
.etaxonomy
.cdm
.api
.service
.dto
.IncludedTaxaDTO
;
26 import eu
.etaxonomy
.cdm
.api
.service
.dto
.MarkedEntityDTO
;
27 import eu
.etaxonomy
.cdm
.api
.service
.dto
.TaxonRelationshipsDTO
;
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
.LuceneParseException
;
33 import eu
.etaxonomy
.cdm
.api
.service
.search
.SearchResult
;
34 import eu
.etaxonomy
.cdm
.api
.util
.TaxonRelationshipEdge
;
35 import eu
.etaxonomy
.cdm
.exception
.UnpublishedException
;
36 import eu
.etaxonomy
.cdm
.model
.common
.IdentifiableEntity
;
37 import eu
.etaxonomy
.cdm
.model
.common
.Language
;
38 import eu
.etaxonomy
.cdm
.model
.common
.MarkerType
;
39 import eu
.etaxonomy
.cdm
.model
.common
.RelationshipBase
.Direction
;
40 import eu
.etaxonomy
.cdm
.model
.description
.DescriptionElementBase
;
41 import eu
.etaxonomy
.cdm
.model
.description
.Feature
;
42 import eu
.etaxonomy
.cdm
.model
.description
.PresenceAbsenceTerm
;
43 import eu
.etaxonomy
.cdm
.model
.location
.NamedArea
;
44 import eu
.etaxonomy
.cdm
.model
.media
.Media
;
45 import eu
.etaxonomy
.cdm
.model
.metadata
.SecReferenceHandlingEnum
;
46 import eu
.etaxonomy
.cdm
.model
.metadata
.SecReferenceHandlingSwapEnum
;
47 import eu
.etaxonomy
.cdm
.model
.name
.HomotypicalGroup
;
48 import eu
.etaxonomy
.cdm
.model
.name
.Rank
;
49 import eu
.etaxonomy
.cdm
.model
.name
.TaxonName
;
50 import eu
.etaxonomy
.cdm
.model
.reference
.Reference
;
51 import eu
.etaxonomy
.cdm
.model
.taxon
.Classification
;
52 import eu
.etaxonomy
.cdm
.model
.taxon
.Synonym
;
53 import eu
.etaxonomy
.cdm
.model
.taxon
.SynonymType
;
54 import eu
.etaxonomy
.cdm
.model
.taxon
.Taxon
;
55 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonBase
;
56 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonNode
;
57 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonRelationship
;
58 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonRelationshipType
;
59 import eu
.etaxonomy
.cdm
.model
.term
.DefinedTerm
;
60 import eu
.etaxonomy
.cdm
.model
.term
.IdentifierType
;
61 import eu
.etaxonomy
.cdm
.persistence
.dao
.common
.Restriction
;
62 import eu
.etaxonomy
.cdm
.persistence
.dao
.initializer
.IBeanInitializer
;
63 import eu
.etaxonomy
.cdm
.persistence
.dto
.UuidAndTitleCache
;
64 import eu
.etaxonomy
.cdm
.persistence
.query
.MatchMode
;
65 import eu
.etaxonomy
.cdm
.persistence
.query
.OrderHint
;
66 import eu
.etaxonomy
.cdm
.persistence
.query
.TaxonTitleType
;
69 public interface ITaxonService
70 extends IIdentifiableEntityService
<TaxonBase
>, IPublishableService
<TaxonBase
>{
75 * NOTE: Also taxa with <code>publish=false</code> are returned.
78 public TaxonBase
load(UUID uuid
, List
<String
> propertyPaths
);
81 * Returns a list of taxa that matches the name string and the sec reference
82 * @param name the name string to search for
83 * @param sec the taxons sec reference
84 * @return a list of taxa matching the name and the sec reference
86 public List
<TaxonBase
> searchByName(String name
, boolean includeUnpublished
, Reference sec
);
89 * Swaps given synonym and accepted taxon.
92 * <li>A new accepted taxon with the synonyms name is created</li>
93 * <li>The synonym is deleted from the old accepted taxons synonym list</li>
94 * <li>A new synonym with the name of the old accepted taxon is created</li>
95 * <li>The newly created synonym get related to the newly created accepted taxon</li>
99 * @param acceptedTaxon
100 * @param setNameInSource
103 public UpdateResult
swapSynonymAndAcceptedTaxon(Synonym synonym
, Taxon acceptedTaxon
, boolean setNameInSource
, boolean newUuidForAcceptedTaxon
, SecReferenceHandlingSwapEnum secHandling
, Reference secRefAcc
, Reference secRefSyn
);
105 public UpdateResult
swapSynonymAndAcceptedTaxon(UUID synonymUUid
, UUID acceptedTaxonUuid
, boolean setNameInSource
, boolean newUuidForAcceptedTaxon
, SecReferenceHandlingSwapEnum secHandling
, UUID newSecAcc
, UUID newSecSyn
);
108 * Changes a synonym into an accepted taxon and removes
109 * the synonym relationship to the given accepted taxon.
110 * Other synonyms homotypic to the synonym to change are
111 * moved to the same new accepted taxon as homotypic
112 * synonyms. The new accepted taxon has the same name and
113 * the same sec reference as the old synonym.<BR>
114 * If the given accepted taxon and the synonym are homotypic
115 * to each other an exception may be thrown as taxonomically it doesn't
116 * make sense to have two accepted taxa in the same homotypic group
117 * but also it is than difficult to decide how to handle other names
118 * in the homotypic group. It is up to the implementing class to
119 * handle this situation via an exception or in another way.
123 * the synonym to change into an accepted taxon
124 * @param acceptedTaxon
125 * an accepted taxon, the synonym had a relationship to
126 * @param deleteSynonym
127 * if true the method tries to delete the old synonym from the database
129 * the newly created accepted taxon
130 * @throws IllegalArgumentException
131 * if the given accepted taxon and the synonym are homotypic
132 * to each other an exception may be thrown as taxonomically it doesn't
133 * make sense to have two accepted taxa in the same homotypic group
134 * but also it is than difficult to decide how to handle other names
135 * in the homotypic group. It is up to the implementing class to
136 * handle this situation via an exception or in another way.
138 public UpdateResult
changeSynonymToAcceptedTaxon(Synonym synonym
, Taxon acceptedTaxon
,Reference newSecRef
, String microRef
, SecReferenceHandlingEnum secHandling
, boolean deleteSynonym
) throws HomotypicalGroupChangeException
;
142 * @param acceptedTaxonUuid
143 * @param newParentNodeUuid
144 * @param deleteSynonym
146 * @throws HomotypicalGroupChangeException
148 public UpdateResult
changeSynonymToAcceptedTaxon(UUID synonymUuid
, UUID acceptedTaxonUuid
, UUID newParentNodeUuid
, UUID newSecRef
, String microRef
, SecReferenceHandlingEnum secHandling
,
149 boolean deleteSynonym
)
150 throws HomotypicalGroupChangeException
;
153 * Change a synonym into a related concept
156 * the synonym to change into the concept taxon
158 * the taxon the newly created concept should be related to
159 * @param taxonRelationshipType
160 * the type of relationship
162 * @param microReference
164 * update result with the newly created concept
166 public UpdateResult
changeSynonymToRelatedTaxon(Synonym synonym
, Taxon toTaxon
, TaxonRelationshipType taxonRelationshipType
, Reference reference
, String microReference
);
170 * Change a related concept into synonym
173 * the concept taxon to change into a synonym
175 * the taxon the newly created synonym should be related to
176 * @param oldRelationshipType
177 * the type of old concept relationship
178 * @param synonymRelationshipType
179 * the type of new synonym relationship
182 * update result with the newly created synonym
183 * @throws DataChangeNoRollbackException
185 public UpdateResult
changeRelatedTaxonToSynonym(Taxon fromTaxon
, Taxon toTaxon
,
186 TaxonRelationshipType oldRelationshipType
,
187 SynonymType synonymType
) throws DataChangeNoRollbackException
;
190 * Changes the homotypic group of a synonym into the new homotypic group.
191 * All relations to taxa are updated correctly depending on the homotypic
192 * group of the accepted taxon. <BR>
193 * All existing basionym relationships to and from this name are removed.<BR>
194 * If the parameter <code>targetTaxon</code> is defined, the synonym is
195 * added to this taxon irrespctive of if it has been related to this
197 * If <code>setBasionymRelationIfApplicable</code> is true a basionym relationship
198 * between the existing basionym(s) of the new homotypic group and the synonyms name
202 * @param newHomotypicalGroup
204 * @param setBasionymRelationIfApplicable
206 public void changeHomotypicalGroupOfSynonym(Synonym synonym
, HomotypicalGroup newHomotypicalGroup
,
207 Taxon targetTaxon
, boolean setBasionymRelationIfApplicable
);
210 * See {@link #moveSynonymToAnotherTaxon(Synonym, Taxon, boolean, SynonymType, Reference, String, boolean)}
213 * @param moveHomotypicGroup
214 * @param newSynonymType
216 * @throws HomotypicalGroupChangeException
218 public UpdateResult
moveSynonymToAnotherTaxon(Synonym oldSynonym
, Taxon newTaxon
, boolean moveHomotypicGroup
,
219 SynonymType newSynonymType
) throws HomotypicalGroupChangeException
;
222 * Moves a synonym to another taxon and removes the old synonym relationship.
224 * @param oldSynonym the old synonym to move.
225 * @param newTaxon the taxon the synonym will be moved to
226 * @param moveHomotypicGroup if the synonym belongs to a homotypic group with other synonyms and
227 * <code>moveHomotypicGroup</code> is <code>true</code> all these synonyms are moved to the new taxon,
228 * if <code>false</code> a {@link HomotypicalGroupChangeException} is thrown.
229 * <code>moveHomotypicGroup</code> has no effect if the synonym is the only synonym in it's homotypic group.
230 * @param newSynonymType the synonym type of the new synonyms. Default is
231 * {@link SynonymType#HETEROTYPIC_SYNONYM_OF() heterotypic}.
232 * @param newSecundum The secundum for the new synonyms).
233 * @param newSecundumDetail The secundum micro reference for the new synonym(s).
234 * @param keepSecundumIfUndefined if no <code>newSecundum</code> and/or no <code>newSecundumDetail</code>
235 * is defined they are taken from the old synonym(s) if <code>keepSecundumIfUndefined</code> is
236 * <code>true</code>. If <code>false</code> the secundum and the secundum detail will be taken
237 * only from the <code>newSecundum</code> and <code>newSecundumDetail</code> even if they are
238 * undefined (<code>null</code>).
239 * @return The new synonym relationship. If <code>moveHomotypicGroup</code> is <code>true</code> additionally
240 * created new synonym relationships must be retrieved separately from the new taxon.
241 * @throws HomotypicalGroupChangeException Exception is thrown if (1) synonym is homotypic to the old accepted taxon or
242 * (2) synonym is in homotypic group with other synonyms and <code>moveHomotypicGroup</code> is false
244 public UpdateResult
moveSynonymToAnotherTaxon(Synonym oldSynonym
, Taxon newTaxon
, boolean moveHomotypicGroup
,
245 SynonymType newSynonymType
, UUID newSecundumUuid
,
246 String newSecundumDetail
, boolean keepSecundumIfUndefined
) throws HomotypicalGroupChangeException
;
249 * @see {@link #moveSynonymToAnotherTaxon(Synonym, Taxon, boolean, SynonymType, Reference, String, boolean)}
251 public UpdateResult
moveSynonymToAnotherTaxon(Synonym oldSynonym
,
252 UUID newTaxonUUID
, boolean moveHomotypicGroup
,
253 SynonymType newSynonymType
,
254 UUID newSecundumUuid
, String newSecundumDetail
, boolean keepSecundumIfUndefined
)
255 throws HomotypicalGroupChangeException
;
258 * Returns the TaxonRelationships (of where relationship.type == type, if this argument is supplied)
259 * where the supplied taxon is relatedTo.
261 * @param taxon The taxon that is relatedTo
262 * @param type The type of TaxonRelationship (can be null)
263 * @param includeUnpublished should unpublished related taxa also be returned?
264 * @param pageSize The maximum number of relationships returned (can be null for all relationships)
265 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
266 * @param orderHints Properties to order by
267 * @param propertyPaths Properties to initialize in the returned entities, following the syntax described in {@link IBeanInitializer#initialize(Object, List)}
268 * @return a List of TaxonRelationship instances
270 public List
<TaxonRelationship
> listToTaxonRelationships(Taxon taxon
, TaxonRelationshipType type
,
271 boolean includeUnpublished
, Integer pageSize
, Integer pageNumber
, List
<OrderHint
> orderHints
, List
<String
> propertyPaths
);
275 * Returns the TaxonRelationships (of where relationship.type == type, if this arguement is supplied)
276 * where the supplied taxon is relatedTo.
278 * @param taxon The taxon that is relatedTo
279 * @param type The type of TaxonRelationship (can be null)
280 * @param includeUnpublished should unpublished related taxa also be returned?
281 * @param pageSize The maximum number of relationships returned (can be null for all relationships)
282 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
283 * @param orderHints Properties to order by
284 * @param propertyPaths Properties to initialize in the returned entities, following the syntax described in {@link IBeanInitializer#initialize(Object, List)}
285 * @return a Pager of TaxonRelationship instances
287 public Pager
<TaxonRelationship
> pageToTaxonRelationships(Taxon taxon
, TaxonRelationshipType type
,
288 boolean includeUnpublished
, Integer pageSize
, Integer pageNumber
, List
<OrderHint
> orderHints
, List
<String
> propertyPaths
);
291 * Returns the TaxonRelationships (of where relationship.type == type, if this argument is supplied)
292 * where the supplied taxon is relatedFrom.
294 * @param taxon The taxon that is relatedFrom
295 * @param type The type of TaxonRelationship (can be null)
296 * @param includeUnpublished should unpublished related taxa also be returned?
297 * @param pageSize The maximum number of relationships returned (can be null for all relationships)
298 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
299 * @param orderHints Properties to order by
300 * @param propertyPaths Properties to initialize in the returned entities, following the syntax described in {@link IBeanInitializer#initialize(Object, List)}
301 * @return a List of TaxonRelationship instances
303 public List
<TaxonRelationship
> listFromTaxonRelationships(Taxon taxon
, TaxonRelationshipType type
,
304 boolean includeUnpublished
, Integer pageSize
, Integer pageNumber
, List
<OrderHint
> orderHints
, List
<String
> propertyPaths
);
308 * Returns the TaxonRelationships (of where relationship.type == type, if this argument is supplied)
309 * where the supplied taxon is relatedFrom.
311 * @param taxon The taxon that is relatedFrom
312 * @param type The type of TaxonRelationship (can be null)
313 * @param includeUnpublished should unpublished related taxa also be returned?
314 * @param pageSize The maximum number of relationships returned (can be null for all relationships)
315 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
316 * @param orderHints Properties to order by
317 * @param propertyPaths Properties to initialize in the returned entities, following the syntax described in {@link IBeanInitializer#initialize(Object, List)}
318 * @return a Pager of TaxonRelationship instances
320 public Pager
<TaxonRelationship
> pageFromTaxonRelationships(Taxon taxon
, TaxonRelationshipType type
,
321 boolean includeUnpublished
, Integer pageSize
, Integer pageNumber
, List
<OrderHint
> orderHints
, List
<String
> propertyPaths
);
324 * lists all taxa which are related to the <code>taxon</code> given as
328 * @param includeRelationships
330 * <code>1</code> for one level, <code>null</code> for infinite
331 * depth, <code>0</code> will completely omit collecting related taxa.
334 * @param propertyPaths
337 public Set
<Taxon
> listRelatedTaxa(Taxon taxon
, Set
<TaxonRelationshipEdge
> includeRelationships
, Integer maxDepth
,
338 boolean includeUnpublished
, Integer limit
, Integer start
, List
<String
> propertyPaths
);
342 * Returns all or a page of all taxon concept relationships in the database.
343 * The result can be filtered by relationship types.
345 * @param types The taxon relationship type filter, if <code>null</code> no filter is set, if empty the result will also be empty
346 * @param pageSize the page size
347 * @param pageStart the number of the page
348 * @param orderHints the order hints
349 * @param propertyPaths the property path to initialize the resulting objects
350 * @return list of taxon relationships matching the filter criteria
352 public List
<TaxonRelationship
> listTaxonRelationships(Set
<TaxonRelationshipType
> types
,
353 Integer pageSize
, Integer pageNumber
, List
<OrderHint
> orderHints
, List
<String
> propertyPaths
);
356 * Lists all classifications the given taxon/synonym is used in{@link Synonym}
361 * @param propertyPaths
364 public List
<Classification
> listClassifications(TaxonBase taxonBase
, Integer limit
, Integer start
, List
<String
> propertyPaths
);
367 * Returns the Synonyms (with the given synonym relationship type, if this argument is supplied)
368 * that do have the supplied taxon as accepted taxon.
370 * @param taxon The accepted taxon
371 * @param type The type of Synonym (can be null)
372 * @param pageSize The maximum number of synonyms returned (can be null for returning synonyms)
373 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
374 * * @param orderHints Properties to order by
375 * @param propertyPaths Properties to initialize in the returned entities, following the syntax described in {@link IBeanInitializer#initialize(Object, List)}
376 * @return a Pager of {@link Synonym} instances
378 public Pager
<Synonym
> getSynonyms(Taxon taxon
, SynonymType type
, Integer pageSize
, Integer pageNumber
, List
<OrderHint
> orderHints
, List
<String
> propertyPaths
);
381 * This method returns in the first entry the list of synonyms of the
382 * homotypic group of the accepted taxon. All other entries represent the lists of heterotypic
383 * synonym groups. For detailed information about these 2 groups see
384 * {@link #getHomotypicSynonymsByHomotypicGroup(Taxon, List)} and
385 * {@link #getHeterotypicSynonymyGroups(Taxon, List)}
387 * @see #getSynonyms()
388 * @see SynonymType#HETEROTYPIC_SYNONYM_OF()
389 * @see eu.etaxonomy.cdm.model.name.HomotypicalGroup
391 * @param taxon the accepted taxon
392 * @param propertyPaths the property path
393 * @return the list of groups of synonyms
395 public List
<List
<Synonym
>> getSynonymsByHomotypicGroup(Taxon taxon
, List
<String
> propertyPaths
);
399 * Returns the list of all synonyms that share the same homotypical group with the given taxon.
400 * Only those homotypic synonyms are returned that do have a synonym relationship with the accepted taxon.
402 * @param propertyPaths
405 public List
<Synonym
> getHomotypicSynonymsByHomotypicGroup(Taxon taxon
, List
<String
> propertyPaths
);
408 * Returns the ordered list of all {@link eu.etaxonomy.cdm.model.name.HomotypicalGroup homotypical groups}
409 * that contain {@link Synonym synonyms} that are heterotypic to the given taxon.
410 * {@link eu.etaxonomy.cdm.model.name.TaxonName Taxon names} of heterotypic synonyms
411 * belong to a homotypical group which cannot be the homotypical group to which the
412 * taxon name of the given taxon belongs. This method does not return the homotypic group the given
413 * taxon belongs to.<BR>
414 * This method does neglect the type of synonym relationship that is defined between the given taxon
415 * and the synonym. So the synonym relationship may be homotypic however a synonym is returned
416 * in one of the result lists as long as the synonym does not belong to the same homotypic group as
417 * the given taxon.<BR>
418 * The list returned is ordered according to the date of publication of the
419 * first published name within each homotypical group.
421 * @see #getHeterotypicSynonymyGroups()
422 * @see #getSynonyms()
423 * @see SynonymType#HETEROTYPIC_SYNONYM_OF()
424 * @see eu.etaxonomy.cdm.model.name.HomotypicalGroup
427 * @param propertyPaths
430 public List
<List
<Synonym
>> getHeterotypicSynonymyGroups(Taxon taxon
, List
<String
> propertyPaths
);
433 * Returns a Paged List of TaxonBase instances where the default field matches the String queryString (as interpreted by the Lucene QueryParser)
435 * @param clazz filter the results by class (or pass null to return all TaxonBase instances)
437 * @param pageSize The maximum number of taxa returned (can be null for all matching taxa)
438 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
440 * Supports path like <code>orderHints.propertyNames</code> which
441 * include *-to-one properties like createdBy.username or
442 * authorTeam.persistentTitleCache
443 * @param propertyPaths properties to be initialized
444 * @return a Pager Taxon instances
445 * @see <a href="http://lucene.apache.org/java/2_4_0/queryparsersyntax.html">Apache Lucene - Query Parser Syntax</a>
448 public Pager
<TaxonBase
> search(Class
<?
extends TaxonBase
> clazz
, String queryString
, Integer pageSize
, Integer pageNumber
, List
<OrderHint
> orderHints
, List
<String
> propertyPaths
);
451 * Returns a list of TaxonBase instances where the
452 * taxon.name properties match the parameters passed. In order to search for any string value, pass '*', passing the string value of
453 * <i>null</i> will search for those taxa with a value of null in that field
455 * @param clazz optionally filter by class (can be null to return all taxa)
457 * @param infragenericEpithet
458 * @param specificEpithet
459 * @param infraspecificEpithet
461 * @param pageSize The maximum number of taxa returned (can be null for all matching taxa)
462 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
463 * @return a list of TaxonBase instances
465 public <T
extends TaxonBase
> Pager
<T
> findTaxaByName(Class
<T
> clazz
, String uninomial
, String infragenericEpithet
, String specificEpithet
,
466 String infraspecificEpithet
, String authorshipCache
, Rank rank
, Integer pageSize
, Integer pageNumber
, List
<String
> propertyPaths
);
469 * Returns a list of TaxonBase instances where the
470 * taxon.name properties match the parameters passed. In order to search for any string value, pass '*', passing the string value of
471 * <i>null</i> will search for those taxa with a value of null in that field
473 * @param clazz optionally filter by class
475 * @param infragenericEpithet
476 * @param specificEpithet
477 * @param infraspecificEpithet
479 * @param authorshipCache
480 * @param pageSize The maximum number of taxa returned (can be null for all matching taxa)
481 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
482 * @return a List of TaxonBase instances
484 public <T
extends TaxonBase
> List
<T
> listTaxaByName(Class
<T
> clazz
, String uninomial
, String infragenericEpithet
, String specificEpithet
,
485 String infraspecificEpithet
, String authorshipCache
, Rank rank
, Integer pageSize
, Integer pageNumber
, List
<String
> propertyPaths
);
488 * Returns a list of IdentifiableEntity instances (in particular, TaxonName and TaxonBase instances)
489 * that match the properties specified in the configurator.
491 * Note: The search result includes a search on titleCache (with {@link MatchMode#BEGINNING} or {@link MatchMode#ANYWHERE} )
492 * for all records with protected titleCache (see #9561). Maybe this should be parameterized in future.
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
);
775 * Lists all Media found in an any TaxonDescription, NameDescription,
776 * SpecimenOrObservationBase, DnaSample Chromatograms, etc. associated with this taxon.
779 * @param includeRelationships
780 * the given list of TaxonRelationshipEdges will be taken into
781 * account when retrieving media associated with the given taxon.
783 * @param limitToGalleries
784 * whether to take only descriptions into account which are
785 * marked as gallery, can be NULL
786 * @param includeTaxonDescriptions
787 * whether to take TaxonDescriptions into account, can be NULL
788 * @param includeOccurrences
789 * whether to take SpecimenDescriptions into account, can be NULL
790 * @param includeOriginals
791 * whether to take SpecimenDescriptions of the originals of associated derived units into account, can be NULL
792 * @param includeTaxonNameDescriptions
793 * whether to take TaxonNameDescriptions into account, can be NULL
794 * @param propertyPath
797 public List
<Media
> listMedia(Taxon taxon
, Set
<TaxonRelationshipEdge
> includeRelationships
,
798 Boolean limitToGalleries
, Boolean includeTaxonDescriptions
, Boolean includeOccurrences
, Boolean includeOriginals
,
799 Boolean includeTaxonNameDescriptions
, List
<String
> propertyPath
);
801 public List
<TaxonBase
> findTaxaByID(Set
<Integer
> listOfIDs
);
804 * Returns the TaxonBase with the given UUID
805 * using the given match mode and initialization strategy
808 * @param propertyPaths
811 public TaxonBase
findTaxonByUuid(UUID uuid
, List
<String
> propertyPaths
);
814 * Counts the number of synonyms
815 * @param onlyAttachedToTaxon if <code>true</code> only those synonyms being attached to
816 * an accepted taxon are counted
817 * @return the number of synonyms
819 public long countSynonyms(boolean onlyAttachedToTaxon
);
822 * Returns a map of taxon names that have identical name caches but derive from different sources.
823 * The sources are defined via the sources reference uuid.
825 * @return map of nameCaches and taxon name maps where the key is the UUID of the according sourceRefUuid
827 public Map
<String
, Map
<UUID
,Set
<TaxonName
>>> findIdenticalTaxonNames(List
<UUID
> sourceRefUuids
, List
<String
> propertyPaths
);
830 * Returns all {@link Taxon taxa} which are {@link TaxonRelationshipType#CONGRUENT_TO() congruent} or
831 * {@link TaxonRelationshipType#INCLUDES() included} in the taxon represented by the given taxon uuid.
832 * The result also returns the path to these taxa represented by the uuids of
833 * the {@link TaxonRelationshipType taxon relationships types} and doubtful information.
834 * If classificationUuids is set only taxa of classifications are returned which are included
835 * in the given {@link Classification classifications}. ALso the path to these taxa may not include
836 * taxa from other classifications.
837 * @param taxonUuid uuid of the original taxon
838 * @param classificationUuids List of uuids of classifications used as a filter
839 * @param includeDoubtful set to <code>true</code> if also doubtfully included taxa should be included in the result
840 * @return a DTO which includes a list of taxa with the pathes from the original taxon to the given taxon as well
841 * as doubtful and date information. The original taxon is included in the result.
843 public IncludedTaxaDTO
listIncludedTaxa(UUID taxonUuid
, IncludedTaxonConfiguration configuration
);
847 * Removes a synonym.<BR><BR>
849 * In detail it removes
850 * <li>the synonym concept</li>
852 * If <code>removeNameIfPossible</code> is true
853 * it also removes the synonym name if it is not used in any other context
854 * (part of a concept, in DescriptionElementSource, part of a name relationship, used inline, ...)<BR><BR>
855 * If <code>newHomotypicGroupIfNeeded</code> is <code>true</code> and the synonym name
856 * is not deleted and the name is homotypic to the taxon
857 * the name is moved to a new homotypic group.<BR><BR>
859 * If synonym is <code>null</code> the method has no effect.
863 * @param removeNameIfPossible
864 * @return deleteResult
866 public DeleteResult
deleteSynonym(Synonym synonym
, SynonymDeletionConfigurator config
);
871 * The method essentially loads the synonym and calls the
872 * {@link #deleteSynonym(Synonym, SynonymDeletionConfigurator) deleteSynonym} method
878 public DeleteResult
deleteSynonym(UUID synonymUuid
, SynonymDeletionConfigurator config
);
880 public Taxon
findBestMatchingTaxon(String taxonName
);
882 public Taxon
findBestMatchingTaxon(MatchingTaxonConfigurator config
);
884 public Synonym
findBestMatchingSynonym(String taxonName
, boolean includeUnpublished
);
886 public List
<UuidAndTitleCache
<?
extends IdentifiableEntity
>> findTaxaAndNamesForEditor(IFindTaxaAndNamesConfigurator configurator
);
889 * Creates the specified inferred synonyms for the taxon in the classification, but do not insert it to the database
892 * @return list of inferred synonyms
894 public List
<Synonym
> createInferredSynonyms(Taxon taxon
, Classification tree
, SynonymType type
, boolean doWithMisappliedNames
);
897 * Creates all inferred synonyms for the taxon in the classification, but do not insert it to the database
901 * @return list of inferred synonyms
903 public List
<Synonym
> createAllInferredSynonyms(Taxon taxon
, Classification tree
, boolean doWithMisappliedNames
);
905 public Taxon
findAcceptedTaxonFor(UUID synonymUuid
, UUID classificationUuid
, boolean includeUnpublished
,
906 List
<String
> propertyPaths
) throws UnpublishedException
;
908 public List
<TaxonBase
> findTaxaByName(MatchingTaxonConfigurator config
);
911 * @param clazz the optional {@link TaxonBase} subclass
912 * @param identifier the identifier string
913 * @param identifierType the identifier type
914 * @param subtreeFilter filter on a classification subtree (TaxonNode)
915 * @param matchmode the match mode for the identifier string
916 * @param includeEntity should the taxon as an object be included in the result
917 * @param pageSize page size
918 * @param pageNumber page number
919 * @param propertyPaths property path for initializing the returned taxon object (requires includeEntity=true)
920 * @return the resulting {@link IdentifiedEntityDTO} pager
921 * @see IIdentifiableEntityService#findByIdentifier(Class, String, DefinedTerm, MatchMode, boolean, Integer, Integer, List)
923 public <S
extends TaxonBase
> Pager
<IdentifiedEntityDTO
<S
>> findByIdentifier(
924 Class
<S
> clazz
, String identifier
, IdentifierType identifierType
, TaxonNode subtreeFilter
,
925 MatchMode matchmode
, boolean includeEntity
, Integer pageSize
,
926 Integer pageNumber
, List
<String
> propertyPaths
);
929 * Returns a pager for {@link MarkedEntityDTO DTOs} that hold the marker including type, title and uuid
930 * and the according {@link TaxonBase} information (uuid, title and the taxon object itself (optional)).
932 * @param clazz The optional {@link TaxonBase} subclass
933 * @param markerType the obligatory marker type, if not given, the results will always be empty
934 * @param markerValue the optional
935 * @param subtreeFilter filter on a classification subtree (TaxonNode)
936 * @param includeEntity should the taxon as an object be included in the result
937 * @param titleType which label to give the returned entity, taxon.titleCache, name.titleCache or name.nameCache
938 * @param pageSize page size
939 * @param pageNumber page number
940 * @param propertyPaths property path for initializing the returned taxon object (requires includeEntity=true)
941 * @return the resulting {@link MarkedEntityDTO} pager
942 * @see IIdentifiableEntityService#findByMarker(Class, MarkerType, Boolean, boolean, Integer, Integer, List)
944 public <S
extends TaxonBase
> Pager
<MarkedEntityDTO
<S
>> findByMarker(
945 Class
<S
> clazz
, MarkerType markerType
, Boolean markerValue
,
946 TaxonNode subtreeFilter
, boolean includeEntity
, TaxonTitleType titleType
,
947 Integer pageSize
, Integer pageNumber
, List
<String
> propertyPaths
);
949 public DeleteResult
deleteTaxon(UUID taxonUuid
, TaxonDeletionConfigurator config
, UUID classificationUuid
);
951 public UpdateResult
moveFactualDateToAnotherTaxon(UUID fromTaxonUuid
,
954 public UpdateResult
changeSynonymToRelatedTaxon(UUID synonymUuid
, UUID toTaxonUuid
, TaxonRelationshipType taxonRelationshipType
,
955 Reference citation
, String microcitation
);
957 public UpdateResult
changeRelatedTaxonToSynonym(UUID fromTaxonUuid
, UUID toTaxonUuid
,
958 TaxonRelationshipType oldRelationshipType
, SynonymType synonymType
) throws DataChangeNoRollbackException
;
961 * Returns a list of taxon relationships for a given taxon as DTO.
963 public TaxonRelationshipsDTO
listTaxonRelationships(UUID taxonUuid
,
964 Set
<TaxonRelationshipType
> directTypes
,
965 Set
<TaxonRelationshipType
> inversTypes
, Direction direction
, boolean groupMisapplications
,
966 boolean includeUnpublished
, Integer pageSize
, Integer pageNumber
);
968 public <S
extends TaxonBase
> Pager
<S
> page(Class
<S
> clazz
, List
<Restriction
<?
>> restrictions
, Integer pageSize
, Integer pageIndex
,
969 List
<OrderHint
> orderHints
, List
<String
> propertyPaths
, boolean includeUnpublished
);