f87246451b6ff97c636392a8f8a6fc82d8d0adcd
[cdmlib.git] / cdmlib-persistence / src / main / java / eu / etaxonomy / cdm / persistence / dao / name / ITaxonNameDao.java
1 /**
2 * Copyright (C) 2007 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
5 *
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.
8 */
9 package eu.etaxonomy.cdm.persistence.dao.name;
10
11 import java.util.List;
12
13 import org.hibernate.criterion.Criterion;
14
15 import eu.etaxonomy.cdm.model.name.BotanicalName;
16 import eu.etaxonomy.cdm.model.name.HybridRelationship;
17 import eu.etaxonomy.cdm.model.name.HybridRelationshipType;
18 import eu.etaxonomy.cdm.model.name.NameRelationship;
19 import eu.etaxonomy.cdm.model.name.NameRelationshipType;
20 import eu.etaxonomy.cdm.model.name.Rank;
21 import eu.etaxonomy.cdm.model.name.TaxonNameBase;
22 import eu.etaxonomy.cdm.model.name.TypeDesignationBase;
23 import eu.etaxonomy.cdm.model.name.SpecimenTypeDesignationStatus;
24 import eu.etaxonomy.cdm.persistence.dao.BeanInitializer;
25 import eu.etaxonomy.cdm.persistence.dao.common.IIdentifiableDao;
26 import eu.etaxonomy.cdm.persistence.query.MatchMode;
27 import eu.etaxonomy.cdm.persistence.query.OrderHint;
28
29 /**
30 * @author a.mueller
31 *
32 */
33 public interface ITaxonNameDao extends IIdentifiableDao<TaxonNameBase> {
34
35 /**
36 * Return a count of names related to this name, optionally filtered by
37 * relationship type
38 *
39 * @param name
40 * the name
41 * @param type
42 * the relationship type (or null to return all relationships)
43 * @return a count of NameRelationship instances
44 */
45 public int countRelatedNames(TaxonNameBase name, NameRelationshipType type);
46
47 /**
48 * Return a List of relationships related to this name, optionally filtered
49 * by relationship type
50 *
51 * @param name
52 * the name
53 * @param type
54 * the relationship type (or null to return all relationships)
55 * @param pageSize
56 * The maximum number of relationships returned (can be null for
57 * all relationships)
58 * @param pageNumber
59 * The offset (in pageSize chunks) from the start of the result
60 * set (0 - based) of the result set (0 - based)
61 * @param orderHints may be null
62 * @param propertyPaths properties to initialize - see {@link BeanInitializer#initialize(Object, List)}
63 * @return a List of NameRelationship instances
64 */
65 public List<NameRelationship> getRelatedNames(TaxonNameBase name, NameRelationshipType type, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);
66
67 /**
68 * Return a count of hybrids related to this name, optionally filtered by
69 * hybrid relationship type
70 *
71 * @param name
72 * the name
73 * @param type
74 * the hybrid relationship type (or null to return all hybrid)
75 * @return a count of HybridRelationship instances
76 */
77 public int countHybridNames(BotanicalName name, HybridRelationshipType type);
78
79 /**
80 * Return a List of hybrids related to this name, optionally filtered by
81 * hybrid relationship type
82 *
83 * @param name
84 * the name
85 * @param type
86 * the hybrid relationship type (or null to return all hybrids)
87 * @param pageSize
88 * The maximum number of hybrid relationships returned (can be
89 * null for all relationships)
90 * @param pageNumber
91 * The offset (in pageSize chunks) from the start of the result
92 * set (0 - based)
93 * @return a List of HybridRelationship instances
94 */
95 public List<HybridRelationship> getHybridNames(BotanicalName name, HybridRelationshipType type, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);
96
97 /**
98 * Return a count of types related to this name, optionally filtered by type
99 * designation status
100 *
101 * @param name
102 * the name
103 * @param status
104 * the type designation status (or null to return all types)
105 * @return a count of TypeDesignationBase instances
106 */
107 public int countTypeDesignations(TaxonNameBase name,
108 SpecimenTypeDesignationStatus status);
109
110 /**
111 * Return a List of types related to this name, optionally filtered by type
112 * designation status
113 *
114 * @param name
115 * the name
116 * @param status
117 * the type designation status (or null to return all types)
118 * @param pageSize
119 * The maximum number of types returned (can be null for all
120 * types)
121 * @param pageNumber
122 * The offset (in pageSize chunks) from the start of the result
123 * set (0 - based)
124 * @return a List of TypeDesignationBase instances
125 */
126 public List<TypeDesignationBase> getTypeDesignations(TaxonNameBase name,
127 SpecimenTypeDesignationStatus status, Integer pageSize, Integer pageNumber);
128
129 /**
130 * Return a List of types related to this name, optionally filtered by type
131 * designation status
132 *
133 * @param name
134 * the name
135 * @param status
136 * the type designation status (or null to return all types)
137 * @param pageSize
138 * The maximum number of types returned (can be null for all
139 * types)
140 * @param pageNumber
141 * The offset (in pageSize chunks) from the start of the result
142 * set (0 - based)
143 * @param propertyPaths
144 * @return a List of TypeDesignationBase instances
145 */
146 public List<TypeDesignationBase> getTypeDesignations(TaxonNameBase name,
147 SpecimenTypeDesignationStatus status, Integer pageSize, Integer pageNumber,
148 List<String> propertyPaths);
149
150 /**
151 * Returns a List of TaxonNameBase instances that match the properties
152 * passed
153 *
154 * @param uninomial
155 * @param infraGenericEpithet
156 * @param specificEpithet
157 * @param infraspecificEpithet
158 * @param rank
159 * @param pageSize
160 * The maximum number of names returned (can be null for all
161 * names)
162 * @param pageNumber
163 * The offset (in pageSize chunks) from the start of the result
164 * set (0 - based)
165 * @return a List of TaxonNameBase instances
166 */
167 public List<TaxonNameBase> searchNames(String uninomial,
168 String infraGenericEpithet, String specificEpithet,
169 String infraspecificEpithet, Rank rank, Integer pageSize,
170 Integer pageNumber);
171
172 /**
173 * Returns a count of TaxonNameBase instances that match the properties
174 * passed
175 *
176 * @param uninomial
177 * @param infraGenericEpithet
178 * @param specificEpithet
179 * @param infraspecificEpithet
180 * @param rank
181 * @return a count of TaxonNameBase instances
182 */
183 public int countNames(String uninomial, String infraGenericEpithet,
184 String specificEpithet, String infraspecificEpithet, Rank rank);
185
186 /**
187 * Returns a List of TaxonNameBase instances which nameCache matches the
188 * query string
189 *
190 * @param queryString
191 * @param pageSize
192 * The maximum number of names returned (can be null for all
193 * names)
194 * @param pageNumber
195 * The offset (in pageSize chunks) from the start of the result
196 * set (0 - based)
197 * @return a List of TaxonNameBase instances
198 */
199 public List<TaxonNameBase<?, ?>> searchNames(String queryString,
200 Integer pageSize, Integer pageNumber);
201
202 /**
203 * Returns a count of TaxonNameBase instances which nameCache matches the
204 * String queryString
205 *
206 * @param queryString
207 * @return a count of TaxonNameBase instances
208 */
209 public int countNames(String queryString);
210
211 /**
212 * @param queryString
213 * @param matchmode
214 * @param pageSize
215 * @param pageNumber
216 * @param criteria
217 * @return
218 */
219 public List<? extends TaxonNameBase<?, ?>> findByName(String queryString,
220 MatchMode matchmode, Integer pageSize, Integer pageNumber,
221 List<Criterion> criteria);
222
223
224 /**
225 * @param queryString
226 * @param matchmode
227 * @param criteria
228 * @return
229 */
230 public Integer countByName(String queryString,
231 MatchMode matchmode, List<Criterion> criteria);
232 }