calls to loadRankSpecificRootNodes() in tests and other classes adapted
[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.model.common.UuidAndTitleCache;
19 import eu.etaxonomy.cdm.model.media.MediaRepresentation;
20 import eu.etaxonomy.cdm.model.name.Rank;
21 import eu.etaxonomy.cdm.model.taxon.ITreeNode;
22 import eu.etaxonomy.cdm.model.taxon.Taxon;
23 import eu.etaxonomy.cdm.model.taxon.TaxonNode;
24 import eu.etaxonomy.cdm.model.taxon.Classification;
25 import eu.etaxonomy.cdm.persistence.query.OrderHint;
26
27
28 /**
29 * @author n.hoffmann
30 * @created Sep 21, 2009
31 * @version 1.0
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 ITreeNode 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 public TaxonNode loadTaxonNodeByTaxon(Taxon taxon, UUID classificationUuid, List<String> propertyPaths);
69
70 /**
71 *
72 * @param taxonNode
73 * @param propertyPaths
74 * @return
75 * @deprecated use TaxonNodeService instead
76 */
77 public TaxonNode loadTaxonNode(TaxonNode taxonNode, List<String> propertyPaths);
78
79 /**
80 * Loads all TaxonNodes of the specified classification for a given Rank or lower.
81 * If a branch of the classification tree is not containing a TaxonNode with a Taxon at the given
82 * Rank the according node associated with the next lower Rank is taken as root node in this case.
83 * So the nodes returned may reference Taxa with different Ranks.
84 *
85 * If the <code>rank</code> is null the absolute root nodes will be returned.
86 *
87 * @param classification may be null for all classifications
88 * @param rank the set to null for to get the root nodes of classifications
89 * @param limit The maximum number of objects returned (can be null for all matching objects)
90 * @param start The offset from the start of the result set (0 - based, can be null -
91 * equivalent of starting at the beginning of the recordset)
92 * @param propertyPaths
93 * @return
94 */
95 public List<TaxonNode> loadRankSpecificRootNodes(Classification classification, Rank rank, Integer limit, Integer start, List<String> propertyPaths);
96
97 /**
98 * @param taxonNode
99 * @param baseRank
100 * specifies the root level of the classification, may be null.
101 * Nodes of this rank or in case this rank does not exist in the
102 * current branch the next lower rank is taken as root node for
103 * this rank henceforth called the <b>base node</b>.
104 * @param propertyPaths
105 * the initialization strategy for the returned TaxonNode
106 * instances.
107 * @return the path of nodes from the <b>base node</b> to the node of the
108 * specified taxon.
109 */
110 public List<TaxonNode> loadTreeBranch(TaxonNode taxonNode, Rank baseRank, List<String> propertyPaths);
111
112 /**
113 * Although this method seems to be a redundant alternative to {@link #loadChildNodesOfTaxonNode(TaxonNode, List)} it is an important
114 * alternative from which web services benefit. Without this method the web service controller method, which operates outside of the
115 * transaction, would have to initialize the full taxon tree with all nodes of the taxon.
116 * This would be rather slow compared to using this method.
117 * @param taxon
118 * @param classification
119 * the classification to be used
120 * @param baseRank
121 * specifies the root level of the classification, may be null.
122 * Nodes of this rank or in case this rank does not exist in the
123 * current branch the next lower rank is taken as as root node for
124 * this rank henceforth called the <b>base node</b>.
125 * @param propertyPaths
126 * the initialization strategy for the returned TaxonNode
127 * instances.
128 * @return the path of nodes from the <b>base node</b> to the node of the specified
129 * taxon.
130 */
131 public List<TaxonNode> loadTreeBranchToTaxon(Taxon taxon, Classification classification, Rank baseRank, List<String> propertyPaths);
132
133
134
135 /**
136 * Although this method seems to be a redundant alternative to {@link #loadChildNodesOfTaxonNode(TaxonNode, List)} it is an important
137 * alternative from which web services benefit. Without this method the web service controller method, which operates outside of the
138 * transaction, would have to initialize the full taxon tree with all nodes of the taxon.
139 * This would be rather slow compared to using this method.
140 * @param taxon
141 * @param classification
142 * @param propertyPaths
143 * @return
144 */
145 public List<TaxonNode> loadChildNodesOfTaxon(Taxon taxon, Classification classification, List<String> propertyPaths);
146
147 /**
148 * @param taxonNode
149 * @param propertyPaths
150 * @deprecated move to TaxonNodeService
151 * @return
152 */
153 public List<TaxonNode> loadChildNodesOfTaxonNode(TaxonNode taxonNode, List<String> propertyPaths);
154
155 /**
156 *
157 * @param classification
158 * @return
159 */
160 public List<UuidAndTitleCache<TaxonNode>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(Classification classification);
161
162 /**
163 * @param taxon
164 * @param taxTree
165 * @param propertyPaths
166 * @param size
167 * @param height
168 * @param widthOrDuration
169 * @param mimeTypes
170 * @return
171 * @deprecated use getAllMediaForChildNodes(TaxonNode taxonNode, ...) instead
172 * if you have a classification and a taxon that is in it, you should also have the according taxonNode
173 */
174 public Map<UUID, List<MediaRepresentation>> getAllMediaForChildNodes(Taxon taxon, Classification taxTree, List<String> propertyPaths, int size, int height, int widthOrDuration, String[] mimeTypes);
175
176 /**
177 *
178 * @param taxonNode
179 * @param propertyPaths
180 * @param size
181 * @param height
182 * @param widthOrDuration
183 * @param mimeTypes
184 * @return
185 */
186 public Map<UUID, List<MediaRepresentation>> getAllMediaForChildNodes(TaxonNode taxonNode, List<String> propertyPaths, int size, int height, int widthOrDuration, String[] mimeTypes);
187
188 /**
189 *
190 * @param taxonNode
191 * @return
192 * @deprecated use TaxonNodeService instead
193 */
194 public UUID removeTaxonNode(TaxonNode taxonNode);
195
196 /**
197 *
198 * @param taxonNode
199 * @return
200 * @deprecated use TaxonNodeService instead
201 */
202 public UUID saveTaxonNode(TaxonNode taxonNode);
203
204 /**
205 *
206 * @param taxonNodeCollection
207 * @return
208 * @deprecated use TaxonNodeService instead
209 */
210 public Map<UUID, TaxonNode> saveTaxonNodeAll(Collection<TaxonNode> taxonNodeCollection);
211
212 /**
213 *
214 * @param treeNode
215 * @return
216 */
217 public UUID removeTreeNode(ITreeNode treeNode);
218
219 /**
220 *
221 * @param treeNode
222 * @return
223 */
224 public UUID saveTreeNode(ITreeNode treeNode);
225
226
227 public List<TaxonNode> getAllNodes();
228
229
230 }