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
.persistence
.dao
.taxon
;
12 import java
.util
.List
;
14 import java
.util
.UUID
;
16 import org
.hibernate
.criterion
.Criterion
;
18 import eu
.etaxonomy
.cdm
.model
.common
.DefinedTerm
;
19 import eu
.etaxonomy
.cdm
.model
.common
.IdentifiableEntity
;
20 import eu
.etaxonomy
.cdm
.model
.common
.MarkerType
;
21 import eu
.etaxonomy
.cdm
.model
.common
.RelationshipBase
.Direction
;
22 import eu
.etaxonomy
.cdm
.model
.location
.NamedArea
;
23 import eu
.etaxonomy
.cdm
.model
.name
.Rank
;
24 import eu
.etaxonomy
.cdm
.model
.name
.TaxonName
;
25 import eu
.etaxonomy
.cdm
.model
.reference
.Reference
;
26 import eu
.etaxonomy
.cdm
.model
.taxon
.Classification
;
27 import eu
.etaxonomy
.cdm
.model
.taxon
.Synonym
;
28 import eu
.etaxonomy
.cdm
.model
.taxon
.SynonymType
;
29 import eu
.etaxonomy
.cdm
.model
.taxon
.Taxon
;
30 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonBase
;
31 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonNode
;
32 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonRelationship
;
33 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonRelationshipType
;
34 import eu
.etaxonomy
.cdm
.persistence
.dao
.common
.IIdentifiableDao
;
35 import eu
.etaxonomy
.cdm
.persistence
.dao
.common
.IPublishableDao
;
36 import eu
.etaxonomy
.cdm
.persistence
.dao
.common
.ITitledDao
;
37 import eu
.etaxonomy
.cdm
.persistence
.dto
.UuidAndTitleCache
;
38 import eu
.etaxonomy
.cdm
.persistence
.query
.MatchMode
;
39 import eu
.etaxonomy
.cdm
.persistence
.query
.NameSearchOrder
;
40 import eu
.etaxonomy
.cdm
.persistence
.query
.OrderHint
;
41 import eu
.etaxonomy
.cdm
.persistence
.query
.TaxonTitleType
;
47 public interface ITaxonDao
48 extends IIdentifiableDao
<TaxonBase
>, ITitledDao
<TaxonBase
>, IPublishableDao
<TaxonBase
> {
54 * NOTE: Also taxa with <code>publish=false</code> are returned.
57 public TaxonBase
load(UUID uuid
, List
<String
> propertyPaths
);
60 * Returns a list of TaxonBase instances where the taxon.titleCache property matches the name parameter,
61 * and taxon.sec matches the sec parameter.
66 public List
<TaxonBase
> getTaxaByName(String name
, boolean includeUnpublished
, Reference sec
);
69 * Returns a list of TaxonBase instances (or Taxon instances, if accepted == true, or Synonym instance, if accepted == false)
70 * where the taxonBase.name.nameCache property matches the String queryString, and taxon.sec matches the sec parameter.
75 public List
<TaxonBase
> getTaxaByName(String queryString
, Boolean accepted
, boolean includeUnpublished
, Reference sec
);
78 * Returns a list of TaxonBase instances (or Taxon instances, if accepted == true, or Synonym instance, if accepted == false)
79 * where the taxonBase.name.nameCache property matches the String queryString.
87 public List
<TaxonBase
> getTaxaByName(String queryString
, MatchMode matchMode
,
88 Boolean accepted
, boolean includeUnpublished
, Integer pageSize
, Integer pageNumber
);
92 * Returns a list of TaxonBase instances (or Taxon instances, if accepted == true, or Synonym instance, if accepted == false)
93 * where the taxonBase.name.nameCache property matches the String queryString.
97 * @param classification TODO
100 * @param namedAreas TODO
103 * @param propertyPaths TODO
104 * @return list of found taxa
106 public List
<TaxonBase
> getTaxaByName(boolean doTaxa
, boolean doSynonyms
, boolean doMisappliedNames
, boolean doCommonNames
,
107 boolean includeAuthors
, String queryString
, Classification classification
, TaxonNode subtree
,
108 MatchMode matchMode
, Set
<NamedArea
> namedAreas
, boolean includeUnpublished
,
109 NameSearchOrder order
, Integer pageSize
, Integer pageNumber
, List
<String
> propertyPaths
);
115 * @param classification TODO
121 * @param propertyPaths
124 public long countTaxaByName(boolean doTaxa
, boolean doSynonyms
, boolean doMisappliedNames
, boolean doCommonNames
,
125 boolean doIncludeAuthors
, String queryString
, Classification classification
, TaxonNode subtree
,
126 MatchMode matchMode
, Set
<NamedArea
> namedAreas
, boolean includeUnpublished
);
130 * Returns a count of TaxonBase instances where the
131 * taxon.name properties match the parameters passed.
136 * @param infragenericEpithet
137 * @param specificEpithet
138 * @param infraspecificEpithet
140 * @return a count of TaxonBase instances
142 public long countTaxaByName(Class
<?
extends TaxonBase
> clazz
, String uninomial
, String infragenericEpithet
,String specificEpithet
, String infraspecificEpithet
, Rank rank
);
145 * Returns a list of TaxonBase instances where the
146 * taxon.name properties match the parameters passed. In order to search for any string value, pass '*', passing the string value of
147 * <i>null</i> will search for those taxa with a value of null in that field
150 * {@link #findByName(String, MatchMode, int, int, boolean)}
151 * which searches for {@link TaxonName}<strong><code>.titleCache</code>
157 * @param infragenericEpithet
158 * @param specificEpithet
159 * @param infraspecificEpithet
161 * @param pageSize The maximum number of taxa returned (can be null for all matching taxa)
162 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
163 * @return a list of TaxonBase instances
165 public List
<TaxonBase
> findTaxaByName(Class
<?
extends TaxonBase
> clazz
, String uninomial
, String infragenericEpithet
, String specificEpithet
, String infraspecificEpithet
, String authorship
, Rank rank
, Integer pageSize
, Integer pageNumber
);
168 * Find taxa by searching for Taxa and Synonyms where the
169 * {@link TaxonName}<strong><code>.titleCache</code></strong> matches
170 * the name specified as queryString <code>taxonName</code>
173 * {@link #findTaxaByName(Class, String, String, String, String, Rank, Integer, Integer)}
174 * which searches for {@link TaxonName}<strong><code>.nameCache</code>
177 * the taqxon Name to search for
178 * @param classification TODO
180 * @param namedAreas TODO
183 * @param onlyAcccepted
186 public List
<TaxonBase
> findByNameTitleCache(boolean doTaxa
, boolean doSynonyms
, boolean includeUnpublished
,
187 String queryString
, Classification classification
, TaxonNode subtree
, MatchMode matchMode
, Set
<NamedArea
> namedAreas
,
188 NameSearchOrder order
, Integer pageNumber
, Integer pageSize
, List
<String
> propertyPaths
) ;
191 * Returns a taxon corresponding to the given uuid
194 * The uuid of the taxon requested
196 * Custom criteria to be added to the default list of applied criteria.
197 * @param propertyPaths
201 public TaxonBase
findByUuid(UUID uuid
, List
<Criterion
> criteria
, List
<String
> propertyPaths
);
204 * Returns a list of Taxon entities corresponding to the given uuid list.
207 * @param propertyPaths
210 public List
<?
extends TaxonBase
> findByUuids(List
<UUID
> uuids
, List
<Criterion
> criteria
, List
<String
> propertyPaths
);
214 * @param classification
219 * @param propertyPaths
220 * @return A List matching Taxa
222 public List
<Taxon
> getTaxaByCommonName(String queryString
, Classification classification
,
223 MatchMode matchMode
, Set
<NamedArea
> namedAreas
, Integer pageSize
,
224 Integer pageNumber
, List
<String
> propertyPaths
);
227 * Counts the number of synonyms
228 * @param onlyAttachedToTaxon if <code>true</code> only those synonyms being attached to
229 * an accepted taxon are counted
230 * @return the number of synonyms
232 public long countSynonyms(boolean onlyAttachedToTaxon
);
237 * @param onlyAcccepted
240 public long countMatchesByName(String queryString
, MatchMode matchMode
, boolean onlyAcccepted
);
245 * @param onlyAcccepted
249 public long countMatchesByName(String queryString
, MatchMode matchMode
, boolean onlyAcccepted
, List
<Criterion
> criteria
);
252 * Returns a count of the TaxonRelationships (of where relationship.type ==
253 * type, if this argument is supplied) where the supplied taxon either is
254 * relatedFrom or relatedTo depending on the <code>direction</code>
258 * The taxon that is relatedFrom
260 * The type of TaxonRelationship (can be null)
262 * specifies the direction of the relationship
263 * @return the number of TaxonRelationship instances
265 public long countTaxonRelationships(Taxon taxon
, TaxonRelationshipType type
,
266 boolean includeUnpublished
, Direction direction
);
267 public long countTaxonRelationships(Taxon taxon
, Set
<TaxonRelationshipType
> types
,
268 boolean includeUnpublished
, Direction direction
);
271 * Returns the TaxonRelationships (of where relationship.type == type, if
272 * this argument is supplied) where the supplied taxon either is
273 * relatedFrom or relatedTo depending on the <code>direction</code>
277 * The taxon that is relatedTo
279 * The type of TaxonRelationship (can be null)
281 * The maximum number of relationships returned (can be null for
284 * The offset (in pageSize chunks) from the start of the result
287 * Properties to order by
288 * @param propertyPaths
289 * Properties to initialize in the returned entities, following
290 * the syntax described in
291 * {@link IBeanInitializer#initialize(Object, List)}
293 * specifies the direction of the relationship
294 * @return a List of TaxonRelationship instances
296 public List
<TaxonRelationship
> getTaxonRelationships(Taxon taxon
,
297 TaxonRelationshipType type
, boolean includeUnpublished
,
298 Integer pageSize
, Integer pageNumber
,
299 List
<OrderHint
> orderHints
, List
<String
> propertyPaths
,
300 Direction direction
);
302 public List
<TaxonRelationship
> getTaxonRelationships(Taxon taxon
,
303 Set
<TaxonRelationshipType
> type
, boolean includeUnpublished
,
304 Integer pageSize
, Integer pageNumber
,
305 List
<OrderHint
> orderHints
, List
<String
> propertyPaths
,
306 Direction direction
);
309 * Returns a count of the Synonyms (where relationship.type == type,
310 * if this argument is supplied) where the supplied taxon is relatedTo.
312 * @param taxon The taxon that is relatedTo
313 * @param type The type of Synonym (can be null)
314 * @return the number of Synonym instances
316 public long countSynonyms(Taxon taxon
, SynonymType type
);
319 * Returns the Synonyms (of where relationship.type == type, if this argument is supplied)
320 * that do have the supplied taxon as accepted taxon.
322 * @param taxon The accepted taxon
323 * @param type The type of synonym (can be null)
324 * @param pageSize The maximum number of synonyms returned (can be null for all synonyms)
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 {@link List} of {@link Synonym} instances
330 public List
<Synonym
> getSynonyms(Taxon taxon
, SynonymType type
, Integer pageSize
, Integer pageNumber
, List
<OrderHint
> orderHints
, List
<String
> propertyPaths
);
333 * Returns a count of the synonyms (where relationship.type == type,
334 * if this argument is supplied) which do have an accepted taxon.
336 * @param synonym The synonym that is relatedFrom
337 * @param type The type of Synonym (can be null)
338 * @return the number of Synonym instances
340 public long countSynonyms(Synonym synonym
, SynonymType type
);
342 public List
<TaxonName
> findIdenticalTaxonNames(List
<String
> propertyPath
);
344 public long countTaxaByCommonName(String searchString
,
345 Classification classification
, MatchMode matchMode
,
346 Set
<NamedArea
> namedAreas
);
348 public List
<UUID
> findIdenticalTaxonNameIds(List
<String
> propertyPath
);
350 public List
<TaxonName
> findIdenticalNamesNew(List
<String
> propertyPaths
);
352 public List
<UuidAndTitleCache
<?
extends IdentifiableEntity
>> getTaxaByNameForEditor(boolean doTaxa
, boolean doSynonyms
, boolean doNamesWithoutTaxa
,
353 boolean doMisappliedNames
, boolean doCommonNames
, boolean includeUnpublished
,
354 String queryString
, Classification classification
, TaxonNode subtree
,
355 MatchMode matchMode
, Set
<NamedArea
> namedAreas
, NameSearchOrder order
);
357 public List
<String
> taxaByNameNotInDB(List
<String
> taxonNames
);
360 * This method was originally required when synonyms still had a synonym relationship
361 * to taxa and could belong to multiple taxa. Now the method might be obsolete.
363 * @param classificationFilter
364 * @param propertyPaths
365 * @see #countAcceptedTaxonFor(Synonym, Classification)
367 public Taxon
acceptedTaxonFor(Synonym synonym
, Classification classificationFilter
, List
<String
> propertyPaths
);
370 * This method was originally required when synonyms still had a synonym relationship
371 * to taxa and could belong to multiple taxa. Now the method might be obsolete.@param synonym
372 * @param classificationFilter
374 * @see #acceptedTaxonFor(Synonym, Classification, Integer, Integer, List, List)
376 public long countAcceptedTaxonFor(Synonym synonym
, Classification classificationFilter
);
378 public List
<UuidAndTitleCache
<Taxon
>> getTaxaByCommonNameForEditor(
379 String titleSearchStringSqlized
, Classification classification
,
380 MatchMode matchMode
, Set
<NamedArea
> namedAreas
);
382 public <S
extends TaxonBase
> List
<Object
[]> findByIdentifier(Class
<S
> clazz
, String identifier
,
383 DefinedTerm identifierType
, TaxonNode subtreeFilter
, MatchMode matchmode
,
384 boolean includeEntity
, Integer pageSize
, Integer pageNumber
, List
<String
> propertyPaths
);
387 * Counts all taxa which match the given identifier (identifier type, identifier string and match mode).
388 * Optionally a subtreefilter can be defined.
390 * @param clazz optional, the TaxonBase subclass
391 * @param identifier the identifier string
392 * @param identifierType the identifier type
393 * @param matchmode the match mode for the identifier string
394 * @param subtreeFilter the subtree filter as taxon node
397 public <S
extends TaxonBase
> long countByIdentifier(Class
<S
> clazz
,
398 String identifier
, DefinedTerm identifierType
, TaxonNode subtreeFilter
, MatchMode matchmode
);
401 * Counts all taxa which have the given marker of type markerType and with value markerValue.
402 * Additionally an optional subtreefilter can be defined.
407 * @param subtreeFilter
410 public <S
extends TaxonBase
> long countByMarker(Class
<S
> clazz
, MarkerType markerType
,
411 Boolean markerValue
, TaxonNode subtreeFilter
);
417 * @param subtreeFilter
418 * @param includeEntity
421 * @param propertyPaths
424 public <S
extends TaxonBase
> List
<Object
[]> findByMarker(Class
<S
> clazz
, MarkerType markerType
,
425 Boolean markerValue
, TaxonNode subtreeFilter
, boolean includeEntity
, TaxonTitleType titleType
,
426 Integer pageSize
, Integer pageNumber
, List
<String
> propertyPaths
);
433 public long countTaxonRelationships(Set
<TaxonRelationshipType
> types
);
440 * @param propertyPaths
443 public List
<TaxonRelationship
> getTaxonRelationships(Set
<TaxonRelationshipType
> types
,
444 Integer pageSize
, Integer pageNumber
,
445 List
<OrderHint
> orderHints
, List
<String
> propertyPaths
);