Project

General

Profile

Download (11.2 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.List;
12
import java.util.UUID;
13

    
14
import org.hibernate.criterion.Criterion;
15

    
16
import eu.etaxonomy.cdm.model.common.RelationshipBase;
17
import eu.etaxonomy.cdm.model.common.UuidAndTitleCache;
18
import eu.etaxonomy.cdm.model.name.HybridRelationship;
19
import eu.etaxonomy.cdm.model.name.HybridRelationshipType;
20
import eu.etaxonomy.cdm.model.name.NameRelationship;
21
import eu.etaxonomy.cdm.model.name.NameRelationshipType;
22
import eu.etaxonomy.cdm.model.name.NonViralName;
23
import eu.etaxonomy.cdm.model.name.Rank;
24
import eu.etaxonomy.cdm.model.name.SpecimenTypeDesignationStatus;
25
import eu.etaxonomy.cdm.model.name.TaxonNameBase;
26
import eu.etaxonomy.cdm.model.name.TypeDesignationBase;
27
import eu.etaxonomy.cdm.model.name.TypeDesignationStatusBase;
28
import eu.etaxonomy.cdm.model.name.ZoologicalName;
29
import eu.etaxonomy.cdm.persistence.dao.common.IIdentifiableDao;
30
import eu.etaxonomy.cdm.persistence.dao.initializer.IBeanInitializer;
31
import eu.etaxonomy.cdm.persistence.query.MatchMode;
32
import eu.etaxonomy.cdm.persistence.query.OrderHint;
33

    
34
/**
35
 * @author a.mueller
36
 * 
37
 */
38
public interface ITaxonNameDao extends IIdentifiableDao<TaxonNameBase> {
39

    
40
	/**
41
	 * Return a count of names related to or from this name, optionally filtered
42
	 * by relationship type. The direction of the relationships taken in to account is depending on
43
	 * the <code>direction</code> parameter.
44
	 * 
45
	 * @param name
46
	 *            the name
47
	 * @param direction
48
	 *            specifies the direction of the relationship
49
	 * @param type
50
	 *            the relationship type (or null to return all relationships)
51
	 * @return a count of NameRelationship instances
52
	 */
53
	public int countNameRelationships(TaxonNameBase name, NameRelationship.Direction direction, NameRelationshipType type);
54

    
55
	/**
56
	 * Return a List of relationships related to or from this name, optionally filtered
57
	 * by relationship type. The direction of the relationships taken in to account is depending on
58
	 * the <code>direction</code> parameter.
59
	 * If both name and direction is null all name relationships will be returned.
60
	 * 
61
	 * @param name
62
	 *            the name
63
	 * @param direction
64
	 *            specifies the direction of the relationship, may be null to return all relationships
65
	 * @param type
66
	 *            the relationship type (or null to return all relationships)
67
	 * @param pageSize
68
	 *            The maximum number of relationships returned (can be null for
69
	 *            all relationships)
70
	 * @param pageNumber
71
	 *            The offset (in pageSize chunks) from the start of the result
72
	 *            set (0 - based) of the result set (0 - based)
73
	 * @param orderHints may be null
74
	 * @param propertyPaths properties to initialize - see {@link IBeanInitializer#initialize(Object, List)}
75
	 * @return a List of NameRelationship instances
76
	 */
77
	public List<NameRelationship> getNameRelationships(TaxonNameBase name, NameRelationship.Direction direction,
78
			NameRelationshipType type, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints,
79
			List<String> propertyPaths);
80
	
81
	/**
82
	 * Return a count of hybrids related to this name, optionally filtered by
83
	 * hybrid relationship type
84
	 * 
85
	 * @param name
86
	 *            the name
87
	 * @param type
88
	 *            the hybrid relationship type (or null to return all hybrid)
89
	 * @return a count of HybridRelationship instances
90
	 */
91
	public int countHybridNames(NonViralName name, HybridRelationshipType type);
92

    
93
	/**
94
	 * Return a List of hybrids related to this name, optionally filtered by
95
	 * hybrid relationship type
96
	 * 
97
	 * @param name
98
	 *            the name
99
	 * @param type
100
	 *            the hybrid relationship type (or null to return all hybrids)
101
	 * @param pageSize
102
	 *            The maximum number of hybrid relationships returned (can be
103
	 *            null for all relationships)
104
	 * @param pageNumber
105
	 *            The offset (in pageSize chunks) from the start of the result
106
	 *            set (0 - based)
107
	 * @return a List of HybridRelationship instances
108
	 */
109
	public List<HybridRelationship> getHybridNames(NonViralName name, HybridRelationshipType type, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);
110

    
111
	/**
112
	 * Return a count of types related to this name, optionally filtered by type
113
	 * designation status
114
	 * 
115
	 * @param name
116
	 *            the name
117
	 * @param status
118
	 *            the type designation status (or null to return all types)
119
	 * @return a count of TypeDesignationBase instances
120
	 */
121
	public int countTypeDesignations(TaxonNameBase name,
122
			SpecimenTypeDesignationStatus status);
123

    
124
	/**
125
	 * Return a List of types related to this name, optionally filtered by type
126
	 * designation status
127
	 * 
128
	 * @param name
129
	 *            the name
130
	 * @param type
131
	 * 			  limit the result set to a specific subtype of TypeDesignationBase, may be null
132
	 * @param status
133
	 *            the type designation status (or null to return all types)
134
	 * @param pageSize
135
	 *            The maximum number of types returned (can be null for all
136
	 *            types)
137
	 * @param pageNumber
138
	 *            The offset (in pageSize chunks) from the start of the result
139
	 *            set (0 - based)
140
	 * @param propertyPaths
141
	 * @return a List of TypeDesignationBase instances
142
	 */
143
	public <T extends TypeDesignationBase> List<T> getTypeDesignations(TaxonNameBase name, 
144
			Class<T> type,
145
			TypeDesignationStatusBase status, Integer pageSize, Integer pageNumber,
146
			List<String> propertyPaths);
147
	
148
	/**
149
	 * Return a List of types related to this name, optionally filtered by type
150
	 * designation status
151
	 * 
152
	 * @param name
153
	 *            the name
154
	 * @param status
155
	 *            the type designation status (or null to return all types)
156
	 * @param pageSize
157
	 *            The maximum number of types returned (can be null for all
158
	 *            types)
159
	 * @param pageNumber
160
	 *            The offset (in pageSize chunks) from the start of the result
161
	 *            set (0 - based)
162
	 * @param propertyPaths
163
	 * @return a List of TypeDesignationBase instances
164
	 * @deprecated use {@link #getTypeDesignations(TaxonNameBase, Class, TypeDesignationStatusBase, Integer, Integer, List)} instead
165
	 */
166
	@Deprecated
167
	public List<TypeDesignationBase> getTypeDesignations(TaxonNameBase name,
168
			TypeDesignationStatusBase status, Integer pageSize, Integer pageNumber,
169
			List<String> propertyPaths);
170

    
171
	/**
172
	 * Returns a List of TaxonNameBase instances that match the properties
173
	 * passed
174
	 * 
175
	 * @param uninomial
176
	 * @param infraGenericEpithet
177
	 * @param specificEpithet
178
	 * @param infraspecificEpithet
179
	 * @param rank
180
	 * @param pageSize
181
	 *            The maximum number of names returned (can be null for all
182
	 *            names)
183
	 * @param pageNumber
184
	 *            The offset (in pageSize chunks) from the start of the result
185
	 *            set (0 - based)
186
	 * @param propertyPaths 
187
	 * @param orderHints 
188
	 * @return a List of TaxonNameBase instances
189
	 */
190
	public List<TaxonNameBase> searchNames(String uninomial,
191
			String infraGenericEpithet, String specificEpithet,
192
			String infraspecificEpithet, Rank rank, Integer pageSize,
193
			Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);
194

    
195
	/**
196
	 * Returns a count of TaxonNameBase instances that match the properties
197
	 * passed
198
	 * 
199
	 * @param uninomial
200
	 * @param infraGenericEpithet
201
	 * @param specificEpithet
202
	 * @param infraspecificEpithet
203
	 * @param rank
204
	 * @return a count of TaxonNameBase instances
205
	 */
206
	public int countNames(String uninomial, String infraGenericEpithet,
207
			String specificEpithet, String infraspecificEpithet, Rank rank);
208

    
209
	/**
210
	 * Returns a count of TaxonNameBase instances that match the properties passed
211
	 * 
212
	 * @param queryString
213
	 * @param matchMode
214
	 * @param criteria
215
	 */
216
	public int countNames(String queryString, MatchMode matchMode, List<Criterion> criteria);
217

    
218
	/**
219
	 * Returns a List of TaxonNameBase instances which nameCache matches the
220
	 * query string
221
	 * 
222
	 * @param queryString
223
	 * @param pageSize
224
	 *            The maximum number of names returned (can be null for all
225
	 *            names)
226
	 * @param pageNumber
227
	 *            The offset (in pageSize chunks) from the start of the result
228
	 *            set (0 - based)
229
	 * @return a List of TaxonNameBase instances
230
	 */
231
	public List<TaxonNameBase<?, ?>> searchNames(String queryString,
232
			Integer pageSize, Integer pageNumber);
233
	
234
	
235

    
236
	/**
237
	 * Returns a count of TaxonNameBase instances which nameCache matches the
238
	 * String queryString
239
	 * 
240
	 * @param queryString
241
	 * @return a count of TaxonNameBase instances
242
	 */
243
	public int countNames(String queryString);
244

    
245
	/**
246
	 * @param queryString
247
	 * @param matchmode
248
	 * @param pageSize
249
	 * @param pageNumber
250
	 * @param criteria
251
	 * @param propertyPaths TODO
252
	 * @return
253
	 */
254
	public List<? extends TaxonNameBase<?, ?>> findByName(String queryString,
255
			MatchMode matchmode, Integer pageSize, Integer pageNumber,
256
			List<Criterion> criteria, List<String> propertyPaths);
257
	
258
	/**
259
	 * @param queryString
260
	 * @param matchmode
261
	 * @param pageSize
262
	 * @param pageNumber
263
	 * @param criteria
264
	 * @param propertyPaths TODO
265
	 * @return
266
	 */
267
	public List<? extends TaxonNameBase<?, ?>> findByTitle(String queryString,
268
			MatchMode matchmode, Integer pageSize, Integer pageNumber,
269
			List<Criterion> criteria, List<String> propertyPaths);
270
	
271
	/**
272
	 * Returns a taxon name corresponding to the given uuid
273
	 * 
274
	 * @param uuid 
275
	 * 			The uuid of the taxon name requested
276
	 * @param criteria
277
	 * 			Custom criteria to be added to the default list of applied criteria.
278
	 * @param propertyPaths 
279
	 * 			
280
	 * @return 
281
	 */
282
	public TaxonNameBase<?, ?> findByUuid(UUID uuid, List<Criterion> criteria, List<String> propertyPaths);
283
	
284
	/**
285
	 * @param queryString
286
	 * @param matchmode
287
	 * @param criteria
288
	 * @return
289
	 */
290
	public Integer countByName(String queryString, 
291
			MatchMode matchmode, List<Criterion> criteria);
292
	
293
	public List<RelationshipBase> getAllRelationships(Integer limit, Integer start); 
294
	
295
	public List<UuidAndTitleCache> getUuidAndTitleCacheOfNames();
296

    
297
	/**
298
	 * @param clazz
299
	 * @param queryString
300
	 * @param matchmode
301
	 * @param pageSize
302
	 * @param pageNumber
303
	 * @param criteria
304
	 * @param orderHints
305
	 * @param propertyPaths TODO
306
	 * @return
307
	 */
308
	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);
309

    
310
	/**
311
	 * @param clazz
312
	 * @param queryString
313
	 * @param matchmode
314
	 * @param criteria
315
	 * @return
316
	 */
317
	public Integer countByName(Class<? extends TaxonNameBase> clazz, String queryString, MatchMode matchmode, List<Criterion> criteria);
318

    
319
	public ZoologicalName findZoologicalNameByUUID(UUID uuid);
320
}
(3-3/4)