merging trunk into 3.6 branche
[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.UuidAndTitleCache;
27 import eu.etaxonomy.cdm.persistence.query.OrderHint;
28
29
30 /**
31 * @author n.hoffmann
32 * @created Sep 21, 2009
33 */
34 public interface IClassificationService extends IIdentifiableEntityService<Classification> {
35
36 /**
37 *
38 * @param uuid
39 * @return
40 */
41 public TaxonNode getTaxonNodeByUuid(UUID uuid);
42
43 /**
44 *
45 * @param uuid
46 * @return
47 */
48 public ITaxonTreeNode getTreeNodeByUuid(UUID uuid);
49
50 /**
51 *
52 * @param limit
53 * @param start
54 * @param orderHints
55 * @param propertyPaths
56 * @return
57 */
58 public List<Classification> listClassifications(Integer limit, Integer start, List<OrderHint> orderHints, List<String> propertyPaths);
59
60 /**
61 *
62 * @param taxon
63 * @param classificationUuid
64 * @param propertyPaths
65 * @return
66 * @deprecated use loadTaxonNode(TaxonNode taxonNode, ...) instead
67 * if you have a classification and a taxon that is in it, you should also have the according taxonNode
68 */
69 @Deprecated
70 public TaxonNode loadTaxonNodeByTaxon(Taxon taxon, UUID classificationUuid, List<String> propertyPaths);
71
72 /**
73 *
74 * @param taxonNode
75 * @param propertyPaths
76 * @return
77 * @deprecated use TaxonNodeService instead
78 */
79 @Deprecated
80 public TaxonNode loadTaxonNode(TaxonNode taxonNode, List<String> propertyPaths);
81
82 /**
83 * Loads all TaxonNodes of the specified classification for a given Rank or lower.
84 * If a branch of the classification tree is not containing a TaxonNode with a Taxon at the given
85 * Rank the according node associated with the next lower Rank is taken as root node in this case.
86 * So the nodes returned may reference Taxa with different Ranks.
87 *
88 * If the <code>rank</code> is null the absolute root nodes will be returned.
89 *
90 * @param classification may be null for all classifications
91 * @param rank the set to null for to get the root nodes of classifications
92 * @param limit The maximum number of objects returned (can be null for all matching objects)
93 * @param start The offset from the start of the result set (0 - based, can be null -
94 * equivalent of starting at the beginning of the recordset)
95 * @param propertyPaths
96 * @return
97 * @deprecated use {@link #listRankSpecificRootNodes(Classification, Rank, Integer, Integer, List)} instead
98 */
99 @Deprecated
100 public List<TaxonNode> loadRankSpecificRootNodes(Classification classification, Rank rank, Integer limit, Integer start, List<String> propertyPaths);
101
102
103 /**
104 * Loads all TaxonNodes of the specified classification for a given Rank or lower.
105 * If a branch of the classification tree is not containing a TaxonNode with a Taxon at the given
106 * Rank the according node associated with the next lower Rank is taken as root node in this case.
107 * So the nodes returned may reference Taxa with different Ranks.
108 *
109 * If the <code>rank</code> is null the absolute root nodes will be returned.
110 *
111 * @param classification may be null for all classifications
112 * @param rank the set to null for to get the root nodes of classifications
113 * @param pageSize The maximum number of relationships returned (can be null for all relationships)
114 * @param pageIndex The offset (in pageSize chunks) from the start of the result set (0 - based)
115 * @param propertyPaths
116 * @return
117 *
118 */
119 public List<TaxonNode> listRankSpecificRootNodes(Classification classification, Rank rank, Integer pageSize, Integer pageIndex, List<String> propertyPaths);
120
121
122 /**
123 * Loads all TaxonNodes of the specified classification for a given Rank or lower.
124 * If a branch of the classification tree is not containing a TaxonNode with a Taxon at the given
125 * Rank the according node associated with the next lower Rank is taken as root node in this case.
126 * So the nodes returned may reference Taxa with different Ranks.
127 *
128 * If the <code>rank</code> is null the absolute root nodes will be returned.
129 *
130 * @param classification may be null for all classifications
131 * @param rank the set to null for to get the root nodes of classifications
132 * @param pageSize The maximum number of relationships returned (can be null for all relationships)
133 * @param pageIndex The offset (in pageSize chunks) from the start of the result set (0 - based)
134 * @param propertyPaths
135 * @return
136 *
137 */
138 public Pager<TaxonNode> pageRankSpecificRootNodes(Classification classification, Rank rank, Integer pageSize, Integer pageIndex, List<String> propertyPaths);
139
140 /**
141 * @param taxonNode
142 * @param baseRank
143 * specifies the root level of the classification, may be null.
144 * Nodes of this rank or in case this rank does not exist in the
145 * current branch the next lower rank is taken as root node for
146 * this rank henceforth called the <b>base node</b>.
147 * @param propertyPaths
148 * the initialization strategy for the returned TaxonNode
149 * instances.
150 * @return the path of nodes from the <b>base node</b> to the node of the
151 * specified taxon.
152 */
153 public List<TaxonNode> loadTreeBranch(TaxonNode taxonNode, Rank baseRank, List<String> propertyPaths);
154
155 /**
156 * Although this method seems to be a redundant alternative to {@link #loadChildNodesOfTaxonNode(TaxonNode, List)} it is an important
157 * alternative from which web services benefit. Without this method the web service controller method, which operates outside of the
158 * transaction, would have to initialize the full taxon tree with all nodes of the taxon.
159 * This would be rather slow compared to using this method.
160 * @param taxon
161 * @param classification
162 * the classification to be used
163 * @param baseRank
164 * specifies the root level of the classification, may be null.
165 * Nodes of this rank or in case this rank does not exist in the
166 * current branch the next lower rank is taken as as root node for
167 * this rank henceforth called the <b>base node</b>.
168 * @param propertyPaths
169 * the initialization strategy for the returned TaxonNode
170 * instances.
171 * @return the path of nodes from the <b>base node</b> to the node of the specified
172 * taxon.
173 */
174 public List<TaxonNode> loadTreeBranchToTaxon(Taxon taxon, Classification classification, Rank baseRank, List<String> propertyPaths);
175
176
177
178 /**
179 * @param taxonUuid
180 * @param classificationUuid
181 * @param propertyPaths
182 * @return
183 */
184 public List<TaxonNode> listChildNodesOfTaxon(UUID taxonUuid, UUID classificationUuid, Integer pageSize, Integer pageIndex, List<String> propertyPaths);
185
186 /**
187 * @param taxonNode
188 * @param propertyPaths
189 * @deprecated move to TaxonNodeService
190 * @return
191 */
192 @Deprecated
193 public List<TaxonNode> loadChildNodesOfTaxonNode(TaxonNode taxonNode, List<String> propertyPaths);
194
195 /**
196 *
197 * @param classification
198 * @return
199 */
200 public List<UuidAndTitleCache<TaxonNode>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(Classification classification);
201
202 /**
203 * @param taxon
204 * @param taxTree
205 * @param propertyPaths
206 * @param size
207 * @param height
208 * @param widthOrDuration
209 * @param mimeTypes
210 * @return
211 *
212 * @deprecated use getAllMediaForChildNodes(TaxonNode taxonNode, ...) instead
213 * if you have a classification and a taxon that is in it, you should also have the according taxonNode
214 */
215 @Deprecated
216 public Map<UUID, List<MediaRepresentation>> getAllMediaForChildNodes(Taxon taxon, Classification taxTree, List<String> propertyPaths, int size, int height, int widthOrDuration, String[] mimeTypes);
217
218 /**
219 *
220 * @param taxonNode
221 * @param propertyPaths
222 * @param size
223 * @param height
224 * @param widthOrDuration
225 * @param mimeTypes
226 * @return
227 */
228 public Map<UUID, List<MediaRepresentation>> getAllMediaForChildNodes(TaxonNode taxonNode, List<String> propertyPaths, int size, int height, int widthOrDuration, String[] mimeTypes);
229
230 /**
231 *
232 * @param taxonNode
233 * @return
234 * @deprecated use TaxonNodeService instead
235 */
236 @Deprecated
237 public UUID removeTaxonNode(TaxonNode taxonNode);
238
239 /**
240 *
241 * @param taxonNode
242 * @return
243 * @deprecated use TaxonNodeService instead
244 */
245 @Deprecated
246 public UUID saveTaxonNode(TaxonNode taxonNode);
247
248 /**
249 *
250 * @param taxonNodeCollection
251 * @return
252 * @deprecated use TaxonNodeService instead
253 */
254 @Deprecated
255 public Map<UUID, TaxonNode> saveTaxonNodeAll(Collection<TaxonNode> taxonNodeCollection);
256
257 /**
258 *
259 * @param treeNode
260 * @return
261 */
262 public UUID removeTreeNode(ITaxonTreeNode treeNode);
263
264 /**
265 *
266 * @param treeNode
267 * @return
268 */
269 public UUID saveTreeNode(ITaxonTreeNode treeNode);
270
271
272 public List<TaxonNode> getAllNodes();
273
274 public UpdateResult createHierarchyInClassification(Classification classification, CreateHierarchyForClassificationConfigurator configurator);
275
276
277 }