Project

General

Profile

Download (29.1 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

    
10
package eu.etaxonomy.cdm.api.service;
11

    
12
import java.io.IOException;
13
import java.util.Collection;
14
import java.util.HashMap;
15
import java.util.List;
16
import java.util.Map;
17
import java.util.Optional;
18
import java.util.Set;
19
import java.util.UUID;
20

    
21
import org.hibernate.criterion.Criterion;
22

    
23
import eu.etaxonomy.cdm.api.service.config.NameDeletionConfigurator;
24
import eu.etaxonomy.cdm.api.service.dto.TypeDesignationStatusFilter;
25
import eu.etaxonomy.cdm.api.service.pager.Pager;
26
import eu.etaxonomy.cdm.api.service.search.DocumentSearchResult;
27
import eu.etaxonomy.cdm.api.service.search.LuceneParseException;
28
import eu.etaxonomy.cdm.api.service.search.SearchResult;
29
import eu.etaxonomy.cdm.api.utility.TaxonNamePartsFilter;
30
import eu.etaxonomy.cdm.model.common.Language;
31
import eu.etaxonomy.cdm.model.name.HomotypicalGroup;
32
import eu.etaxonomy.cdm.model.name.HybridRelationship;
33
import eu.etaxonomy.cdm.model.name.HybridRelationshipType;
34
import eu.etaxonomy.cdm.model.name.INonViralName;
35
import eu.etaxonomy.cdm.model.name.NameRelationship;
36
import eu.etaxonomy.cdm.model.name.NameRelationshipType;
37
import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
38
import eu.etaxonomy.cdm.model.name.NomenclaturalStatus;
39
import eu.etaxonomy.cdm.model.name.Rank;
40
import eu.etaxonomy.cdm.model.name.SpecimenTypeDesignation;
41
import eu.etaxonomy.cdm.model.name.SpecimenTypeDesignationStatus;
42
import eu.etaxonomy.cdm.model.name.TaxonName;
43
import eu.etaxonomy.cdm.model.name.TypeDesignationBase;
44
import eu.etaxonomy.cdm.model.name.TypeDesignationStatusBase;
45
import eu.etaxonomy.cdm.model.occurrence.FieldUnit;
46
import eu.etaxonomy.cdm.persistence.dao.common.Restriction;
47
import eu.etaxonomy.cdm.persistence.dao.initializer.IBeanInitializer;
48
import eu.etaxonomy.cdm.persistence.dto.TaxonNameParts;
49
import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache;
50
import eu.etaxonomy.cdm.persistence.query.MatchMode;
51
import eu.etaxonomy.cdm.persistence.query.OrderHint;
52
import eu.etaxonomy.cdm.strategy.cache.TaggedText;
53
import eu.etaxonomy.cdm.strategy.parser.NonViralNameParserImpl;
54

    
55
public interface INameService
56
        extends IIdentifiableEntityService<TaxonName> {
57

    
58
	/**
59
	 * Deletes a name. Depending on the configurator state links to the name will either be
60
	 * deleted or throw exceptions.<BR>
61
	 * If name is <code>null</code> this method has no effect.
62
	 * @param name
63
	 * @param config
64
	 *
65
	 */
66
	public DeleteResult delete(UUID nameUUID, NameDeletionConfigurator config);
67

    
68
	/**
69
	 * Creates specimen duplicate based on the given type specimen which will be assigned as a type
70
	 * of the given name.<br>
71
	 * The specimen will only differ in accession number, collection and type status and will be attached
72
	 * to the same {@link FieldUnit}
73
	 * @param name the name where this type designation will be added to
74
	 * @param baseDesignation the type specimen of this designation is cloned to create the new specimen
75
 	 * @param accessionNumber the accession number of the cloned specimen
76
 	 * @param barcode the barcode of the cloned specimen
77
 	 * @param catalogNumber the catalog number of the cloned specimen
78
	 * @param collectionUuid the collection the cloned specimen belongs to
79
	 * @param typeStatus the type status of the cloned specimen
80
	 * @return an {@link UpdateResult}
81
	 */
82
    public UpdateResult cloneTypeDesignation(UUID nameUuid, SpecimenTypeDesignation baseDesignation,
83
            String accessionNumber, String barcode, String catalogNumber,
84
            UUID collectionUuid, SpecimenTypeDesignationStatus typeStatus);
85

    
86
	/**
87
	 * Removes the given type designation from the given taxon name and deletes it from
88
	 * the database if it is not connected to any other name.
89
	 * If <code>typeDesignation</code> is <code>null</code> all type designations are deleted
90
	 * from the given taxon name. If <code>name</code> is <code>null</code> all names are removed from
91
	 * the given type designation. If both are <code>null</code> nothing happens.
92
	 * @param typeDesignation
93
	 * @param name
94
	 * @return
95
	 */
96
	public DeleteResult deleteTypeDesignation(TaxonName name, TypeDesignationBase<?> typeDesignation);
97

    
98
	/**
99
	 * Removes the given type designation from the given taxon name and deletes it from
100
	 * the database if it is not connected to any other name.
101
	 * If <code>typeDesignation</code> is <code>null</code> all type designations are deleted
102
	 * from the given taxon name. If <code>name</code> is <code>null</code> all names are removed from
103
	 * the given type designation. If both are <code>null</code> nothing happens.
104
	 * @param typeDesignation
105
	 * @param name
106
	 * @return
107
	 */
108
	public DeleteResult deleteTypeDesignation(UUID nameUuid, UUID typeDesignationUuid);
109

    
110

    
111
	/**
112
	 * Saves the given type designations.
113
	 * @param typeDesignationCollection
114
	 * @return
115
	 */
116
	public Map<UUID, TypeDesignationBase<?>> saveTypeDesignationAll(Collection<TypeDesignationBase<?>> typeDesignationCollection);
117

    
118
	/**
119
	 * Saves the given homotypical groups.
120
	 * @param homotypicalGroups
121
	 * @return
122
	 */
123
	public Map<UUID, HomotypicalGroup> saveAllHomotypicalGroups(Collection<HomotypicalGroup> homotypicalGroups);
124

    
125
	/**
126
	 * Returns all nomenclatural status.
127
	 * @param limit
128
	 * @param start
129
	 * @return
130
	 */
131
	public List<NomenclaturalStatus> getAllNomenclaturalStatus(int limit, int start);
132

    
133
	/**
134
	 * Returns all type designations.
135
	 * @param limit
136
	 * @param start
137
	 * @return
138
	 */
139
	public List<TypeDesignationBase<?>> getAllTypeDesignations(int limit, int start);
140

    
141
    public TypeDesignationBase<?> loadTypeDesignation(int id, List<String> propertyPaths);
142

    
143
    public TypeDesignationBase<?> loadTypeDesignation(UUID uuid, List<String> propertyPaths);
144

    
145
    public List<TypeDesignationBase<?>> loadTypeDesignations(List<UUID> uuids, List<String> propertyPaths);
146

    
147
	/**
148
	 * Returns all NonViralNames with a name cache that matches the given string
149
	 * @param name
150
	 * @return
151
	 */
152
	public List<TaxonName> getNamesByNameCache(String nameCache);
153

    
154
	/**
155
	 * Returns all NonViralNames with a title cache that matches the given string
156
	 * using the given match mode and initialization strategy
157
	 *
158
	 * @param name
159
	 * @param matchMode must not be <code>NULL</code>
160
	 * @param propertyPaths
161
	 * @return
162
	 */
163
	public List<TaxonName> findNamesByTitleCache(String titleCache, MatchMode matchMode, List<String> propertyPaths);
164

    
165
	/**
166
     * Supports using wildcards in the query parameters.
167
     * If a name part passed to the method contains the asterisk character ('*') it will be translated into '%' the related field is search with a LIKE clause.
168
     * <p>
169
     * A query parameter which is passed as <code>NULL</code> value will be ignored. A parameter passed as {@link Optional} object containing a <code>NULL</code> value will be used
170
     * to filter select taxon names where the according field is <code>null</code>.
171
     *
172
     * @param filter
173
     * @param infraGenericEpithet
174
     * @param specificEpithet
175
     * @param infraSpecificEpithet
176
     * @param rank
177
     *     Only names having the specified rank are taken into account.
178
     * @param excludedNamesUuids
179
     *     Names to be excluded from the result set
180
     * @return
181
     */
182
	public Pager<TaxonNameParts> findTaxonNameParts(Optional<String> genusOrUninomial,
183
            Optional<String> infraGenericEpithet, Optional<String> specificEpithet,
184
            Optional<String> infraSpecificEpithet, Rank rank, Set<UUID> excludedNamesUuids,
185
            Integer pageSize, Integer pageIndex, List<OrderHint> orderHints);
186

    
187
	/**
188
     * <b>This method behaves differently compared to {@link #findTaxonNameParts(Optional, Optional, Optional, Optional, Rank, Integer, Integer, List)}!</b>
189
     * <p>
190
     * The {@link TaxonNamePartsFilter} defines the rank and fixed name parts for the search process.
191
     * For example: In case the <code>rank</code> is "genus", the <code>genusOrUninomial</code> will be used as search parameter which needs to match exactly.
192
     * The <code>namePartQueryString</code> will be used to do a wildcard search on the specificEpithet.
193
     * <p>
194
     * For name part lookup purposes the <code>TaxonNameParts</code> in the result list can be asked to return the relavant name part by
195
     * calling {@link TaxonNameParts#nameRankSpecificNamePart(TaxonName)}
196
     *
197
     *
198
     * @param filter
199
     * @return
200
     */
201
	public Pager<TaxonNameParts> findTaxonNameParts(TaxonNamePartsFilter filter, String namePartQueryString, Integer pageSize, Integer pageIndex, List<OrderHint> orderHints);
202

    
203
	/**
204
	 * Returns all NonViralNames with a name cache that matches the given string
205
	 * using the given match mode and initialization strategy
206
	 *
207
	 * @param name
208
	 * @param matchMode
209
	 * @param propertyPaths
210
	 * @return
211
	 */
212
	public List<TaxonName> findNamesByNameCache(String nameCache, MatchMode matchMode, List<String> propertyPaths);
213

    
214
	/**
215
	 * Fuzzy matching for the taxon name elements. The input name is first atomised using the {@link NonViralNameParserImpl}
216
	 * into its separate parts (genusOrUninomial,infraGenericEpithet,specificEpithet,infraGenericEpithet,authorshipCache).
217
	 * Each field is then matched separately with the same accuracy parameter.
218
	 *
219
	 * @param name taxon name to fuzzy match
220
	 * @param accuracy value > 0.0 and < 1.0 which determines the accuracy of the result.
221
	 * @param languages list of languages to consider when matching (currently not used)
222
	 * @param highlightFragments
223
	 * @param propertyPaths
224
	 * @param maxNoOfResults
225
	 * @return
226
	 * @throws IOException
227
	 * @throws LuceneParseException
228
	 */
229
	public List<SearchResult<TaxonName>> findByNameFuzzySearch(
230
            String name,
231
            float accuracy,
232
            List<Language> languages,
233
            boolean highlightFragments,
234
            List<String> propertyPaths,
235
            int maxNoOfResults) throws IOException, LuceneParseException;
236

    
237
	/**
238
	 * Fuzzy matching for the taxon name elements using only the lucene index.
239
	 *
240
	 * The input name is first atomised using the {@link NonViralNameParserImpl}
241
	 * into its separate parts (genusOrUninomial,infraGenericEpithet,specificEpithet,infraGenericEpithet,authorshipCache).
242
	 * Each field is then matched separately with the same accuracy parameter.
243
	 *
244
	 * @param name taxon name to fuzzy match
245
	 * @param accuracy value > 0.0 and < 1.0 which determines the accuracy of the result.
246
	 * @param languages list of languages to consider when matching (currently not used)
247
	 * @param highlightFragments
248
	 * @param maxNoOfResults
249
	 * @return
250
	 * @throws IOException
251
	 * @throws LuceneParseException
252
	 */
253
    public List<DocumentSearchResult> findByNameFuzzySearch(
254
            String name,
255
            float accuracy,
256
            List<Language> languages,
257
            boolean highlightFragments,
258
            int maxNoOfResults) throws IOException, LuceneParseException;
259

    
260
	/**
261
	 * Fuzzy matching against the name cache using only the lucene index.
262
	 *
263
	 *
264
	 * @param name taxon name to fuzzy match
265
	 * @param accuracy value > 0.0 and < 1.0 which determines the accuracy of the result.
266
	 * @param languages list of languages to consider when matching (currently not used)
267
	 * @param highlightFragments
268
	 * @param maxNoOfResults
269
	 * @return
270
	 * @throws IOException
271
	 * @throws LuceneParseException
272
	 */
273
    public List<DocumentSearchResult> findByFuzzyNameCacheSearch(
274
            String name,
275
            float accuracy,
276
            List<Language> languages,
277
            boolean highlightFragments,
278
            int maxNoOfResults) throws IOException, LuceneParseException;
279

    
280
	/**
281
	 * Exact matching for the taxon name elements using only the lucene index.
282
	 *
283
	 * The input name is first atomised using the {@link NonViralNameParserImpl}
284
	 * into its separate parts (genusOrUninomial,infraGenericEpithet,specificEpithet,infraGenericEpithet,authorshipCache).
285
	 * Each field is then matched separately with the same accuracy parameter.
286
	 *
287
	 * @param name taxon name to fuzzy match
288
	 * @param wildcard boolean flag to indicate whether a wildcard '*' should be added at the end of the query
289
	 * @param languages list of languages to consider when matching (currently not used)
290
	 * @param highlightFragments
291
	 * @param maxNoOfResults
292
	 * @return
293
	 * @throws IOException
294
	 * @throws LuceneParseException
295
	 */
296

    
297
    public List<DocumentSearchResult> findByNameExactSearch(
298
            String name,
299
            boolean wildcard,
300
            List<Language> languages,
301
            boolean highlightFragments,
302
            int maxNoOfResults) throws IOException, LuceneParseException;
303

    
304
	// TODO: Remove getNamesByName() methods. Use findNamesByTitle() instead.
305

    
306
    public List<HomotypicalGroup> getAllHomotypicalGroups(int limit, int start);
307

    
308
	/**
309
     * Returns all or a page of all taxon name relationships in the database.
310
     * The result can be filtered by relationship types.
311
     * It does NOT contain hybrid relationships
312
     * (see {@link #listHybridRelationships(Set, Integer, Integer, List, List)})
313
     *
314
     * @param types The name relationship type filter, if <code>null</code> no filter is set, if empty the result will also be empty
315
     * @param pageSize the page size
316
     * @param pageStart the number of the page
317
     * @param orderHints the order hints
318
     * @param propertyPaths the property path to initialize the resulting objects
319
     * @return list of name relationships matching the filter criteria
320
     */
321
    public List<NameRelationship> listNameRelationships(Set<NameRelationshipType> types,
322
            Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);
323

    
324
    /**
325
     * Returns all or a page of all hybrid relationships in the database.
326
     * The result can be filtered by relationship types.
327
     * It does NOT contain ordinary name relationships
328
     * (see {@link #listNameRelationships(Set, Integer, Integer, List, List)})
329
     *
330
     * @param types The hybrid relationship type filter, if <code>null</code> no filter is set, if empty the result will also be empty
331
     * @param pageSize the page size
332
     * @param pageStart the number of the page
333
     * @param orderHints the order hints
334
     * @param propertyPaths the property path to initialize the resulting objects
335
     * @return list of hybrid relationships matching the filter criteria
336
     */
337
    public List<HybridRelationship> listHybridRelationships(Set<HybridRelationshipType> types,
338
            Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);
339

    
340
	/**
341
	 * Return a List of name relationships in which this name is related to
342
	 * another name, optionally filtered by relationship type
343
	 *
344
	 * @param name
345
	 *            the name on either the <i>"from side"</i> or on the
346
	 *            <i>"to side"</i> of the relationship, depending on the
347
	 *            <code>direction</code> of the relationship.
348
	 * @param direction
349
	 *            the direction of the NameRelationship, may be null to return all relationships
350
	 * @param type
351
	 *            the relationship type (or null to return all relationships)
352
	 * @param pageSize
353
	 *            The maximum number of relationships returned (can be null for
354
	 *            all relationships)
355
	 * @param pageNumber
356
	 *            The offset (in pageSize chunks) from the start of the result
357
	 *            set (0 - based)
358
	 * @param orderHints
359
	 *            may be null
360
	 * @param propertyPaths
361
	 *            properties to initialize - see
362
	 *            {@link IBeanInitializer#initialize(Object, List)}
363
	 * @return a Pager of NameRelationship instances
364
	 */
365
	public List<NameRelationship> listNameRelationships(TaxonName name,  NameRelationship.Direction direction, NameRelationshipType type, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);
366

    
367
	/**
368
	 * Return a List of name relationships in which this name is related to another name, optionally filtered
369
	 * by relationship type
370
	 *
371
	 * @param name the name on the <i>"from side"</i> of the relationship
372
	 * @param direction the direction of the NameRelationship
373
	 * @param type the relationship type (or null to return all relationships)
374
	 * @param pageSize The maximum number of relationships returned (can be null for all relationships)
375
	 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
376
	 * @param orderHints may be null
377
	 * @param propertyPaths properties to initialize - see {@link IBeanInitializer#initialize(Object, List)}
378
	 * @return a Pager of NameRelationship instances
379
	 */
380
	public Pager<NameRelationship> pageNameRelationships(TaxonName name,  NameRelationship.Direction direction, NameRelationshipType type, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);
381

    
382
	/**
383
	 * Return a List of relationships in which this name is related to another name, optionally filtered
384
	 * by relationship type
385
	 *
386
	 * @param name the name on the <i>"from side"</i> of the relationship
387
	 * @param type the relationship type (or null to return all relationships)
388
	 * @param pageSize The maximum number of relationships returned (can be null for all relationships)
389
	 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
390
	 * @param orderHints may be null
391
	 * @param propertyPaths properties to initialize - see {@link IBeanInitializer#initialize(Object, List)}
392
	 * @return a Pager of NameRelationship instances
393
	 * @deprecated use {@link #listNameRelationships(TaxonName, eu.etaxonomy.cdm.model.common.RelationshipBase.Direction, NameRelationshipType, Integer, Integer, List, List)} instead
394
	 */
395
	@Deprecated
396
	public List<NameRelationship> listFromNameRelationships(TaxonName name,  NameRelationshipType type, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);
397

    
398
	/**
399
	 * Return a List of relationships in which this name is related to another name, optionally filtered
400
	 * by relationship type
401
	 *
402
	 * @param name the name on the <i>"from side"</i> of the relationship
403
	 * @param type the relationship type (or null to return all relationships)
404
	 * @param pageSize The maximum number of relationships returned (can be null for all relationships)
405
	 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
406
	 * @param orderHints may be null
407
	 * @param propertyPaths properties to initialize - see {@link IBeanInitializer#initialize(Object, List)}
408
	 * @return a Pager of NameRelationship instances
409
	 * @deprecated use {@link #pageNameRelationships(TaxonName, eu.etaxonomy.cdm.model.common.RelationshipBase.Direction, NameRelationshipType, Integer, Integer, List, List)} instead
410
	 */
411
	@Deprecated
412
	public Pager<NameRelationship> pageFromNameRelationships(TaxonName name,  NameRelationshipType type, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);
413

    
414
	/**
415
	 * Return a List of relationships in which another name is related to this name, optionally filtered
416
	 * by relationship type
417
	 *
418
	 * @param name the name on the <i>"to side"</i> of the relationship
419
	 * @param type the relationship type (or null to return all relationships)
420
	 * @param pageSize The maximum number of relationships returned (can be null for all relationships)
421
	 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
422
	 * @param orderHints may be null
423
	 * @param propertyPaths properties to initialize - see {@link IBeanInitializer#initialize(Object, List)}
424
	 * @return a Pager of NameRelationship instances
425
	 * @deprecated use {@link #listNameRelationships(TaxonName, eu.etaxonomy.cdm.model.common.RelationshipBase.Direction, NameRelationshipType, Integer, Integer, List, List)} instead
426
	 */
427
	@Deprecated
428
	public List<NameRelationship> listToNameRelationships(TaxonName name,  NameRelationshipType type, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);
429

    
430
	/**
431
	 * Return a List of relationships in which another name is related to this name, optionally filtered
432
	 * by relationship type
433
	 *
434
	 * @param name the name on the <i>"to side"</i> of the relationship
435
	 * @param type the relationship type (or null to return all relationships)
436
	 * @param pageSize The maximum number of relationships returned (can be null for all relationships)
437
	 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
438
	 * @param orderHints may be null
439
	 * @param propertyPaths properties to initialize - see {@link IBeanInitializer#initialize(Object, List)}
440
	 * @return a Pager of NameRelationship instances
441
	 * @deprecated use {@link #pageNameRelationships(TaxonName, eu.etaxonomy.cdm.model.common.RelationshipBase.Direction, NameRelationshipType, Integer, Integer, List, List)} instead
442
	 */
443
	@Deprecated
444
	public Pager<NameRelationship> pageToNameRelationships(TaxonName name,  NameRelationshipType type, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);
445

    
446

    
447
	/**
448
	 * Return a List of hybrids related to this name, optionally filtered
449
	 * by hybrid relationship type
450
	 *
451
	 * @param name the name
452
	 * @param type the hybrid relationship type (or null to return all hybrids)
453
	 * @param pageSize The maximum number of hybrid relationships returned (can be null for all relationships)
454
	 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
455
	 * @param orderHints may be null
456
	 * @param propertyPaths properties to initialize - see {@link IBeanInitializer#initialize(Object, List)}
457
	 * @return a Pager of HybridRelationship instances
458
	 */
459
	public Pager<HybridRelationship> getHybridNames(INonViralName name, HybridRelationshipType type, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);
460

    
461
	/**
462
	 * Return a List of types related to this name, optionally filtered
463
	 * by type designation status
464
	 *
465
	 * @param name the name
466
	 * @param status the type designation status (or null to return all types)
467
	 * @param pageSize The maximum number of types returned (can be null for all types)
468
	 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
469
	 * @return a Pager of TypeDesignationBase instances
470
	 */
471
	public Pager<TypeDesignationBase> getTypeDesignations(TaxonName name,
472
			SpecimenTypeDesignationStatus status, Integer pageSize, Integer pageNumber);
473

    
474
	public Pager<TypeDesignationBase> getTypeDesignations(TaxonName name,
475
			SpecimenTypeDesignationStatus status, Integer pageSize, Integer pageNumber, List<String> propertyPaths);
476

    
477
	public List<TypeDesignationBase> getTypeDesignationsInHomotypicalGroup(UUID nameUuid, Integer pageSize,
478
	        Integer pageNumber, List<String> propertyPaths);
479

    
480

    
481
	/**
482
	 * Returns a List of TaxonName instances that match the properties passed
483
	 *
484
	 * @param uninomial
485
	 * @param infraGenericEpithet
486
	 * @param specificEpithet
487
	 * @param infraspecificEpithet
488
	 * @param rank
489
	 * @param pageSize The maximum number of names returned (can be null for all names)
490
	 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
491
	 * @param orderHints may be null
492
	 * @param propertyPaths properties to initialize - see {@link IBeanInitializer#initialize(Object, List)}
493
	 * @return a Pager of TaxonName instances
494
	 */
495
	public Pager<TaxonName> searchNames(String uninomial, String infraGenericEpithet, String specificEpithet, String infraspecificEpithet, Rank rank, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);
496

    
497
	/**
498
	 * Returns a Paged List of TaxonName instances where the default field matches the String queryString (as interpreted by the Lucene QueryParser)
499
	 *
500
	 * @param clazz filter the results by class (or pass null to return all TaxonName instances)
501
	 * @param queryString
502
	 * @param pageSize The maximum number of names returned (can be null for all matching names)
503
	 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
504
	 * @param orderHints
505
	 *            Supports path like <code>orderHints.propertyNames</code> which
506
	 *            include *-to-one properties like createdBy.username or
507
	 *            authorTeam.persistentTitleCache
508
	 * @param propertyPaths properties to be initialized
509
	 * @return a Pager TaxonName instances
510
	 * @see <a href="http://lucene.apache.org/java/2_4_0/queryparsersyntax.html">Apache Lucene - Query Parser Syntax</a>
511
	 */
512
	@Override
513
    public Pager<TaxonName> search(Class<? extends TaxonName> clazz, String queryString, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);
514

    
515
	/**
516
	 * Returns a map that holds uuid, titleCache pairs of all names in the current database
517
	 *
518
	 * @return
519
	 * 			a <code>Map</code> containing uuid and titleCache of names
520
	 */
521
	public List<UuidAndTitleCache> getUuidAndTitleCacheOfNames(Integer limit, String pattern);
522

    
523
	/**
524
     * Returns a list of names belonging to the synonymy of the taxon
525
     * @param limit
526
     * @param taxonUuid
527
     * @return a list containing uuid and titleCache of names of the synonymy of the given taxon
528
     */
529
    public List<UuidAndTitleCache> getUuidAndTitleCacheOfSynonymy(Integer limit, UUID taxonUuid);
530

    
531
	/**
532
	 * Return a Pager of names matching the given query string, optionally filtered by class, optionally with a particular MatchMode
533
	 *
534
	 * @param clazz filter by class - can be null to include all instances of type T
535
	 * @param queryString the query string to filter by
536
	 * @param matchmode use a particular type of matching (can be null - defaults to exact matching)
537
	 * @param criteria additional criteria to filter by
538
	 * @param pageSize The maximum number of objects returned (can be null for all objects)
539
	 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
540
	 * @param propertyPaths properties to initialize - see {@link IBeanInitializer#initialize(Object, List)}
541
	 * @param orderHints
542
	 *            Supports path like <code>orderHints.propertyNames</code> which
543
	 *            include *-to-one properties like createdBy.username or
544
	 *            authorTeam.persistentTitleCache
545
	 * @return a paged list of instances of type T matching the queryString
546
	 */
547
    public Pager<TaxonName> findByName(Class<TaxonName> clazz, String queryString, MatchMode matchmode,
548
            List<Criterion> criteria, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);
549

    
550
    /**
551
     * Returns a homotypical group with the given UUID or null if not homotypical group exists with that UUID
552
     *
553
     * @param uuid the uuid of the homotypical group
554
     * @return a homotypical group
555
     */
556
    public HomotypicalGroup findHomotypicalGroup(UUID uuid);
557

    
558
    /**
559
     * @param uuid
560
     * @return
561
     */
562
    public List<TaggedText> getTaggedName(UUID uuid);
563

    
564
    /**
565
     * @param nameUuid
566
     * @return
567
     */
568
    public UpdateResult setAsGroupsBasionym(UUID nameUuid);
569

    
570
	public List<HashMap<String, String>> getNameRecords();
571

    
572
    /**
573
     * @param name
574
     * @param config
575
     * @return
576
     */
577
    DeleteResult delete(TaxonName name, NameDeletionConfigurator config);
578

    
579
    List<TypeDesignationStatusBase> getTypeDesignationStatusInUse();
580

    
581
    /**
582
     * Provides a collection of the TypeDesignationStatusBase terms which are in use.
583
     * Terms having the same label are merged into one filter item.
584
     *
585
     * @param preferredLanguage
586
     * @return
587
     */
588
    Collection<TypeDesignationStatusFilter> getTypeDesignationStatusFilterTerms(List<Language> preferredLanguages);
589

    
590
    /**
591
     * @param uuid
592
     * @param propertyPaths
593
     * @return
594
     */
595
    NomenclaturalStatus loadNomenclaturalStatus(UUID uuid, List<String> propertyPaths);
596

    
597
    /**
598
     * @param clazz
599
     * @param restrictions
600
     * @param pageSize
601
     * @param pageIndex
602
     * @param orderHints
603
     * @param propertyPaths
604
     * @param includeUnpublished
605
     * @return
606
     */
607
    public <S extends TaxonName> Pager<S> page(Class<S> clazz, List<Restriction<?>> restrictions, Integer pageSize, Integer pageIndex,
608
            List<OrderHint> orderHints, List<String> propertyPaths, boolean includeUnpublished);
609

    
610
    /**
611
     * @param clazz
612
     * @param queryString
613
     * @param matchmode
614
     * @param criteria
615
     * @param pageSize
616
     * @param pageNumber
617
     * @param orderHints
618
     * @param propertyPaths
619
     * @return
620
     */
621
    public List<TaxonName> findByFullTitle(Class<TaxonName> clazz, String queryString, MatchMode matchmode,
622
            List<Criterion> criteria, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints,
623
            List<String> propertyPaths);
624

    
625

    
626
    /**
627
     * Parses a name string and returns a parsed name. If deduplicate is <code>true</code>
628
     * the parsed parts like nomenclatural reference and authors are deduplicated against the
629
     * database.
630
     *
631
     * @param taxonNameString
632
     * @param code the nomenclatural code to use
633
     * @param preferredRank the preferred rank to use if rank is not clearly defined by the taxon name
634
     * @param doDeduplicate if <code>true</code> the name parts are deduplicated against the database,
635
     *      but the name itself is NOT deduplicated (this may change in future)
636
     * @return
637
     */
638
    public UpdateResult parseName(String taxonNameString, NomenclaturalCode code, Rank preferredRank, boolean doDeduplicate);
639

    
640
    public UpdateResult parseName(TaxonName nameToBeFilled, String stringToBeParsed, Rank preferredRank, boolean doEmpty, boolean doDeduplicate);
641

    
642
}
(45-45/100)