moving all beaninitializer classes to new package 'eu.etaxonomy.cdm.persistence.dao...
[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 import java.util.UUID;
13
14 import org.hibernate.criterion.Criterion;
15
16 import eu.etaxonomy.cdm.model.common.IdentifiableEntity;
17 import eu.etaxonomy.cdm.model.common.RelationshipBase;
18 import eu.etaxonomy.cdm.model.common.UuidAndTitleCache;
19 import eu.etaxonomy.cdm.model.name.HybridRelationship;
20 import eu.etaxonomy.cdm.model.name.HybridRelationshipType;
21 import eu.etaxonomy.cdm.model.name.NameRelationship;
22 import eu.etaxonomy.cdm.model.name.NameRelationshipType;
23 import eu.etaxonomy.cdm.model.name.NonViralName;
24 import eu.etaxonomy.cdm.model.name.Rank;
25 import eu.etaxonomy.cdm.model.name.SpecimenTypeDesignationStatus;
26 import eu.etaxonomy.cdm.model.name.TaxonNameBase;
27 import eu.etaxonomy.cdm.model.name.TypeDesignationBase;
28 import eu.etaxonomy.cdm.model.name.TypeDesignationStatusBase;
29 import eu.etaxonomy.cdm.model.name.ZoologicalName;
30 import eu.etaxonomy.cdm.persistence.dao.common.IIdentifiableDao;
31 import eu.etaxonomy.cdm.persistence.dao.initializer.IBeanInitializer;
32 import eu.etaxonomy.cdm.persistence.query.MatchMode;
33 import eu.etaxonomy.cdm.persistence.query.OrderHint;
34
35 /**
36 * @author a.mueller
37 *
38 */
39 public interface ITaxonNameDao extends IIdentifiableDao<TaxonNameBase> {
40
41 /**
42 * Return a count of names related to or from this name, optionally filtered
43 * by relationship type. The direction of the relationships taken in to account is depending on
44 * the <code>direction</code> parameter.
45 *
46 * @param name
47 * the name
48 * @param direction
49 * specifies the direction of the relationship
50 * @param type
51 * the relationship type (or null to return all relationships)
52 * @return a count of NameRelationship instances
53 */
54 public int countNameRelationships(TaxonNameBase name, NameRelationship.Direction direction, NameRelationshipType type);
55
56 /**
57 * Return a List of relationships related to or from this name, optionally filtered
58 * by relationship type. The direction of the relationships taken in to account is depending on
59 * the <code>direction</code> parameter.
60 * If both name and direction is null all name relationships will be returned.
61 *
62 * @param name
63 * the name
64 * @param direction
65 * specifies the direction of the relationship, may be null to return all relationships
66 * @param type
67 * the relationship type (or null to return all relationships)
68 * @param pageSize
69 * The maximum number of relationships returned (can be null for
70 * all relationships)
71 * @param pageNumber
72 * The offset (in pageSize chunks) from the start of the result
73 * set (0 - based) of the result set (0 - based)
74 * @param orderHints may be null
75 * @param propertyPaths properties to initialize - see {@link IBeanInitializer#initialize(Object, List)}
76 * @return a List of NameRelationship instances
77 */
78 public List<NameRelationship> getNameRelationships(TaxonNameBase name, NameRelationship.Direction direction,
79 NameRelationshipType type, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints,
80 List<String> propertyPaths);
81
82 /**
83 * Return a count of hybrids related to this name, optionally filtered by
84 * hybrid relationship type
85 *
86 * @param name
87 * the name
88 * @param type
89 * the hybrid relationship type (or null to return all hybrid)
90 * @return a count of HybridRelationship instances
91 */
92 public int countHybridNames(NonViralName name, HybridRelationshipType type);
93
94 /**
95 * Return a List of hybrids related to this name, optionally filtered by
96 * hybrid relationship type
97 *
98 * @param name
99 * the name
100 * @param type
101 * the hybrid relationship type (or null to return all hybrids)
102 * @param pageSize
103 * The maximum number of hybrid relationships returned (can be
104 * null for all relationships)
105 * @param pageNumber
106 * The offset (in pageSize chunks) from the start of the result
107 * set (0 - based)
108 * @return a List of HybridRelationship instances
109 */
110 public List<HybridRelationship> getHybridNames(NonViralName name, HybridRelationshipType type, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);
111
112 /**
113 * Return a count of types related to this name, optionally filtered by type
114 * designation status
115 *
116 * @param name
117 * the name
118 * @param status
119 * the type designation status (or null to return all types)
120 * @return a count of TypeDesignationBase instances
121 */
122 public int countTypeDesignations(TaxonNameBase name,
123 SpecimenTypeDesignationStatus status);
124
125 /**
126 * Return a List of types related to this name, optionally filtered by type
127 * designation status
128 *
129 * @param name
130 * the name
131 * @param type
132 * limit the result set to a specific subtype of TypeDesignationBase, may be null
133 * @param status
134 * the type designation status (or null to return all types)
135 * @param pageSize
136 * The maximum number of types returned (can be null for all
137 * types)
138 * @param pageNumber
139 * The offset (in pageSize chunks) from the start of the result
140 * set (0 - based)
141 * @param propertyPaths
142 * @return a List of TypeDesignationBase instances
143 */
144 public <T extends TypeDesignationBase> List<T> getTypeDesignations(TaxonNameBase name,
145 Class<T> type,
146 TypeDesignationStatusBase status, Integer pageSize, Integer pageNumber,
147 List<String> propertyPaths);
148
149 /**
150 * Return a List of types related to this name, optionally filtered by type
151 * designation status
152 *
153 * @param name
154 * the name
155 * @param status
156 * the type designation status (or null to return all types)
157 * @param pageSize
158 * The maximum number of types returned (can be null for all
159 * types)
160 * @param pageNumber
161 * The offset (in pageSize chunks) from the start of the result
162 * set (0 - based)
163 * @param propertyPaths
164 * @return a List of TypeDesignationBase instances
165 * @deprecated use {@link #getTypeDesignations(TaxonNameBase, Class, TypeDesignationStatusBase, Integer, Integer, List)} instead
166 */
167 @Deprecated
168 public List<TypeDesignationBase> getTypeDesignations(TaxonNameBase name,
169 TypeDesignationStatusBase status, Integer pageSize, Integer pageNumber,
170 List<String> propertyPaths);
171
172 /**
173 * Returns a List 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 * @param pageSize
182 * The maximum number of names returned (can be null for all
183 * names)
184 * @param pageNumber
185 * The offset (in pageSize chunks) from the start of the result
186 * set (0 - based)
187 * @param propertyPaths
188 * @param orderHints
189 * @return a List of TaxonNameBase instances
190 */
191 public List<TaxonNameBase> searchNames(String uninomial,
192 String infraGenericEpithet, String specificEpithet,
193 String infraspecificEpithet, Rank rank, Integer pageSize,
194 Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);
195
196 /**
197 * Returns a count of TaxonNameBase instances that match the properties
198 * passed
199 *
200 * @param uninomial
201 * @param infraGenericEpithet
202 * @param specificEpithet
203 * @param infraspecificEpithet
204 * @param rank
205 * @return a count of TaxonNameBase instances
206 */
207 public int countNames(String uninomial, String infraGenericEpithet,
208 String specificEpithet, String infraspecificEpithet, Rank rank);
209
210 /**
211 * Returns a count of TaxonNameBase instances that match the properties passed
212 *
213 * @param queryString
214 * @param matchMode
215 * @param criteria
216 */
217 public int countNames(String queryString, MatchMode matchMode, List<Criterion> criteria);
218
219 /**
220 * Returns a List of TaxonNameBase instances which nameCache matches the
221 * query string
222 *
223 * @param queryString
224 * @param pageSize
225 * The maximum number of names returned (can be null for all
226 * names)
227 * @param pageNumber
228 * The offset (in pageSize chunks) from the start of the result
229 * set (0 - based)
230 * @return a List of TaxonNameBase instances
231 */
232 public List<TaxonNameBase<?, ?>> searchNames(String queryString,
233 Integer pageSize, Integer pageNumber);
234
235
236
237 /**
238 * Returns a count of TaxonNameBase instances which nameCache matches the
239 * String queryString
240 *
241 * @param queryString
242 * @return a count of TaxonNameBase instances
243 */
244 public int countNames(String queryString);
245
246 /**
247 * @param queryString
248 * @param matchmode
249 * @param pageSize
250 * @param pageNumber
251 * @param criteria
252 * @param propertyPaths TODO
253 * @return
254 */
255 public List<? extends TaxonNameBase<?, ?>> findByName(String queryString,
256 MatchMode matchmode, Integer pageSize, Integer pageNumber,
257 List<Criterion> criteria, List<String> propertyPaths);
258
259 /**
260 * @param queryString
261 * @param matchmode
262 * @param pageSize
263 * @param pageNumber
264 * @param criteria
265 * @param propertyPaths TODO
266 * @return
267 */
268 public List<? extends TaxonNameBase<?, ?>> findByTitle(String queryString,
269 MatchMode matchmode, Integer pageSize, Integer pageNumber,
270 List<Criterion> criteria, List<String> propertyPaths);
271
272 /**
273 * Returns a taxon name corresponding to the given uuid
274 *
275 * @param uuid
276 * The uuid of the taxon name requested
277 * @param criteria
278 * Custom criteria to be added to the default list of applied criteria.
279 * @param propertyPaths
280 *
281 * @return
282 */
283 public TaxonNameBase<?, ?> findByUuid(UUID uuid, List<Criterion> criteria, List<String> propertyPaths);
284
285 /**
286 * @param queryString
287 * @param matchmode
288 * @param criteria
289 * @return
290 */
291 public Integer countByName(String queryString,
292 MatchMode matchmode, List<Criterion> criteria);
293
294 public List<RelationshipBase> getAllRelationships(Integer limit, Integer start);
295
296 public List<UuidAndTitleCache> getUuidAndTitleCacheOfNames();
297
298 /**
299 * @param clazz
300 * @param queryString
301 * @param matchmode
302 * @param pageSize
303 * @param pageNumber
304 * @param criteria
305 * @param orderHints
306 * @param propertyPaths TODO
307 * @return
308 */
309 public List<TaxonNameBase> findByName(Class<? extends TaxonNameBase> clazz, String queryString, MatchMode matchmode, List<Criterion> criteria,Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);
310
311 /**
312 * @param clazz
313 * @param queryString
314 * @param matchmode
315 * @param criteria
316 * @return
317 */
318 public Integer countByName(Class<? extends TaxonNameBase> clazz, String queryString, MatchMode matchmode, List<Criterion> criteria);
319
320 public List<ZoologicalName> getZoologicalNames(Integer limit, Integer start);
321
322 public ZoologicalName findZoologicalNameByUUID(UUID uuid);
323 }