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
);
61 public UUID
getTaxonNodeUuidByTaxonUuid(UUID classificationUuid
, UUID taxonUuid
);
68 * @param propertyPaths
71 public List
<Classification
> listClassifications(Integer limit
, Integer start
, List
<OrderHint
> orderHints
, List
<String
> propertyPaths
);
76 * @param classificationUuid
77 * @param propertyPaths
79 * @deprecated use loadTaxonNode(TaxonNode taxonNode, ...) instead
80 * if you have a classification and a taxon that is in it, you should also have the according taxonNode
83 public TaxonNode
loadTaxonNodeByTaxon(Taxon taxon
, UUID classificationUuid
, List
<String
> propertyPaths
);
88 * @param propertyPaths
90 * @deprecated use TaxonNodeService instead
93 public TaxonNode
loadTaxonNode(TaxonNode taxonNode
, List
<String
> propertyPaths
);
96 * Loads all TaxonNodes of the specified classification for a given Rank or lower.
97 * If a branch of the classification tree is not containing a TaxonNode with a Taxon at the given
98 * Rank the according node associated with the next lower Rank is taken as root node in this case.
99 * So the nodes returned may reference Taxa with different Ranks.
101 * If the <code>rank</code> is null the absolute root nodes will be returned.
103 * @param classification may be null for all classifications
104 * @param rank the set to null for to get the root nodes of classifications
105 * @param pageSize The maximum number of relationships returned (can be null for all relationships)
106 * @param pageIndex The offset (in pageSize chunks) from the start of the result set (0 - based)
107 * @param propertyPaths
111 public List
<TaxonNode
> listRankSpecificRootNodes(Classification classification
, Rank rank
, Integer pageSize
, Integer pageIndex
, List
<String
> propertyPaths
);
115 * Loads all TaxonNodes of the specified classification for a given Rank or lower.
116 * If a branch of the classification tree is not containing a TaxonNode with a Taxon at the given
117 * Rank the according node associated with the next lower Rank is taken as root node in this case.
118 * So the nodes returned may reference Taxa with different Ranks.
120 * If the <code>rank</code> is null the absolute root nodes will be returned.
122 * @param classification may be null for all classifications
123 * @param rank the set to null for to get the root nodes of classifications
124 * @param pageSize The maximum number of relationships returned (can be null for all relationships)
125 * @param pageIndex The offset (in pageSize chunks) from the start of the result set (0 - based)
126 * @param propertyPaths
130 public Pager
<TaxonNode
> pageRankSpecificRootNodes(Classification classification
, Rank rank
, Integer pageSize
, Integer pageIndex
, List
<String
> propertyPaths
);
135 * specifies the root level of the classification, may be null.
136 * Nodes of this rank or in case this rank does not exist in the
137 * current branch the next lower rank is taken as root node for
138 * this rank henceforth called the <b>base node</b>.
139 * @param propertyPaths
140 * the initialization strategy for the returned TaxonNode
142 * @return the path of nodes from the <b>base node</b> to the node of the
145 public List
<TaxonNode
> loadTreeBranch(TaxonNode taxonNode
, Rank baseRank
, List
<String
> propertyPaths
);
148 * Although this method seems to be a redundant alternative to {@link #loadChildNodesOfTaxonNode(TaxonNode, List)} it is an important
149 * alternative from which web services benefit. Without this method the web service controller method, which operates outside of the
150 * transaction, would have to initialize the full taxon tree with all nodes of the taxon.
151 * This would be rather slow compared to using this method.
153 * @param classification
154 * the classification to be used
156 * specifies the root level of the classification, may be null.
157 * Nodes of this rank or in case this rank does not exist in the
158 * current branch the next lower rank is taken as as root node for
159 * this rank henceforth called the <b>base node</b>.
160 * @param propertyPaths
161 * the initialization strategy for the returned TaxonNode
163 * @return the path of nodes from the <b>base node</b> to the node of the specified
166 public List
<TaxonNode
> loadTreeBranchToTaxon(Taxon taxon
, Classification classification
, Rank baseRank
, List
<String
> propertyPaths
);
172 * @param classificationUuid
173 * @param propertyPaths
176 public List
<TaxonNode
> listChildNodesOfTaxon(UUID taxonUuid
, UUID classificationUuid
, Integer pageSize
, Integer pageIndex
, List
<String
> propertyPaths
);
180 * @param propertyPaths
181 * @deprecated move to TaxonNodeService
185 public List
<TaxonNode
> loadChildNodesOfTaxonNode(TaxonNode taxonNode
, List
<String
> propertyPaths
);
189 * @param classification
192 public List
<UuidAndTitleCache
<TaxonNode
>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(Classification classification
);
197 * @param propertyPaths
200 * @param widthOrDuration
204 * @deprecated use getAllMediaForChildNodes(TaxonNode taxonNode, ...) instead
205 * if you have a classification and a taxon that is in it, you should also have the according taxonNode
208 public Map
<UUID
, List
<MediaRepresentation
>> getAllMediaForChildNodes(Taxon taxon
, Classification taxTree
, List
<String
> propertyPaths
, int size
, int height
, int widthOrDuration
, String
[] mimeTypes
);
213 * @param propertyPaths
216 * @param widthOrDuration
220 public Map
<UUID
, List
<MediaRepresentation
>> getAllMediaForChildNodes(TaxonNode taxonNode
, List
<String
> propertyPaths
, int size
, int height
, int widthOrDuration
, String
[] mimeTypes
);
226 * @deprecated use TaxonNodeService instead
229 public UUID
removeTaxonNode(TaxonNode taxonNode
);
235 * @deprecated use TaxonNodeService instead
238 public UUID
saveTaxonNode(TaxonNode taxonNode
);
242 * @param taxonNodeCollection
244 * @deprecated use TaxonNodeService instead
247 public Map
<UUID
, TaxonNode
> saveTaxonNodeAll(Collection
<TaxonNode
> taxonNodeCollection
);
255 public UUID
removeTreeNode(ITaxonTreeNode treeNode
);
262 public UUID
saveTreeNode(ITaxonTreeNode treeNode
);
265 public List
<TaxonNode
> getAllNodes();
267 public UpdateResult
createHierarchyInClassification(Classification classification
, CreateHierarchyForClassificationConfigurator configurator
);
270 * @param classificationUuid
274 public List
<UuidAndTitleCache
<TaxonNode
>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(UUID classificationUuid
);
277 * @param classificationUuid
283 List
<UuidAndTitleCache
<TaxonNode
>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(
284 UUID classificationUuid
, Integer limit
, String pattern
);
287 * @param classification
293 List
<UuidAndTitleCache
<TaxonNode
>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(
294 Classification classification
, Integer limit
, String pattern
);
298 * @param classificationUuid
301 * @param propertyPaths
304 List
<TaxonNode
> listSiblingsOfTaxon(UUID taxonUuid
, UUID classificationUuid
, Integer pageSize
, Integer pageIndex
,
305 List
<String
> propertyPaths
);
309 * @param classificationUuid
312 * @param propertyPaths
315 Pager
<TaxonNode
> pageSiblingsOfTaxon(UUID taxonUuid
, UUID classificationUuid
, Integer pageSize
, Integer pageIndex
,
316 List
<String
> propertyPaths
);
319 * @param classification
322 ClassificationLookupDTO
classificationLookup(Classification classification
);
324 DeleteResult
delete(UUID classificationUuid
, TaxonDeletionConfigurator config
);
327 * Returns the higher taxon id for each taxon in taxonUuids.
328 * The highter taxon is defined by rank where the lowest rank equal or above minRank
329 * is taken. If maxRank <> null and no taxon exists with minRank <= rank <= maxRank
330 * no higher taxon is returned for this taxon.
337 List
<GroupedTaxonDTO
> groupTaxaByHigherTaxon(List
<UUID
> taxonUuids
, UUID classificationUuid
, Rank minRank
, Rank maxRank
);