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 * Loads all TaxonNodes of the specified classification for a given Rank or lower.
118 * If a branch of the classification tree is not containing a TaxonNode with a Taxon at the given
119 * Rank the according node associated with the next lower Rank is taken as root node in this case.
120 * So the nodes returned may reference Taxa with different Ranks.
122 * If the <code>rank</code> is null the absolute root nodes will be returned.
124 * @param classification may be null for all classifications
125 * @param subtree the taxonomic subtree filter
126 * @param rank the set to null for to get the root nodes of classifications
127 * @param includeUnpublished if <code>true</code> unpublished taxa are also exported
128 * @param pageSize The maximum number of relationships returned (can be null for all relationships)
129 * @param pageIndex The offset (in pageSize chunks) from the start of the result set (0 - based)
130 * @param propertyPaths
133 * @see #listRankSpecificRootNodes(Classification, TaxonNode, Rank, boolean, Integer, Integer, List)
135 public Pager
<TaxonNode
> pageRankSpecificRootNodes(Classification classification
, TaxonNode subtree
,
136 Rank rank
, boolean includeUnpublished
, Integer pageSize
, Integer pageIndex
,
137 List
<String
> propertyPaths
);
139 * @see #pageRankSpecificRootNodes(Classification, TaxonNode, Rank, boolean, Integer, Integer, List)
140 * @deprecated keep this for compatibility to older versions, might be removed in versions >5.3
143 public Pager
<TaxonNode
> pageRankSpecificRootNodes(Classification classification
,
144 Rank rank
, boolean includeUnpublished
, Integer pageSize
, Integer pageIndex
,
145 List
<String
> propertyPaths
);
150 * specifies the root level of the classification, may be null.
151 * Nodes of this rank or in case this rank does not exist in the
152 * current branch the next lower rank is taken as root node for
153 * this rank henceforth called the <b>base node</b>.
154 * @param propertyPaths
155 * the initialization strategy for the returned TaxonNode
157 * @param includeUnpublished
158 * if <code>true</code> no {@link UnpublishedException}
159 * is thrown if any of the taxa in the branch are unpublished
160 * @return the path of nodes from the <b>base node</b> to the node of the
162 * @throws UnpublishedException
163 * if any of the taxa in the path is unpublished an {@link UnpublishedException} is thrown.
165 public List
<TaxonNode
> loadTreeBranch(TaxonNode taxonNode
, TaxonNode subtree
, Rank baseRank
, boolean includeUnpublished
,
166 List
<String
> propertyPaths
) throws UnpublishedException
;
167 public List
<TaxonNode
> loadTreeBranch(TaxonNode taxonNode
, Rank baseRank
, boolean includeUnpublished
,
168 List
<String
> propertyPaths
) throws UnpublishedException
;
171 * Although this method seems to be a redundant alternative to {@link #loadChildNodesOfTaxonNode(TaxonNode, List)} it is an important
172 * alternative from which web services benefit. Without this method the web service controller method, which operates outside of the
173 * transaction, would have to initialize the full taxon tree with all nodes of the taxon.
174 * This would be rather slow compared to using this method.
176 * @param classification
177 * the classification to be used
179 * specifies the root level of the classification, may be null.
180 * Nodes of this rank or in case this rank does not exist in the
181 * current branch the next lower rank is taken as as root node for
182 * this rank henceforth called the <b>base node</b>.
183 * @param includeUnpublished
184 * if <code>true</code> no {@link UnpublishedException}
185 * is thrown if any of the taxa in the branch are unpublished
186 * @param propertyPaths
187 * the initialization strategy for the returned TaxonNode
189 * @return the path of nodes from the <b>base node</b> to the node of the specified
191 * @throws UnpublishedException
192 * if any of the taxa in the path is unpublished an {@link UnpublishedException} is thrown
194 public List
<TaxonNode
> loadTreeBranchToTaxon(Taxon taxon
, Classification classification
,
195 TaxonNode subtree
, Rank baseRank
,
196 boolean includeUnpublished
, List
<String
> propertyPaths
) throws UnpublishedException
;
197 public List
<TaxonNode
> loadTreeBranchToTaxon(Taxon taxon
, Classification classification
,
199 boolean includeUnpublished
, List
<String
> propertyPaths
) throws UnpublishedException
;
201 public List
<TaxonNode
> listChildNodesOfTaxon(UUID taxonUuid
, UUID classificationUuid
, boolean includeUnpublished
,
202 Integer pageSize
, Integer pageIndex
, List
<String
> propertyPaths
);
204 public List
<TaxonNode
> listChildNodesOfTaxon(UUID taxonUuid
, UUID classificationUuid
, UUID subtreeUuid
, boolean includeUnpublished
,
205 Integer pageSize
, Integer pageIndex
, List
<String
> propertyPaths
) throws FilterException
;
210 * @param propertyPaths
211 * @deprecated move to TaxonNodeService
215 public List
<TaxonNode
> loadChildNodesOfTaxonNode(TaxonNode taxonNode
, List
<String
> propertyPaths
);
219 * @param classification
222 public List
<UuidAndTitleCache
<TaxonNode
>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(Classification classification
);
224 public Map
<UUID
, List
<MediaRepresentation
>> getAllMediaForChildNodes(TaxonNode taxonNode
, List
<String
> propertyPaths
, int size
, int height
, int widthOrDuration
, String
[] mimeTypes
);
230 * @deprecated use TaxonNodeService instead
233 public UUID
removeTaxonNode(TaxonNode taxonNode
);
239 * @deprecated use TaxonNodeService instead
242 public UUID
saveTaxonNode(TaxonNode taxonNode
);
246 * @param taxonNodeCollection
248 * @deprecated use TaxonNodeService instead
251 public Map
<UUID
, TaxonNode
> saveTaxonNodeAll(Collection
<TaxonNode
> taxonNodeCollection
);
253 public UUID
removeTreeNode(ITaxonTreeNode treeNode
);
255 public UUID
saveTreeNode(ITaxonTreeNode treeNode
);
257 public List
<TaxonNode
> getAllNodes();
259 public UpdateResult
createHierarchyInClassification(Classification classification
, CreateHierarchyForClassificationConfigurator configurator
);
261 public List
<UuidAndTitleCache
<TaxonNode
>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(UUID classificationUuid
);
263 public List
<UuidAndTitleCache
<TaxonNode
>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(
264 UUID classificationUuid
, Integer limit
, String pattern
);
266 public List
<UuidAndTitleCache
<TaxonNode
>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(
267 Classification classification
, Integer limit
, String pattern
);
269 public List
<TaxonNode
> listSiblingsOfTaxon(UUID taxonUuid
, UUID classificationUuid
, boolean includeUnpublished
,
270 Integer pageSize
, Integer pageIndex
, List
<String
> propertyPaths
);
272 public Pager
<TaxonNode
> pageSiblingsOfTaxon(UUID taxonUuid
, UUID classificationUuid
, boolean includeUnpublished
, Integer pageSize
, Integer pageIndex
,
273 List
<String
> propertyPaths
);
275 public ClassificationLookupDTO
classificationLookup(Classification classification
);
277 public DeleteResult
delete(UUID classificationUuid
, TaxonDeletionConfigurator config
);
280 * Returns the higher taxon id for each taxon in taxonUuids.
281 * The highter taxon is defined by rank where the lowest rank equal or above minRank
282 * is taken. If maxRank <> null and no taxon exists with minRank <= rank <= maxRank
283 * no higher taxon is returned for this taxon.
290 public List
<GroupedTaxonDTO
> groupTaxaByHigherTaxon(List
<UUID
> taxonUuids
, UUID classificationUuid
, Rank minRank
, Rank maxRank
);
294 * @param classificationUuid
299 public List
<GroupedTaxonDTO
> groupTaxaByMarkedParents(List
<UUID
> taxonUuids
, UUID classificationUuid
,
300 MarkerType markerType
, Boolean value
);
304 * Returns the most relevant data of a taxon/taxon node, including children, synonyms
305 * and certain ancestors if required.
306 * @param classificationUuid
309 * @param includeUnpublished
310 * @param ancestorMarkers
313 public TaxonInContextDTO
getTaxonInContext(UUID classificationUuid
, UUID taxonUuid
,
314 Boolean doChildren
, Boolean doSynonyms
, boolean includeUnpublished
, List
<UUID
> ancestorMarkers
,
315 NodeSortMode sortMode
);
318 * @param classification
321 public UUID
saveClassification(Classification classification
);
324 * @param classificationUuid
327 * @param searchForClassifications
330 public List
<UuidAndTitleCache
<TaxonNode
>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(
331 UUID classificationUuid
, Integer limit
, String pattern
, boolean searchForClassifications
);
334 * @param classification
337 * @param searchForClassifications
340 public List
<UuidAndTitleCache
<TaxonNode
>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(
341 Classification classification
, Integer limit
, String pattern
, boolean searchForClassifications
);
344 * @param classificationUuid
345 * @param searchForClassifications
348 public List
<UuidAndTitleCache
<TaxonNode
>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(
349 UUID classificationUuid
, boolean searchForClassifications
);
352 * @param classification
353 * @param searchForClassifications
356 public List
<UuidAndTitleCache
<TaxonNode
>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(
357 Classification classification
, boolean searchForClassifications
);