#5177 fixing tests which where broken after rebasing the TransmissionEngine-speedup...
[cdmlib.git] / cdmlib-services / src / main / java / eu / etaxonomy / cdm / api / service / IClassificationService.java
1 // $Id$
2 /**
3 * Copyright (C) 2007 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
6 *
7 * The contents of this file are subject to the Mozilla Public License Version 1.1
8 * See LICENSE.TXT at the top of this package for the full license terms.
9 */
10
11 package eu.etaxonomy.cdm.api.service;
12
13 import java.util.Collection;
14 import java.util.List;
15 import java.util.Map;
16 import java.util.UUID;
17
18 import eu.etaxonomy.cdm.api.service.config.CreateHierarchyForClassificationConfigurator;
19 import eu.etaxonomy.cdm.api.service.pager.Pager;
20 import eu.etaxonomy.cdm.model.media.MediaRepresentation;
21 import eu.etaxonomy.cdm.model.name.Rank;
22 import eu.etaxonomy.cdm.model.taxon.Classification;
23 import eu.etaxonomy.cdm.model.taxon.ITaxonTreeNode;
24 import eu.etaxonomy.cdm.model.taxon.Taxon;
25 import eu.etaxonomy.cdm.model.taxon.TaxonNode;
26 import eu.etaxonomy.cdm.persistence.dto.ClassificationLookupDTO;
27 import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache;
28 import eu.etaxonomy.cdm.persistence.query.OrderHint;
29
30
31 /**
32 * @author n.hoffmann
33 * @created Sep 21, 2009
34 */
35 public interface IClassificationService extends IIdentifiableEntityService<Classification> {
36
37 /**
38 *
39 * @param uuid
40 * @return
41 */
42 public TaxonNode getTaxonNodeByUuid(UUID uuid);
43
44 /**
45 *
46 * @param uuid
47 * @return
48 */
49 public ITaxonTreeNode getTreeNodeByUuid(UUID uuid);
50
51 /**
52 *
53 * @param limit
54 * @param start
55 * @param orderHints
56 * @param propertyPaths
57 * @return
58 */
59 public List<Classification> listClassifications(Integer limit, Integer start, List<OrderHint> orderHints, List<String> propertyPaths);
60
61 /**
62 *
63 * @param taxon
64 * @param classificationUuid
65 * @param propertyPaths
66 * @return
67 * @deprecated use loadTaxonNode(TaxonNode taxonNode, ...) instead
68 * if you have a classification and a taxon that is in it, you should also have the according taxonNode
69 */
70 @Deprecated
71 public TaxonNode loadTaxonNodeByTaxon(Taxon taxon, UUID classificationUuid, List<String> propertyPaths);
72
73 /**
74 *
75 * @param taxonNode
76 * @param propertyPaths
77 * @return
78 * @deprecated use TaxonNodeService instead
79 */
80 @Deprecated
81 public TaxonNode loadTaxonNode(TaxonNode taxonNode, List<String> propertyPaths);
82
83 /**
84 * Loads all TaxonNodes of the specified classification for a given Rank or lower.
85 * If a branch of the classification tree is not containing a TaxonNode with a Taxon at the given
86 * Rank the according node associated with the next lower Rank is taken as root node in this case.
87 * So the nodes returned may reference Taxa with different Ranks.
88 *
89 * If the <code>rank</code> is null the absolute root nodes will be returned.
90 *
91 * @param classification may be null for all classifications
92 * @param rank the set to null for to get the root nodes of classifications
93 * @param pageSize The maximum number of relationships returned (can be null for all relationships)
94 * @param pageIndex The offset (in pageSize chunks) from the start of the result set (0 - based)
95 * @param propertyPaths
96 * @return
97 *
98 */
99 public List<TaxonNode> listRankSpecificRootNodes(Classification classification, Rank rank, Integer pageSize, Integer pageIndex, List<String> propertyPaths);
100
101
102 /**
103 * Loads all TaxonNodes of the specified classification for a given Rank or lower.
104 * If a branch of the classification tree is not containing a TaxonNode with a Taxon at the given
105 * Rank the according node associated with the next lower Rank is taken as root node in this case.
106 * So the nodes returned may reference Taxa with different Ranks.
107 *
108 * If the <code>rank</code> is null the absolute root nodes will be returned.
109 *
110 * @param classification may be null for all classifications
111 * @param rank the set to null for to get the root nodes of classifications
112 * @param pageSize The maximum number of relationships returned (can be null for all relationships)
113 * @param pageIndex The offset (in pageSize chunks) from the start of the result set (0 - based)
114 * @param propertyPaths
115 * @return
116 *
117 */
118 public Pager<TaxonNode> pageRankSpecificRootNodes(Classification classification, Rank rank, Integer pageSize, Integer pageIndex, List<String> propertyPaths);
119
120 /**
121 * @param taxonNode
122 * @param baseRank
123 * specifies the root level of the classification, may be null.
124 * Nodes of this rank or in case this rank does not exist in the
125 * current branch the next lower rank is taken as root node for
126 * this rank henceforth called the <b>base node</b>.
127 * @param propertyPaths
128 * the initialization strategy for the returned TaxonNode
129 * instances.
130 * @return the path of nodes from the <b>base node</b> to the node of the
131 * specified taxon.
132 */
133 public List<TaxonNode> loadTreeBranch(TaxonNode taxonNode, Rank baseRank, List<String> propertyPaths);
134
135 /**
136 * Although this method seems to be a redundant alternative to {@link #loadChildNodesOfTaxonNode(TaxonNode, List)} it is an important
137 * alternative from which web services benefit. Without this method the web service controller method, which operates outside of the
138 * transaction, would have to initialize the full taxon tree with all nodes of the taxon.
139 * This would be rather slow compared to using this method.
140 * @param taxon
141 * @param classification
142 * the classification to be used
143 * @param baseRank
144 * specifies the root level of the classification, may be null.
145 * Nodes of this rank or in case this rank does not exist in the
146 * current branch the next lower rank is taken as as root node for
147 * this rank henceforth called the <b>base node</b>.
148 * @param propertyPaths
149 * the initialization strategy for the returned TaxonNode
150 * instances.
151 * @return the path of nodes from the <b>base node</b> to the node of the specified
152 * taxon.
153 */
154 public List<TaxonNode> loadTreeBranchToTaxon(Taxon taxon, Classification classification, Rank baseRank, List<String> propertyPaths);
155
156
157
158 /**
159 * @param taxonUuid
160 * @param classificationUuid
161 * @param propertyPaths
162 * @return
163 */
164 public List<TaxonNode> listChildNodesOfTaxon(UUID taxonUuid, UUID classificationUuid, Integer pageSize, Integer pageIndex, List<String> propertyPaths);
165
166 /**
167 * @param taxonNode
168 * @param propertyPaths
169 * @deprecated move to TaxonNodeService
170 * @return
171 */
172 @Deprecated
173 public List<TaxonNode> loadChildNodesOfTaxonNode(TaxonNode taxonNode, List<String> propertyPaths);
174
175 /**
176 *
177 * @param classification
178 * @return
179 */
180 public List<UuidAndTitleCache<TaxonNode>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(Classification classification, List<UUID> excludeTaxa);
181
182 /**
183 * @param taxon
184 * @param taxTree
185 * @param propertyPaths
186 * @param size
187 * @param height
188 * @param widthOrDuration
189 * @param mimeTypes
190 * @return
191 *
192 * @deprecated use getAllMediaForChildNodes(TaxonNode taxonNode, ...) instead
193 * if you have a classification and a taxon that is in it, you should also have the according taxonNode
194 */
195 @Deprecated
196 public Map<UUID, List<MediaRepresentation>> getAllMediaForChildNodes(Taxon taxon, Classification taxTree, List<String> propertyPaths, int size, int height, int widthOrDuration, String[] mimeTypes);
197
198 /**
199 *
200 * @param taxonNode
201 * @param propertyPaths
202 * @param size
203 * @param height
204 * @param widthOrDuration
205 * @param mimeTypes
206 * @return
207 */
208 public Map<UUID, List<MediaRepresentation>> getAllMediaForChildNodes(TaxonNode taxonNode, List<String> propertyPaths, int size, int height, int widthOrDuration, String[] mimeTypes);
209
210 /**
211 *
212 * @param taxonNode
213 * @return
214 * @deprecated use TaxonNodeService instead
215 */
216 @Deprecated
217 public UUID removeTaxonNode(TaxonNode taxonNode);
218
219 /**
220 *
221 * @param taxonNode
222 * @return
223 * @deprecated use TaxonNodeService instead
224 */
225 @Deprecated
226 public UUID saveTaxonNode(TaxonNode taxonNode);
227
228 /**
229 *
230 * @param taxonNodeCollection
231 * @return
232 * @deprecated use TaxonNodeService instead
233 */
234 @Deprecated
235 public Map<UUID, TaxonNode> saveTaxonNodeAll(Collection<TaxonNode> taxonNodeCollection);
236
237 /**
238 *
239 * @param treeNode
240 * @return
241 */
242
243 public UUID removeTreeNode(ITaxonTreeNode treeNode);
244
245 /**
246 *
247 * @param treeNode
248 * @return
249 */
250 public UUID saveTreeNode(ITaxonTreeNode treeNode);
251
252
253 public List<TaxonNode> getAllNodes();
254
255 public UpdateResult createHierarchyInClassification(Classification classification, CreateHierarchyForClassificationConfigurator configurator);
256
257 /**
258 * @param classificationUuid
259 * @param excludeTaxa
260 * @return
261 */
262 public List<UuidAndTitleCache<TaxonNode>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(UUID classificationUuid, List<UUID> excludeTaxa);
263
264 /**
265 * @param classificationUuid
266 * @param excludeTaxa
267 * @param limit
268 * @param pattern
269 * @return
270 */
271 List<UuidAndTitleCache<TaxonNode>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(
272 UUID classificationUuid, List<UUID> excludeTaxa, Integer limit, String pattern);
273
274 /**
275 * @param classification
276 * @param excludeTaxa
277 * @param limit
278 * @param pattern
279 * @return
280 */
281 List<UuidAndTitleCache<TaxonNode>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(
282 Classification classification, List<UUID> excludeTaxa, Integer limit, String pattern);
283
284 /**
285 * @param taxonUuid
286 * @param classificationUuid
287 * @param pageSize
288 * @param pageIndex
289 * @param propertyPaths
290 * @return
291 */
292 List<TaxonNode> listSiblingsOfTaxon(UUID taxonUuid, UUID classificationUuid, Integer pageSize, Integer pageIndex,
293 List<String> propertyPaths);
294
295 /**
296 * @param taxonUuid
297 * @param classificationUuid
298 * @param pageSize
299 * @param pageIndex
300 * @param propertyPaths
301 * @return
302 */
303 Pager<TaxonNode> pageSiblingsOfTaxon(UUID taxonUuid, UUID classificationUuid, Integer pageSize, Integer pageIndex,
304 List<String> propertyPaths);
305
306 /**
307 * @param classification
308 * @return
309 */
310 ClassificationLookupDTO classificationLookup(Classification classification);
311
312
313 }