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 eu
.etaxonomy
.cdm
.api
.service
.config
.CreateHierarchyForClassificationConfigurator
;
19 import eu
.etaxonomy
.cdm
.api
.service
.config
.TaxonDeletionConfigurator
;
20 import eu
.etaxonomy
.cdm
.api
.service
.dto
.GroupedTaxonDTO
;
21 import eu
.etaxonomy
.cdm
.api
.service
.dto
.TaxonInContextDTO
;
22 import eu
.etaxonomy
.cdm
.api
.service
.pager
.Pager
;
23 import eu
.etaxonomy
.cdm
.model
.common
.MarkerType
;
24 import eu
.etaxonomy
.cdm
.model
.media
.MediaRepresentation
;
25 import eu
.etaxonomy
.cdm
.model
.name
.Rank
;
26 import eu
.etaxonomy
.cdm
.model
.reference
.Reference
;
27 import eu
.etaxonomy
.cdm
.model
.taxon
.Classification
;
28 import eu
.etaxonomy
.cdm
.model
.taxon
.ITaxonTreeNode
;
29 import eu
.etaxonomy
.cdm
.model
.taxon
.Taxon
;
30 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonNode
;
31 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonRelationshipType
;
32 import eu
.etaxonomy
.cdm
.persistence
.dto
.ClassificationLookupDTO
;
33 import eu
.etaxonomy
.cdm
.persistence
.dto
.UuidAndTitleCache
;
34 import eu
.etaxonomy
.cdm
.persistence
.query
.OrderHint
;
39 * @created Sep 21, 2009
41 public interface IClassificationService
extends IIdentifiableEntityService
<Classification
> {
48 public TaxonNode
getTaxonNodeByUuid(UUID uuid
);
55 public ITaxonTreeNode
getTreeNodeByUuid(UUID uuid
);
59 * Returns the root node of the the given classification (specified by its UUID)
60 * @param classificationUuid the uuid of the classification
61 * @return the root node of the classification
63 public TaxonNode
getRootNode(UUID classificationUuid
);
65 public UUID
getTaxonNodeUuidByTaxonUuid(UUID classificationUuid
, UUID taxonUuid
);
68 * Clones an existing classification including all taxa and taxon nodes.
71 * @param relationshipType
74 public UpdateResult
cloneClassification(UUID classificationUuid
, String name
, Reference sec
, TaxonRelationshipType relationshipType
);
81 * @param propertyPaths
84 public List
<Classification
> listClassifications(Integer limit
, Integer start
, List
<OrderHint
> orderHints
, List
<String
> propertyPaths
);
89 * @param classificationUuid
90 * @param propertyPaths
92 * @deprecated use loadTaxonNode(TaxonNode taxonNode, ...) instead
93 * if you have a classification and a taxon that is in it, you should also have the according taxonNode
96 public TaxonNode
loadTaxonNodeByTaxon(Taxon taxon
, UUID classificationUuid
, List
<String
> propertyPaths
);
101 * @param propertyPaths
103 * @deprecated use TaxonNodeService instead
106 public TaxonNode
loadTaxonNode(TaxonNode taxonNode
, List
<String
> propertyPaths
);
109 * Loads all TaxonNodes of the specified classification for a given Rank or lower.
110 * If a branch of the classification tree is not containing a TaxonNode with a Taxon at the given
111 * Rank the according node associated with the next lower Rank is taken as root node in this case.
112 * So the nodes returned may reference Taxa with different Ranks.
114 * If the <code>rank</code> is null the absolute root nodes will be returned.
116 * @param classification may be null for all classifications
117 * @param rank the set to null for to get the root nodes of classifications
118 * @param pageSize The maximum number of relationships returned (can be null for all relationships)
119 * @param pageIndex The offset (in pageSize chunks) from the start of the result set (0 - based)
120 * @param propertyPaths
124 public List
<TaxonNode
> listRankSpecificRootNodes(Classification classification
, Rank rank
, Integer pageSize
, Integer pageIndex
, List
<String
> propertyPaths
);
128 * Loads all TaxonNodes of the specified classification for a given Rank or lower.
129 * If a branch of the classification tree is not containing a TaxonNode with a Taxon at the given
130 * Rank the according node associated with the next lower Rank is taken as root node in this case.
131 * So the nodes returned may reference Taxa with different Ranks.
133 * If the <code>rank</code> is null the absolute root nodes will be returned.
135 * @param classification may be null for all classifications
136 * @param rank the set to null for to get the root nodes of classifications
137 * @param pageSize The maximum number of relationships returned (can be null for all relationships)
138 * @param pageIndex The offset (in pageSize chunks) from the start of the result set (0 - based)
139 * @param propertyPaths
143 public Pager
<TaxonNode
> pageRankSpecificRootNodes(Classification classification
, Rank rank
, Integer pageSize
, Integer pageIndex
, List
<String
> propertyPaths
);
148 * specifies the root level of the classification, may be null.
149 * Nodes of this rank or in case this rank does not exist in the
150 * current branch the next lower rank is taken as root node for
151 * this rank henceforth called the <b>base node</b>.
152 * @param propertyPaths
153 * the initialization strategy for the returned TaxonNode
155 * @return the path of nodes from the <b>base node</b> to the node of the
158 public List
<TaxonNode
> loadTreeBranch(TaxonNode taxonNode
, Rank baseRank
, List
<String
> propertyPaths
);
161 * Although this method seems to be a redundant alternative to {@link #loadChildNodesOfTaxonNode(TaxonNode, List)} it is an important
162 * alternative from which web services benefit. Without this method the web service controller method, which operates outside of the
163 * transaction, would have to initialize the full taxon tree with all nodes of the taxon.
164 * This would be rather slow compared to using this method.
166 * @param classification
167 * the classification to be used
169 * specifies the root level of the classification, may be null.
170 * Nodes of this rank or in case this rank does not exist in the
171 * current branch the next lower rank is taken as as root node for
172 * this rank henceforth called the <b>base node</b>.
173 * @param propertyPaths
174 * the initialization strategy for the returned TaxonNode
176 * @return the path of nodes from the <b>base node</b> to the node of the specified
179 public List
<TaxonNode
> loadTreeBranchToTaxon(Taxon taxon
, Classification classification
, Rank baseRank
, List
<String
> propertyPaths
);
185 * @param classificationUuid
186 * @param propertyPaths
189 public List
<TaxonNode
> listChildNodesOfTaxon(UUID taxonUuid
, UUID classificationUuid
, Integer pageSize
, Integer pageIndex
, List
<String
> propertyPaths
);
193 * @param propertyPaths
194 * @deprecated move to TaxonNodeService
198 public List
<TaxonNode
> loadChildNodesOfTaxonNode(TaxonNode taxonNode
, List
<String
> propertyPaths
);
202 * @param classification
205 public List
<UuidAndTitleCache
<TaxonNode
>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(Classification classification
);
210 * @param propertyPaths
213 * @param widthOrDuration
217 * @deprecated use getAllMediaForChildNodes(TaxonNode taxonNode, ...) instead
218 * if you have a classification and a taxon that is in it, you should also have the according taxonNode
221 public Map
<UUID
, List
<MediaRepresentation
>> getAllMediaForChildNodes(Taxon taxon
, Classification taxTree
, List
<String
> propertyPaths
, int size
, int height
, int widthOrDuration
, String
[] mimeTypes
);
226 * @param propertyPaths
229 * @param widthOrDuration
233 public Map
<UUID
, List
<MediaRepresentation
>> getAllMediaForChildNodes(TaxonNode taxonNode
, List
<String
> propertyPaths
, int size
, int height
, int widthOrDuration
, String
[] mimeTypes
);
239 * @deprecated use TaxonNodeService instead
242 public UUID
removeTaxonNode(TaxonNode taxonNode
);
248 * @deprecated use TaxonNodeService instead
251 public UUID
saveTaxonNode(TaxonNode taxonNode
);
255 * @param taxonNodeCollection
257 * @deprecated use TaxonNodeService instead
260 public Map
<UUID
, TaxonNode
> saveTaxonNodeAll(Collection
<TaxonNode
> taxonNodeCollection
);
268 public UUID
removeTreeNode(ITaxonTreeNode treeNode
);
275 public UUID
saveTreeNode(ITaxonTreeNode treeNode
);
278 public List
<TaxonNode
> getAllNodes();
280 public UpdateResult
createHierarchyInClassification(Classification classification
, CreateHierarchyForClassificationConfigurator configurator
);
283 * @param classificationUuid
287 public List
<UuidAndTitleCache
<TaxonNode
>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(UUID classificationUuid
);
290 * @param classificationUuid
296 List
<UuidAndTitleCache
<TaxonNode
>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(
297 UUID classificationUuid
, Integer limit
, String pattern
);
300 * @param classification
306 List
<UuidAndTitleCache
<TaxonNode
>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(
307 Classification classification
, Integer limit
, String pattern
);
311 * @param classificationUuid
314 * @param propertyPaths
317 List
<TaxonNode
> listSiblingsOfTaxon(UUID taxonUuid
, UUID classificationUuid
, Integer pageSize
, Integer pageIndex
,
318 List
<String
> propertyPaths
);
322 * @param classificationUuid
325 * @param propertyPaths
328 Pager
<TaxonNode
> pageSiblingsOfTaxon(UUID taxonUuid
, UUID classificationUuid
, Integer pageSize
, Integer pageIndex
,
329 List
<String
> propertyPaths
);
332 * @param classification
335 ClassificationLookupDTO
classificationLookup(Classification classification
);
337 DeleteResult
delete(UUID classificationUuid
, TaxonDeletionConfigurator config
);
340 * Returns the higher taxon id for each taxon in taxonUuids.
341 * The highter taxon is defined by rank where the lowest rank equal or above minRank
342 * is taken. If maxRank <> null and no taxon exists with minRank <= rank <= maxRank
343 * no higher taxon is returned for this taxon.
350 List
<GroupedTaxonDTO
> groupTaxaByHigherTaxon(List
<UUID
> taxonUuids
, UUID classificationUuid
, Rank minRank
, Rank maxRank
);
354 * @param classificationUuid
359 public List
<GroupedTaxonDTO
> groupTaxaByMarkedParents(List
<UUID
> taxonUuids
, UUID classificationUuid
,
360 MarkerType markerType
, Boolean value
);
364 * Returns the most relevant data of a taxon/taxon node, including children, synonyms
365 * and certain ancestors if required.
366 * @param classificationUuid
369 * @param ancestorMarkers
372 public TaxonInContextDTO
getTaxonInContext(UUID classificationUuid
, UUID taxonUuid
,
373 Boolean doChildren
, Boolean doSynonyms
, List
<UUID
> ancestorMarkers
,
374 NodeSortMode sortMode
);
377 * @param classification
380 public UUID
saveClassification(Classification classification
);