1
|
/**
|
2
|
* Copyright (C) 2007 EDIT
|
3
|
* European Distributed Institute of Taxonomy
|
4
|
* http://www.e-taxonomy.eu
|
5
|
*
|
6
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
7
|
* See LICENSE.TXT at the top of this package for the full license terms.
|
8
|
*/
|
9
|
|
10
|
package eu.etaxonomy.cdm.api.service;
|
11
|
|
12
|
import java.util.Collection;
|
13
|
import java.util.List;
|
14
|
import java.util.Map;
|
15
|
import java.util.UUID;
|
16
|
|
17
|
import eu.etaxonomy.cdm.api.service.config.CreateHierarchyForClassificationConfigurator;
|
18
|
import eu.etaxonomy.cdm.api.service.config.TaxonDeletionConfigurator;
|
19
|
import eu.etaxonomy.cdm.api.service.dto.GroupedTaxonDTO;
|
20
|
import eu.etaxonomy.cdm.api.service.dto.TaxonInContextDTO;
|
21
|
import eu.etaxonomy.cdm.api.service.pager.Pager;
|
22
|
import eu.etaxonomy.cdm.compare.taxon.TaxonNodeSortMode;
|
23
|
import eu.etaxonomy.cdm.exception.FilterException;
|
24
|
import eu.etaxonomy.cdm.exception.UnpublishedException;
|
25
|
import eu.etaxonomy.cdm.model.common.MarkerType;
|
26
|
import eu.etaxonomy.cdm.model.media.MediaRepresentation;
|
27
|
import eu.etaxonomy.cdm.model.name.Rank;
|
28
|
import eu.etaxonomy.cdm.model.taxon.Classification;
|
29
|
import eu.etaxonomy.cdm.model.taxon.ITaxonTreeNode;
|
30
|
import eu.etaxonomy.cdm.model.taxon.Taxon;
|
31
|
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
|
32
|
import eu.etaxonomy.cdm.persistence.dto.ClassificationLookupDTO;
|
33
|
import eu.etaxonomy.cdm.persistence.dto.TaxonNodeDto;
|
34
|
import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache;
|
35
|
import eu.etaxonomy.cdm.persistence.query.OrderHint;
|
36
|
|
37
|
|
38
|
/**
|
39
|
* @author n.hoffmann
|
40
|
* @since Sep 21, 2009
|
41
|
*/
|
42
|
public interface IClassificationService extends IIdentifiableEntityService<Classification> {
|
43
|
|
44
|
public ITaxonTreeNode getTreeNodeByUuid(UUID uuid);
|
45
|
|
46
|
/**
|
47
|
* Returns the root node of the the given classification (specified by its UUID)
|
48
|
* @param classificationUuid the uuid of the classification
|
49
|
* @return the root node of the classification
|
50
|
*/
|
51
|
public TaxonNode getRootNode(UUID classificationUuid);
|
52
|
|
53
|
public UUID getTaxonNodeUuidByTaxonUuid(UUID classificationUuid, UUID taxonUuid);
|
54
|
|
55
|
public List<Classification> listClassifications(Integer limit, Integer start, List<OrderHint> orderHints, List<String> propertyPaths);
|
56
|
|
57
|
/**
|
58
|
*
|
59
|
* @param taxon
|
60
|
* @param classificationUuid
|
61
|
* @param propertyPaths
|
62
|
* @return
|
63
|
* @deprecated use loadTaxonNode(TaxonNode taxonNode, ...) instead
|
64
|
* if you have a classification and a taxon that is in it, you should also have the according taxonNode
|
65
|
*/
|
66
|
@Deprecated
|
67
|
public TaxonNode loadTaxonNodeByTaxon(Taxon taxon, UUID classificationUuid, List<String> propertyPaths);
|
68
|
|
69
|
/**
|
70
|
* Loads all TaxonNodes of the specified classification for a given Rank or lower.
|
71
|
* If a branch of the classification tree is not containing a TaxonNode with a Taxon at the given
|
72
|
* Rank the according node associated with the next lower Rank is taken as root node in this case.
|
73
|
* So the nodes returned may reference Taxa with different Ranks.
|
74
|
*
|
75
|
* If the <code>rank</code> is null the absolute root nodes will be returned.
|
76
|
|
77
|
* @param classification may be null for all classifications
|
78
|
* @param subtree filter on a taxonomic subtree
|
79
|
* @param rank the set to null for to get the root nodes of classifications
|
80
|
* @param includeUnpublished if <code>true</code> unpublished taxa are also exported
|
81
|
* @param pageSize The maximum number of relationships returned (can be null for all relationships)
|
82
|
* @param pageIndex The offset (in pageSize chunks) from the start of the result set (0 - based)
|
83
|
* @param propertyPaths
|
84
|
* @return
|
85
|
* @see #pageRankSpecificRootNodes(Classification, TaxonNode, Rank, boolean, Integer, Integer, List)
|
86
|
* @deprecated use according DTO method instead
|
87
|
*/
|
88
|
@Deprecated
|
89
|
public List<TaxonNode> listRankSpecificRootNodes(Classification classification, TaxonNode subtree,
|
90
|
Rank rank, boolean includeUnpublished, Integer pageSize, Integer pageIndex,
|
91
|
List<String> propertyPaths);
|
92
|
|
93
|
/**
|
94
|
* Loads all TaxonNodes of the specified classification for a given Rank or lower.
|
95
|
* If a branch of the classification tree is not containing a TaxonNode with a Taxon at the given
|
96
|
* Rank the according node associated with the next lower Rank is taken as root node in this case.
|
97
|
* So the nodes returned may reference Taxa with different Ranks.
|
98
|
*
|
99
|
* If the <code>rank</code> is null the absolute root nodes will be returned.
|
100
|
|
101
|
* @param classification may be null for all classifications
|
102
|
* @param subtree filter on a taxonomic subtree
|
103
|
* @param rank the set to null for to get the root nodes of classifications
|
104
|
* @param includeUnpublished if <code>true</code> unpublished taxa are also exported
|
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
|
* @see #pageRankSpecificRootNodes(Classification, TaxonNode, Rank, boolean, Integer, Integer, List)
|
110
|
*
|
111
|
*/
|
112
|
public List<TaxonNodeDto> listRankSpecificRootNodeDtos(Classification classification, TaxonNode subtree,
|
113
|
Rank rank, boolean includeUnpublished, Integer pageSize, Integer pageIndex, TaxonNodeDtoSortMode sortMode,
|
114
|
List<String> propertyPaths);
|
115
|
|
116
|
|
117
|
/**
|
118
|
* Loads all TaxonNodes of the specified classification for a given Rank or lower.
|
119
|
* If a branch of the classification tree is not containing a TaxonNode with a Taxon at the given
|
120
|
* Rank the according node associated with the next lower Rank is taken as root node in this case.
|
121
|
* So the nodes returned may reference Taxa with different Ranks.
|
122
|
*
|
123
|
* If the <code>rank</code> is null the absolute root nodes will be returned.
|
124
|
*
|
125
|
* @param classification may be null for all classifications
|
126
|
* @param subtree the taxonomic subtree filter
|
127
|
* @param rank the set to null for to get the root nodes of classifications
|
128
|
* @param includeUnpublished if <code>true</code> unpublished taxa are also exported
|
129
|
* @param pageSize The maximum number of relationships returned (can be null for all relationships)
|
130
|
* @param pageIndex The offset (in pageSize chunks) from the start of the result set (0 - based)
|
131
|
* @param propertyPaths
|
132
|
* @return
|
133
|
*
|
134
|
* @see #listRankSpecificRootNodes(Classification, TaxonNode, Rank, boolean, Integer, Integer, List)
|
135
|
*/
|
136
|
public Pager<TaxonNode> pageRankSpecificRootNodes(Classification classification, TaxonNode subtree,
|
137
|
Rank rank, boolean includeUnpublished, Integer pageSize, Integer pageIndex,
|
138
|
List<String> propertyPaths);
|
139
|
/**
|
140
|
* @see #pageRankSpecificRootNodes(Classification, TaxonNode, Rank, boolean, Integer, Integer, List)
|
141
|
* @deprecated keep this for compatibility to older versions, might be removed in versions >5.3
|
142
|
*/
|
143
|
@Deprecated
|
144
|
public Pager<TaxonNode> pageRankSpecificRootNodes(Classification classification,
|
145
|
Rank rank, boolean includeUnpublished, Integer pageSize, Integer pageIndex,
|
146
|
List<String> propertyPaths);
|
147
|
|
148
|
/**
|
149
|
* @param taxonNode
|
150
|
* @param baseRank
|
151
|
* specifies the root level of the classification, may be null.
|
152
|
* Nodes of this rank or in case this rank does not exist in the
|
153
|
* current branch the next lower rank is taken as root node for
|
154
|
* this rank henceforth called the <b>base node</b>.
|
155
|
* @param propertyPaths
|
156
|
* the initialization strategy for the returned TaxonNode
|
157
|
* instances.
|
158
|
* @param includeUnpublished
|
159
|
* if <code>true</code> no {@link UnpublishedException}
|
160
|
* is thrown if any of the taxa in the branch are unpublished
|
161
|
* @return the path of nodes from the <b>base node</b> to the node of the
|
162
|
* specified taxon.
|
163
|
* @throws UnpublishedException
|
164
|
* if any of the taxa in the path is unpublished an {@link UnpublishedException} is thrown.
|
165
|
*/
|
166
|
public List<TaxonNode> loadTreeBranch(TaxonNode taxonNode, TaxonNode subtree, Rank baseRank, boolean includeUnpublished,
|
167
|
List<String> propertyPaths) throws UnpublishedException;
|
168
|
public List<TaxonNode> loadTreeBranch(TaxonNode taxonNode, Rank baseRank, boolean includeUnpublished,
|
169
|
List<String> propertyPaths) throws UnpublishedException;
|
170
|
|
171
|
/**
|
172
|
* Although this method seems to be a redundant alternative to {@link #loadChildNodesOfTaxonNode(TaxonNode, List)} it is an important
|
173
|
* alternative from which web services benefit. Without this method the web service controller method, which operates outside of the
|
174
|
* transaction, would have to initialize the full taxon tree with all nodes of the taxon.
|
175
|
* This would be rather slow compared to using this method.
|
176
|
* @param taxon
|
177
|
* @param classification
|
178
|
* the classification to be used
|
179
|
* @param baseRank
|
180
|
* specifies the root level of the classification, may be null.
|
181
|
* Nodes of this rank or in case this rank does not exist in the
|
182
|
* current branch the next lower rank is taken as as root node for
|
183
|
* this rank henceforth called the <b>base node</b>.
|
184
|
* @param includeUnpublished
|
185
|
* if <code>true</code> no {@link UnpublishedException}
|
186
|
* is thrown if any of the taxa in the branch are unpublished
|
187
|
* @param propertyPaths
|
188
|
* the initialization strategy for the returned TaxonNode
|
189
|
* instances.
|
190
|
* @return the path of nodes from the <b>base node</b> to the node of the specified
|
191
|
* taxon.
|
192
|
* @throws UnpublishedException
|
193
|
* if any of the taxa in the path is unpublished an {@link UnpublishedException} is thrown
|
194
|
*/
|
195
|
public List<TaxonNode> loadTreeBranchToTaxon(Taxon taxon, Classification classification,
|
196
|
TaxonNode subtree, Rank baseRank,
|
197
|
boolean includeUnpublished, List<String> propertyPaths) throws UnpublishedException;
|
198
|
|
199
|
/**
|
200
|
* Although this method seems to be a redundant alternative to {@link #loadChildNodesOfTaxonNode(TaxonNode, List)} it is an important
|
201
|
* alternative from which web services benefit. Without this method the web service controller method, which operates outside of the
|
202
|
* transaction, would have to initialize the full taxon tree with all nodes of the taxon.
|
203
|
* This would be rather slow compared to using this method.
|
204
|
* @param taxon
|
205
|
* @param classification
|
206
|
* the classification to be used
|
207
|
* @param baseRank
|
208
|
* specifies the root level of the classification, may be null.
|
209
|
* Nodes of this rank or in case this rank does not exist in the
|
210
|
* current branch the next lower rank is taken as as root node for
|
211
|
* this rank henceforth called the <b>base node</b>.
|
212
|
* @param includeUnpublished
|
213
|
* if <code>true</code> no {@link UnpublishedException}
|
214
|
* is thrown if any of the taxa in the branch are unpublished
|
215
|
* @param propertyPaths
|
216
|
* the initialization strategy for the returned TaxonNode
|
217
|
* instances.
|
218
|
* @return the path of nodes from the <b>base node</b> to the node of the specified
|
219
|
* taxon.
|
220
|
* @throws UnpublishedException
|
221
|
* if any of the taxa in the path is unpublished an {@link UnpublishedException} is thrown
|
222
|
*/
|
223
|
public List<TaxonNodeDto> loadTreeBranchDTOsToTaxon(Taxon taxon, Classification classification,
|
224
|
TaxonNode subtree, Rank baseRank,
|
225
|
boolean includeUnpublished, List<String> propertyPaths) throws UnpublishedException;
|
226
|
|
227
|
public List<TaxonNode> loadTreeBranchToTaxon(Taxon taxon, Classification classification,
|
228
|
Rank baseRank,
|
229
|
boolean includeUnpublished, List<String> propertyPaths) throws UnpublishedException;
|
230
|
|
231
|
public List<TaxonNode> listChildNodesOfTaxon(UUID taxonUuid, UUID classificationUuid, boolean includeUnpublished,
|
232
|
Integer pageSize, Integer pageIndex, List<String> propertyPaths);
|
233
|
|
234
|
public List<TaxonNode> listChildNodesOfTaxon(UUID taxonUuid, UUID classificationUuid, UUID subtreeUuid, boolean includeUnpublished,
|
235
|
Integer pageSize, Integer pageIndex, List<String> propertyPaths) throws FilterException;
|
236
|
|
237
|
public List<TaxonNodeDto> listChildNodeDtosOfTaxon(UUID taxonUuid, UUID classificationUuid, UUID subtreeUuid, boolean includeUnpublished,
|
238
|
Integer pageSize, Integer pageIndex, TaxonNodeDtoSortMode comparator, List<String> propertyPaths) throws FilterException;
|
239
|
|
240
|
/**
|
241
|
* @param taxonNode
|
242
|
* @param propertyPaths
|
243
|
* @deprecated move to TaxonNodeService
|
244
|
* @return
|
245
|
*/
|
246
|
@Deprecated
|
247
|
public List<TaxonNode> loadChildNodesOfTaxonNode(TaxonNode taxonNode, List<String> propertyPaths);
|
248
|
|
249
|
public List<UuidAndTitleCache<TaxonNode>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(Classification classification);
|
250
|
|
251
|
public Map<UUID, List<MediaRepresentation>> getAllMediaForChildNodes(TaxonNode taxonNode, List<String> propertyPaths, int size, int height, int widthOrDuration, String[] mimeTypes);
|
252
|
|
253
|
/**
|
254
|
* @param taxonNodeCollection
|
255
|
* @return
|
256
|
* @deprecated use TaxonNodeService instead
|
257
|
*/
|
258
|
@Deprecated
|
259
|
public Map<UUID, TaxonNode> saveTaxonNodeAll(Collection<TaxonNode> taxonNodeCollection);
|
260
|
|
261
|
public UUID removeTreeNode(ITaxonTreeNode treeNode);
|
262
|
|
263
|
public UUID saveTreeNode(ITaxonTreeNode treeNode);
|
264
|
|
265
|
public List<TaxonNode> getAllNodes();
|
266
|
|
267
|
public UpdateResult createHierarchyInClassification(Classification classification, CreateHierarchyForClassificationConfigurator configurator);
|
268
|
|
269
|
public List<UuidAndTitleCache<TaxonNode>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(UUID classificationUuid);
|
270
|
|
271
|
public List<UuidAndTitleCache<TaxonNode>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(
|
272
|
UUID classificationUuid, Integer limit, String pattern);
|
273
|
|
274
|
public List<UuidAndTitleCache<TaxonNode>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(
|
275
|
Classification classification, Integer limit, String pattern);
|
276
|
|
277
|
public List<TaxonNode> listSiblingsOfTaxon(UUID taxonUuid, UUID classificationUuid, boolean includeUnpublished,
|
278
|
Integer pageSize, Integer pageIndex, List<String> propertyPaths);
|
279
|
|
280
|
public Pager<TaxonNode> pageSiblingsOfTaxon(UUID taxonUuid, UUID classificationUuid, boolean includeUnpublished, Integer pageSize, Integer pageIndex,
|
281
|
List<String> propertyPaths);
|
282
|
|
283
|
public ClassificationLookupDTO classificationLookup(Classification classification);
|
284
|
|
285
|
public DeleteResult delete(UUID classificationUuid, TaxonDeletionConfigurator config);
|
286
|
|
287
|
/**
|
288
|
* Returns the higher taxon id for each taxon in taxonUuids.
|
289
|
* The highter taxon is defined by rank where the lowest rank equal or above minRank
|
290
|
* is taken. If maxRank <> null and no taxon exists with minRank <= rank <= maxRank
|
291
|
* no higher taxon is returned for this taxon.
|
292
|
*/
|
293
|
public List<GroupedTaxonDTO> groupTaxaByHigherTaxon(List<UUID> taxonUuids, UUID classificationUuid, Rank minRank, Rank maxRank);
|
294
|
|
295
|
public List<GroupedTaxonDTO> groupTaxaByMarkedParents(List<UUID> taxonUuids, UUID classificationUuid,
|
296
|
MarkerType markerType, Boolean value);
|
297
|
|
298
|
/**
|
299
|
* Returns the most relevant data of a taxon/taxon node, including children, synonyms
|
300
|
* and certain ancestors if required.
|
301
|
*/
|
302
|
public TaxonInContextDTO getTaxonInContext(UUID classificationUuid, UUID taxonUuid,
|
303
|
Boolean doChildren, Boolean doSynonyms, boolean includeUnpublished, List<UUID> ancestorMarkers,
|
304
|
TaxonNodeSortMode sortMode);
|
305
|
|
306
|
public UUID saveClassification(Classification classification);
|
307
|
|
308
|
public List<UuidAndTitleCache<TaxonNode>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(
|
309
|
UUID classificationUuid, Integer limit, String pattern, boolean searchForClassifications);
|
310
|
|
311
|
public List<UuidAndTitleCache<TaxonNode>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(
|
312
|
Classification classification, Integer limit, String pattern, boolean searchForClassifications);
|
313
|
|
314
|
public List<UuidAndTitleCache<TaxonNode>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(
|
315
|
UUID classificationUuid, boolean searchForClassifications);
|
316
|
|
317
|
public List<UuidAndTitleCache<TaxonNode>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(
|
318
|
Classification classification, boolean searchForClassifications);
|
319
|
|
320
|
List<UuidAndTitleCache<TaxonNode>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(
|
321
|
UUID classificationUuid, Integer limit, String pattern, boolean searchForClassifications,
|
322
|
boolean includeDoubtful);
|
323
|
|
324
|
}
|