refactor update title cache
[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 tree for a given Rank.
81 * If a branch does not contain a TaxonNode with a TaxonName at the given
82 * Rank the node associated with the next lower Rank is taken as root node.
83 * If the <code>rank</code> is null the absolute root nodes will be returned.
84 *
85 * @param classification
86 * @param rank may be null
87 * @param propertyPaths
88 * @return
89 */
90 public List<TaxonNode> loadRankSpecificRootNodes(Classification classification, Rank rank, List<String> propertyPaths);
91
92 /**
93 * @param taxonNode
94 * @param baseRank
95 * specifies the root level of the classification, may be null.
96 * Nodes of this rank or in case this rank does not exist in the
97 * current branch the next lower rank is taken as root node for
98 * this rank henceforth called the <b>base node</b>.
99 * @param propertyPaths
100 * the initialization strategy for the returned TaxonNode
101 * instances.
102 * @return the path of nodes from the <b>base node</b> to the node of the
103 * specified taxon.
104 */
105 public List<TaxonNode> loadTreeBranch(TaxonNode taxonNode, Rank baseRank, List<String> propertyPaths);
106
107 /**
108 * Although this method seems to be a redundant alternative to {@link #loadChildNodesOfTaxonNode(TaxonNode, List)} it is an important
109 * alternative from which web services benefit. Without this method the web service controller method, which operates outside of the
110 * transaction, would have to initialize the full taxon tree with all nodes of the taxon.
111 * This would be rather slow compared to using this method.
112 * @param taxon
113 * @param classification
114 * the classification to be used
115 * @param baseRank
116 * specifies the root level of the classification, may be null.
117 * Nodes of this rank or in case this rank does not exist in the
118 * current branch the next lower rank is taken as as root node for
119 * this rank henceforth called the <b>base node</b>.
120 * @param propertyPaths
121 * the initialization strategy for the returned TaxonNode
122 * instances.
123 * @return the path of nodes from the <b>base node</b> to the node of the specified
124 * taxon.
125 */
126 public List<TaxonNode> loadTreeBranchToTaxon(Taxon taxon, Classification classification, Rank baseRank, List<String> propertyPaths);
127
128
129
130 /**
131 * Although this method seems to be a redundant alternative to {@link #loadChildNodesOfTaxonNode(TaxonNode, List)} it is an important
132 * alternative from which web services benefit. Without this method the web service controller method, which operates outside of the
133 * transaction, would have to initialize the full taxon tree with all nodes of the taxon.
134 * This would be rather slow compared to using this method.
135 * @param taxon
136 * @param classification
137 * @param propertyPaths
138 * @return
139 */
140 public List<TaxonNode> loadChildNodesOfTaxon(Taxon taxon, Classification classification, List<String> propertyPaths);
141
142 /**
143 * @param taxonNode
144 * @param propertyPaths
145 * @deprecated move to TaxonNodeService
146 * @return
147 */
148 public List<TaxonNode> loadChildNodesOfTaxonNode(TaxonNode taxonNode, List<String> propertyPaths);
149
150 /**
151 *
152 * @param classification
153 * @return
154 */
155 public List<UuidAndTitleCache<TaxonNode>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(Classification classification);
156
157 /**
158 * @param taxon
159 * @param taxTree
160 * @param propertyPaths
161 * @param size
162 * @param height
163 * @param widthOrDuration
164 * @param mimeTypes
165 * @return
166 * @deprecated use getAllMediaForChildNodes(TaxonNode taxonNode, ...) instead
167 * if you have a classification and a taxon that is in it, you should also have the according taxonNode
168 */
169 public Map<UUID, List<MediaRepresentation>> getAllMediaForChildNodes(Taxon taxon, Classification taxTree, List<String> propertyPaths, int size, int height, int widthOrDuration, String[] mimeTypes);
170
171 /**
172 *
173 * @param taxonNode
174 * @param propertyPaths
175 * @param size
176 * @param height
177 * @param widthOrDuration
178 * @param mimeTypes
179 * @return
180 */
181 public Map<UUID, List<MediaRepresentation>> getAllMediaForChildNodes(TaxonNode taxonNode, List<String> propertyPaths, int size, int height, int widthOrDuration, String[] mimeTypes);
182
183 /**
184 *
185 * @param taxonNode
186 * @return
187 * @deprecated use TaxonNodeService instead
188 */
189 public UUID removeTaxonNode(TaxonNode taxonNode);
190
191 /**
192 *
193 * @param taxonNode
194 * @return
195 * @deprecated use TaxonNodeService instead
196 */
197 public UUID saveTaxonNode(TaxonNode taxonNode);
198
199 /**
200 *
201 * @param taxonNodeCollection
202 * @return
203 * @deprecated use TaxonNodeService instead
204 */
205 public Map<UUID, TaxonNode> saveTaxonNodeAll(Collection<TaxonNode> taxonNodeCollection);
206
207 /**
208 *
209 * @param treeNode
210 * @return
211 */
212 public UUID removeTreeNode(ITreeNode treeNode);
213
214 /**
215 *
216 * @param treeNode
217 * @return
218 */
219 public UUID saveTreeNode(ITreeNode treeNode);
220
221
222 public List<TaxonNode> getAllNodes();
223
224
225 }