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
.SubtreeCloneConfigurator
;
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
.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
);
56 * Clones an existing classification including all taxa and taxon nodes.
58 * @param config the configurator for the cloning
60 public UpdateResult
cloneClassification(SubtreeCloneConfigurator config
);
67 * @param propertyPaths
70 public List
<Classification
> listClassifications(Integer limit
, Integer start
, List
<OrderHint
> orderHints
, List
<String
> propertyPaths
);
75 * @param classificationUuid
76 * @param propertyPaths
78 * @deprecated use loadTaxonNode(TaxonNode taxonNode, ...) instead
79 * if you have a classification and a taxon that is in it, you should also have the according taxonNode
82 public TaxonNode
loadTaxonNodeByTaxon(Taxon taxon
, UUID classificationUuid
, List
<String
> propertyPaths
);
85 * Loads all TaxonNodes of the specified classification for a given Rank or lower.
86 * If a branch of the classification tree is not containing a TaxonNode with a Taxon at the given
87 * Rank the according node associated with the next lower Rank is taken as root node in this case.
88 * So the nodes returned may reference Taxa with different Ranks.
90 * If the <code>rank</code> is null the absolute root nodes will be returned.
92 * @param classification may be null for all classifications
93 * @param subtree filter on a taxonomic subtree
94 * @param rank the set to null for to get the root nodes of classifications
95 * @param includeUnpublished if <code>true</code> unpublished taxa are also exported
96 * @param pageSize The maximum number of relationships returned (can be null for all relationships)
97 * @param pageIndex The offset (in pageSize chunks) from the start of the result set (0 - based)
98 * @param propertyPaths
100 * @see #pageRankSpecificRootNodes(Classification, TaxonNode, Rank, boolean, Integer, Integer, List)
101 * @deprecated use according DTO method instead
104 public List
<TaxonNode
> listRankSpecificRootNodes(Classification classification
, TaxonNode subtree
,
105 Rank rank
, boolean includeUnpublished
, Integer pageSize
, Integer pageIndex
,
106 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 subtree filter on a taxonomic subtree
118 * @param rank the set to null for to get the root nodes of classifications
119 * @param includeUnpublished if <code>true</code> unpublished taxa are also exported
120 * @param pageSize The maximum number of relationships returned (can be null for all relationships)
121 * @param pageIndex The offset (in pageSize chunks) from the start of the result set (0 - based)
122 * @param propertyPaths
124 * @see #pageRankSpecificRootNodes(Classification, TaxonNode, Rank, boolean, Integer, Integer, List)
127 public List
<TaxonNodeDto
> listRankSpecificRootNodeDtos(Classification classification
, TaxonNode subtree
,
128 Rank rank
, boolean includeUnpublished
, Integer pageSize
, Integer pageIndex
, TaxonNodeDtoSortMode sortMode
,
129 List
<String
> propertyPaths
);
133 * Loads all TaxonNodes of the specified classification for a given Rank or lower.
134 * If a branch of the classification tree is not containing a TaxonNode with a Taxon at the given
135 * Rank the according node associated with the next lower Rank is taken as root node in this case.
136 * So the nodes returned may reference Taxa with different Ranks.
138 * If the <code>rank</code> is null the absolute root nodes will be returned.
140 * @param classification may be null for all classifications
141 * @param subtree the taxonomic subtree filter
142 * @param rank the set to null for to get the root nodes of classifications
143 * @param includeUnpublished if <code>true</code> unpublished taxa are also exported
144 * @param pageSize The maximum number of relationships returned (can be null for all relationships)
145 * @param pageIndex The offset (in pageSize chunks) from the start of the result set (0 - based)
146 * @param propertyPaths
149 * @see #listRankSpecificRootNodes(Classification, TaxonNode, Rank, boolean, Integer, Integer, List)
151 public Pager
<TaxonNode
> pageRankSpecificRootNodes(Classification classification
, TaxonNode subtree
,
152 Rank rank
, boolean includeUnpublished
, Integer pageSize
, Integer pageIndex
,
153 List
<String
> propertyPaths
);
155 * @see #pageRankSpecificRootNodes(Classification, TaxonNode, Rank, boolean, Integer, Integer, List)
156 * @deprecated keep this for compatibility to older versions, might be removed in versions >5.3
159 public Pager
<TaxonNode
> pageRankSpecificRootNodes(Classification classification
,
160 Rank rank
, boolean includeUnpublished
, Integer pageSize
, Integer pageIndex
,
161 List
<String
> propertyPaths
);
166 * specifies the root level of the classification, may be null.
167 * Nodes of this rank or in case this rank does not exist in the
168 * current branch the next lower rank is taken as root node for
169 * this rank henceforth called the <b>base node</b>.
170 * @param propertyPaths
171 * the initialization strategy for the returned TaxonNode
173 * @param includeUnpublished
174 * if <code>true</code> no {@link UnpublishedException}
175 * is thrown if any of the taxa in the branch are unpublished
176 * @return the path of nodes from the <b>base node</b> to the node of the
178 * @throws UnpublishedException
179 * if any of the taxa in the path is unpublished an {@link UnpublishedException} is thrown.
181 public List
<TaxonNode
> loadTreeBranch(TaxonNode taxonNode
, TaxonNode subtree
, Rank baseRank
, boolean includeUnpublished
,
182 List
<String
> propertyPaths
) throws UnpublishedException
;
183 public List
<TaxonNode
> loadTreeBranch(TaxonNode taxonNode
, Rank baseRank
, boolean includeUnpublished
,
184 List
<String
> propertyPaths
) throws UnpublishedException
;
187 * Although this method seems to be a redundant alternative to {@link #loadChildNodesOfTaxonNode(TaxonNode, List)} it is an important
188 * alternative from which web services benefit. Without this method the web service controller method, which operates outside of the
189 * transaction, would have to initialize the full taxon tree with all nodes of the taxon.
190 * This would be rather slow compared to using this method.
192 * @param classification
193 * the classification to be used
195 * specifies the root level of the classification, may be null.
196 * Nodes of this rank or in case this rank does not exist in the
197 * current branch the next lower rank is taken as as root node for
198 * this rank henceforth called the <b>base node</b>.
199 * @param includeUnpublished
200 * if <code>true</code> no {@link UnpublishedException}
201 * is thrown if any of the taxa in the branch are unpublished
202 * @param propertyPaths
203 * the initialization strategy for the returned TaxonNode
205 * @return the path of nodes from the <b>base node</b> to the node of the specified
207 * @throws UnpublishedException
208 * if any of the taxa in the path is unpublished an {@link UnpublishedException} is thrown
210 public List
<TaxonNode
> loadTreeBranchToTaxon(Taxon taxon
, Classification classification
,
211 TaxonNode subtree
, Rank baseRank
,
212 boolean includeUnpublished
, List
<String
> propertyPaths
) throws UnpublishedException
;
215 * Although this method seems to be a redundant alternative to {@link #loadChildNodesOfTaxonNode(TaxonNode, List)} it is an important
216 * alternative from which web services benefit. Without this method the web service controller method, which operates outside of the
217 * transaction, would have to initialize the full taxon tree with all nodes of the taxon.
218 * This would be rather slow compared to using this method.
220 * @param classification
221 * the classification to be used
223 * specifies the root level of the classification, may be null.
224 * Nodes of this rank or in case this rank does not exist in the
225 * current branch the next lower rank is taken as as root node for
226 * this rank henceforth called the <b>base node</b>.
227 * @param includeUnpublished
228 * if <code>true</code> no {@link UnpublishedException}
229 * is thrown if any of the taxa in the branch are unpublished
230 * @param propertyPaths
231 * the initialization strategy for the returned TaxonNode
233 * @return the path of nodes from the <b>base node</b> to the node of the specified
235 * @throws UnpublishedException
236 * if any of the taxa in the path is unpublished an {@link UnpublishedException} is thrown
238 public List
<TaxonNodeDto
> loadTreeBranchDTOsToTaxon(Taxon taxon
, Classification classification
,
239 TaxonNode subtree
, Rank baseRank
,
240 boolean includeUnpublished
, List
<String
> propertyPaths
) throws UnpublishedException
;
242 public List
<TaxonNode
> loadTreeBranchToTaxon(Taxon taxon
, Classification classification
,
244 boolean includeUnpublished
, List
<String
> propertyPaths
) throws UnpublishedException
;
246 public List
<TaxonNode
> listChildNodesOfTaxon(UUID taxonUuid
, UUID classificationUuid
, boolean includeUnpublished
,
247 Integer pageSize
, Integer pageIndex
, List
<String
> propertyPaths
);
249 public List
<TaxonNode
> listChildNodesOfTaxon(UUID taxonUuid
, UUID classificationUuid
, UUID subtreeUuid
, boolean includeUnpublished
,
250 Integer pageSize
, Integer pageIndex
, List
<String
> propertyPaths
) throws FilterException
;
252 public List
<TaxonNodeDto
> listChildNodeDtosOfTaxon(UUID taxonUuid
, UUID classificationUuid
, UUID subtreeUuid
, boolean includeUnpublished
,
253 Integer pageSize
, Integer pageIndex
, TaxonNodeDtoSortMode comparator
, List
<String
> propertyPaths
) throws FilterException
;
257 * @param propertyPaths
258 * @deprecated move to TaxonNodeService
262 public List
<TaxonNode
> loadChildNodesOfTaxonNode(TaxonNode taxonNode
, List
<String
> propertyPaths
);
266 * @param classification
269 public List
<UuidAndTitleCache
<TaxonNode
>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(Classification classification
);
271 public Map
<UUID
, List
<MediaRepresentation
>> getAllMediaForChildNodes(TaxonNode taxonNode
, List
<String
> propertyPaths
, int size
, int height
, int widthOrDuration
, String
[] mimeTypes
);
277 * @deprecated use TaxonNodeService instead
280 public UUID
removeTaxonNode(TaxonNode taxonNode
);
286 * @deprecated use TaxonNodeService instead
289 public UUID
saveTaxonNode(TaxonNode taxonNode
);
293 * @param taxonNodeCollection
295 * @deprecated use TaxonNodeService instead
298 public Map
<UUID
, TaxonNode
> saveTaxonNodeAll(Collection
<TaxonNode
> taxonNodeCollection
);
300 public UUID
removeTreeNode(ITaxonTreeNode treeNode
);
302 public UUID
saveTreeNode(ITaxonTreeNode treeNode
);
304 public List
<TaxonNode
> getAllNodes();
306 public UpdateResult
createHierarchyInClassification(Classification classification
, CreateHierarchyForClassificationConfigurator configurator
);
308 public List
<UuidAndTitleCache
<TaxonNode
>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(UUID classificationUuid
);
310 public List
<UuidAndTitleCache
<TaxonNode
>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(
311 UUID classificationUuid
, Integer limit
, String pattern
);
313 public List
<UuidAndTitleCache
<TaxonNode
>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(
314 Classification classification
, Integer limit
, String pattern
);
316 public List
<TaxonNode
> listSiblingsOfTaxon(UUID taxonUuid
, UUID classificationUuid
, boolean includeUnpublished
,
317 Integer pageSize
, Integer pageIndex
, List
<String
> propertyPaths
);
319 public Pager
<TaxonNode
> pageSiblingsOfTaxon(UUID taxonUuid
, UUID classificationUuid
, boolean includeUnpublished
, Integer pageSize
, Integer pageIndex
,
320 List
<String
> propertyPaths
);
322 public ClassificationLookupDTO
classificationLookup(Classification classification
);
324 public 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 public List
<GroupedTaxonDTO
> groupTaxaByHigherTaxon(List
<UUID
> taxonUuids
, UUID classificationUuid
, Rank minRank
, Rank maxRank
);
341 * @param classificationUuid
346 public List
<GroupedTaxonDTO
> groupTaxaByMarkedParents(List
<UUID
> taxonUuids
, UUID classificationUuid
,
347 MarkerType markerType
, Boolean value
);
351 * Returns the most relevant data of a taxon/taxon node, including children, synonyms
352 * and certain ancestors if required.
353 * @param classificationUuid
356 * @param includeUnpublished
357 * @param ancestorMarkers
360 public TaxonInContextDTO
getTaxonInContext(UUID classificationUuid
, UUID taxonUuid
,
361 Boolean doChildren
, Boolean doSynonyms
, boolean includeUnpublished
, List
<UUID
> ancestorMarkers
,
362 TaxonNodeSortMode sortMode
);
365 * @param classification
368 public UUID
saveClassification(Classification classification
);
371 * @param classificationUuid
374 * @param searchForClassifications
377 public List
<UuidAndTitleCache
<TaxonNode
>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(
378 UUID classificationUuid
, Integer limit
, String pattern
, boolean searchForClassifications
);
381 * @param classification
384 * @param searchForClassifications
387 public List
<UuidAndTitleCache
<TaxonNode
>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(
388 Classification classification
, Integer limit
, String pattern
, boolean searchForClassifications
);
391 * @param classificationUuid
392 * @param searchForClassifications
395 public List
<UuidAndTitleCache
<TaxonNode
>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(
396 UUID classificationUuid
, boolean searchForClassifications
);
399 * @param classification
400 * @param searchForClassifications
403 public List
<UuidAndTitleCache
<TaxonNode
>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(
404 Classification classification
, boolean searchForClassifications
);
407 * @param classificationUuid
410 * @param searchForClassifications
411 * @param includeDoubtful
414 List
<UuidAndTitleCache
<TaxonNode
>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(
415 UUID classificationUuid
, Integer limit
, String pattern
, boolean searchForClassifications
,
416 boolean includeDoubtful
);