3 * Copyright (C) 2007 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
7 * The contents of this file are subject to the Mozilla Public License Version 1.1
8 * See LICENSE.TXT at the top of this package for the full license terms.
11 package eu
.etaxonomy
.cdm
.api
.service
;
13 import java
.util
.Collection
;
14 import java
.util
.List
;
16 import java
.util
.UUID
;
18 import org
.hibernate
.criterion
.Criterion
;
20 import eu
.etaxonomy
.cdm
.api
.service
.config
.NameDeletionConfigurator
;
21 import eu
.etaxonomy
.cdm
.api
.service
.exception
.ReferencedObjectUndeletableException
;
22 import eu
.etaxonomy
.cdm
.api
.service
.pager
.Pager
;
23 import eu
.etaxonomy
.cdm
.model
.common
.CdmBase
;
24 import eu
.etaxonomy
.cdm
.model
.common
.OrderedTermVocabulary
;
25 import eu
.etaxonomy
.cdm
.model
.common
.ReferencedEntityBase
;
26 import eu
.etaxonomy
.cdm
.model
.common
.RelationshipBase
;
27 import eu
.etaxonomy
.cdm
.model
.common
.TermVocabulary
;
28 import eu
.etaxonomy
.cdm
.model
.common
.UuidAndTitleCache
;
29 import eu
.etaxonomy
.cdm
.model
.name
.HomotypicalGroup
;
30 import eu
.etaxonomy
.cdm
.model
.name
.HybridRelationship
;
31 import eu
.etaxonomy
.cdm
.model
.name
.HybridRelationshipType
;
32 import eu
.etaxonomy
.cdm
.model
.name
.NameRelationship
;
33 import eu
.etaxonomy
.cdm
.model
.name
.NameRelationshipType
;
34 import eu
.etaxonomy
.cdm
.model
.name
.NomenclaturalStatus
;
35 import eu
.etaxonomy
.cdm
.model
.name
.NomenclaturalStatusType
;
36 import eu
.etaxonomy
.cdm
.model
.name
.NonViralName
;
37 import eu
.etaxonomy
.cdm
.model
.name
.Rank
;
38 import eu
.etaxonomy
.cdm
.model
.name
.SpecimenTypeDesignationStatus
;
39 import eu
.etaxonomy
.cdm
.model
.name
.TaxonNameBase
;
40 import eu
.etaxonomy
.cdm
.model
.name
.TypeDesignationBase
;
41 import eu
.etaxonomy
.cdm
.persistence
.dao
.BeanInitializer
;
42 import eu
.etaxonomy
.cdm
.persistence
.query
.MatchMode
;
43 import eu
.etaxonomy
.cdm
.persistence
.query
.OrderHint
;
44 import eu
.etaxonomy
.cdm
.strategy
.cache
.TaggedText
;
46 public interface INameService
extends IIdentifiableEntityService
<TaxonNameBase
> {
49 * Deletes a name. Depening on the configurator state links to the name will either be
50 * deleted or throw exceptions.<BR>
51 * If name is <code>null</code> this method has no effect.
54 * @throws ReferencedObjectUndeletableException
56 public UUID
delete(TaxonNameBase name
, NameDeletionConfigurator config
) throws ReferencedObjectUndeletableException
;
59 * Removes the given type designation from the given taxon name and deletes it from
60 * the database if it is not connected to any other name.
61 * If <code>typeDesignation</code> is <code>null</code> all type designations are deleted
62 * from the given taxon name. If <code>name</code> is <code>null</code> all names are removed from
63 * the given type designation. If both are <code>null</code> nothing happens.
64 * @param typeDesignation
68 public void deleteTypeDesignation(TaxonNameBase name
, TypeDesignationBase typeDesignation
);
72 * Saves the given type designations.
73 * @param typeDesignationCollection
76 public Map
<UUID
, TypeDesignationBase
> saveTypeDesignationAll(Collection
<TypeDesignationBase
> typeDesignationCollection
);
78 public Map
<UUID
, ReferencedEntityBase
> saveReferencedEntitiesAll(Collection
<ReferencedEntityBase
> referencedEntityCollection
);
81 * Saves the given homotypical groups.
82 * @param homotypicalGroups
85 public Map
<UUID
, HomotypicalGroup
> saveAllHomotypicalGroups(Collection
<HomotypicalGroup
> homotypicalGroups
);
88 * Returns all nomenclatural status.
93 public List
<NomenclaturalStatus
> getAllNomenclaturalStatus(int limit
, int start
);
96 * Returns all type designations.
101 public List
<TypeDesignationBase
> getAllTypeDesignations(int limit
, int start
);
107 public List
<TaxonNameBase
> getNamesByName(String name
);
110 * Returns all NonViralNames with a name cache that matches the given string
114 public List
<NonViralName
> getNamesByNameCache(String nameCache
);
118 * @param sessionObject An object that is attached to the session before executing the query
121 public List
getNamesByName(String name
, CdmBase sessionObject
);
123 // TODO: Remove getNamesByName() methods. Use findNamesByTitle() instead.
125 // FIXME candidate for harmonization?
126 public List
findNamesByTitle(String title
);
128 public List
findNamesByTitle(String title
, CdmBase sessionObject
);
130 public List
<HomotypicalGroup
> getAllHomotypicalGroups(int limit
, int start
);
133 public List
<RelationshipBase
> getAllRelationships(int limit
, int start
);
138 * @deprecated use VocabularyService#getVocabulary(VocabularyEnum) instead
140 public OrderedTermVocabulary
<Rank
> getRankVocabulary();
143 * Returns all NomenclaturalStatusTypes
145 * @deprecated use VocabularyService#getVocabulary(VocabularyEnum) instead
147 public TermVocabulary
<NomenclaturalStatusType
> getStatusTypeVocabulary();
150 * Returns TypeDesignationStatus vocabulary
152 * @deprecated use VocabularyService#getVocabulary(VocabularyEnum) instead
154 public TermVocabulary
<SpecimenTypeDesignationStatus
> getSpecimenTypeDesignationStatusVocabulary();
157 * Returns TypeDesignationStatus ordered vocabulary
159 * @deprecated use VocabularyService#getVocabulary(VocabularyEnum) instead
161 public OrderedTermVocabulary
<SpecimenTypeDesignationStatus
> getSpecimenTypeDesignationVocabulary();
164 * Returns all NameRelationshipTypes
166 * @deprecated use VocabularyService#getVocabulary(VocabularyEnum) instead
168 public TermVocabulary
<NameRelationshipType
> getNameRelationshipTypeVocabulary();
171 * Return a List of name relationships in which this name is related to
172 * another name, optionally filtered by relationship type
175 * the name on either the <i>"from side"</i> or on the
176 * <i>"to side"</i> of the relationship, depending on the
177 * <code>direction</code> of the relationship.
179 * the direction of the NameRelationship, may be null to return all relationships
181 * the relationship type (or null to return all relationships)
183 * The maximum number of relationships returned (can be null for
186 * The offset (in pageSize chunks) from the start of the result
190 * @param propertyPaths
191 * properties to initialize - see
192 * {@link BeanInitializer#initialize(Object, List)}
193 * @return a Pager of NameRelationship instances
195 public List
<NameRelationship
> listNameRelationships(TaxonNameBase name
, NameRelationship
.Direction direction
, NameRelationshipType type
, Integer pageSize
, Integer pageNumber
, List
<OrderHint
> orderHints
, List
<String
> propertyPaths
);
198 * Return a List of name relationships in which this name is related to another name, optionally filtered
199 * by relationship type
201 * @param name the name on the <i>"from side"</i> of the relationship
202 * @param direction the direction of the NameRelationship
203 * @param type the relationship type (or null to return all relationships)
204 * @param pageSize The maximum number of relationships returned (can be null for all relationships)
205 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
206 * @param orderHints may be null
207 * @param propertyPaths properties to initialize - see {@link BeanInitializer#initialize(Object, List)}
208 * @return a Pager of NameRelationship instances
210 public Pager
<NameRelationship
> pageNameRelationships(TaxonNameBase name
, NameRelationship
.Direction direction
, NameRelationshipType type
, Integer pageSize
, Integer pageNumber
, List
<OrderHint
> orderHints
, List
<String
> propertyPaths
);
213 * Return a List of relationships in which this name is related to another name, optionally filtered
214 * by relationship type
216 * @param name the name on the <i>"from side"</i> of the relationship
217 * @param type the relationship type (or null to return all relationships)
218 * @param pageSize The maximum number of relationships returned (can be null for all relationships)
219 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
220 * @param orderHints may be null
221 * @param propertyPaths properties to initialize - see {@link BeanInitializer#initialize(Object, List)}
222 * @return a Pager of NameRelationship instances
223 * @deprecated use {@link #listNameRelationships(TaxonNameBase, eu.etaxonomy.cdm.model.common.RelationshipBase.Direction, NameRelationshipType, Integer, Integer, List, List)} instead
226 public List
<NameRelationship
> listFromNameRelationships(TaxonNameBase name
, NameRelationshipType type
, Integer pageSize
, Integer pageNumber
, List
<OrderHint
> orderHints
, List
<String
> propertyPaths
);
229 * Return a List of relationships in which this name is related to another name, optionally filtered
230 * by relationship type
232 * @param name the name on the <i>"from side"</i> of the relationship
233 * @param type the relationship type (or null to return all relationships)
234 * @param pageSize The maximum number of relationships returned (can be null for all relationships)
235 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
236 * @param orderHints may be null
237 * @param propertyPaths properties to initialize - see {@link BeanInitializer#initialize(Object, List)}
238 * @return a Pager of NameRelationship instances
239 * @deprecated use {@link #pageNameRelationships(TaxonNameBase, eu.etaxonomy.cdm.model.common.RelationshipBase.Direction, NameRelationshipType, Integer, Integer, List, List)} instead
242 public Pager
<NameRelationship
> pageFromNameRelationships(TaxonNameBase name
, NameRelationshipType type
, Integer pageSize
, Integer pageNumber
, List
<OrderHint
> orderHints
, List
<String
> propertyPaths
);
245 * Return a List of relationships in which another name is related to this name, optionally filtered
246 * by relationship type
248 * @param name the name on the <i>"to side"</i> of the relationship
249 * @param type the relationship type (or null to return all relationships)
250 * @param pageSize The maximum number of relationships returned (can be null for all relationships)
251 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
252 * @param orderHints may be null
253 * @param propertyPaths properties to initialize - see {@link BeanInitializer#initialize(Object, List)}
254 * @return a Pager of NameRelationship instances
255 * @deprecated use {@link #listNameRelationships(TaxonNameBase, eu.etaxonomy.cdm.model.common.RelationshipBase.Direction, NameRelationshipType, Integer, Integer, List, List)} instead
258 public List
<NameRelationship
> listToNameRelationships(TaxonNameBase name
, NameRelationshipType type
, Integer pageSize
, Integer pageNumber
, List
<OrderHint
> orderHints
, List
<String
> propertyPaths
);
261 * Return a List of relationships in which another name is related to this name, optionally filtered
262 * by relationship type
264 * @param name the name on the <i>"to side"</i> of the relationship
265 * @param type the relationship type (or null to return all relationships)
266 * @param pageSize The maximum number of relationships returned (can be null for all relationships)
267 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
268 * @param orderHints may be null
269 * @param propertyPaths properties to initialize - see {@link BeanInitializer#initialize(Object, List)}
270 * @return a Pager of NameRelationship instances
271 * @deprecated use {@link #pageNameRelationships(TaxonNameBase, eu.etaxonomy.cdm.model.common.RelationshipBase.Direction, NameRelationshipType, Integer, Integer, List, List)} instead
274 public Pager
<NameRelationship
> pageToNameRelationships(TaxonNameBase name
, NameRelationshipType type
, Integer pageSize
, Integer pageNumber
, List
<OrderHint
> orderHints
, List
<String
> propertyPaths
);
278 * Return a List of hybrids related to this name, optionally filtered
279 * by hybrid relationship type
281 * @param name the name
282 * @param type the hybrid relationship type (or null to return all hybrids)
283 * @param pageSize The maximum number of hybrid relationships returned (can be null for all relationships)
284 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
285 * @param orderHints may be null
286 * @param propertyPaths properties to initialize - see {@link BeanInitializer#initialize(Object, List)}
287 * @return a Pager of HybridRelationship instances
289 public Pager
<HybridRelationship
> getHybridNames(NonViralName name
, HybridRelationshipType type
, Integer pageSize
, Integer pageNumber
, List
<OrderHint
> orderHints
, List
<String
> propertyPaths
);
292 * Return a List of types related to this name, optionally filtered
293 * by type designation status
295 * @param name the name
296 * @param status the type designation status (or null to return all types)
297 * @param pageSize The maximum number of types returned (can be null for all types)
298 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
299 * @return a Pager of TypeDesignationBase instances
301 public Pager
<TypeDesignationBase
> getTypeDesignations(TaxonNameBase name
,
302 SpecimenTypeDesignationStatus status
, Integer pageSize
, Integer pageNumber
);
304 public Pager
<TypeDesignationBase
> getTypeDesignations(TaxonNameBase name
,
305 SpecimenTypeDesignationStatus status
, Integer pageSize
, Integer pageNumber
, List
<String
> propertyPaths
);
309 * Returns a List of TaxonNameBase instances that match the properties passed
312 * @param infraGenericEpithet
313 * @param specificEpithet
314 * @param infraspecificEpithet
316 * @param pageSize The maximum number of names returned (can be null for all names)
317 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
318 * @param orderHints may be null
319 * @param propertyPaths properties to initialize - see {@link BeanInitializer#initialize(Object, List)}
320 * @return a Pager of TaxonNameBase instances
322 public Pager
<TaxonNameBase
> searchNames(String uninomial
, String infraGenericEpithet
, String specificEpithet
, String infraspecificEpithet
, Rank rank
, Integer pageSize
, Integer pageNumber
, List
<OrderHint
> orderHints
, List
<String
> propertyPaths
);
325 * Returns a Paged List of TaxonNameBase instances where the default field matches the String queryString (as interpreted by the Lucene QueryParser)
327 * @param clazz filter the results by class (or pass null to return all TaxonNameBase instances)
329 * @param pageSize The maximum number of names returned (can be null for all matching names)
330 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
332 * Supports path like <code>orderHints.propertyNames</code> which
333 * include *-to-one properties like createdBy.username or
334 * authorTeam.persistentTitleCache
335 * @param propertyPaths properties to be initialized
336 * @return a Pager TaxonNameBase instances
337 * @see <a href="http://lucene.apache.org/java/2_4_0/queryparsersyntax.html">Apache Lucene - Query Parser Syntax</a>
339 public Pager
<TaxonNameBase
> search(Class
<?
extends TaxonNameBase
> clazz
, String queryString
, Integer pageSize
, Integer pageNumber
, List
<OrderHint
> orderHints
, List
<String
> propertyPaths
);
342 * Returns a map that holds uuid, titleCache pairs of all names in the current database
345 * a <code>Map</code> containing uuid and titleCache of names
347 public List
<UuidAndTitleCache
> getUuidAndTitleCacheOfNames();
350 * Return a Pager of names matching the given query string, optionally filtered by class, optionally with a particular MatchMode
352 * @param clazz filter by class - can be null to include all instances of type T
353 * @param queryString the query string to filter by
354 * @param matchmode use a particular type of matching (can be null - defaults to exact matching)
355 * @param criteria additional criteria to filter by
356 * @param pageSize The maximum number of objects returned (can be null for all objects)
357 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
358 * @param propertyPaths properties to initialize - see {@link BeanInitializer#initialize(Object, List)}
360 * Supports path like <code>orderHints.propertyNames</code> which
361 * include *-to-one properties like createdBy.username or
362 * authorTeam.persistentTitleCache
363 * @return a paged list of instances of type T matching the queryString
365 public Pager
<TaxonNameBase
> findByName(Class
<?
extends TaxonNameBase
> clazz
, String queryString
,MatchMode matchmode
, List
<Criterion
> criteria
, Integer pageSize
, Integer pageNumber
, List
<OrderHint
> orderHints
, List
<String
> propertyPaths
);
368 * Returns a homotypical group with the given UUID or null if not homotypical group exists with that UUID
370 * @param uuid the uuid of the homotypical group
371 * @return a homotypical group
373 public HomotypicalGroup
findHomotypicalGroup(UUID uuid
);
379 public List
<TaggedText
> getTaggedName(UUID uuid
);