Project

General

Profile

Download (11.6 KB) Statistics
| Branch: | Tag: | Revision:
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.config.TaxonDeletionConfigurator;
20
import eu.etaxonomy.cdm.api.service.dto.GroupedTaxonDTO;
21
import eu.etaxonomy.cdm.api.service.pager.Pager;
22
import eu.etaxonomy.cdm.model.media.MediaRepresentation;
23
import eu.etaxonomy.cdm.model.name.Rank;
24
import eu.etaxonomy.cdm.model.taxon.Classification;
25
import eu.etaxonomy.cdm.model.taxon.ITaxonTreeNode;
26
import eu.etaxonomy.cdm.model.taxon.Taxon;
27
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
28
import eu.etaxonomy.cdm.persistence.dto.ClassificationLookupDTO;
29
import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache;
30
import eu.etaxonomy.cdm.persistence.query.OrderHint;
31

    
32

    
33
/**
34
 * @author n.hoffmann
35
 * @created Sep 21, 2009
36
 */
37
public interface IClassificationService extends IIdentifiableEntityService<Classification> {
38

    
39
    /**
40
     *
41
     * @param uuid
42
     * @return
43
     */
44
    public TaxonNode getTaxonNodeByUuid(UUID uuid);
45

    
46
    /**
47
     *
48
     * @param uuid
49
     * @return
50
     */
51
    public ITaxonTreeNode getTreeNodeByUuid(UUID uuid);
52

    
53
    /**
54
     *
55
     * Returns the root node of the the given classification (specified by its UUID)
56
     * @param classificationUuid the uuid of the classification
57
     * @return the root node of the classification
58
     */
59
    public TaxonNode getRootNode(UUID classificationUuid);
60

    
61
    public UUID getTaxonNodeUuidByTaxonUuid(UUID classificationUuid, UUID taxonUuid);
62

    
63
    /**
64
     *
65
     * @param limit
66
     * @param start
67
     * @param orderHints
68
     * @param propertyPaths
69
     * @return
70
     */
71
    public List<Classification> listClassifications(Integer limit, Integer start, List<OrderHint> orderHints, List<String> propertyPaths);
72

    
73
    /**
74
     *
75
     * @param taxon
76
     * @param classificationUuid
77
     * @param propertyPaths
78
     * @return
79
     * @deprecated use loadTaxonNode(TaxonNode taxonNode, ...) instead
80
     * if you have a classification and a taxon that is in it, you should also have the according taxonNode
81
     */
82
    @Deprecated
83
    public TaxonNode loadTaxonNodeByTaxon(Taxon taxon, UUID classificationUuid, List<String> propertyPaths);
84

    
85
    /**
86
     *
87
     * @param taxonNode
88
     * @param propertyPaths
89
     * @return
90
     * @deprecated use TaxonNodeService instead
91
     */
92
    @Deprecated
93
    public TaxonNode loadTaxonNode(TaxonNode taxonNode, List<String> propertyPaths);
94

    
95
    /**
96
     * Loads all TaxonNodes of the specified classification for a given Rank or lower.
97
     * If a branch of the classification tree is not containing a TaxonNode with a Taxon at the given
98
     * Rank the according node associated with the next lower Rank is taken as root node in this case.
99
     * So the nodes returned may reference Taxa with different Ranks.
100
     *
101
     * If the <code>rank</code> is null the absolute root nodes will be returned.
102
     *
103
     * @param classification may be null for all classifications
104
     * @param rank the set to null for to get the root nodes of classifications
105
     * @param pageSize The maximum number of relationships returned (can be null for all relationships)
106
     * @param pageIndex The offset (in pageSize chunks) from the start of the result set (0 - based)
107
     * @param propertyPaths
108
     * @return
109
     *
110
     */
111
    public List<TaxonNode> listRankSpecificRootNodes(Classification classification, Rank rank, Integer pageSize, Integer pageIndex, List<String> propertyPaths);
112

    
113

    
114
    /**
115
     * Loads all TaxonNodes of the specified classification for a given Rank or lower.
116
     * If a branch of the classification tree is not containing a TaxonNode with a Taxon at the given
117
     * Rank the according node associated with the next lower Rank is taken as root node in this case.
118
     * So the nodes returned may reference Taxa with different Ranks.
119
     *
120
     * If the <code>rank</code> is null the absolute root nodes will be returned.
121
     *
122
     * @param classification may be null for all classifications
123
     * @param rank the set to null for to get the root nodes of classifications
124
     * @param pageSize The maximum number of relationships returned (can be null for all relationships)
125
     * @param pageIndex The offset (in pageSize chunks) from the start of the result set (0 - based)
126
     * @param propertyPaths
127
     * @return
128
     *
129
     */
130
    public Pager<TaxonNode> pageRankSpecificRootNodes(Classification classification, Rank rank, Integer pageSize, Integer pageIndex, List<String> propertyPaths);
131

    
132
    /**
133
     * @param taxonNode
134
     * @param baseRank
135
     *            specifies the root level of the classification, may be null.
136
     *            Nodes of this rank or in case this rank does not exist in the
137
     *            current branch the next lower rank is taken as root node for
138
     *            this rank henceforth called the <b>base node</b>.
139
     * @param propertyPaths
140
     *            the initialization strategy for the returned TaxonNode
141
     *            instances.
142
     * @return the path of nodes from the <b>base node</b> to the node of the
143
     *         specified taxon.
144
     */
145
    public List<TaxonNode> loadTreeBranch(TaxonNode taxonNode, Rank baseRank, List<String> propertyPaths);
146

    
147
    /**
148
     * Although this method seems to be a redundant alternative to {@link #loadChildNodesOfTaxonNode(TaxonNode, List)} it is an important
149
     * alternative from which web services benefit. Without this method the web service controller method, which operates outside of the
150
     * transaction, would have to initialize the full taxon tree with all nodes of the taxon.
151
     * This would be rather slow compared to using this method.
152
     * @param taxon
153
     * @param classification
154
     *            the classification to be used
155
     * @param baseRank
156
     *            specifies the root level of the classification, may be null.
157
     *            Nodes of this rank or in case this rank does not exist in the
158
     *            current branch the next lower rank is taken as as root node for
159
     *            this rank henceforth called the <b>base node</b>.
160
     * @param propertyPaths
161
     *            the initialization strategy for the returned TaxonNode
162
     *            instances.
163
     * @return the path of nodes from the <b>base node</b> to the node of the specified
164
     *         taxon.
165
     */
166
    public List<TaxonNode> loadTreeBranchToTaxon(Taxon taxon, Classification classification, Rank baseRank, List<String> propertyPaths);
167

    
168

    
169

    
170
    /**
171
     * @param taxonUuid
172
     * @param classificationUuid
173
     * @param propertyPaths
174
     * @return
175
     */
176
    public List<TaxonNode> listChildNodesOfTaxon(UUID taxonUuid, UUID classificationUuid, Integer pageSize, Integer pageIndex, List<String> propertyPaths);
177

    
178
    /**
179
     * @param taxonNode
180
     * @param propertyPaths
181
     * @deprecated move to TaxonNodeService
182
     * @return
183
     */
184
    @Deprecated
185
    public List<TaxonNode> loadChildNodesOfTaxonNode(TaxonNode taxonNode, List<String> propertyPaths);
186

    
187
    /**
188
     *
189
     * @param classification
190
     * @return
191
     */
192
    public List<UuidAndTitleCache<TaxonNode>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(Classification classification);
193

    
194
    /**
195
     * @param taxon
196
     * @param taxTree
197
     * @param propertyPaths
198
     * @param size
199
     * @param height
200
     * @param widthOrDuration
201
     * @param mimeTypes
202
     * @return
203
     *
204
     * @deprecated use getAllMediaForChildNodes(TaxonNode taxonNode, ...) instead
205
     * if you have a classification and a taxon that is in it, you should also have the according taxonNode
206
     */
207
    @Deprecated
208
    public Map<UUID, List<MediaRepresentation>> getAllMediaForChildNodes(Taxon taxon, Classification taxTree, List<String> propertyPaths, int size, int height, int widthOrDuration, String[] mimeTypes);
209

    
210
    /**
211
     *
212
     * @param taxonNode
213
     * @param propertyPaths
214
     * @param size
215
     * @param height
216
     * @param widthOrDuration
217
     * @param mimeTypes
218
     * @return
219
     */
220
    public Map<UUID, List<MediaRepresentation>> getAllMediaForChildNodes(TaxonNode taxonNode, List<String> propertyPaths, int size, int height, int widthOrDuration, String[] mimeTypes);
221

    
222
    /**
223
     *
224
     * @param taxonNode
225
     * @return
226
     * @deprecated use TaxonNodeService instead
227
     */
228
    @Deprecated
229
    public UUID removeTaxonNode(TaxonNode taxonNode);
230

    
231
    /**
232
     *
233
     * @param taxonNode
234
     * @return
235
     * @deprecated use TaxonNodeService instead
236
     */
237
    @Deprecated
238
    public UUID saveTaxonNode(TaxonNode taxonNode);
239

    
240
    /**
241
     *
242
     * @param taxonNodeCollection
243
     * @return
244
     * @deprecated use TaxonNodeService instead
245
     */
246
    @Deprecated
247
    public Map<UUID, TaxonNode> saveTaxonNodeAll(Collection<TaxonNode> taxonNodeCollection);
248

    
249
    /**
250
     *
251
     * @param treeNode
252
     * @return
253
     */
254

    
255
    public UUID removeTreeNode(ITaxonTreeNode treeNode);
256

    
257
    /**
258
     *
259
     * @param treeNode
260
     * @return
261
     */
262
    public UUID saveTreeNode(ITaxonTreeNode treeNode);
263

    
264

    
265
    public List<TaxonNode> getAllNodes();
266

    
267
	public UpdateResult createHierarchyInClassification(Classification classification, CreateHierarchyForClassificationConfigurator configurator);
268

    
269
    /**
270
     * @param classificationUuid
271
     * @param excludeTaxa
272
     * @return
273
     */
274
    public List<UuidAndTitleCache<TaxonNode>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(UUID classificationUuid);
275

    
276
    /**
277
     * @param classificationUuid
278
     * @param excludeTaxa
279
     * @param limit
280
     * @param pattern
281
     * @return
282
     */
283
    List<UuidAndTitleCache<TaxonNode>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(
284
            UUID classificationUuid, Integer limit, String pattern);
285

    
286
    /**
287
     * @param classification
288
     * @param excludeTaxa
289
     * @param limit
290
     * @param pattern
291
     * @return
292
     */
293
    List<UuidAndTitleCache<TaxonNode>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(
294
            Classification classification, Integer limit, String pattern);
295

    
296
    /**
297
     * @param taxonUuid
298
     * @param classificationUuid
299
     * @param pageSize
300
     * @param pageIndex
301
     * @param propertyPaths
302
     * @return
303
     */
304
    List<TaxonNode> listSiblingsOfTaxon(UUID taxonUuid, UUID classificationUuid, Integer pageSize, Integer pageIndex,
305
            List<String> propertyPaths);
306

    
307
    /**
308
     * @param taxonUuid
309
     * @param classificationUuid
310
     * @param pageSize
311
     * @param pageIndex
312
     * @param propertyPaths
313
     * @return
314
     */
315
    Pager<TaxonNode> pageSiblingsOfTaxon(UUID taxonUuid, UUID classificationUuid, Integer pageSize, Integer pageIndex,
316
            List<String> propertyPaths);
317

    
318
    /**
319
     * @param classification
320
     * @return
321
     */
322
    ClassificationLookupDTO classificationLookup(Classification classification);
323

    
324
    DeleteResult delete(UUID classificationUuid, TaxonDeletionConfigurator config);
325

    
326
    /**
327
     * Returns the higher taxon id for each taxon in taxonUuids.
328
     * The highter taxon is defined by rank where the lowest rank equal or above minRank
329
     * is taken. If maxRank <> null and no taxon exists with minRank <= rank <= maxRank
330
     * no higher taxon is returned for this taxon.
331
     *
332
     * @param taxonUuids
333
     * @param minRank
334
     * @param maxRank
335
     * @return
336
     */
337
    List<GroupedTaxonDTO> groupTaxaByHigherTaxon(List<UUID> taxonUuids, UUID classificationUuid, Rank minRank, Rank maxRank);
338

    
339

    
340
}
(30-30/98)