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
.FilterException
;
23 import eu
.etaxonomy
.cdm
.exception
.UnpublishedException
;
24 import eu
.etaxonomy
.cdm
.model
.common
.MarkerType
;
25 import eu
.etaxonomy
.cdm
.model
.media
.MediaRepresentation
;
26 import eu
.etaxonomy
.cdm
.model
.name
.Rank
;
27 import eu
.etaxonomy
.cdm
.model
.reference
.Reference
;
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
.model
.taxon
.TaxonRelationshipType
;
33 import eu
.etaxonomy
.cdm
.persistence
.dto
.ClassificationLookupDTO
;
34 import eu
.etaxonomy
.cdm
.persistence
.dto
.UuidAndTitleCache
;
35 import eu
.etaxonomy
.cdm
.persistence
.query
.OrderHint
;
42 public interface IClassificationService
extends IIdentifiableEntityService
<Classification
> {
49 public ITaxonTreeNode
getTreeNodeByUuid(UUID uuid
);
53 * Returns the root node of the the given classification (specified by its UUID)
54 * @param classificationUuid the uuid of the classification
55 * @return the root node of the classification
57 public TaxonNode
getRootNode(UUID classificationUuid
);
59 public UUID
getTaxonNodeUuidByTaxonUuid(UUID classificationUuid
, UUID taxonUuid
);
62 * Clones an existing classification including all taxa and taxon nodes.
65 * @param relationshipType
68 public UpdateResult
cloneClassification(UUID classificationUuid
, String name
, Reference sec
, TaxonRelationshipType relationshipType
);
75 * @param propertyPaths
78 public List
<Classification
> listClassifications(Integer limit
, Integer start
, List
<OrderHint
> orderHints
, List
<String
> propertyPaths
);
83 * @param classificationUuid
84 * @param propertyPaths
86 * @deprecated use loadTaxonNode(TaxonNode taxonNode, ...) instead
87 * if you have a classification and a taxon that is in it, you should also have the according taxonNode
90 public TaxonNode
loadTaxonNodeByTaxon(Taxon taxon
, UUID classificationUuid
, List
<String
> propertyPaths
);
93 * Loads all TaxonNodes of the specified classification for a given Rank or lower.
94 * If a branch of the classification tree is not containing a TaxonNode with a Taxon at the given
95 * Rank the according node associated with the next lower Rank is taken as root node in this case.
96 * So the nodes returned may reference Taxa with different Ranks.
98 * If the <code>rank</code> is null the absolute root nodes will be returned.
100 * @param classification may be null for all classifications
101 * @param subtree filter on a taxonomic subtree
102 * @param rank the set to null for to get the root nodes of classifications
103 * @param includeUnpublished if <code>true</code> unpublished taxa are also exported
104 * @param pageSize The maximum number of relationships returned (can be null for all relationships)
105 * @param pageIndex The offset (in pageSize chunks) from the start of the result set (0 - based)
106 * @param propertyPaths
108 * @see #pageRankSpecificRootNodes(Classification, TaxonNode, Rank, boolean, Integer, Integer, List)
111 public List
<TaxonNode
> listRankSpecificRootNodes(Classification classification
, TaxonNode subtree
,
112 Rank rank
, boolean includeUnpublished
, Integer pageSize
, Integer pageIndex
,
113 List
<String
> propertyPaths
);
117 * @see #listRankSpecificRootNodes(Classification, TaxonNode, Rank, boolean, Integer, Integer, List)
118 * @deprecated keep this for compatibility to older versions, might be removed in versions >5.3
121 public List
<TaxonNode
> listRankSpecificRootNodes(Classification classification
,
122 Rank rank
, boolean includeUnpublished
, Integer pageSize
, Integer pageIndex
,
123 List
<String
> propertyPaths
);
127 * Loads all TaxonNodes of the specified classification for a given Rank or lower.
128 * If a branch of the classification tree is not containing a TaxonNode with a Taxon at the given
129 * Rank the according node associated with the next lower Rank is taken as root node in this case.
130 * So the nodes returned may reference Taxa with different Ranks.
132 * If the <code>rank</code> is null the absolute root nodes will be returned.
134 * @param classification may be null for all classifications
135 * @param subtree the taxonomic subtree filter
136 * @param rank the set to null for to get the root nodes of classifications
137 * @param includeUnpublished if <code>true</code> unpublished taxa are also exported
138 * @param pageSize The maximum number of relationships returned (can be null for all relationships)
139 * @param pageIndex The offset (in pageSize chunks) from the start of the result set (0 - based)
140 * @param propertyPaths
143 * @see #listRankSpecificRootNodes(Classification, TaxonNode, Rank, boolean, Integer, Integer, List)
145 public Pager
<TaxonNode
> pageRankSpecificRootNodes(Classification classification
, TaxonNode subtree
,
146 Rank rank
, boolean includeUnpublished
, Integer pageSize
, Integer pageIndex
,
147 List
<String
> propertyPaths
);
149 * @see #pageRankSpecificRootNodes(Classification, TaxonNode, Rank, boolean, Integer, Integer, List)
150 * @deprecated keep this for compatibility to older versions, might be removed in versions >5.3
153 public Pager
<TaxonNode
> pageRankSpecificRootNodes(Classification classification
,
154 Rank rank
, boolean includeUnpublished
, Integer pageSize
, Integer pageIndex
,
155 List
<String
> propertyPaths
);
160 * specifies the root level of the classification, may be null.
161 * Nodes of this rank or in case this rank does not exist in the
162 * current branch the next lower rank is taken as root node for
163 * this rank henceforth called the <b>base node</b>.
164 * @param propertyPaths
165 * the initialization strategy for the returned TaxonNode
167 * @param includeUnpublished
168 * if <code>true</code> no {@link UnpublishedException}
169 * is thrown if any of the taxa in the branch are unpublished
170 * @return the path of nodes from the <b>base node</b> to the node of the
172 * @throws UnpublishedException
173 * if any of the taxa in the path is unpublished an {@link UnpublishedException} is thrown.
175 public List
<TaxonNode
> loadTreeBranch(TaxonNode taxonNode
, TaxonNode subtree
, Rank baseRank
, boolean includeUnpublished
,
176 List
<String
> propertyPaths
) throws UnpublishedException
;
177 public List
<TaxonNode
> loadTreeBranch(TaxonNode taxonNode
, Rank baseRank
, boolean includeUnpublished
,
178 List
<String
> propertyPaths
) throws UnpublishedException
;
181 * Although this method seems to be a redundant alternative to {@link #loadChildNodesOfTaxonNode(TaxonNode, List)} it is an important
182 * alternative from which web services benefit. Without this method the web service controller method, which operates outside of the
183 * transaction, would have to initialize the full taxon tree with all nodes of the taxon.
184 * This would be rather slow compared to using this method.
186 * @param classification
187 * the classification to be used
189 * specifies the root level of the classification, may be null.
190 * Nodes of this rank or in case this rank does not exist in the
191 * current branch the next lower rank is taken as as root node for
192 * this rank henceforth called the <b>base node</b>.
193 * @param includeUnpublished
194 * if <code>true</code> no {@link UnpublishedException}
195 * is thrown if any of the taxa in the branch are unpublished
196 * @param propertyPaths
197 * the initialization strategy for the returned TaxonNode
199 * @return the path of nodes from the <b>base node</b> to the node of the specified
201 * @throws UnpublishedException
202 * if any of the taxa in the path is unpublished an {@link UnpublishedException} is thrown
204 public List
<TaxonNode
> loadTreeBranchToTaxon(Taxon taxon
, Classification classification
,
205 TaxonNode subtree
, Rank baseRank
,
206 boolean includeUnpublished
, List
<String
> propertyPaths
) throws UnpublishedException
;
207 public List
<TaxonNode
> loadTreeBranchToTaxon(Taxon taxon
, Classification classification
,
209 boolean includeUnpublished
, List
<String
> propertyPaths
) throws UnpublishedException
;
211 public List
<TaxonNode
> listChildNodesOfTaxon(UUID taxonUuid
, UUID classificationUuid
, boolean includeUnpublished
,
212 Integer pageSize
, Integer pageIndex
, List
<String
> propertyPaths
);
214 public List
<TaxonNode
> listChildNodesOfTaxon(UUID taxonUuid
, UUID classificationUuid
, UUID subtreeUuid
, boolean includeUnpublished
,
215 Integer pageSize
, Integer pageIndex
, List
<String
> propertyPaths
) throws FilterException
;
220 * @param propertyPaths
221 * @deprecated move to TaxonNodeService
225 public List
<TaxonNode
> loadChildNodesOfTaxonNode(TaxonNode taxonNode
, List
<String
> propertyPaths
);
229 * @param classification
232 public List
<UuidAndTitleCache
<TaxonNode
>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(Classification classification
);
234 public Map
<UUID
, List
<MediaRepresentation
>> getAllMediaForChildNodes(TaxonNode taxonNode
, List
<String
> propertyPaths
, int size
, int height
, int widthOrDuration
, String
[] mimeTypes
);
240 * @deprecated use TaxonNodeService instead
243 public UUID
removeTaxonNode(TaxonNode taxonNode
);
249 * @deprecated use TaxonNodeService instead
252 public UUID
saveTaxonNode(TaxonNode taxonNode
);
256 * @param taxonNodeCollection
258 * @deprecated use TaxonNodeService instead
261 public Map
<UUID
, TaxonNode
> saveTaxonNodeAll(Collection
<TaxonNode
> taxonNodeCollection
);
263 public UUID
removeTreeNode(ITaxonTreeNode treeNode
);
265 public UUID
saveTreeNode(ITaxonTreeNode treeNode
);
267 public List
<TaxonNode
> getAllNodes();
269 public UpdateResult
createHierarchyInClassification(Classification classification
, CreateHierarchyForClassificationConfigurator configurator
);
271 public List
<UuidAndTitleCache
<TaxonNode
>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(UUID classificationUuid
);
273 public List
<UuidAndTitleCache
<TaxonNode
>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(
274 UUID classificationUuid
, Integer limit
, String pattern
);
276 public List
<UuidAndTitleCache
<TaxonNode
>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(
277 Classification classification
, Integer limit
, String pattern
);
279 public List
<TaxonNode
> listSiblingsOfTaxon(UUID taxonUuid
, UUID classificationUuid
, boolean includeUnpublished
,
280 Integer pageSize
, Integer pageIndex
, List
<String
> propertyPaths
);
282 public Pager
<TaxonNode
> pageSiblingsOfTaxon(UUID taxonUuid
, UUID classificationUuid
, boolean includeUnpublished
, Integer pageSize
, Integer pageIndex
,
283 List
<String
> propertyPaths
);
285 public ClassificationLookupDTO
classificationLookup(Classification classification
);
287 public DeleteResult
delete(UUID classificationUuid
, TaxonDeletionConfigurator config
);
290 * Returns the higher taxon id for each taxon in taxonUuids.
291 * The highter taxon is defined by rank where the lowest rank equal or above minRank
292 * is taken. If maxRank <> null and no taxon exists with minRank <= rank <= maxRank
293 * no higher taxon is returned for this taxon.
300 public List
<GroupedTaxonDTO
> groupTaxaByHigherTaxon(List
<UUID
> taxonUuids
, UUID classificationUuid
, Rank minRank
, Rank maxRank
);
304 * @param classificationUuid
309 public List
<GroupedTaxonDTO
> groupTaxaByMarkedParents(List
<UUID
> taxonUuids
, UUID classificationUuid
,
310 MarkerType markerType
, Boolean value
);
314 * Returns the most relevant data of a taxon/taxon node, including children, synonyms
315 * and certain ancestors if required.
316 * @param classificationUuid
319 * @param includeUnpublished
320 * @param ancestorMarkers
323 public TaxonInContextDTO
getTaxonInContext(UUID classificationUuid
, UUID taxonUuid
,
324 Boolean doChildren
, Boolean doSynonyms
, boolean includeUnpublished
, List
<UUID
> ancestorMarkers
,
325 NodeSortMode sortMode
);
328 * @param classification
331 public UUID
saveClassification(Classification classification
);
334 * @param classificationUuid
337 * @param searchForClassifications
340 public List
<UuidAndTitleCache
<TaxonNode
>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(
341 UUID classificationUuid
, Integer limit
, String pattern
, boolean searchForClassifications
);
344 * @param classification
347 * @param searchForClassifications
350 public List
<UuidAndTitleCache
<TaxonNode
>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(
351 Classification classification
, Integer limit
, String pattern
, boolean searchForClassifications
);
354 * @param classificationUuid
355 * @param searchForClassifications
358 public List
<UuidAndTitleCache
<TaxonNode
>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(
359 UUID classificationUuid
, boolean searchForClassifications
);
362 * @param classification
363 * @param searchForClassifications
366 public List
<UuidAndTitleCache
<TaxonNode
>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(
367 Classification classification
, boolean searchForClassifications
);