Improvements to TransmissionEngineDistribution, basic monitoring added and new servic...
[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.ITreeNode;
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 * @version 1.0
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 ITreeNode 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 * Although this method seems to be a redundant alternative to {@link #loadChildNodesOfTaxonNode(TaxonNode, List)} it is an important
180 * alternative from which web services benefit. Without this method the web service controller method, which operates outside of the
181 * transaction, would have to initialize the full taxon tree with all nodes of the taxon.
182 * This would be rather slow compared to using this method.
183 * @param taxon
184 * @param classification
185 * @param propertyPaths
186 * @return
187 */
188 public List<TaxonNode> loadChildNodesOfTaxon(Taxon taxon, Classification classification, List<String> propertyPaths);
189
190 /**
191 * @param taxonNode
192 * @param propertyPaths
193 * @deprecated move to TaxonNodeService
194 * @return
195 */
196 @Deprecated
197 public List<TaxonNode> loadChildNodesOfTaxonNode(TaxonNode taxonNode, List<String> propertyPaths);
198
199 /**
200 *
201 * @param classification
202 * @return
203 */
204 public List<UuidAndTitleCache<TaxonNode>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(Classification classification);
205
206 /**
207 * @param taxon
208 * @param taxTree
209 * @param propertyPaths
210 * @param size
211 * @param height
212 * @param widthOrDuration
213 * @param mimeTypes
214 * @return
215 * @deprecated use getAllMediaForChildNodes(TaxonNode taxonNode, ...) instead
216 * if you have a classification and a taxon that is in it, you should also have the according taxonNode
217 */
218 @Deprecated
219 public Map<UUID, List<MediaRepresentation>> getAllMediaForChildNodes(Taxon taxon, Classification taxTree, List<String> propertyPaths, int size, int height, int widthOrDuration, String[] mimeTypes);
220
221 /**
222 *
223 * @param taxonNode
224 * @param propertyPaths
225 * @param size
226 * @param height
227 * @param widthOrDuration
228 * @param mimeTypes
229 * @return
230 */
231 public Map<UUID, List<MediaRepresentation>> getAllMediaForChildNodes(TaxonNode taxonNode, List<String> propertyPaths, int size, int height, int widthOrDuration, String[] mimeTypes);
232
233 /**
234 *
235 * @param taxonNode
236 * @return
237 * @deprecated use TaxonNodeService instead
238 */
239 @Deprecated
240 public UUID removeTaxonNode(TaxonNode taxonNode);
241
242 /**
243 *
244 * @param taxonNode
245 * @return
246 * @deprecated use TaxonNodeService instead
247 */
248 @Deprecated
249 public UUID saveTaxonNode(TaxonNode taxonNode);
250
251 /**
252 *
253 * @param taxonNodeCollection
254 * @return
255 * @deprecated use TaxonNodeService instead
256 */
257 @Deprecated
258 public Map<UUID, TaxonNode> saveTaxonNodeAll(Collection<TaxonNode> taxonNodeCollection);
259
260 /**
261 *
262 * @param treeNode
263 * @return
264 */
265 public UUID removeTreeNode(ITreeNode treeNode);
266
267 /**
268 *
269 * @param treeNode
270 * @return
271 */
272 public UUID saveTreeNode(ITreeNode treeNode);
273
274
275 public List<TaxonNode> getAllNodes();
276
277
278 }