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
.IIdentifiableEntityServiceConfigurator
;
21 import eu
.etaxonomy
.cdm
.api
.service
.pager
.Pager
;
22 import eu
.etaxonomy
.cdm
.model
.common
.CdmBase
;
23 import eu
.etaxonomy
.cdm
.model
.common
.OrderedTermVocabulary
;
24 import eu
.etaxonomy
.cdm
.model
.common
.ReferencedEntityBase
;
25 import eu
.etaxonomy
.cdm
.model
.common
.RelationshipBase
;
26 import eu
.etaxonomy
.cdm
.model
.common
.TermVocabulary
;
27 import eu
.etaxonomy
.cdm
.model
.common
.UuidAndTitleCache
;
28 import eu
.etaxonomy
.cdm
.model
.name
.HomotypicalGroup
;
29 import eu
.etaxonomy
.cdm
.model
.name
.HybridRelationship
;
30 import eu
.etaxonomy
.cdm
.model
.name
.HybridRelationshipType
;
31 import eu
.etaxonomy
.cdm
.model
.name
.NameRelationship
;
32 import eu
.etaxonomy
.cdm
.model
.name
.NameRelationshipType
;
33 import eu
.etaxonomy
.cdm
.model
.name
.NomenclaturalStatus
;
34 import eu
.etaxonomy
.cdm
.model
.name
.NomenclaturalStatusType
;
35 import eu
.etaxonomy
.cdm
.model
.name
.NonViralName
;
36 import eu
.etaxonomy
.cdm
.model
.name
.Rank
;
37 import eu
.etaxonomy
.cdm
.model
.name
.SpecimenTypeDesignationStatus
;
38 import eu
.etaxonomy
.cdm
.model
.name
.TaxonNameBase
;
39 import eu
.etaxonomy
.cdm
.model
.name
.TypeDesignationBase
;
40 import eu
.etaxonomy
.cdm
.persistence
.dao
.BeanInitializer
;
41 import eu
.etaxonomy
.cdm
.persistence
.query
.MatchMode
;
42 import eu
.etaxonomy
.cdm
.persistence
.query
.OrderHint
;
43 import eu
.etaxonomy
.cdm
.strategy
.TaggedText
;
44 import eu
.etaxonomy
.cdm
.strategy
.TaggedTextGenerator
;
46 public interface INameService
extends IIdentifiableEntityService
<TaxonNameBase
> {
49 public Map
<UUID
, TypeDesignationBase
> saveTypeDesignationAll(Collection
<TypeDesignationBase
> typeDesignationCollection
);
51 public Map
<UUID
, ReferencedEntityBase
> saveReferencedEntitiesAll(Collection
<ReferencedEntityBase
> referencedEntityCollection
);
53 public Map
<UUID
, HomotypicalGroup
> saveAllHomotypicalGroups(Collection
<HomotypicalGroup
> homotypicalGroups
);
55 public List
<NomenclaturalStatus
> getAllNomenclaturalStatus(int limit
, int start
);
57 public List
<TypeDesignationBase
> getAllTypeDesignations(int limit
, int start
);
63 public List
<TaxonNameBase
> getNamesByName(String name
);
66 * Returns all NonViralNames with a name cache that matches the given string
70 public List
<NonViralName
> getNamesByNameCache(String nameCache
);
74 * @param sessionObject An object that is attached to the session before executing the query
77 public List
getNamesByName(String name
, CdmBase sessionObject
);
79 // TODO: Remove getNamesByName() methods. Use findNamesByTitle() instead.
81 // FIXME candidate for harmonization?
82 public List
findNamesByTitle(String title
);
84 public List
findNamesByTitle(String title
, CdmBase sessionObject
);
86 public List
<HomotypicalGroup
> getAllHomotypicalGroups(int limit
, int start
);
89 public List
<RelationshipBase
> getAllRelationships(int limit
, int start
);
94 * @deprecated use VocabularyService#getVocabulary(VocabularyEnum) instead
96 public OrderedTermVocabulary
<Rank
> getRankVocabulary();
99 * Returns all NomenclaturalStatusTypes
101 * @deprecated use VocabularyService#getVocabulary(VocabularyEnum) instead
103 public TermVocabulary
<NomenclaturalStatusType
> getStatusTypeVocabulary();
106 * Returns TypeDesignationStatus vocabulary
108 * @deprecated use VocabularyService#getVocabulary(VocabularyEnum) instead
110 public TermVocabulary
<SpecimenTypeDesignationStatus
> getSpecimenTypeDesignationStatusVocabulary();
113 * Returns TypeDesignationStatus ordered vocabulary
115 * @deprecated use VocabularyService#getVocabulary(VocabularyEnum) instead
117 public OrderedTermVocabulary
<SpecimenTypeDesignationStatus
> getSpecimenTypeDesignationVocabulary();
120 * Returns all NameRelationshipTypes
122 * @deprecated use VocabularyService#getVocabulary(VocabularyEnum) instead
124 public TermVocabulary
<NameRelationshipType
> getNameRelationshipTypeVocabulary();
127 * Return a List of name relationships in which this name is related to
128 * another name, optionally filtered by relationship type
131 * the name on either the <i>"from side"</i> or on the
132 * <i>"to side"</i> of the relationship, depending on the
133 * <code>direction</code> of the relationship.
135 * the direction of the NameRelationship, may be null to return all relationships
137 * the relationship type (or null to return all relationships)
139 * The maximum number of relationships returned (can be null for
142 * The offset (in pageSize chunks) from the start of the result
146 * @param propertyPaths
147 * properties to initialize - see
148 * {@link BeanInitializer#initialize(Object, List)}
149 * @return a Pager of NameRelationship instances
151 public List
<NameRelationship
> listNameRelationships(TaxonNameBase name
, NameRelationship
.Direction direction
, NameRelationshipType type
, Integer pageSize
, Integer pageNumber
, List
<OrderHint
> orderHints
, List
<String
> propertyPaths
);
154 * Return a List of name relationships in which this name is related to another name, optionally filtered
155 * by relationship type
157 * @param name the name on the <i>"from side"</i> of the relationship
158 * @param direction the direction of the NameRelationship
159 * @param type the relationship type (or null to return all relationships)
160 * @param pageSize The maximum number of relationships returned (can be null for all relationships)
161 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
162 * @param orderHints may be null
163 * @param propertyPaths properties to initialize - see {@link BeanInitializer#initialize(Object, List)}
164 * @return a Pager of NameRelationship instances
166 public Pager
<NameRelationship
> pageNameRelationships(TaxonNameBase name
, NameRelationship
.Direction direction
, NameRelationshipType type
, Integer pageSize
, Integer pageNumber
, List
<OrderHint
> orderHints
, List
<String
> propertyPaths
);
169 * Return a List of relationships in which this name is related to another name, optionally filtered
170 * by relationship type
172 * @param name the name on the <i>"from side"</i> of the relationship
173 * @param type the relationship type (or null to return all relationships)
174 * @param pageSize The maximum number of relationships returned (can be null for all relationships)
175 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
176 * @param orderHints may be null
177 * @param propertyPaths properties to initialize - see {@link BeanInitializer#initialize(Object, List)}
178 * @return a Pager of NameRelationship instances
179 * @deprecated use {@link #listNameRelationships(TaxonNameBase, eu.etaxonomy.cdm.model.common.RelationshipBase.Direction, NameRelationshipType, Integer, Integer, List, List)} instead
182 public List
<NameRelationship
> listFromNameRelationships(TaxonNameBase name
, NameRelationshipType type
, Integer pageSize
, Integer pageNumber
, List
<OrderHint
> orderHints
, List
<String
> propertyPaths
);
185 * Return a List of relationships in which this name is related to another name, optionally filtered
186 * by relationship type
188 * @param name the name on the <i>"from side"</i> of the relationship
189 * @param type the relationship type (or null to return all relationships)
190 * @param pageSize The maximum number of relationships returned (can be null for all relationships)
191 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
192 * @param orderHints may be null
193 * @param propertyPaths properties to initialize - see {@link BeanInitializer#initialize(Object, List)}
194 * @return a Pager of NameRelationship instances
195 * @deprecated use {@link #pageNameRelationships(TaxonNameBase, eu.etaxonomy.cdm.model.common.RelationshipBase.Direction, NameRelationshipType, Integer, Integer, List, List)} instead
198 public Pager
<NameRelationship
> pageFromNameRelationships(TaxonNameBase name
, NameRelationshipType type
, Integer pageSize
, Integer pageNumber
, List
<OrderHint
> orderHints
, List
<String
> propertyPaths
);
201 * Return a List of relationships in which another name is related to this name, optionally filtered
202 * by relationship type
204 * @param name the name on the <i>"to side"</i> of the relationship
205 * @param type the relationship type (or null to return all relationships)
206 * @param pageSize The maximum number of relationships returned (can be null for all relationships)
207 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
208 * @param orderHints may be null
209 * @param propertyPaths properties to initialize - see {@link BeanInitializer#initialize(Object, List)}
210 * @return a Pager of NameRelationship instances
211 * @deprecated use {@link #listNameRelationships(TaxonNameBase, eu.etaxonomy.cdm.model.common.RelationshipBase.Direction, NameRelationshipType, Integer, Integer, List, List)} instead
214 public List
<NameRelationship
> listToNameRelationships(TaxonNameBase name
, NameRelationshipType type
, Integer pageSize
, Integer pageNumber
, List
<OrderHint
> orderHints
, List
<String
> propertyPaths
);
217 * Return a List of relationships in which another name is related to this name, optionally filtered
218 * by relationship type
220 * @param name the name on the <i>"to side"</i> of the relationship
221 * @param type the relationship type (or null to return all relationships)
222 * @param pageSize The maximum number of relationships returned (can be null for all relationships)
223 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
224 * @param orderHints may be null
225 * @param propertyPaths properties to initialize - see {@link BeanInitializer#initialize(Object, List)}
226 * @return a Pager of NameRelationship instances
227 * @deprecated use {@link #pageNameRelationships(TaxonNameBase, eu.etaxonomy.cdm.model.common.RelationshipBase.Direction, NameRelationshipType, Integer, Integer, List, List)} instead
230 public Pager
<NameRelationship
> pageToNameRelationships(TaxonNameBase name
, NameRelationshipType type
, Integer pageSize
, Integer pageNumber
, List
<OrderHint
> orderHints
, List
<String
> propertyPaths
);
234 * Return a List of hybrids related to this name, optionally filtered
235 * by hybrid relationship type
237 * @param name the name
238 * @param type the hybrid relationship type (or null to return all hybrids)
239 * @param pageSize The maximum number of hybrid relationships returned (can be null for all relationships)
240 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
241 * @param orderHints may be null
242 * @param propertyPaths properties to initialize - see {@link BeanInitializer#initialize(Object, List)}
243 * @return a Pager of HybridRelationship instances
245 public Pager
<HybridRelationship
> getHybridNames(NonViralName name
, HybridRelationshipType type
, Integer pageSize
, Integer pageNumber
, List
<OrderHint
> orderHints
, List
<String
> propertyPaths
);
248 * Return a List of types related to this name, optionally filtered
249 * by type designation status
251 * @param name the name
252 * @param status the type designation status (or null to return all types)
253 * @param pageSize The maximum number of types returned (can be null for all types)
254 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
255 * @return a Pager of TypeDesignationBase instances
257 public Pager
<TypeDesignationBase
> getTypeDesignations(TaxonNameBase name
,
258 SpecimenTypeDesignationStatus status
, Integer pageSize
, Integer pageNumber
);
260 public Pager
<TypeDesignationBase
> getTypeDesignations(TaxonNameBase name
,
261 SpecimenTypeDesignationStatus status
, Integer pageSize
, Integer pageNumber
, List
<String
> propertyPaths
);
265 * Returns a List of TaxonNameBase instances that match the properties passed
268 * @param infraGenericEpithet
269 * @param specificEpithet
270 * @param infraspecificEpithet
272 * @param pageSize The maximum number of names returned (can be null for all names)
273 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
274 * @param orderHints may be null
275 * @param propertyPaths properties to initialize - see {@link BeanInitializer#initialize(Object, List)}
276 * @return a Pager of TaxonNameBase instances
278 public Pager
<TaxonNameBase
> searchNames(String uninomial
, String infraGenericEpithet
, String specificEpithet
, String infraspecificEpithet
, Rank rank
, Integer pageSize
, Integer pageNumber
, List
<OrderHint
> orderHints
, List
<String
> propertyPaths
);
281 * Returns a Paged List of TaxonNameBase instances where the default field matches the String queryString (as interpreted by the Lucene QueryParser)
283 * @param clazz filter the results by class (or pass null to return all TaxonNameBase instances)
285 * @param pageSize The maximum number of names returned (can be null for all matching names)
286 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
288 * Supports path like <code>orderHints.propertyNames</code> which
289 * include *-to-one properties like createdBy.username or
290 * authorTeam.persistentTitleCache
291 * @param propertyPaths properties to be initialized
292 * @return a Pager TaxonNameBase instances
293 * @see <a href="http://lucene.apache.org/java/2_4_0/queryparsersyntax.html">Apache Lucene - Query Parser Syntax</a>
295 public Pager
<TaxonNameBase
> search(Class
<?
extends TaxonNameBase
> clazz
, String queryString
, Integer pageSize
, Integer pageNumber
, List
<OrderHint
> orderHints
, List
<String
> propertyPaths
);
298 * Returns a map that holds uuid, titleCache pairs of all names in the current database
301 * a <code>Map</code> containing uuid and titleCache of names
303 public List
<UuidAndTitleCache
> getUuidAndTitleCacheOfNames();
306 * Return a Pager of names matching the given query string, optionally filtered by class, optionally with a particular MatchMode
308 * @param clazz filter by class - can be null to include all instances of type T
309 * @param queryString the query string to filter by
310 * @param matchmode use a particular type of matching (can be null - defaults to exact matching)
311 * @param criteria additional criteria to filter by
312 * @param pageSize The maximum number of objects returned (can be null for all objects)
313 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
314 * @param propertyPaths properties to initialize - see {@link BeanInitializer#initialize(Object, List)}
316 * Supports path like <code>orderHints.propertyNames</code> which
317 * include *-to-one properties like createdBy.username or
318 * authorTeam.persistentTitleCache
319 * @return a paged list of instances of type T matching the queryString
321 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
);
324 * Returns a homotypical group with the given UUID or null if not homotypical group exists with that UUID
326 * @param uuid the uuid of the homotypical group
327 * @return a homotypical group
329 public HomotypicalGroup
findHomotypicalGroup(UUID uuid
);
331 public List
<TaggedText
> getTaggedName(UUID uuid
);