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
;
13 import java
.util
.UUID
;
15 import org
.hibernate
.criterion
.Criterion
;
17 import eu
.etaxonomy
.cdm
.model
.common
.RelationshipBase
;
18 import eu
.etaxonomy
.cdm
.model
.common
.RelationshipBase
.Direction
;
19 import eu
.etaxonomy
.cdm
.model
.name
.Rank
;
20 import eu
.etaxonomy
.cdm
.model
.reference
.ReferenceBase
;
21 import eu
.etaxonomy
.cdm
.model
.taxon
.Synonym
;
22 import eu
.etaxonomy
.cdm
.model
.taxon
.SynonymRelationship
;
23 import eu
.etaxonomy
.cdm
.model
.taxon
.SynonymRelationshipType
;
24 import eu
.etaxonomy
.cdm
.model
.taxon
.Taxon
;
25 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonBase
;
26 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonRelationship
;
27 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonRelationshipType
;
28 import eu
.etaxonomy
.cdm
.persistence
.dao
.BeanInitializer
;
29 import eu
.etaxonomy
.cdm
.persistence
.dao
.common
.IIdentifiableDao
;
30 import eu
.etaxonomy
.cdm
.persistence
.dao
.common
.ISearchableDao
;
31 import eu
.etaxonomy
.cdm
.persistence
.dao
.common
.ITitledDao
;
32 import eu
.etaxonomy
.cdm
.persistence
.fetch
.CdmFetch
;
33 import eu
.etaxonomy
.cdm
.persistence
.query
.MatchMode
;
34 import eu
.etaxonomy
.cdm
.persistence
.query
.OrderHint
;
35 import eu
.etaxonomy
.cdm
.persistence
.query
.SelectMode
;
41 public interface ITaxonDao
extends IIdentifiableDao
<TaxonBase
>, ITitledDao
<TaxonBase
>, ISearchableDao
<TaxonBase
> {
44 * Returns a count of TaxonBase instances (or Taxon instances, if accepted == true, or Synonym instance, if accepted == false)
45 * where the taxonBase.name.nameCache property matches the String queryString
50 * @return a count of the matching taxa
52 public int countTaxaByName(String queryString
, Boolean accepted
, ReferenceBase sec
);
55 * Returns a count of TaxonBase instances where the
56 * taxon.name properties match the parameters passed.
58 * @param queryString search string
59 * @param matchMode way how search string shall be matched: exact, beginning, or anywhere
60 * @param selectMode either all taxon bases, or all taxa, or all synonyms
61 * @param sec reference
63 public Integer
countTaxaByName(String queryString
,
64 MatchMode matchMode
, SelectMode selectMode
, ReferenceBase sec
);
67 * Returns a list of TaxonBase instances where the taxon.titleCache property matches the name parameter,
68 * and taxon.sec matches the sec parameter.
73 public List
<TaxonBase
> getTaxaByName(String name
, ReferenceBase sec
);
76 * Returns a list of TaxonBase instances (or Taxon instances, if accepted == true, or Synonym instance, if accepted == false)
77 * where the taxonBase.name.nameCache property matches the String queryString, and taxon.sec matches the sec parameter.
82 public List
<TaxonBase
> getTaxaByName(String queryString
, Boolean accepted
, ReferenceBase sec
);
85 * Returns a list of TaxonBase instances (or Taxon instances, if accepted == true, or Synonym instance, if accepted == false)
86 * where the taxonBase.name.nameCache property matches the String queryString.
94 public List
<TaxonBase
> getTaxaByName(String queryString
, MatchMode matchMode
,
95 Boolean accepted
, Integer pageSize
, Integer pageNumber
);
99 * Returns a list of TaxonBase instances (or Taxon instances, if accepted == true, or Synonym instance, if accepted == false)
100 * where the taxonBase.name.nameCache property matches the String queryString.
106 * @param propertyPaths TODO
107 * @return list of found taxa
109 public List
<TaxonBase
> getTaxaByName(String queryString
, MatchMode matchMode
, SelectMode selectMode
,
110 ReferenceBase sec
, Integer pageSize
, Integer pageNumber
, List
<String
> propertyPaths
);
118 public Integer
countTaxaByName(String queryString
, MatchMode matchMode
,
122 * Returns a count of TaxonBase instances where the
123 * taxon.name properties match the parameters passed.
125 * @param queryString search string
126 * @param matchMode way how search string shall be matched: exact, beginning, or anywhere
127 * @param selectModel all taxon base, taxa, or synonyms
129 public Integer
countTaxaByName(String queryString
, MatchMode matchMode
, SelectMode selectMode
);
132 * Computes all Taxon instances that do not have a taxonomic parent and has at least one child.
133 * @return The List<Taxon> of root taxa.
135 public List
<Taxon
> getRootTaxa(ReferenceBase sec
);
139 * Computes all Taxon instances that do not have a taxonomic parent.
140 * @param sec The concept reference that the taxon belongs to
141 * @param cdmFetch not used yet !! TODO
142 * @param onlyWithChildren if true only taxa are returned that have taxonomic children. <Br>Default: true.
143 * @param withMisaplications if false only taxa are returned that have no isMisappliedNameFor relationship.
145 * @return The List<Taxon> of root taxa.
147 public List
<Taxon
> getRootTaxa(ReferenceBase sec
, CdmFetch cdmFetch
, Boolean onlyWithChildren
, Boolean withMisapplications
);
151 * Computes all Taxon instances which name is of a certain Rank.
154 * The rank of the taxon name
156 * The concept reference that the taxon belongs to
158 * not used yet !! TODO
159 * @param onlyWithChildren
160 * if true only taxa are returned that have taxonomic children. <Br>
162 * @param withMisaplications
163 * if false only taxa are returned that have no
164 * isMisappliedNameFor relationship.
165 * @param propertyPaths
166 * properties to be initialized, For detailed description and
167 * examples <b>please refer to:</b>
168 * {@link BeanInitializer#initialize(Object, List)}. <Br>
170 * @return The List<Taxon> of root taxa.
173 getRootTaxa(Rank rank
, ReferenceBase sec
, CdmFetch cdmFetch
, Boolean onlyWithChildren
, Boolean withMisapplications
, List
<String
> propertyPaths
);
177 * @param pagesize max maximum number of returned taxa
178 * @param page page to start, with 0 being first page
181 public List
<TaxonBase
> getAllTaxonBases(Integer pagesize
, Integer page
);
189 public List
<Taxon
> getAllTaxa(Integer limit
, Integer start
);
196 public List
<Synonym
> getAllSynonyms(Integer limit
, Integer start
);
198 public List
<RelationshipBase
> getAllRelationships(Integer limit
, Integer start
);
201 * Find taxa by searching for @{link NameBase}
206 * @param onlyAcccepted
209 public List
<Taxon
> findByName(String queryString
, MatchMode matchMode
, int page
, int pagesize
, boolean onlyAcccepted
);
214 * @param onlyAcccepted
217 public int countMatchesByName(String queryString
, MatchMode matchMode
, boolean onlyAcccepted
);
222 * @param onlyAcccepted
226 public int countMatchesByName(String queryString
, MatchMode matchMode
, boolean onlyAcccepted
, List
<Criterion
> criteria
);
229 * Returns a count of the TaxonRelationships (of where relationship.type ==
230 * type, if this argument is supplied) where the supplied taxon either is
231 * relatedFrom or relatedTo depending on the <code>direction</code>
235 * The taxon that is relatedFrom
237 * The type of TaxonRelationship (can be null)
239 * specifies the direction of the relationship
240 * @return the number of TaxonRelationship instances
242 public int countTaxonRelationships(Taxon taxon
, TaxonRelationshipType type
,
243 Direction direction
);
246 * Returns the TaxonRelationships (of where relationship.type == type, if
247 * this argument is supplied) where the supplied taxon either is
248 * relatedFrom or relatedTo depending on the <code>direction</code>
252 * The taxon that is relatedTo
254 * The type of TaxonRelationship (can be null)
256 * The maximum number of relationships returned (can be null for
259 * The offset (in pageSize chunks) from the start of the result
262 * Properties to order by
263 * @param propertyPaths
264 * Properties to initialize in the returned entities, following
265 * the syntax described in
266 * {@link BeanInitializer#initialize(Object, List)}
268 * specifies the direction of the relationship
269 * @return a List of TaxonRelationship instances
271 public List
<TaxonRelationship
> getTaxonRelationships(Taxon taxon
,
272 TaxonRelationshipType type
, Integer pageSize
, Integer pageNumber
,
273 List
<OrderHint
> orderHints
, List
<String
> propertyPaths
,
274 Direction direction
);
277 * Returns a count of the SynonymRelationships (of where relationship.type == type,
278 * if this arguement is supplied) where the supplied taxon is relatedTo.
280 * @param taxon The taxon that is relatedTo
281 * @param type The type of SynonymRelationship (can be null)
282 * @return the number of SynonymRelationship instances
284 public int countSynonyms(Taxon taxon
, SynonymRelationshipType type
);
287 * Returns the SynonymRelationships (of where relationship.type == type, if this arguement is supplied)
288 * where the supplied taxon is relatedTo.
290 * @param taxon The taxon that is relatedTo
291 * @param type The type of SynonymRelationship (can be null)
292 * @param pageSize The maximum number of relationships returned (can be null for all relationships)
293 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
294 * * @param orderHints Properties to order by
295 * @param propertyPaths Properties to initialize in the returned entities, following the syntax described in {@link BeanInitializer#initialize(Object, List)}
296 * @return a List of SynonymRelationship instances
298 public List
<SynonymRelationship
> getSynonyms(Taxon taxon
, SynonymRelationshipType type
, Integer pageSize
, Integer pageNumber
, List
<OrderHint
> orderHints
, List
<String
> propertyPaths
);
301 * Returns a count of TaxonBase instances where the
302 * taxon.name properties match the parameters passed.
306 * @param infragenericEpithet
307 * @param specificEpithet
308 * @param infraspecificEpithet
310 * @return a count of TaxonBase instances
312 public int countTaxaByName(Class
<?
extends TaxonBase
> clazz
, String uninomial
, String infragenericEpithet
,String specificEpithet
, String infraspecificEpithet
, Rank rank
);
315 * Returns a list of TaxonBase instances where the
316 * taxon.name properties match the parameters passed. In order to search for any string value, pass '*', passing the string value of
317 * <i>null</i> will search for those taxa with a value of null in that field
319 * @param clazz optionally filter by class (can be null to return all taxa)
321 * @param infragenericEpithet
322 * @param specificEpithet
323 * @param infraspecificEpithet
325 * @param pageSize The maximum number of taxa returned (can be null for all matching taxa)
326 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
327 * @return a list of TaxonBase instances
329 public List
<TaxonBase
> findTaxaByName(Class
<?
extends TaxonBase
> clazz
, String uninomial
, String infragenericEpithet
, String specificEpithet
, String infraspecificEpithet
, Rank rank
, Integer pageSize
, Integer pageNumber
);