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
.exception
.UnpublishedException
;
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
;
41 public interface IClassificationService
extends IIdentifiableEntityService
<Classification
> {
48 public ITaxonTreeNode
getTreeNodeByUuid(UUID uuid
);
52 * Returns the root node of the the given classification (specified by its UUID)
53 * @param classificationUuid the uuid of the classification
54 * @return the root node of the classification
56 public TaxonNode
getRootNode(UUID classificationUuid
);
58 public UUID
getTaxonNodeUuidByTaxonUuid(UUID classificationUuid
, UUID taxonUuid
);
61 * Clones an existing classification including all taxa and taxon nodes.
64 * @param relationshipType
67 public UpdateResult
cloneClassification(UUID classificationUuid
, String name
, Reference sec
, TaxonRelationshipType relationshipType
);
74 * @param propertyPaths
77 public List
<Classification
> listClassifications(Integer limit
, Integer start
, List
<OrderHint
> orderHints
, List
<String
> propertyPaths
);
82 * @param classificationUuid
83 * @param propertyPaths
85 * @deprecated use loadTaxonNode(TaxonNode taxonNode, ...) instead
86 * if you have a classification and a taxon that is in it, you should also have the according taxonNode
89 public TaxonNode
loadTaxonNodeByTaxon(Taxon taxon
, UUID classificationUuid
, List
<String
> propertyPaths
);
92 * Loads all TaxonNodes of the specified classification for a given Rank or lower.
93 * If a branch of the classification tree is not containing a TaxonNode with a Taxon at the given
94 * Rank the according node associated with the next lower Rank is taken as root node in this case.
95 * So the nodes returned may reference Taxa with different Ranks.
97 * If the <code>rank</code> is null the absolute root nodes will be returned.
99 * @param classification may be null for all classifications
100 * @param subtree filter on a taxonomic subtree
101 * @param rank the set to null for to get the root nodes of classifications
102 * @param includeUnpublished if <code>true</code> unpublished taxa are also exported
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
107 * @see #pageRankSpecificRootNodes(Classification, TaxonNode, Rank, boolean, Integer, Integer, List)
110 public List
<TaxonNode
> listRankSpecificRootNodes(Classification classification
, TaxonNode subtree
,
111 Rank rank
, boolean includeUnpublished
, Integer pageSize
, Integer pageIndex
,
112 List
<String
> propertyPaths
);
116 * @see #listRankSpecificRootNodes(Classification, TaxonNode, Rank, boolean, Integer, Integer, List)
117 * @deprecated keep this for compatibility to older versions, might be removed in versions >5.3
120 public List
<TaxonNode
> listRankSpecificRootNodes(Classification classification
,
121 Rank rank
, boolean includeUnpublished
, Integer pageSize
, Integer pageIndex
,
122 List
<String
> propertyPaths
);
126 * Loads all TaxonNodes of the specified classification for a given Rank or lower.
127 * If a branch of the classification tree is not containing a TaxonNode with a Taxon at the given
128 * Rank the according node associated with the next lower Rank is taken as root node in this case.
129 * So the nodes returned may reference Taxa with different Ranks.
131 * If the <code>rank</code> is null the absolute root nodes will be returned.
133 * @param classification may be null for all classifications
134 * @param subtree the taxonomic subtree filter
135 * @param rank the set to null for to get the root nodes of classifications
136 * @param includeUnpublished if <code>true</code> unpublished taxa are also exported
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
142 * @see #listRankSpecificRootNodes(Classification, TaxonNode, Rank, boolean, Integer, Integer, List)
144 public Pager
<TaxonNode
> pageRankSpecificRootNodes(Classification classification
, TaxonNode subtree
,
145 Rank rank
, boolean includeUnpublished
, Integer pageSize
, Integer pageIndex
,
146 List
<String
> propertyPaths
);
148 * @see #pageRankSpecificRootNodes(Classification, TaxonNode, Rank, boolean, Integer, Integer, List)
149 * @deprecated keep this for compatibility to older versions, might be removed in versions >5.3
152 public Pager
<TaxonNode
> pageRankSpecificRootNodes(Classification classification
,
153 Rank rank
, boolean includeUnpublished
, Integer pageSize
, Integer pageIndex
,
154 List
<String
> propertyPaths
);
159 * specifies the root level of the classification, may be null.
160 * Nodes of this rank or in case this rank does not exist in the
161 * current branch the next lower rank is taken as root node for
162 * this rank henceforth called the <b>base node</b>.
163 * @param propertyPaths
164 * the initialization strategy for the returned TaxonNode
166 * @param includeUnpublished
167 * if <code>true</code> no {@link UnpublishedException}
168 * is thrown if any of the taxa in the branch are unpublished
169 * @return the path of nodes from the <b>base node</b> to the node of the
171 * @throws UnpublishedException
172 * if any of the taxa in the path is unpublished an {@link UnpublishedException} is thrown.
174 public List
<TaxonNode
> loadTreeBranch(TaxonNode taxonNode
, TaxonNode subtree
, Rank baseRank
, boolean includeUnpublished
,
175 List
<String
> propertyPaths
) throws UnpublishedException
;
176 public List
<TaxonNode
> loadTreeBranch(TaxonNode taxonNode
, Rank baseRank
, boolean includeUnpublished
,
177 List
<String
> propertyPaths
) throws UnpublishedException
;
180 * Although this method seems to be a redundant alternative to {@link #loadChildNodesOfTaxonNode(TaxonNode, List)} it is an important
181 * alternative from which web services benefit. Without this method the web service controller method, which operates outside of the
182 * transaction, would have to initialize the full taxon tree with all nodes of the taxon.
183 * This would be rather slow compared to using this method.
185 * @param classification
186 * the classification to be used
188 * specifies the root level of the classification, may be null.
189 * Nodes of this rank or in case this rank does not exist in the
190 * current branch the next lower rank is taken as as root node for
191 * this rank henceforth called the <b>base node</b>.
192 * @param includeUnpublished
193 * if <code>true</code> no {@link UnpublishedException}
194 * is thrown if any of the taxa in the branch are unpublished
195 * @param propertyPaths
196 * the initialization strategy for the returned TaxonNode
198 * @return the path of nodes from the <b>base node</b> to the node of the specified
200 * @throws UnpublishedException
201 * if any of the taxa in the path is unpublished an {@link UnpublishedException} is thrown
203 public List
<TaxonNode
> loadTreeBranchToTaxon(Taxon taxon
, Classification classification
,
204 TaxonNode subtree
, Rank baseRank
,
205 boolean includeUnpublished
, List
<String
> propertyPaths
) throws UnpublishedException
;
206 public List
<TaxonNode
> loadTreeBranchToTaxon(Taxon taxon
, Classification classification
,
208 boolean includeUnpublished
, List
<String
> propertyPaths
) throws UnpublishedException
;
210 public List
<TaxonNode
> listChildNodesOfTaxon(UUID taxonUuid
, UUID classificationUuid
, boolean includeUnpublished
,
211 Integer pageSize
, Integer pageIndex
, List
<String
> propertyPaths
);
212 public List
<TaxonNode
> listChildNodesOfTaxon(UUID taxonUuid
, UUID classificationUuid
, UUID subtreeUuid
, boolean includeUnpublished
,
213 Integer pageSize
, Integer pageIndex
, List
<String
> propertyPaths
);
218 * @param propertyPaths
219 * @deprecated move to TaxonNodeService
223 public List
<TaxonNode
> loadChildNodesOfTaxonNode(TaxonNode taxonNode
, List
<String
> propertyPaths
);
227 * @param classification
230 public List
<UuidAndTitleCache
<TaxonNode
>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(Classification classification
);
232 public Map
<UUID
, List
<MediaRepresentation
>> getAllMediaForChildNodes(TaxonNode taxonNode
, List
<String
> propertyPaths
, int size
, int height
, int widthOrDuration
, String
[] mimeTypes
);
238 * @deprecated use TaxonNodeService instead
241 public UUID
removeTaxonNode(TaxonNode taxonNode
);
247 * @deprecated use TaxonNodeService instead
250 public UUID
saveTaxonNode(TaxonNode taxonNode
);
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.
298 public List
<GroupedTaxonDTO
> groupTaxaByHigherTaxon(List
<UUID
> taxonUuids
, UUID classificationUuid
, Rank minRank
, Rank maxRank
);
302 * @param classificationUuid
307 public List
<GroupedTaxonDTO
> groupTaxaByMarkedParents(List
<UUID
> taxonUuids
, UUID classificationUuid
,
308 MarkerType markerType
, Boolean value
);
312 * Returns the most relevant data of a taxon/taxon node, including children, synonyms
313 * and certain ancestors if required.
314 * @param classificationUuid
317 * @param includeUnpublished
318 * @param ancestorMarkers
321 public TaxonInContextDTO
getTaxonInContext(UUID classificationUuid
, UUID taxonUuid
,
322 Boolean doChildren
, Boolean doSynonyms
, boolean includeUnpublished
, List
<UUID
> ancestorMarkers
,
323 NodeSortMode sortMode
);
326 * @param classification
329 public UUID
saveClassification(Classification classification
);
332 * @param classificationUuid
335 * @param searchForClassifications
338 public List
<UuidAndTitleCache
<TaxonNode
>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(
339 UUID classificationUuid
, Integer limit
, String pattern
, boolean searchForClassifications
);
342 * @param classification
345 * @param searchForClassifications
348 public List
<UuidAndTitleCache
<TaxonNode
>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(
349 Classification classification
, Integer limit
, String pattern
, boolean searchForClassifications
);
352 * @param classificationUuid
353 * @param searchForClassifications
356 public List
<UuidAndTitleCache
<TaxonNode
>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(
357 UUID classificationUuid
, boolean searchForClassifications
);
360 * @param classification
361 * @param searchForClassifications
364 public List
<UuidAndTitleCache
<TaxonNode
>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(
365 Classification classification
, boolean searchForClassifications
);