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
.pager
.Pager
;
22 import eu
.etaxonomy
.cdm
.model
.media
.MediaRepresentation
;
23 import eu
.etaxonomy
.cdm
.model
.name
.Rank
;
24 import eu
.etaxonomy
.cdm
.model
.taxon
.Classification
;
25 import eu
.etaxonomy
.cdm
.model
.taxon
.ITaxonTreeNode
;
26 import eu
.etaxonomy
.cdm
.model
.taxon
.Taxon
;
27 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonNode
;
28 import eu
.etaxonomy
.cdm
.persistence
.dto
.ClassificationLookupDTO
;
29 import eu
.etaxonomy
.cdm
.persistence
.dto
.UuidAndTitleCache
;
30 import eu
.etaxonomy
.cdm
.persistence
.query
.OrderHint
;
35 * @created Sep 21, 2009
37 public interface IClassificationService
extends IIdentifiableEntityService
<Classification
> {
44 public TaxonNode
getTaxonNodeByUuid(UUID uuid
);
51 public ITaxonTreeNode
getTreeNodeByUuid(UUID uuid
);
55 * Returns the root node of the the given classification (specified by its UUID)
56 * @param classificationUuid the uuid of the classification
57 * @return the root node of the classification
59 public TaxonNode
getRootNode(UUID classificationUuid
);
66 * @param propertyPaths
69 public List
<Classification
> listClassifications(Integer limit
, Integer start
, List
<OrderHint
> orderHints
, List
<String
> propertyPaths
);
74 * @param classificationUuid
75 * @param propertyPaths
77 * @deprecated use loadTaxonNode(TaxonNode taxonNode, ...) instead
78 * if you have a classification and a taxon that is in it, you should also have the according taxonNode
81 public TaxonNode
loadTaxonNodeByTaxon(Taxon taxon
, UUID classificationUuid
, List
<String
> propertyPaths
);
86 * @param propertyPaths
88 * @deprecated use TaxonNodeService instead
91 public TaxonNode
loadTaxonNode(TaxonNode taxonNode
, List
<String
> propertyPaths
);
94 * Loads all TaxonNodes of the specified classification for a given Rank or lower.
95 * If a branch of the classification tree is not containing a TaxonNode with a Taxon at the given
96 * Rank the according node associated with the next lower Rank is taken as root node in this case.
97 * So the nodes returned may reference Taxa with different Ranks.
99 * If the <code>rank</code> is null the absolute root nodes will be returned.
101 * @param classification may be null for all classifications
102 * @param rank the set to null for to get the root nodes of classifications
103 * @param pageSize The maximum number of relationships returned (can be null for all relationships)
104 * @param pageIndex The offset (in pageSize chunks) from the start of the result set (0 - based)
105 * @param propertyPaths
109 public List
<TaxonNode
> listRankSpecificRootNodes(Classification classification
, Rank rank
, Integer pageSize
, Integer pageIndex
, List
<String
> propertyPaths
);
113 * Loads all TaxonNodes of the specified classification for a given Rank or lower.
114 * If a branch of the classification tree is not containing a TaxonNode with a Taxon at the given
115 * Rank the according node associated with the next lower Rank is taken as root node in this case.
116 * So the nodes returned may reference Taxa with different Ranks.
118 * If the <code>rank</code> is null the absolute root nodes will be returned.
120 * @param classification may be null for all classifications
121 * @param rank the set to null for to get the root nodes of classifications
122 * @param pageSize The maximum number of relationships returned (can be null for all relationships)
123 * @param pageIndex The offset (in pageSize chunks) from the start of the result set (0 - based)
124 * @param propertyPaths
128 public Pager
<TaxonNode
> pageRankSpecificRootNodes(Classification classification
, Rank rank
, Integer pageSize
, Integer pageIndex
, List
<String
> propertyPaths
);
133 * specifies the root level of the classification, may be null.
134 * Nodes of this rank or in case this rank does not exist in the
135 * current branch the next lower rank is taken as root node for
136 * this rank henceforth called the <b>base node</b>.
137 * @param propertyPaths
138 * the initialization strategy for the returned TaxonNode
140 * @return the path of nodes from the <b>base node</b> to the node of the
143 public List
<TaxonNode
> loadTreeBranch(TaxonNode taxonNode
, Rank baseRank
, List
<String
> propertyPaths
);
146 * Although this method seems to be a redundant alternative to {@link #loadChildNodesOfTaxonNode(TaxonNode, List)} it is an important
147 * alternative from which web services benefit. Without this method the web service controller method, which operates outside of the
148 * transaction, would have to initialize the full taxon tree with all nodes of the taxon.
149 * This would be rather slow compared to using this method.
151 * @param classification
152 * the classification to be used
154 * specifies the root level of the classification, may be null.
155 * Nodes of this rank or in case this rank does not exist in the
156 * current branch the next lower rank is taken as as root node for
157 * this rank henceforth called the <b>base node</b>.
158 * @param propertyPaths
159 * the initialization strategy for the returned TaxonNode
161 * @return the path of nodes from the <b>base node</b> to the node of the specified
164 public List
<TaxonNode
> loadTreeBranchToTaxon(Taxon taxon
, Classification classification
, Rank baseRank
, List
<String
> propertyPaths
);
170 * @param classificationUuid
171 * @param propertyPaths
174 public List
<TaxonNode
> listChildNodesOfTaxon(UUID taxonUuid
, UUID classificationUuid
, Integer pageSize
, Integer pageIndex
, List
<String
> propertyPaths
);
178 * @param propertyPaths
179 * @deprecated move to TaxonNodeService
183 public List
<TaxonNode
> loadChildNodesOfTaxonNode(TaxonNode taxonNode
, List
<String
> propertyPaths
);
187 * @param classification
190 public List
<UuidAndTitleCache
<TaxonNode
>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(Classification classification
);
195 * @param propertyPaths
198 * @param widthOrDuration
202 * @deprecated use getAllMediaForChildNodes(TaxonNode taxonNode, ...) instead
203 * if you have a classification and a taxon that is in it, you should also have the according taxonNode
206 public Map
<UUID
, List
<MediaRepresentation
>> getAllMediaForChildNodes(Taxon taxon
, Classification taxTree
, List
<String
> propertyPaths
, int size
, int height
, int widthOrDuration
, String
[] mimeTypes
);
211 * @param propertyPaths
214 * @param widthOrDuration
218 public Map
<UUID
, List
<MediaRepresentation
>> getAllMediaForChildNodes(TaxonNode taxonNode
, List
<String
> propertyPaths
, int size
, int height
, int widthOrDuration
, String
[] mimeTypes
);
224 * @deprecated use TaxonNodeService instead
227 public UUID
removeTaxonNode(TaxonNode taxonNode
);
233 * @deprecated use TaxonNodeService instead
236 public UUID
saveTaxonNode(TaxonNode taxonNode
);
240 * @param taxonNodeCollection
242 * @deprecated use TaxonNodeService instead
245 public Map
<UUID
, TaxonNode
> saveTaxonNodeAll(Collection
<TaxonNode
> taxonNodeCollection
);
253 public UUID
removeTreeNode(ITaxonTreeNode treeNode
);
260 public UUID
saveTreeNode(ITaxonTreeNode treeNode
);
263 public List
<TaxonNode
> getAllNodes();
265 public UpdateResult
createHierarchyInClassification(Classification classification
, CreateHierarchyForClassificationConfigurator configurator
);
268 * @param classificationUuid
272 public List
<UuidAndTitleCache
<TaxonNode
>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(UUID classificationUuid
, List
<UUID
> excludeTaxa
);
275 * @param classificationUuid
281 List
<UuidAndTitleCache
<TaxonNode
>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(
282 UUID classificationUuid
, List
<UUID
> excludeTaxa
, Integer limit
, String pattern
);
285 * @param classification
291 List
<UuidAndTitleCache
<TaxonNode
>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(
292 Classification classification
, List
<UUID
> excludeTaxa
, Integer limit
, String pattern
);
296 * @param classificationUuid
299 * @param propertyPaths
302 List
<TaxonNode
> listSiblingsOfTaxon(UUID taxonUuid
, UUID classificationUuid
, Integer pageSize
, Integer pageIndex
,
303 List
<String
> propertyPaths
);
307 * @param classificationUuid
310 * @param propertyPaths
313 Pager
<TaxonNode
> pageSiblingsOfTaxon(UUID taxonUuid
, UUID classificationUuid
, Integer pageSize
, Integer pageIndex
,
314 List
<String
> propertyPaths
);
317 * @param classification
320 ClassificationLookupDTO
classificationLookup(Classification classification
);
322 DeleteResult
delete(UUID classificationUuid
, TaxonDeletionConfigurator config
);
325 * Returns the higher taxon id for each taxon in taxonUuids.
326 * The highter taxon is defined by rank where the lowest rank equal or above minRank
327 * is taken. If maxRank <> null and no taxon exists with minRank <= rank <= maxRank
328 * no higher taxon is returned for this taxon.
335 List
<GroupedTaxonDTO
> groupTaxaByHigherTaxon(List
<UUID
> taxonUuids
, UUID classificationUuid
, Rank minRank
, Rank maxRank
);