fix #8458: remove unused parameter
[cdmlib.git] / cdmlib-services / src / main / java / eu / etaxonomy / cdm / api / service / IClassificationService.java
1 /**
2 * Copyright (C) 2007 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
5 *
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.
8 */
9
10 package eu.etaxonomy.cdm.api.service;
11
12 import java.util.Collection;
13 import java.util.List;
14 import java.util.Map;
15 import java.util.UUID;
16
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;
36
37
38 /**
39 * @author n.hoffmann
40 * @since Sep 21, 2009
41 */
42 public interface IClassificationService extends IIdentifiableEntityService<Classification> {
43
44 /**
45 *
46 * @param uuid
47 * @return
48 */
49 public ITaxonTreeNode getTreeNodeByUuid(UUID uuid);
50
51 /**
52 *
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
56 */
57 public TaxonNode getRootNode(UUID classificationUuid);
58
59 public UUID getTaxonNodeUuidByTaxonUuid(UUID classificationUuid, UUID taxonUuid);
60
61 /**
62 * Clones an existing classification including all taxa and taxon nodes.
63 * @param name
64 * @param sec
65 * @param relationshipType
66 * @return
67 */
68 public UpdateResult cloneClassification(UUID classificationUuid, String name, Reference sec, TaxonRelationshipType relationshipType);
69
70 /**
71 *
72 * @param limit
73 * @param start
74 * @param orderHints
75 * @param propertyPaths
76 * @return
77 */
78 public List<Classification> listClassifications(Integer limit, Integer start, List<OrderHint> orderHints, List<String> propertyPaths);
79
80 /**
81 *
82 * @param taxon
83 * @param classificationUuid
84 * @param propertyPaths
85 * @return
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
88 */
89 @Deprecated
90 public TaxonNode loadTaxonNodeByTaxon(Taxon taxon, UUID classificationUuid, List<String> propertyPaths);
91
92 /**
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.
97 *
98 * If the <code>rank</code> is null the absolute root nodes will be returned.
99
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
107 * @return
108 * @see #pageRankSpecificRootNodes(Classification, TaxonNode, Rank, boolean, Integer, Integer, List)
109 *
110 */
111 public List<TaxonNode> listRankSpecificRootNodes(Classification classification, TaxonNode subtree,
112 Rank rank, boolean includeUnpublished, Integer pageSize, Integer pageIndex,
113 List<String> propertyPaths);
114
115
116 /**
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.
121 *
122 * If the <code>rank</code> is null the absolute root nodes will be returned.
123 *
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
131 * @return
132 *
133 * @see #listRankSpecificRootNodes(Classification, TaxonNode, Rank, boolean, Integer, Integer, List)
134 */
135 public Pager<TaxonNode> pageRankSpecificRootNodes(Classification classification, TaxonNode subtree,
136 Rank rank, boolean includeUnpublished, Integer pageSize, Integer pageIndex,
137 List<String> propertyPaths);
138 /**
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
141 */
142 @Deprecated
143 public Pager<TaxonNode> pageRankSpecificRootNodes(Classification classification,
144 Rank rank, boolean includeUnpublished, Integer pageSize, Integer pageIndex,
145 List<String> propertyPaths);
146
147 /**
148 * @param taxonNode
149 * @param baseRank
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
156 * instances.
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
161 * specified taxon.
162 * @throws UnpublishedException
163 * if any of the taxa in the path is unpublished an {@link UnpublishedException} is thrown.
164 */
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;
169
170 /**
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.
175 * @param taxon
176 * @param classification
177 * the classification to be used
178 * @param baseRank
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
188 * instances.
189 * @return the path of nodes from the <b>base node</b> to the node of the specified
190 * taxon.
191 * @throws UnpublishedException
192 * if any of the taxa in the path is unpublished an {@link UnpublishedException} is thrown
193 */
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,
198 Rank baseRank,
199 boolean includeUnpublished, List<String> propertyPaths) throws UnpublishedException;
200
201 public List<TaxonNode> listChildNodesOfTaxon(UUID taxonUuid, UUID classificationUuid, boolean includeUnpublished,
202 Integer pageSize, Integer pageIndex, List<String> propertyPaths);
203
204 public List<TaxonNode> listChildNodesOfTaxon(UUID taxonUuid, UUID classificationUuid, UUID subtreeUuid, boolean includeUnpublished,
205 Integer pageSize, Integer pageIndex, List<String> propertyPaths) throws FilterException;
206
207
208 /**
209 * @param taxonNode
210 * @param propertyPaths
211 * @deprecated move to TaxonNodeService
212 * @return
213 */
214 @Deprecated
215 public List<TaxonNode> loadChildNodesOfTaxonNode(TaxonNode taxonNode, List<String> propertyPaths);
216
217 /**
218 *
219 * @param classification
220 * @return
221 */
222 public List<UuidAndTitleCache<TaxonNode>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(Classification classification);
223
224 public Map<UUID, List<MediaRepresentation>> getAllMediaForChildNodes(TaxonNode taxonNode, List<String> propertyPaths, int size, int height, int widthOrDuration, String[] mimeTypes);
225
226 /**
227 *
228 * @param taxonNode
229 * @return
230 * @deprecated use TaxonNodeService instead
231 */
232 @Deprecated
233 public UUID removeTaxonNode(TaxonNode taxonNode);
234
235 /**
236 *
237 * @param taxonNode
238 * @return
239 * @deprecated use TaxonNodeService instead
240 */
241 @Deprecated
242 public UUID saveTaxonNode(TaxonNode taxonNode);
243
244 /**
245 *
246 * @param taxonNodeCollection
247 * @return
248 * @deprecated use TaxonNodeService instead
249 */
250 @Deprecated
251 public Map<UUID, TaxonNode> saveTaxonNodeAll(Collection<TaxonNode> taxonNodeCollection);
252
253 public UUID removeTreeNode(ITaxonTreeNode treeNode);
254
255 public UUID saveTreeNode(ITaxonTreeNode treeNode);
256
257 public List<TaxonNode> getAllNodes();
258
259 public UpdateResult createHierarchyInClassification(Classification classification, CreateHierarchyForClassificationConfigurator configurator);
260
261 public List<UuidAndTitleCache<TaxonNode>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(UUID classificationUuid);
262
263 public List<UuidAndTitleCache<TaxonNode>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(
264 UUID classificationUuid, Integer limit, String pattern);
265
266 public List<UuidAndTitleCache<TaxonNode>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(
267 Classification classification, Integer limit, String pattern);
268
269 public List<TaxonNode> listSiblingsOfTaxon(UUID taxonUuid, UUID classificationUuid, boolean includeUnpublished,
270 Integer pageSize, Integer pageIndex, List<String> propertyPaths);
271
272 public Pager<TaxonNode> pageSiblingsOfTaxon(UUID taxonUuid, UUID classificationUuid, boolean includeUnpublished, Integer pageSize, Integer pageIndex,
273 List<String> propertyPaths);
274
275 public ClassificationLookupDTO classificationLookup(Classification classification);
276
277 public DeleteResult delete(UUID classificationUuid, TaxonDeletionConfigurator config);
278
279 /**
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.
284 *
285 * @param taxonUuids
286 * @param minRank
287 * @param maxRank
288 * @return
289 */
290 public List<GroupedTaxonDTO> groupTaxaByHigherTaxon(List<UUID> taxonUuids, UUID classificationUuid, Rank minRank, Rank maxRank);
291
292 /**
293 * @param taxonUuids
294 * @param classificationUuid
295 * @param markerType
296 * @param value
297 * @return
298 */
299 public List<GroupedTaxonDTO> groupTaxaByMarkedParents(List<UUID> taxonUuids, UUID classificationUuid,
300 MarkerType markerType, Boolean value);
301
302
303 /**
304 * Returns the most relevant data of a taxon/taxon node, including children, synonyms
305 * and certain ancestors if required.
306 * @param classificationUuid
307 * @param taxonUuid
308 * @param doSynonyms
309 * @param includeUnpublished
310 * @param ancestorMarkers
311 * @return
312 */
313 public TaxonInContextDTO getTaxonInContext(UUID classificationUuid, UUID taxonUuid,
314 Boolean doChildren, Boolean doSynonyms, boolean includeUnpublished, List<UUID> ancestorMarkers,
315 NodeSortMode sortMode);
316
317 /**
318 * @param classification
319 * @return
320 */
321 public UUID saveClassification(Classification classification);
322
323 /**
324 * @param classificationUuid
325 * @param limit
326 * @param pattern
327 * @param searchForClassifications
328 * @return
329 */
330 public List<UuidAndTitleCache<TaxonNode>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(
331 UUID classificationUuid, Integer limit, String pattern, boolean searchForClassifications);
332
333 /**
334 * @param classification
335 * @param limit
336 * @param pattern
337 * @param searchForClassifications
338 * @return
339 */
340 public List<UuidAndTitleCache<TaxonNode>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(
341 Classification classification, Integer limit, String pattern, boolean searchForClassifications);
342
343 /**
344 * @param classificationUuid
345 * @param searchForClassifications
346 * @return
347 */
348 public List<UuidAndTitleCache<TaxonNode>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(
349 UUID classificationUuid, boolean searchForClassifications);
350
351 /**
352 * @param classification
353 * @param searchForClassifications
354 * @return
355 */
356 public List<UuidAndTitleCache<TaxonNode>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(
357 Classification classification, boolean searchForClassifications);
358
359 }