further fixes for subareas #4220
[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 * @param taxonUuid
179 * @param classificationUuid
180 * @param propertyPaths
181 * @return
182 */
183 public List<TaxonNode> listChildNodesOfTaxon(UUID taxonUuid, UUID classificationUuid, Integer pageSize, Integer pageIndex, List<String> propertyPaths);
184
185 /**
186 * @param taxonNode
187 * @param propertyPaths
188 * @deprecated move to TaxonNodeService
189 * @return
190 */
191 @Deprecated
192 public List<TaxonNode> loadChildNodesOfTaxonNode(TaxonNode taxonNode, List<String> propertyPaths);
193
194 /**
195 *
196 * @param classification
197 * @return
198 */
199 public List<UuidAndTitleCache<TaxonNode>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(Classification classification);
200
201 /**
202 * @param taxon
203 * @param taxTree
204 * @param propertyPaths
205 * @param size
206 * @param height
207 * @param widthOrDuration
208 * @param mimeTypes
209 * @return
210 *
211 * @deprecated use getAllMediaForChildNodes(TaxonNode taxonNode, ...) instead
212 * if you have a classification and a taxon that is in it, you should also have the according taxonNode
213 */
214 @Deprecated
215 public Map<UUID, List<MediaRepresentation>> getAllMediaForChildNodes(Taxon taxon, Classification taxTree, List<String> propertyPaths, int size, int height, int widthOrDuration, String[] mimeTypes);
216
217 /**
218 *
219 * @param taxonNode
220 * @param propertyPaths
221 * @param size
222 * @param height
223 * @param widthOrDuration
224 * @param mimeTypes
225 * @return
226 */
227 public Map<UUID, List<MediaRepresentation>> getAllMediaForChildNodes(TaxonNode taxonNode, List<String> propertyPaths, int size, int height, int widthOrDuration, String[] mimeTypes);
228
229 /**
230 *
231 * @param taxonNode
232 * @return
233 * @deprecated use TaxonNodeService instead
234 */
235 @Deprecated
236 public UUID removeTaxonNode(TaxonNode taxonNode);
237
238 /**
239 *
240 * @param taxonNode
241 * @return
242 * @deprecated use TaxonNodeService instead
243 */
244 @Deprecated
245 public UUID saveTaxonNode(TaxonNode taxonNode);
246
247 /**
248 *
249 * @param taxonNodeCollection
250 * @return
251 * @deprecated use TaxonNodeService instead
252 */
253 @Deprecated
254 public Map<UUID, TaxonNode> saveTaxonNodeAll(Collection<TaxonNode> taxonNodeCollection);
255
256 /**
257 *
258 * @param treeNode
259 * @return
260 */
261 public UUID removeTreeNode(ITaxonTreeNode treeNode);
262
263 /**
264 *
265 * @param treeNode
266 * @return
267 */
268 public UUID saveTreeNode(ITaxonTreeNode treeNode);
269
270
271 public List<TaxonNode> getAllNodes();
272
273
274 }