Project

General

Profile

Download (29.7 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.NomenclaturalSource;
39
import eu.etaxonomy.cdm.model.name.NomenclaturalStatus;
40
import eu.etaxonomy.cdm.model.name.Rank;
41
import eu.etaxonomy.cdm.model.name.SpecimenTypeDesignation;
42
import eu.etaxonomy.cdm.model.name.SpecimenTypeDesignationStatus;
43
import eu.etaxonomy.cdm.model.name.TaxonName;
44
import eu.etaxonomy.cdm.model.name.TypeDesignationBase;
45
import eu.etaxonomy.cdm.model.name.TypeDesignationStatusBase;
46
import eu.etaxonomy.cdm.model.occurrence.FieldUnit;
47
import eu.etaxonomy.cdm.persistence.dao.common.Restriction;
48
import eu.etaxonomy.cdm.persistence.dao.initializer.IBeanInitializer;
49
import eu.etaxonomy.cdm.persistence.dto.TaxonNameParts;
50
import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache;
51
import eu.etaxonomy.cdm.persistence.query.MatchMode;
52
import eu.etaxonomy.cdm.persistence.query.OrderHint;
53
import eu.etaxonomy.cdm.strategy.cache.TaggedText;
54
import eu.etaxonomy.cdm.strategy.parser.NonViralNameParserImpl;
55

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

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

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

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

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

    
111

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

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

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

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

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

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

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

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

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

    
166
	/**
167
     * Supports using wildcards in the query parameters.
168
     * 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.
169
     * <p>
170
     * 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
171
     * to filter select taxon names where the according field is <code>null</code>.
172
     *
173
     * @param filter
174
     * @param infraGenericEpithet
175
     * @param specificEpithet
176
     * @param infraSpecificEpithet
177
     * @param rank
178
     *     Only names having the specified rank are taken into account.
179
     * @param excludedNamesUuids
180
     *     Names to be excluded from the result set
181
     * @return
182
     */
183
	public Pager<TaxonNameParts> findTaxonNameParts(Optional<String> genusOrUninomial,
184
            Optional<String> infraGenericEpithet, Optional<String> specificEpithet,
185
            Optional<String> infraSpecificEpithet, Rank rank, Set<UUID> excludedNamesUuids,
186
            Integer pageSize, Integer pageIndex, List<OrderHint> orderHints);
187

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

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

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

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

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

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

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

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

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

    
309
    /**
310
     * Returns all or a page of all original spellings in the database.
311
     * As original spellings are
312
     *
313
     * @param pageSize the page size
314
     * @param pageStart the number of the page
315
     * @param orderHints the order hints
316
     * @param propertyPaths the property path to initialize the resulting objects
317
     * @return list of nomenclatural the filter criteria
318
     */
319
    public List<NomenclaturalSource> listOriginalSpellings(Integer pageSize,
320
            Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);
321

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

    
338
    /**
339
     * Returns all or a page of all hybrid relationships in the database.
340
     * The result can be filtered by relationship types.
341
     * It does NOT contain ordinary name relationships
342
     * (see {@link #listNameRelationships(Set, Integer, Integer, List, List)})
343
     *
344
     * @param types The hybrid relationship type filter, if <code>null</code> no filter is set, if empty the result will also be empty
345
     * @param pageSize the page size
346
     * @param pageStart the number of the page
347
     * @param orderHints the order hints
348
     * @param propertyPaths the property path to initialize the resulting objects
349
     * @return list of hybrid relationships matching the filter criteria
350
     */
351
    public List<HybridRelationship> listHybridRelationships(Set<HybridRelationshipType> types,
352
            Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);
353

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

    
381
	/**
382
	 * Return a List of name relationships in which this name is related to another name, optionally filtered
383
	 * by relationship type
384
	 *
385
	 * @param name the name on the <i>"from side"</i> of the relationship
386
	 * @param direction the direction of the NameRelationship
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
	 */
394
	public Pager<NameRelationship> pageNameRelationships(TaxonName name,  NameRelationship.Direction direction, NameRelationshipType type, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);
395

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

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

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

    
444
	/**
445
	 * Return a List of relationships in which another name is related to this name, optionally filtered
446
	 * by relationship type
447
	 *
448
	 * @param name the name on the <i>"to side"</i> of the relationship
449
	 * @param type the relationship type (or null to return all relationships)
450
	 * @param pageSize The maximum number of relationships returned (can be null for all relationships)
451
	 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
452
	 * @param orderHints may be null
453
	 * @param propertyPaths properties to initialize - see {@link IBeanInitializer#initialize(Object, List)}
454
	 * @return a Pager of NameRelationship instances
455
	 * @deprecated use {@link #pageNameRelationships(TaxonName, eu.etaxonomy.cdm.model.common.RelationshipBase.Direction, NameRelationshipType, Integer, Integer, List, List)} instead
456
	 */
457
	@Deprecated
458
	public Pager<NameRelationship> pageToNameRelationships(TaxonName name,  NameRelationshipType type, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);
459

    
460

    
461
	/**
462
	 * Return a List of hybrids related to this name, optionally filtered
463
	 * by hybrid relationship type
464
	 *
465
	 * @param name the name
466
	 * @param type the hybrid relationship type (or null to return all hybrids)
467
	 * @param pageSize The maximum number of hybrid relationships returned (can be null for all relationships)
468
	 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
469
	 * @param orderHints may be null
470
	 * @param propertyPaths properties to initialize - see {@link IBeanInitializer#initialize(Object, List)}
471
	 * @return a Pager of HybridRelationship instances
472
	 */
473
	public Pager<HybridRelationship> getHybridNames(INonViralName name, HybridRelationshipType type, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);
474

    
475
	/**
476
	 * Return a List of types related to this name, optionally filtered
477
	 * by type designation status
478
	 *
479
	 * @param name the name
480
	 * @param status the type designation status (or null to return all types)
481
	 * @param pageSize The maximum number of types returned (can be null for all types)
482
	 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
483
	 * @return a Pager of TypeDesignationBase instances
484
	 */
485
	public Pager<TypeDesignationBase> getTypeDesignations(TaxonName name,
486
			SpecimenTypeDesignationStatus status, Integer pageSize, Integer pageNumber);
487

    
488
	public Pager<TypeDesignationBase> getTypeDesignations(TaxonName name,
489
			SpecimenTypeDesignationStatus status, Integer pageSize, Integer pageNumber, List<String> propertyPaths);
490

    
491
	public List<TypeDesignationBase> getTypeDesignationsInHomotypicalGroup(UUID nameUuid, Integer pageSize,
492
	        Integer pageNumber, List<String> propertyPaths);
493

    
494

    
495
	/**
496
	 * Returns a List of TaxonName instances that match the properties passed
497
	 *
498
	 * @param uninomial
499
	 * @param infraGenericEpithet
500
	 * @param specificEpithet
501
	 * @param infraspecificEpithet
502
	 * @param rank
503
	 * @param pageSize The maximum number of names returned (can be null for all names)
504
	 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
505
	 * @param orderHints may be null
506
	 * @param propertyPaths properties to initialize - see {@link IBeanInitializer#initialize(Object, List)}
507
	 * @return a Pager of TaxonName instances
508
	 */
509
	public Pager<TaxonName> searchNames(String uninomial, String infraGenericEpithet, String specificEpithet, String infraspecificEpithet, Rank rank, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);
510

    
511
	/**
512
	 * Returns a Paged List of TaxonName instances where the default field matches the String queryString (as interpreted by the Lucene QueryParser)
513
	 *
514
	 * @param clazz filter the results by class (or pass null to return all TaxonName instances)
515
	 * @param queryString
516
	 * @param pageSize The maximum number of names returned (can be null for all matching names)
517
	 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
518
	 * @param orderHints
519
	 *            Supports path like <code>orderHints.propertyNames</code> which
520
	 *            include *-to-one properties like createdBy.username or
521
	 *            authorTeam.persistentTitleCache
522
	 * @param propertyPaths properties to be initialized
523
	 * @return a Pager TaxonName instances
524
	 * @see <a href="http://lucene.apache.org/java/2_4_0/queryparsersyntax.html">Apache Lucene - Query Parser Syntax</a>
525
	 */
526
	@Override
527
    public Pager<TaxonName> search(Class<? extends TaxonName> clazz, String queryString, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);
528

    
529
	/**
530
	 * Returns a map that holds uuid, titleCache pairs of all names in the current database
531
	 *
532
	 * @return
533
	 * 			a <code>Map</code> containing uuid and titleCache of names
534
	 */
535
	public List<UuidAndTitleCache> getUuidAndTitleCacheOfNames(Integer limit, String pattern);
536

    
537
	/**
538
     * Returns a list of names belonging to the synonymy of the taxon
539
     * @param limit
540
     * @param taxonUuid
541
     * @return a list containing uuid and titleCache of names of the synonymy of the given taxon
542
     */
543
    public List<UuidAndTitleCache> getUuidAndTitleCacheOfSynonymy(Integer limit, UUID taxonUuid);
544

    
545
	/**
546
	 * Return a Pager of names matching the given query string, optionally filtered by class, optionally with a particular MatchMode
547
	 *
548
	 * @param clazz filter by class - can be null to include all instances of type T
549
	 * @param queryString the query string to filter by
550
	 * @param matchmode use a particular type of matching (can be null - defaults to exact matching)
551
	 * @param criteria additional criteria to filter by
552
	 * @param pageSize The maximum number of objects returned (can be null for all objects)
553
	 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
554
	 * @param propertyPaths properties to initialize - see {@link IBeanInitializer#initialize(Object, List)}
555
	 * @param orderHints
556
	 *            Supports path like <code>orderHints.propertyNames</code> which
557
	 *            include *-to-one properties like createdBy.username or
558
	 *            authorTeam.persistentTitleCache
559
	 * @return a paged list of instances of type T matching the queryString
560
	 */
561
    public Pager<TaxonName> findByName(Class<TaxonName> clazz, String queryString, MatchMode matchmode,
562
            List<Criterion> criteria, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);
563

    
564
    /**
565
     * Returns a homotypical group with the given UUID or null if not homotypical group exists with that UUID
566
     *
567
     * @param uuid the uuid of the homotypical group
568
     * @return a homotypical group
569
     */
570
    public HomotypicalGroup findHomotypicalGroup(UUID uuid);
571

    
572
    /**
573
     * @param uuid
574
     * @return
575
     */
576
    public List<TaggedText> getTaggedName(UUID uuid);
577

    
578
    /**
579
     * @param nameUuid
580
     * @return
581
     */
582
    public UpdateResult setAsGroupsBasionym(UUID nameUuid);
583

    
584
	public List<HashMap<String, String>> getNameRecords();
585

    
586
    /**
587
     * @param name
588
     * @param config
589
     * @return
590
     */
591
    DeleteResult delete(TaxonName name, NameDeletionConfigurator config);
592

    
593
    List<TypeDesignationStatusBase> getTypeDesignationStatusInUse();
594

    
595
    /**
596
     * Provides a collection of the TypeDesignationStatusBase terms which are in use.
597
     * Terms having the same label are merged into one filter item.
598
     *
599
     * @param preferredLanguage
600
     * @return
601
     */
602
    Collection<TypeDesignationStatusFilter> getTypeDesignationStatusFilterTerms(List<Language> preferredLanguages);
603

    
604
    /**
605
     * @param uuid
606
     * @param propertyPaths
607
     * @return
608
     */
609
    NomenclaturalStatus loadNomenclaturalStatus(UUID uuid, List<String> propertyPaths);
610

    
611
    /**
612
     * @param clazz
613
     * @param restrictions
614
     * @param pageSize
615
     * @param pageIndex
616
     * @param orderHints
617
     * @param propertyPaths
618
     * @param includeUnpublished
619
     * @return
620
     */
621
    public <S extends TaxonName> Pager<S> page(Class<S> clazz, List<Restriction<?>> restrictions, Integer pageSize, Integer pageIndex,
622
            List<OrderHint> orderHints, List<String> propertyPaths, boolean includeUnpublished);
623

    
624
    /**
625
     * @param clazz
626
     * @param queryString
627
     * @param matchmode
628
     * @param criteria
629
     * @param pageSize
630
     * @param pageNumber
631
     * @param orderHints
632
     * @param propertyPaths
633
     * @return
634
     */
635
    public List<TaxonName> findByFullTitle(Class<TaxonName> clazz, String queryString, MatchMode matchmode,
636
            List<Criterion> criteria, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints,
637
            List<String> propertyPaths);
638

    
639

    
640
    /**
641
     * Parses a name string and returns a parsed name. If deduplicate is <code>true</code>
642
     * the parsed parts like nomenclatural reference and authors are deduplicated against the
643
     * database.
644
     *
645
     * @param taxonNameString
646
     * @param code the nomenclatural code to use
647
     * @param preferredRank the preferred rank to use if rank is not clearly defined by the taxon name
648
     * @param doDeduplicate if <code>true</code> the name parts are deduplicated against the database,
649
     *      but the name itself is NOT deduplicated (this may change in future)
650
     * @return
651
     */
652
    public UpdateResult parseName(String taxonNameString, NomenclaturalCode code, Rank preferredRank, boolean doDeduplicate);
653

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

    
656
}
(45-45/100)