Project

General

Profile

Download (11.5 KB) Statistics
| Branch: | Tag: | Revision:
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.HashMap;
12
import java.util.List;
13
import java.util.UUID;
14

    
15
import org.hibernate.criterion.Criterion;
16

    
17
import eu.etaxonomy.cdm.model.common.RelationshipBase;
18
import eu.etaxonomy.cdm.model.name.HybridRelationship;
19
import eu.etaxonomy.cdm.model.name.HybridRelationshipType;
20
import eu.etaxonomy.cdm.model.name.INonViralName;
21
import eu.etaxonomy.cdm.model.name.IZoologicalName;
22
import eu.etaxonomy.cdm.model.name.NameRelationship;
23
import eu.etaxonomy.cdm.model.name.NameRelationshipType;
24
import eu.etaxonomy.cdm.model.name.Rank;
25
import eu.etaxonomy.cdm.model.name.SpecimenTypeDesignationStatus;
26
import eu.etaxonomy.cdm.model.name.TaxonName;
27
import eu.etaxonomy.cdm.model.name.TypeDesignationBase;
28
import eu.etaxonomy.cdm.model.name.TypeDesignationStatusBase;
29
import eu.etaxonomy.cdm.persistence.dao.common.IIdentifiableDao;
30
import eu.etaxonomy.cdm.persistence.dao.initializer.IBeanInitializer;
31
import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache;
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<TaxonName> {
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(TaxonName 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(TaxonName 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(INonViralName 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(INonViralName 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(TaxonName 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(TaxonName name,
145
			Class<T> type,
146
			TypeDesignationStatusBase status, Integer pageSize, Integer pageNumber,
147
			List<String> propertyPaths);
148

    
149
	/**
150
	 * Return a list ids of specimens that are type specimens for the given name
151
	 * @param name
152
	 * @param status
153
	 * @param pageSize
154
	 * @param pageNumber
155
	 * @return
156
	 */
157
	public List<Integer> getTypeSpecimenIdsForTaxonName(TaxonName name,
158
	        TypeDesignationStatusBase status, Integer pageSize, Integer pageNumber);
159

    
160
	/**
161
	 * Return a List of types related to this name, optionally filtered by type
162
	 * designation status
163
	 *
164
	 * @param name
165
	 *            the name
166
	 * @param status
167
	 *            the type designation status (or null to return all types)
168
	 * @param pageSize
169
	 *            The maximum number of types returned (can be null for all
170
	 *            types)
171
	 * @param pageNumber
172
	 *            The offset (in pageSize chunks) from the start of the result
173
	 *            set (0 - based)
174
	 * @param propertyPaths
175
	 * @return a List of TypeDesignationBase instances
176
	 * @deprecated use {@link #getTypeDesignations(TaxonName, Class, TypeDesignationStatusBase, Integer, Integer, List)} instead
177
	 */
178
	@Deprecated
179
	public List<TypeDesignationBase> getTypeDesignations(TaxonName name,
180
			TypeDesignationStatusBase status, Integer pageSize, Integer pageNumber,
181
			List<String> propertyPaths);
182

    
183
	/**
184
	 * Returns a List of TaxonName instances that match the properties
185
	 * passed
186
	 *
187
	 * @param uninomial
188
	 * @param infraGenericEpithet
189
	 * @param specificEpithet
190
	 * @param infraspecificEpithet
191
	 * @param rank
192
	 * @param pageSize
193
	 *            The maximum number of names returned (can be null for all
194
	 *            names)
195
	 * @param pageNumber
196
	 *            The offset (in pageSize chunks) from the start of the result
197
	 *            set (0 - based)
198
	 * @param propertyPaths
199
	 * @param orderHints
200
	 * @return a List of TaxonName instances
201
	 */
202
	public List<TaxonName> searchNames(String uninomial,
203
			String infraGenericEpithet, String specificEpithet,
204
			String infraspecificEpithet, Rank rank, Integer pageSize,
205
			Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);
206

    
207
	/**
208
	 * Returns a count of TaxonName instances that match the properties
209
	 * passed
210
	 *
211
	 * @param uninomial
212
	 * @param infraGenericEpithet
213
	 * @param specificEpithet
214
	 * @param infraspecificEpithet
215
	 * @param rank
216
	 * @return a count of TaxonName instances
217
	 */
218
	public int countNames(String uninomial, String infraGenericEpithet,
219
			String specificEpithet, String infraspecificEpithet, Rank rank);
220

    
221
	/**
222
	 * Returns a count of TaxonName instances that match the properties passed
223
	 *
224
	 * @param queryString
225
	 * @param matchMode
226
	 * @param criteria
227
	 */
228
	public int countNames(String queryString, MatchMode matchMode, List<Criterion> criteria);
229

    
230
	/**
231
	 * Returns a List of TaxonName instances which nameCache matches the
232
	 * query string
233
	 *
234
	 * @param queryString
235
	 * @param pageSize
236
	 *            The maximum number of names returned (can be null for all
237
	 *            names)
238
	 * @param pageNumber
239
	 *            The offset (in pageSize chunks) from the start of the result
240
	 *            set (0 - based)
241
	 * @return a List of TaxonName instances
242
	 */
243
	public List<TaxonName> searchNames(String queryString,
244
			Integer pageSize, Integer pageNumber);
245

    
246

    
247

    
248
	/**
249
	 * Returns a count of TaxonName instances which nameCache matches the
250
	 * String queryString
251
	 *
252
	 * @param queryString
253
	 * @return a count of TaxonName instances
254
	 */
255
	public int countNames(String queryString);
256

    
257
	/**
258
	 * @param queryString
259
	 * @param matchmode
260
	 * @param pageSize
261
	 * @param pageNumber
262
	 * @param criteria
263
	 * @param propertyPaths TODO
264
	 * @return
265
	 */
266
	public List<? extends TaxonName> findByName(boolean doIncludeAuthors,
267
	        String queryString,
268
			MatchMode matchmode, Integer pageSize, Integer pageNumber,
269
			List<Criterion> criteria, List<String> propertyPaths);
270

    
271
	/**
272
	 * @param queryString
273
	 * @param matchmode
274
	 * @param pageSize
275
	 * @param pageNumber
276
	 * @param criteria
277
	 * @param propertyPaths TODO
278
	 * @return
279
	 */
280
	public List<? extends TaxonName> findByTitle(String queryString,
281
			MatchMode matchmode, Integer pageSize, Integer pageNumber,
282
			List<Criterion> criteria, List<String> propertyPaths);
283

    
284
	/**
285
	 * Returns a taxon name corresponding to the given uuid
286
	 *
287
	 * @param uuid
288
	 * 			The uuid of the taxon name requested
289
	 * @param criteria
290
	 * 			Custom criteria to be added to the default list of applied criteria.
291
	 * @param propertyPaths
292
	 *
293
	 * @return
294
	 */
295
	public TaxonName findByUuid(UUID uuid, List<Criterion> criteria, List<String> propertyPaths);
296

    
297
	/**
298
	 * @param queryString
299
	 * @param matchmode
300
	 * @param criteria
301
	 * @return
302
	 */
303
	public Integer countByName(String queryString,
304
			MatchMode matchmode, List<Criterion> criteria);
305

    
306
	public List<RelationshipBase> getAllRelationships(Integer limit, Integer start);
307

    
308
	public List<UuidAndTitleCache> getUuidAndTitleCacheOfNames(Integer limit, String pattern);
309

    
310
	/**
311
	 * @param clazz
312
	 * @param queryString
313
	 * @param matchmode
314
	 * @param pageSize
315
	 * @param pageNumber
316
	 * @param criteria
317
	 * @param orderHints
318
	 * @param propertyPaths TODO
319
	 * @return
320
	 */
321
	public List<TaxonName> findByName(Class<? extends TaxonName> clazz,	String queryString, MatchMode matchmode, List<Criterion> criteria,Integer pageSize, Integer pageNumber, List<OrderHint> orderHints,	List<String> propertyPaths);
322

    
323
	/**
324
	 * @param clazz
325
	 * @param queryString
326
	 * @param matchmode
327
	 * @param criteria
328
	 * @return
329
	 */
330
	public long countByName(Class<? extends TaxonName> clazz, String queryString, MatchMode matchmode, List<Criterion> criteria);
331

    
332
	public IZoologicalName findZoologicalNameByUUID(UUID uuid);
333

    
334
	List<HashMap<String, String>> getNameRecords();
335
}
(4-4/5)