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.model.common.Language;
32
import eu.etaxonomy.cdm.model.name.HomotypicalGroup;
33
import eu.etaxonomy.cdm.model.name.HybridRelationship;
34
import eu.etaxonomy.cdm.model.name.HybridRelationshipType;
35
import eu.etaxonomy.cdm.model.name.INonViralName;
36
import eu.etaxonomy.cdm.model.name.NameRelationship;
37
import eu.etaxonomy.cdm.model.name.NameRelationshipType;
38
import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
39
import eu.etaxonomy.cdm.model.name.NomenclaturalSource;
40
import eu.etaxonomy.cdm.model.name.NomenclaturalStatus;
41
import eu.etaxonomy.cdm.model.name.Rank;
42
import eu.etaxonomy.cdm.model.name.SpecimenTypeDesignation;
43
import eu.etaxonomy.cdm.model.name.SpecimenTypeDesignationStatus;
44
import eu.etaxonomy.cdm.model.name.TaxonName;
45
import eu.etaxonomy.cdm.model.name.TypeDesignationBase;
46
import eu.etaxonomy.cdm.model.name.TypeDesignationStatusBase;
47
import eu.etaxonomy.cdm.model.occurrence.FieldUnit;
48
import eu.etaxonomy.cdm.persistence.dao.common.Restriction;
49
import eu.etaxonomy.cdm.persistence.dao.initializer.IBeanInitializer;
50
import eu.etaxonomy.cdm.persistence.dto.TaxonNameParts;
51
import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache;
52
import eu.etaxonomy.cdm.persistence.query.MatchMode;
53
import eu.etaxonomy.cdm.persistence.query.OrderHint;
54
import eu.etaxonomy.cdm.strategy.cache.TaggedText;
55
import eu.etaxonomy.cdm.strategy.parser.NonViralNameParserImpl;
56

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

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

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

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

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

    
112

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
382
	/**
383
	 * Return a List of name 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 direction the direction of the NameRelationship
388
	 * @param type the relationship type (or null to return all relationships)
389
	 * @param pageSize The maximum number of relationships returned (can be null for all relationships)
390
	 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
391
	 * @param orderHints may be null
392
	 * @param propertyPaths properties to initialize - see {@link IBeanInitializer#initialize(Object, List)}
393
	 * @return a Pager of NameRelationship instances
394
	 */
395
	public Pager<NameRelationship> pageNameRelationships(TaxonName name,  NameRelationship.Direction direction, NameRelationshipType type, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);
396

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

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

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

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

    
461

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

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

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

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

    
495

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

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

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

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

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

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

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

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

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

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

    
594
    List<TypeDesignationStatusBase> getTypeDesignationStatusInUse();
595

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

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

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

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

    
640

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

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

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

    
666
}
(43-43/97)