Project

General

Profile

Download (11.3 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.TaxonNameBase;
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<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(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(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(boolean doIncludeAuthors,
256
	        String queryString,
257
			MatchMode matchmode, Integer pageSize, Integer pageNumber,
258
			List<Criterion> criteria, List<String> propertyPaths);
259

    
260
	/**
261
	 * @param queryString
262
	 * @param matchmode
263
	 * @param pageSize
264
	 * @param pageNumber
265
	 * @param criteria
266
	 * @param propertyPaths TODO
267
	 * @return
268
	 */
269
	public List<? extends TaxonNameBase<?, ?>> findByTitle(String queryString,
270
			MatchMode matchmode, Integer pageSize, Integer pageNumber,
271
			List<Criterion> criteria, List<String> propertyPaths);
272

    
273
	/**
274
	 * Returns a taxon name corresponding to the given uuid
275
	 *
276
	 * @param uuid
277
	 * 			The uuid of the taxon name requested
278
	 * @param criteria
279
	 * 			Custom criteria to be added to the default list of applied criteria.
280
	 * @param propertyPaths
281
	 *
282
	 * @return
283
	 */
284
	public TaxonNameBase<?, ?> findByUuid(UUID uuid, List<Criterion> criteria, List<String> propertyPaths);
285

    
286
	/**
287
	 * @param queryString
288
	 * @param matchmode
289
	 * @param criteria
290
	 * @return
291
	 */
292
	public Integer countByName(String queryString,
293
			MatchMode matchmode, List<Criterion> criteria);
294

    
295
	public List<RelationshipBase> getAllRelationships(Integer limit, Integer start);
296

    
297
	public List<UuidAndTitleCache> getUuidAndTitleCacheOfNames(Integer limit, String pattern);
298

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

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

    
321
	public IZoologicalName findZoologicalNameByUUID(UUID uuid);
322

    
323
	List<HashMap<String, String>> getNameRecords();
324
}
(3-3/4)