Merge branch 'develop' into ticket-5066
[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 pageSize The maximum number of relationships returned (can be null for all relationships)
93 * @param pageIndex The offset (in pageSize chunks) from the start of the result set (0 - based)
94 * @param propertyPaths
95 * @return
96 *
97 */
98 public List<TaxonNode> listRankSpecificRootNodes(Classification classification, Rank rank, Integer pageSize, Integer pageIndex, List<String> propertyPaths);
99
100
101 /**
102 * Loads all TaxonNodes of the specified classification for a given Rank or lower.
103 * If a branch of the classification tree is not containing a TaxonNode with a Taxon at the given
104 * Rank the according node associated with the next lower Rank is taken as root node in this case.
105 * So the nodes returned may reference Taxa with different Ranks.
106 *
107 * If the <code>rank</code> is null the absolute root nodes will be returned.
108 *
109 * @param classification may be null for all classifications
110 * @param rank the set to null for to get the root nodes of classifications
111 * @param pageSize The maximum number of relationships returned (can be null for all relationships)
112 * @param pageIndex The offset (in pageSize chunks) from the start of the result set (0 - based)
113 * @param propertyPaths
114 * @return
115 *
116 */
117 public Pager<TaxonNode> pageRankSpecificRootNodes(Classification classification, Rank rank, Integer pageSize, Integer pageIndex, List<String> propertyPaths);
118
119 /**
120 * @param taxonNode
121 * @param baseRank
122 * specifies the root level of the classification, may be null.
123 * Nodes of this rank or in case this rank does not exist in the
124 * current branch the next lower rank is taken as root node for
125 * this rank henceforth called the <b>base node</b>.
126 * @param propertyPaths
127 * the initialization strategy for the returned TaxonNode
128 * instances.
129 * @return the path of nodes from the <b>base node</b> to the node of the
130 * specified taxon.
131 */
132 public List<TaxonNode> loadTreeBranch(TaxonNode taxonNode, Rank baseRank, List<String> propertyPaths);
133
134 /**
135 * Although this method seems to be a redundant alternative to {@link #loadChildNodesOfTaxonNode(TaxonNode, List)} it is an important
136 * alternative from which web services benefit. Without this method the web service controller method, which operates outside of the
137 * transaction, would have to initialize the full taxon tree with all nodes of the taxon.
138 * This would be rather slow compared to using this method.
139 * @param taxon
140 * @param classification
141 * the classification to be used
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 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 specified
151 * taxon.
152 */
153 public List<TaxonNode> loadTreeBranchToTaxon(Taxon taxon, Classification classification, Rank baseRank, List<String> propertyPaths);
154
155
156
157 /**
158 * @param taxonUuid
159 * @param classificationUuid
160 * @param propertyPaths
161 * @return
162 */
163 public List<TaxonNode> listChildNodesOfTaxon(UUID taxonUuid, UUID classificationUuid, Integer pageSize, Integer pageIndex, List<String> propertyPaths);
164
165 /**
166 * @param taxonNode
167 * @param propertyPaths
168 * @deprecated move to TaxonNodeService
169 * @return
170 */
171 @Deprecated
172 public List<TaxonNode> loadChildNodesOfTaxonNode(TaxonNode taxonNode, List<String> propertyPaths);
173
174 /**
175 *
176 * @param classification
177 * @return
178 */
179 public List<UuidAndTitleCache<TaxonNode>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(Classification classification);
180
181 /**
182 * @param taxon
183 * @param taxTree
184 * @param propertyPaths
185 * @param size
186 * @param height
187 * @param widthOrDuration
188 * @param mimeTypes
189 * @return
190 *
191 * @deprecated use getAllMediaForChildNodes(TaxonNode taxonNode, ...) instead
192 * if you have a classification and a taxon that is in it, you should also have the according taxonNode
193 */
194 @Deprecated
195 public Map<UUID, List<MediaRepresentation>> getAllMediaForChildNodes(Taxon taxon, Classification taxTree, List<String> propertyPaths, int size, int height, int widthOrDuration, String[] mimeTypes);
196
197 /**
198 *
199 * @param taxonNode
200 * @param propertyPaths
201 * @param size
202 * @param height
203 * @param widthOrDuration
204 * @param mimeTypes
205 * @return
206 */
207 public Map<UUID, List<MediaRepresentation>> getAllMediaForChildNodes(TaxonNode taxonNode, List<String> propertyPaths, int size, int height, int widthOrDuration, String[] mimeTypes);
208
209 /**
210 *
211 * @param taxonNode
212 * @return
213 * @deprecated use TaxonNodeService instead
214 */
215 @Deprecated
216 public UUID removeTaxonNode(TaxonNode taxonNode);
217
218 /**
219 *
220 * @param taxonNode
221 * @return
222 * @deprecated use TaxonNodeService instead
223 */
224 @Deprecated
225 public UUID saveTaxonNode(TaxonNode taxonNode);
226
227 /**
228 *
229 * @param taxonNodeCollection
230 * @return
231 * @deprecated use TaxonNodeService instead
232 */
233 @Deprecated
234 public Map<UUID, TaxonNode> saveTaxonNodeAll(Collection<TaxonNode> taxonNodeCollection);
235
236 /**
237 *
238 * @param treeNode
239 * @return
240 */
241
242 public UUID removeTreeNode(ITaxonTreeNode treeNode);
243
244 /**
245 *
246 * @param treeNode
247 * @return
248 */
249 public UUID saveTreeNode(ITaxonTreeNode treeNode);
250
251
252 public List<TaxonNode> getAllNodes();
253
254 public UpdateResult createHierarchyInClassification(Classification classification, CreateHierarchyForClassificationConfigurator configurator);
255
256
257 }