2 * Copyright (C) 2007 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
6 * The contents of this file are subject to the Mozilla Public License Version 1.1
7 * See LICENSE.TXT at the top of this package for the full license terms.
10 package eu
.etaxonomy
.cdm
.api
.service
;
12 import java
.util
.Collection
;
13 import java
.util
.List
;
15 import java
.util
.UUID
;
17 import eu
.etaxonomy
.cdm
.api
.service
.config
.CreateHierarchyForClassificationConfigurator
;
18 import eu
.etaxonomy
.cdm
.api
.service
.config
.TaxonDeletionConfigurator
;
19 import eu
.etaxonomy
.cdm
.api
.service
.dto
.GroupedTaxonDTO
;
20 import eu
.etaxonomy
.cdm
.api
.service
.dto
.TaxonInContextDTO
;
21 import eu
.etaxonomy
.cdm
.api
.service
.pager
.Pager
;
22 import eu
.etaxonomy
.cdm
.compare
.taxon
.TaxonNodeSortMode
;
23 import eu
.etaxonomy
.cdm
.exception
.FilterException
;
24 import eu
.etaxonomy
.cdm
.exception
.UnpublishedException
;
25 import eu
.etaxonomy
.cdm
.model
.common
.MarkerType
;
26 import eu
.etaxonomy
.cdm
.model
.media
.MediaRepresentation
;
27 import eu
.etaxonomy
.cdm
.model
.name
.Rank
;
28 import eu
.etaxonomy
.cdm
.model
.taxon
.Classification
;
29 import eu
.etaxonomy
.cdm
.model
.taxon
.ITaxonTreeNode
;
30 import eu
.etaxonomy
.cdm
.model
.taxon
.Taxon
;
31 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonNode
;
32 import eu
.etaxonomy
.cdm
.persistence
.dto
.ClassificationLookupDTO
;
33 import eu
.etaxonomy
.cdm
.persistence
.dto
.TaxonNodeDto
;
34 import eu
.etaxonomy
.cdm
.persistence
.dto
.UuidAndTitleCache
;
35 import eu
.etaxonomy
.cdm
.persistence
.query
.OrderHint
;
42 public interface IClassificationService
extends IIdentifiableEntityService
<Classification
> {
44 public ITaxonTreeNode
getTreeNodeByUuid(UUID uuid
);
47 * Returns the root node of the the given classification (specified by its UUID)
48 * @param classificationUuid the uuid of the classification
49 * @return the root node of the classification
51 public TaxonNode
getRootNode(UUID classificationUuid
);
53 public UUID
getTaxonNodeUuidByTaxonUuid(UUID classificationUuid
, UUID taxonUuid
);
55 public List
<Classification
> listClassifications(Integer limit
, Integer start
, List
<OrderHint
> orderHints
, List
<String
> propertyPaths
);
60 * @param classificationUuid
61 * @param propertyPaths
63 * @deprecated use loadTaxonNode(TaxonNode taxonNode, ...) instead
64 * if you have a classification and a taxon that is in it, you should also have the according taxonNode
67 public TaxonNode
loadTaxonNodeByTaxon(Taxon taxon
, UUID classificationUuid
, List
<String
> propertyPaths
);
70 * Loads all TaxonNodes of the specified classification for a given Rank or lower.
71 * If a branch of the classification tree is not containing a TaxonNode with a Taxon at the given
72 * Rank the according node associated with the next lower Rank is taken as root node in this case.
73 * So the nodes returned may reference Taxa with different Ranks.
75 * If the <code>rank</code> is null the absolute root nodes will be returned.
77 * @param classification may be null for all classifications
78 * @param subtree filter on a taxonomic subtree
79 * @param rank the set to null for to get the root nodes of classifications
80 * @param includeUnpublished if <code>true</code> unpublished taxa are also exported
81 * @param pageSize The maximum number of relationships returned (can be null for all relationships)
82 * @param pageIndex The offset (in pageSize chunks) from the start of the result set (0 - based)
83 * @param propertyPaths
85 * @see #pageRankSpecificRootNodes(Classification, TaxonNode, Rank, boolean, Integer, Integer, List)
86 * @deprecated use according DTO method instead
89 public List
<TaxonNode
> listRankSpecificRootNodes(Classification classification
, TaxonNode subtree
,
90 Rank rank
, boolean includeUnpublished
, Integer pageSize
, Integer pageIndex
,
91 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 subtree filter on a taxonomic subtree
103 * @param rank the set to null for to get the root nodes of classifications
104 * @param includeUnpublished if <code>true</code> unpublished taxa are also exported
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
109 * @see #pageRankSpecificRootNodes(Classification, TaxonNode, Rank, boolean, Integer, Integer, List)
112 public List
<TaxonNodeDto
> listRankSpecificRootNodeDtos(Classification classification
, TaxonNode subtree
,
113 Rank rank
, boolean includeUnpublished
, Integer pageSize
, Integer pageIndex
, TaxonNodeDtoSortMode sortMode
,
114 List
<String
> propertyPaths
);
118 * Loads all TaxonNodes of the specified classification for a given Rank or lower.
119 * If a branch of the classification tree is not containing a TaxonNode with a Taxon at the given
120 * Rank the according node associated with the next lower Rank is taken as root node in this case.
121 * So the nodes returned may reference Taxa with different Ranks.
123 * If the <code>rank</code> is null the absolute root nodes will be returned.
125 * @param classification may be null for all classifications
126 * @param subtree the taxonomic subtree filter
127 * @param rank the set to null for to get the root nodes of classifications
128 * @param includeUnpublished if <code>true</code> unpublished taxa are also exported
129 * @param pageSize The maximum number of relationships returned (can be null for all relationships)
130 * @param pageIndex The offset (in pageSize chunks) from the start of the result set (0 - based)
131 * @param propertyPaths
134 * @see #listRankSpecificRootNodes(Classification, TaxonNode, Rank, boolean, Integer, Integer, List)
136 public Pager
<TaxonNode
> pageRankSpecificRootNodes(Classification classification
, TaxonNode subtree
,
137 Rank rank
, boolean includeUnpublished
, Integer pageSize
, Integer pageIndex
,
138 List
<String
> propertyPaths
);
140 * @see #pageRankSpecificRootNodes(Classification, TaxonNode, Rank, boolean, Integer, Integer, List)
141 * @deprecated keep this for compatibility to older versions, might be removed in versions >5.3
144 public Pager
<TaxonNode
> pageRankSpecificRootNodes(Classification classification
,
145 Rank rank
, boolean includeUnpublished
, Integer pageSize
, Integer pageIndex
,
146 List
<String
> propertyPaths
);
151 * specifies the root level of the classification, may be null.
152 * Nodes of this rank or in case this rank does not exist in the
153 * current branch the next lower rank is taken as root node for
154 * this rank henceforth called the <b>base node</b>.
155 * @param propertyPaths
156 * the initialization strategy for the returned TaxonNode
158 * @param includeUnpublished
159 * if <code>true</code> no {@link UnpublishedException}
160 * is thrown if any of the taxa in the branch are unpublished
161 * @return the path of nodes from the <b>base node</b> to the node of the
163 * @throws UnpublishedException
164 * if any of the taxa in the path is unpublished an {@link UnpublishedException} is thrown.
166 public List
<TaxonNode
> loadTreeBranch(TaxonNode taxonNode
, TaxonNode subtree
, Rank baseRank
, boolean includeUnpublished
,
167 List
<String
> propertyPaths
) throws UnpublishedException
;
168 public List
<TaxonNode
> loadTreeBranch(TaxonNode taxonNode
, Rank baseRank
, boolean includeUnpublished
,
169 List
<String
> propertyPaths
) throws UnpublishedException
;
172 * Although this method seems to be a redundant alternative to {@link #loadChildNodesOfTaxonNode(TaxonNode, List)} it is an important
173 * alternative from which web services benefit. Without this method the web service controller method, which operates outside of the
174 * transaction, would have to initialize the full taxon tree with all nodes of the taxon.
175 * This would be rather slow compared to using this method.
177 * @param classification
178 * the classification to be used
180 * specifies the root level of the classification, may be null.
181 * Nodes of this rank or in case this rank does not exist in the
182 * current branch the next lower rank is taken as as root node for
183 * this rank henceforth called the <b>base node</b>.
184 * @param includeUnpublished
185 * if <code>true</code> no {@link UnpublishedException}
186 * is thrown if any of the taxa in the branch are unpublished
187 * @param propertyPaths
188 * the initialization strategy for the returned TaxonNode
190 * @return the path of nodes from the <b>base node</b> to the node of the specified
192 * @throws UnpublishedException
193 * if any of the taxa in the path is unpublished an {@link UnpublishedException} is thrown
195 public List
<TaxonNode
> loadTreeBranchToTaxon(Taxon taxon
, Classification classification
,
196 TaxonNode subtree
, Rank baseRank
,
197 boolean includeUnpublished
, List
<String
> propertyPaths
) throws UnpublishedException
;
200 * Although this method seems to be a redundant alternative to {@link #loadChildNodesOfTaxonNode(TaxonNode, List)} it is an important
201 * alternative from which web services benefit. Without this method the web service controller method, which operates outside of the
202 * transaction, would have to initialize the full taxon tree with all nodes of the taxon.
203 * This would be rather slow compared to using this method.
205 * @param classification
206 * the classification to be used
208 * specifies the root level of the classification, may be null.
209 * Nodes of this rank or in case this rank does not exist in the
210 * current branch the next lower rank is taken as as root node for
211 * this rank henceforth called the <b>base node</b>.
212 * @param includeUnpublished
213 * if <code>true</code> no {@link UnpublishedException}
214 * is thrown if any of the taxa in the branch are unpublished
215 * @param propertyPaths
216 * the initialization strategy for the returned TaxonNode
218 * @return the path of nodes from the <b>base node</b> to the node of the specified
220 * @throws UnpublishedException
221 * if any of the taxa in the path is unpublished an {@link UnpublishedException} is thrown
223 public List
<TaxonNodeDto
> loadTreeBranchDTOsToTaxon(Taxon taxon
, Classification classification
,
224 TaxonNode subtree
, Rank baseRank
,
225 boolean includeUnpublished
, List
<String
> propertyPaths
) throws UnpublishedException
;
227 public List
<TaxonNode
> loadTreeBranchToTaxon(Taxon taxon
, Classification classification
,
229 boolean includeUnpublished
, List
<String
> propertyPaths
) throws UnpublishedException
;
231 public List
<TaxonNode
> listChildNodesOfTaxon(UUID taxonUuid
, UUID classificationUuid
, boolean includeUnpublished
,
232 Integer pageSize
, Integer pageIndex
, List
<String
> propertyPaths
);
234 public List
<TaxonNode
> listChildNodesOfTaxon(UUID taxonUuid
, UUID classificationUuid
, UUID subtreeUuid
, boolean includeUnpublished
,
235 Integer pageSize
, Integer pageIndex
, List
<String
> propertyPaths
) throws FilterException
;
237 public List
<TaxonNodeDto
> listChildNodeDtosOfTaxon(UUID taxonUuid
, UUID classificationUuid
, UUID subtreeUuid
, boolean includeUnpublished
,
238 Integer pageSize
, Integer pageIndex
, TaxonNodeDtoSortMode comparator
, List
<String
> propertyPaths
) throws FilterException
;
242 * @param propertyPaths
243 * @deprecated move to TaxonNodeService
247 public List
<TaxonNode
> loadChildNodesOfTaxonNode(TaxonNode taxonNode
, List
<String
> propertyPaths
);
249 public List
<UuidAndTitleCache
<TaxonNode
>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(Classification classification
);
251 public Map
<UUID
, List
<MediaRepresentation
>> getAllMediaForChildNodes(TaxonNode taxonNode
, List
<String
> propertyPaths
, int size
, int height
, int widthOrDuration
, String
[] mimeTypes
);
254 * @param taxonNodeCollection
256 * @deprecated use TaxonNodeService instead
259 public Map
<UUID
, TaxonNode
> saveTaxonNodeAll(Collection
<TaxonNode
> taxonNodeCollection
);
261 public UUID
removeTreeNode(ITaxonTreeNode treeNode
);
263 public UUID
saveTreeNode(ITaxonTreeNode treeNode
);
265 public List
<TaxonNode
> getAllNodes();
267 public UpdateResult
createHierarchyInClassification(Classification classification
, CreateHierarchyForClassificationConfigurator configurator
);
269 public List
<UuidAndTitleCache
<TaxonNode
>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(UUID classificationUuid
);
271 public List
<UuidAndTitleCache
<TaxonNode
>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(
272 UUID classificationUuid
, Integer limit
, String pattern
);
274 public List
<UuidAndTitleCache
<TaxonNode
>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(
275 Classification classification
, Integer limit
, String pattern
);
277 public List
<TaxonNode
> listSiblingsOfTaxon(UUID taxonUuid
, UUID classificationUuid
, boolean includeUnpublished
,
278 Integer pageSize
, Integer pageIndex
, List
<String
> propertyPaths
);
280 public Pager
<TaxonNode
> pageSiblingsOfTaxon(UUID taxonUuid
, UUID classificationUuid
, boolean includeUnpublished
, Integer pageSize
, Integer pageIndex
,
281 List
<String
> propertyPaths
);
283 public ClassificationLookupDTO
classificationLookup(Classification classification
);
285 public DeleteResult
delete(UUID classificationUuid
, TaxonDeletionConfigurator config
);
288 * Returns the higher taxon id for each taxon in taxonUuids.
289 * The highter taxon is defined by rank where the lowest rank equal or above minRank
290 * is taken. If maxRank <> null and no taxon exists with minRank <= rank <= maxRank
291 * no higher taxon is returned for this taxon.
293 public List
<GroupedTaxonDTO
> groupTaxaByHigherTaxon(List
<UUID
> taxonUuids
, UUID classificationUuid
, Rank minRank
, Rank maxRank
);
295 public List
<GroupedTaxonDTO
> groupTaxaByMarkedParents(List
<UUID
> taxonUuids
, UUID classificationUuid
,
296 MarkerType markerType
, Boolean value
);
299 * Returns the most relevant data of a taxon/taxon node, including children, synonyms
300 * and certain ancestors if required.
302 public TaxonInContextDTO
getTaxonInContext(UUID classificationUuid
, UUID taxonUuid
,
303 Boolean doChildren
, Boolean doSynonyms
, boolean includeUnpublished
, List
<UUID
> ancestorMarkers
,
304 TaxonNodeSortMode sortMode
);
306 public UUID
saveClassification(Classification classification
);
308 public List
<UuidAndTitleCache
<TaxonNode
>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(
309 UUID classificationUuid
, Integer limit
, String pattern
, boolean searchForClassifications
);
311 public List
<UuidAndTitleCache
<TaxonNode
>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(
312 Classification classification
, Integer limit
, String pattern
, boolean searchForClassifications
);
314 public List
<UuidAndTitleCache
<TaxonNode
>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(
315 UUID classificationUuid
, boolean searchForClassifications
);
317 public List
<UuidAndTitleCache
<TaxonNode
>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(
318 Classification classification
, boolean searchForClassifications
);
320 List
<UuidAndTitleCache
<TaxonNode
>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(
321 UUID classificationUuid
, Integer limit
, String pattern
, boolean searchForClassifications
,
322 boolean includeDoubtful
);