Project

General

Profile

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

    
58
public interface INameService
59
        extends IIdentifiableEntityService<TaxonName> {
60

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

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

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

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

    
113

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

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

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

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

    
144
    public TypeDesignationBase<?> loadTypeDesignation(int id, List<String> propertyPaths);
145

    
146
    public TypeDesignationBase<?> loadTypeDesignation(UUID uuid, List<String> propertyPaths);
147

    
148
    public List<TypeDesignationBase<?>> loadTypeDesignations(List<UUID> uuids, List<String> propertyPaths);
149

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

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

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

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

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

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

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

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

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

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

    
307
	// TODO: Remove getNamesByName() methods. Use findNamesByTitle() instead.
308

    
309
    public List<HomotypicalGroup> getAllHomotypicalGroups(int limit, int start);
310

    
311
    /**
312
     * Returns all or a page of all original spellings in the database.
313
     * As original spellings are
314
     *
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 nomenclatural the filter criteria
320
     */
321
    public List<NomenclaturalSource> listOriginalSpellings(Integer pageSize,
322
            Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);
323

    
324
	/**
325
     * Returns all or a page of all taxon name relationships in the database.
326
     * The result can be filtered by relationship types.
327
     * It does NOT contain hybrid relationships
328
     * (see {@link #listHybridRelationships(Set, Integer, Integer, List, List)})
329
     *
330
     * @param types The name 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 name relationships matching the filter criteria
336
     */
337
    public List<NameRelationship> listNameRelationships(Set<NameRelationshipType> types,
338
            Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);
339

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

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

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

    
414
	/**
415
	 * Return a List of relationships in which this name is related to another name, optionally filtered
416
	 * by relationship type
417
	 *
418
	 * @param name the name on the <i>"from 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 #pageNameRelationships(TaxonName, eu.etaxonomy.cdm.model.common.RelationshipBase.Direction, NameRelationshipType, Integer, Integer, List, List)} instead
426
	 */
427
	@Deprecated
428
	public Pager<NameRelationship> pageFromNameRelationships(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 #listNameRelationships(TaxonName, eu.etaxonomy.cdm.model.common.RelationshipBase.Direction, NameRelationshipType, Integer, Integer, List, List)} instead
442
	 */
443
	@Deprecated
444
	public List<NameRelationship> listToNameRelationships(TaxonName name,  NameRelationshipType type, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);
445

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

    
462

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

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

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

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

    
496

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

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

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

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

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

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

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

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

    
586
	public List<HashMap<String, String>> getNameRecords();
587

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

    
595
    List<TypeDesignationStatusBase> getTypeDesignationStatusInUse();
596

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

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

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

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

    
641

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

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

    
658
    /**
659
     * checks whether the name can be deleted if the taxon with taxonUuid will be deleted, too
660
     * @param name
661
     * @param config
662
     * @param taxonUuid
663
     * @return
664
     */
665
    DeleteResult isDeletable(UUID nameUuid, DeleteConfiguratorBase config, UUID taxonUuid);
666

    
667
}
(43-43/97)