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