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
;
15 import java
.util
.UUID
;
17 import org
.hibernate
.criterion
.Criterion
;
19 import eu
.etaxonomy
.cdm
.model
.common
.RelationshipBase
;
20 import eu
.etaxonomy
.cdm
.model
.common
.UuidAndTitleCache
;
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
.reference
.ReferenceBase
;
25 import eu
.etaxonomy
.cdm
.model
.taxon
.Synonym
;
26 import eu
.etaxonomy
.cdm
.model
.taxon
.SynonymRelationship
;
27 import eu
.etaxonomy
.cdm
.model
.taxon
.SynonymRelationshipType
;
28 import eu
.etaxonomy
.cdm
.model
.taxon
.Taxon
;
29 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonBase
;
30 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonRelationship
;
31 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonRelationshipType
;
32 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonomicTree
;
33 import eu
.etaxonomy
.cdm
.persistence
.dao
.BeanInitializer
;
34 import eu
.etaxonomy
.cdm
.persistence
.dao
.common
.IIdentifiableDao
;
35 import eu
.etaxonomy
.cdm
.persistence
.dao
.common
.ISearchableDao
;
36 import eu
.etaxonomy
.cdm
.persistence
.dao
.common
.ITitledDao
;
37 import eu
.etaxonomy
.cdm
.persistence
.fetch
.CdmFetch
;
38 import eu
.etaxonomy
.cdm
.persistence
.query
.MatchMode
;
39 import eu
.etaxonomy
.cdm
.persistence
.query
.OrderHint
;
45 public interface ITaxonDao
extends IIdentifiableDao
<TaxonBase
>, ITitledDao
<TaxonBase
>, ISearchableDao
<TaxonBase
> {
48 // * Returns a count of TaxonBase instances (or Taxon instances, if accepted == true, or Synonym instance, if accepted == false)
49 // * where the taxonBase.name.nameCache property matches the String queryString
51 // * @param queryString
54 // * @return a count of the matching taxa
56 // public int countTaxaByName(String queryString, Boolean accepted, ReferenceBase sec);
59 // * Returns a count of TaxonBase instances where the
60 // * taxon.name properties match the parameters passed.
62 // * @param queryString search string
63 // * @param matchMode way how search string shall be matched: exact, beginning, or anywhere
64 // * @param selectMode either all taxon bases, or all taxa, or all synonyms
65 // * @param sec reference
67 // public Integer countTaxaByName(String queryString,
68 // MatchMode matchMode, SelectMode selectMode, ReferenceBase sec);
71 * Returns a list of TaxonBase instances where the taxon.titleCache property matches the name parameter,
72 * and taxon.sec matches the sec parameter.
77 public List
<TaxonBase
> getTaxaByName(String name
, ReferenceBase sec
);
80 * Returns a list of TaxonBase instances (or Taxon instances, if accepted == true, or Synonym instance, if accepted == false)
81 * where the taxonBase.name.nameCache property matches the String queryString, and taxon.sec matches the sec parameter.
86 public List
<TaxonBase
> getTaxaByName(String queryString
, Boolean accepted
, ReferenceBase sec
);
89 * Returns a list of TaxonBase instances (or Taxon instances, if accepted == true, or Synonym instance, if accepted == false)
90 * where the taxonBase.name.nameCache property matches the String queryString.
98 public List
<TaxonBase
> getTaxaByName(String queryString
, MatchMode matchMode
,
99 Boolean accepted
, Integer pageSize
, Integer pageNumber
);
103 * Returns a list of TaxonBase instances (or Taxon instances, if accepted == true, or Synonym instance, if accepted == false)
104 * where the taxonBase.name.nameCache property matches the String queryString.
107 * @param taxonomicTree TODO
109 * @param namedAreas TODO
112 * @param propertyPaths TODO
113 * @return list of found taxa
115 public List
<TaxonBase
> getTaxaByName(Class
<?
extends TaxonBase
> clazz
, String queryString
, TaxonomicTree taxonomicTree
,
116 MatchMode matchMode
, Set
<NamedArea
> namedAreas
, Integer pageSize
, Integer pageNumber
, List
<String
> propertyPaths
);
121 * @param taxonomicTree TODO
126 * @param propertyPaths
129 public long countTaxaByName(Class
<?
extends TaxonBase
> clazz
, String queryString
, TaxonomicTree taxonomicTree
,
131 MatchMode matchMode
, Set
<NamedArea
> namedAreas
);
134 // * @param queryString
135 // * @param matchMode
139 // public Integer countTaxaByName(String queryString, MatchMode matchMode,
140 // Boolean accepted);
143 // * Returns a count of TaxonBase instances where the
144 // * taxon.name properties match the parameters passed.
146 // * @param queryString search string
147 // * @param matchMode way how search string shall be matched: exact, beginning, or anywhere
148 // * @param selectModel all taxon base, taxa, or synonyms
150 // public Integer countTaxaByName(String queryString, MatchMode matchMode, SelectMode selectMode);
153 * Computes all Taxon instances that do not have a taxonomic parent and has at least one child.
154 * @return The List<Taxon> of root taxa.
156 public List
<Taxon
> getRootTaxa(ReferenceBase sec
);
160 * Computes all Taxon instances that do not have a taxonomic parent.
161 * @param sec The concept reference that the taxon belongs to
162 * @param cdmFetch not used yet !! TODO
163 * @param onlyWithChildren if true only taxa are returned that have taxonomic children. <Br>Default: true.
164 * @param withMisaplications if false only taxa are returned that have no isMisappliedNameFor relationship.
166 * @return The List<Taxon> of root taxa.
168 public List
<Taxon
> getRootTaxa(ReferenceBase sec
, CdmFetch cdmFetch
, Boolean onlyWithChildren
, Boolean withMisapplications
);
172 * Computes all Taxon instances which name is of a certain Rank.
175 * The rank of the taxon name
177 * The concept reference that the taxon belongs to
179 * not used yet !! TODO
180 * @param onlyWithChildren
181 * if true only taxa are returned that have taxonomic children. <Br>
183 * @param withMisaplications
184 * if false only taxa are returned that have no
185 * isMisappliedNameFor relationship.
186 * @param propertyPaths
187 * properties to be initialized, For detailed description and
188 * examples <b>please refer to:</b>
189 * {@link BeanInitializer#initialize(Object, List)}. <Br>
191 * @return The List<Taxon> of root taxa.
194 getRootTaxa(Rank rank
, ReferenceBase sec
, CdmFetch cdmFetch
, Boolean onlyWithChildren
, Boolean withMisapplications
, List
<String
> propertyPaths
);
198 * @param pagesize max maximum number of returned taxa
199 * @param page page to start, with 0 being first page
202 public List
<TaxonBase
> getAllTaxonBases(Integer pagesize
, Integer page
);
210 public List
<Taxon
> getAllTaxa(Integer limit
, Integer start
);
217 public List
<Synonym
> getAllSynonyms(Integer limit
, Integer start
);
219 public List
<RelationshipBase
> getAllRelationships(Integer limit
, Integer start
);
222 * Find taxa by searching for @{link NameBase}
227 * @param onlyAcccepted
230 public List
<Taxon
> findByName(String queryString
, MatchMode matchMode
, int page
, int pagesize
, boolean onlyAcccepted
);
235 * @param onlyAcccepted
238 public int countMatchesByName(String queryString
, MatchMode matchMode
, boolean onlyAcccepted
);
243 * @param onlyAcccepted
247 public int countMatchesByName(String queryString
, MatchMode matchMode
, boolean onlyAcccepted
, List
<Criterion
> criteria
);
250 * Returns a count of the TaxonRelationships (of where relationship.type ==
251 * type, if this argument is supplied) where the supplied taxon either is
252 * relatedFrom or relatedTo depending on the <code>direction</code>
256 * The taxon that is relatedFrom
258 * The type of TaxonRelationship (can be null)
260 * specifies the direction of the relationship
261 * @return the number of TaxonRelationship instances
263 public int countTaxonRelationships(Taxon taxon
, TaxonRelationshipType type
,
264 Direction direction
);
267 * Returns the TaxonRelationships (of where relationship.type == type, if
268 * this argument is supplied) where the supplied taxon either is
269 * relatedFrom or relatedTo depending on the <code>direction</code>
273 * The taxon that is relatedTo
275 * The type of TaxonRelationship (can be null)
277 * The maximum number of relationships returned (can be null for
280 * The offset (in pageSize chunks) from the start of the result
283 * Properties to order by
284 * @param propertyPaths
285 * Properties to initialize in the returned entities, following
286 * the syntax described in
287 * {@link BeanInitializer#initialize(Object, List)}
289 * specifies the direction of the relationship
290 * @return a List of TaxonRelationship instances
292 public List
<TaxonRelationship
> getTaxonRelationships(Taxon taxon
,
293 TaxonRelationshipType type
, Integer pageSize
, Integer pageNumber
,
294 List
<OrderHint
> orderHints
, List
<String
> propertyPaths
,
295 Direction direction
);
298 * Returns a count of the SynonymRelationships (of where relationship.type == type,
299 * if this arguement is supplied) where the supplied taxon is relatedTo.
301 * @param taxon The taxon that is relatedTo
302 * @param type The type of SynonymRelationship (can be null)
303 * @return the number of SynonymRelationship instances
305 public int countSynonyms(Taxon taxon
, SynonymRelationshipType type
);
308 * Returns the SynonymRelationships (of where relationship.type == type, if this arguement is supplied)
309 * where the supplied taxon is relatedTo.
311 * @param taxon The taxon that is relatedTo
312 * @param type The type of SynonymRelationship (can be null)
313 * @param pageSize The maximum number of relationships returned (can be null for all relationships)
314 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
315 * * @param orderHints Properties to order by
316 * @param propertyPaths Properties to initialize in the returned entities, following the syntax described in {@link BeanInitializer#initialize(Object, List)}
317 * @return a List of SynonymRelationship instances
319 public List
<SynonymRelationship
> getSynonyms(Taxon taxon
, SynonymRelationshipType type
, Integer pageSize
, Integer pageNumber
, List
<OrderHint
> orderHints
, List
<String
> propertyPaths
);
322 * Returns a count of TaxonBase instances where the
323 * taxon.name properties match the parameters passed.
327 * @param infragenericEpithet
328 * @param specificEpithet
329 * @param infraspecificEpithet
331 * @return a count of TaxonBase instances
333 public int countTaxaByName(Class
<?
extends TaxonBase
> clazz
, String uninomial
, String infragenericEpithet
,String specificEpithet
, String infraspecificEpithet
, Rank rank
);
336 * Returns a list of TaxonBase instances where the
337 * taxon.name properties match the parameters passed. In order to search for any string value, pass '*', passing the string value of
338 * <i>null</i> will search for those taxa with a value of null in that field
340 * @param clazz optionally filter by class (can be null to return all taxa)
342 * @param infragenericEpithet
343 * @param specificEpithet
344 * @param infraspecificEpithet
346 * @param pageSize The maximum number of taxa returned (can be null for all matching taxa)
347 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
348 * @return a list of TaxonBase instances
350 public List
<TaxonBase
> findTaxaByName(Class
<?
extends TaxonBase
> clazz
, String uninomial
, String infragenericEpithet
, String specificEpithet
, String infraspecificEpithet
, Rank rank
, Integer pageSize
, Integer pageNumber
);
356 public List
<UuidAndTitleCache
> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByTaxonomicTree(TaxonomicTree taxonomicTree
);