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
;
44 public interface INameService
extends IIdentifiableEntityService
<TaxonNameBase
> {
47 public Map
<UUID
, TypeDesignationBase
> saveTypeDesignationAll(Collection
<TypeDesignationBase
> typeDesignationCollection
);
49 public Map
<UUID
, ReferencedEntityBase
> saveReferencedEntitiesAll(Collection
<ReferencedEntityBase
> referencedEntityCollection
);
51 public Map
<UUID
, HomotypicalGroup
> saveAllHomotypicalGroups(Collection
<HomotypicalGroup
> homotypicalGroups
);
53 public List
<NomenclaturalStatus
> getAllNomenclaturalStatus(int limit
, int start
);
55 public List
<TypeDesignationBase
> getAllTypeDesignations(int limit
, int start
);
61 public List
<TaxonNameBase
> getNamesByName(String name
);
64 * Returns all NonViralNames with a name cache that matches the given string
68 public List
<NonViralName
> getNamesByNameCache(String nameCache
);
72 * @param sessionObject An object that is attached to the session before executing the query
75 public List
getNamesByName(String name
, CdmBase sessionObject
);
77 // TODO: Remove getNamesByName() methods. Use findNamesByTitle() instead.
79 // FIXME candidate for harmonization?
80 public List
findNamesByTitle(String title
);
82 public List
findNamesByTitle(String title
, CdmBase sessionObject
);
85 * Finds taxon name(s) according to specifications in configurator
90 public List
<TaxonNameBase
> findByTitle(IIdentifiableEntityServiceConfigurator config
);
92 public List
<HomotypicalGroup
> getAllHomotypicalGroups(int limit
, int start
);
95 public List
<RelationshipBase
> getAllRelationships(int limit
, int start
);
100 * @deprecated use TermService#getVocabulary(VocabularyType) instead
102 public OrderedTermVocabulary
<Rank
> getRankVocabulary();
105 * Returns all NomenclaturalStatusTypes
107 * @deprecated use TermService#getVocabulary(VocabularyType) instead
109 public TermVocabulary
<NomenclaturalStatusType
> getStatusTypeVocabulary();
112 * Returns TypeDesignationStatus vocabulary
114 * @deprecated use TermService#getVocabulary(VocabularyType) instead
116 public TermVocabulary
<SpecimenTypeDesignationStatus
> getSpecimenTypeDesignationStatusVocabulary();
119 * Returns TypeDesignationStatus ordered vocabulary
121 * @deprecated use TermService#getVocabulary(VocabularyType) instead
123 public OrderedTermVocabulary
<SpecimenTypeDesignationStatus
> getSpecimenTypeDesignationVocabulary();
126 * Returns all NameRelationshipTypes
128 * @deprecated use TermService#getVocabulary(VocabularyType) instead
130 public TermVocabulary
<NameRelationshipType
> getNameRelationshipTypeVocabulary();
133 * Return a List of name relationships in which this name is related to
134 * another name, optionally filtered by relationship type
137 * the name on either the <i>"from side"</i> or on the
138 * <i>"to side"</i> of the relationship, depending on the
139 * <code>direction</code> of the relationship.
141 * the direction of the NameRelationship, may be null to return all relationships
143 * the relationship type (or null to return all relationships)
145 * The maximum number of relationships returned (can be null for
148 * The offset (in pageSize chunks) from the start of the result
152 * @param propertyPaths
153 * properties to initialize - see
154 * {@link BeanInitializer#initialize(Object, List)}
155 * @return a Pager of NameRelationship instances
157 public List
<NameRelationship
> listNameRelationships(TaxonNameBase name
, NameRelationship
.Direction direction
, NameRelationshipType type
, Integer pageSize
, Integer pageNumber
, List
<OrderHint
> orderHints
, List
<String
> propertyPaths
);
160 * Return a List of name relationships in which this name is related to another name, optionally filtered
161 * by relationship type
163 * @param name the name on the <i>"from side"</i> of the relationship
164 * @param direction the direction of the NameRelationship
165 * @param type the relationship type (or null to return all relationships)
166 * @param pageSize The maximum number of relationships returned (can be null for all relationships)
167 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
168 * @param orderHints may be null
169 * @param propertyPaths properties to initialize - see {@link BeanInitializer#initialize(Object, List)}
170 * @return a Pager of NameRelationship instances
172 public Pager
<NameRelationship
> pageNameRelationships(TaxonNameBase name
, NameRelationship
.Direction direction
, NameRelationshipType type
, Integer pageSize
, Integer pageNumber
, List
<OrderHint
> orderHints
, List
<String
> propertyPaths
);
175 * Return a List of relationships in which this name is related to another name, optionally filtered
176 * by relationship type
178 * @param name the name on the <i>"from side"</i> of the relationship
179 * @param type the relationship type (or null to return all relationships)
180 * @param pageSize The maximum number of relationships returned (can be null for all relationships)
181 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
182 * @param orderHints may be null
183 * @param propertyPaths properties to initialize - see {@link BeanInitializer#initialize(Object, List)}
184 * @return a Pager of NameRelationship instances
185 * @deprecated use {@link #listNameRelationships(TaxonNameBase, eu.etaxonomy.cdm.model.common.RelationshipBase.Direction, NameRelationshipType, Integer, Integer, List, List)} instead
188 public List
<NameRelationship
> listFromNameRelationships(TaxonNameBase name
, NameRelationshipType type
, Integer pageSize
, Integer pageNumber
, List
<OrderHint
> orderHints
, List
<String
> propertyPaths
);
191 * Return a List of relationships in which this name is related to another name, optionally filtered
192 * by relationship type
194 * @param name the name on the <i>"from side"</i> of the relationship
195 * @param type the relationship type (or null to return all relationships)
196 * @param pageSize The maximum number of relationships returned (can be null for all relationships)
197 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
198 * @param orderHints may be null
199 * @param propertyPaths properties to initialize - see {@link BeanInitializer#initialize(Object, List)}
200 * @return a Pager of NameRelationship instances
201 * @deprecated use {@link #pageNameRelationships(TaxonNameBase, eu.etaxonomy.cdm.model.common.RelationshipBase.Direction, NameRelationshipType, Integer, Integer, List, List)} instead
204 public Pager
<NameRelationship
> pageFromNameRelationships(TaxonNameBase name
, NameRelationshipType type
, Integer pageSize
, Integer pageNumber
, List
<OrderHint
> orderHints
, List
<String
> propertyPaths
);
207 * Return a List of relationships in which another name is related to this name, optionally filtered
208 * by relationship type
210 * @param name the name on the <i>"to side"</i> of the relationship
211 * @param type the relationship type (or null to return all relationships)
212 * @param pageSize The maximum number of relationships returned (can be null for all relationships)
213 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
214 * @param orderHints may be null
215 * @param propertyPaths properties to initialize - see {@link BeanInitializer#initialize(Object, List)}
216 * @return a Pager of NameRelationship instances
217 * @deprecated use {@link #listNameRelationships(TaxonNameBase, eu.etaxonomy.cdm.model.common.RelationshipBase.Direction, NameRelationshipType, Integer, Integer, List, List)} instead
220 public List
<NameRelationship
> listToNameRelationships(TaxonNameBase name
, NameRelationshipType type
, Integer pageSize
, Integer pageNumber
, List
<OrderHint
> orderHints
, List
<String
> propertyPaths
);
223 * Return a List of relationships in which another name is related to this name, optionally filtered
224 * by relationship type
226 * @param name the name on the <i>"to side"</i> of the relationship
227 * @param type the relationship type (or null to return all relationships)
228 * @param pageSize The maximum number of relationships returned (can be null for all relationships)
229 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
230 * @param orderHints may be null
231 * @param propertyPaths properties to initialize - see {@link BeanInitializer#initialize(Object, List)}
232 * @return a Pager of NameRelationship instances
233 * @deprecated use {@link #pageNameRelationships(TaxonNameBase, eu.etaxonomy.cdm.model.common.RelationshipBase.Direction, NameRelationshipType, Integer, Integer, List, List)} instead
236 public Pager
<NameRelationship
> pageToNameRelationships(TaxonNameBase name
, NameRelationshipType type
, Integer pageSize
, Integer pageNumber
, List
<OrderHint
> orderHints
, List
<String
> propertyPaths
);
240 * Return a List of hybrids related to this name, optionally filtered
241 * by hybrid relationship type
243 * @param name the name
244 * @param type the hybrid relationship type (or null to return all hybrids)
245 * @param pageSize The maximum number of hybrid relationships returned (can be null for all relationships)
246 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
247 * @param orderHints may be null
248 * @param propertyPaths properties to initialize - see {@link BeanInitializer#initialize(Object, List)}
249 * @return a Pager of HybridRelationship instances
251 public Pager
<HybridRelationship
> getHybridNames(NonViralName name
, HybridRelationshipType type
, Integer pageSize
, Integer pageNumber
, List
<OrderHint
> orderHints
, List
<String
> propertyPaths
);
254 * Return a List of types related to this name, optionally filtered
255 * by type designation status
257 * @param name the name
258 * @param status the type designation status (or null to return all types)
259 * @param pageSize The maximum number of types returned (can be null for all types)
260 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
261 * @return a Pager of TypeDesignationBase instances
263 public Pager
<TypeDesignationBase
> getTypeDesignations(TaxonNameBase name
,
264 SpecimenTypeDesignationStatus status
, Integer pageSize
, Integer pageNumber
);
266 public Pager
<TypeDesignationBase
> getTypeDesignations(TaxonNameBase name
,
267 SpecimenTypeDesignationStatus status
, Integer pageSize
, Integer pageNumber
, List
<String
> propertyPaths
);
271 * Returns a List of TaxonNameBase instances that match the properties passed
274 * @param infraGenericEpithet
275 * @param specificEpithet
276 * @param infraspecificEpithet
278 * @param pageSize The maximum number of names returned (can be null for all names)
279 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
280 * @param orderHints may be null
281 * @param propertyPaths properties to initialize - see {@link BeanInitializer#initialize(Object, List)}
282 * @return a Pager of TaxonNameBase instances
284 public Pager
<TaxonNameBase
> searchNames(String uninomial
, String infraGenericEpithet
, String specificEpithet
, String infraspecificEpithet
, Rank rank
, Integer pageSize
, Integer pageNumber
, List
<OrderHint
> orderHints
, List
<String
> propertyPaths
);
287 * Returns a Paged List of TaxonNameBase instances where the default field matches the String queryString (as interpreted by the Lucene QueryParser)
289 * @param clazz filter the results by class (or pass null to return all TaxonNameBase instances)
291 * @param pageSize The maximum number of names returned (can be null for all matching names)
292 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
294 * Supports path like <code>orderHints.propertyNames</code> which
295 * include *-to-one properties like createdBy.username or
296 * authorTeam.persistentTitleCache
297 * @param propertyPaths properties to be initialized
298 * @return a Pager TaxonNameBase instances
299 * @see <a href="http://lucene.apache.org/java/2_4_0/queryparsersyntax.html">Apache Lucene - Query Parser Syntax</a>
301 public Pager
<TaxonNameBase
> search(Class
<?
extends TaxonNameBase
> clazz
, String queryString
, Integer pageSize
, Integer pageNumber
, List
<OrderHint
> orderHints
, List
<String
> propertyPaths
);
304 * Returns a map that holds uuid, titleCache pairs of all names in the current database
307 * a <code>Map</code> containing uuid and titleCache of names
309 public List
<UuidAndTitleCache
> getUuidAndTitleCacheOfNames();
312 * Return a Pager of names matching the given query string, optionally filtered by class, optionally with a particular MatchMode
314 * @param clazz filter by class - can be null to include all instances of type T
315 * @param queryString the query string to filter by
316 * @param matchmode use a particular type of matching (can be null - defaults to exact matching)
317 * @param criteria additional criteria to filter by
318 * @param pageSize The maximum number of objects returned (can be null for all objects)
319 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
320 * @param propertyPaths properties to initialize - see {@link BeanInitializer#initialize(Object, List)}
322 * Supports path like <code>orderHints.propertyNames</code> which
323 * include *-to-one properties like createdBy.username or
324 * authorTeam.persistentTitleCache
325 * @return a paged list of instances of type T matching the queryString
327 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
);
330 * Returns a homotypical group with the given UUID or null if not homotypical group exists with that UUID
332 * @param uuid the uuid of the homotypical group
333 * @return a homotypical group
335 public HomotypicalGroup
findHomotypicalGroup(UUID uuid
);