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.Set;
|
15
|
import java.util.UUID;
|
16
|
|
17
|
import eu.etaxonomy.cdm.api.service.config.SecundumForSubtreeConfigurator;
|
18
|
import eu.etaxonomy.cdm.api.service.config.TaxonDeletionConfigurator;
|
19
|
import eu.etaxonomy.cdm.api.service.dto.TaxonDistributionDTO;
|
20
|
import eu.etaxonomy.cdm.api.service.pager.Pager;
|
21
|
import eu.etaxonomy.cdm.common.monitor.IProgressMonitor;
|
22
|
import eu.etaxonomy.cdm.filter.TaxonNodeFilter;
|
23
|
import eu.etaxonomy.cdm.model.common.DefinedTerm;
|
24
|
import eu.etaxonomy.cdm.model.reference.Reference;
|
25
|
import eu.etaxonomy.cdm.model.taxon.Classification;
|
26
|
import eu.etaxonomy.cdm.model.taxon.ITaxonTreeNode;
|
27
|
import eu.etaxonomy.cdm.model.taxon.SynonymType;
|
28
|
import eu.etaxonomy.cdm.model.taxon.Taxon;
|
29
|
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
|
30
|
import eu.etaxonomy.cdm.model.taxon.TaxonNodeAgentRelation;
|
31
|
import eu.etaxonomy.cdm.persistence.dto.TaxonNodeDto;
|
32
|
import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache;
|
33
|
|
34
|
|
35
|
/**
|
36
|
* @author n.hoffmann
|
37
|
* @since Apr 9, 2010
|
38
|
*/
|
39
|
public interface ITaxonNodeService extends IAnnotatableService<TaxonNode>{
|
40
|
|
41
|
/**
|
42
|
* returns the childnodes of the taxonNode, if recursive is true it returns all descendants, if sort is true the nodes are sorted
|
43
|
*
|
44
|
* @param taxonNode
|
45
|
* @param propertyPaths
|
46
|
* @param recursive
|
47
|
* @return List<TaxonNode>
|
48
|
*/
|
49
|
public List<TaxonNode> loadChildNodesOfTaxonNode(TaxonNode taxonNode, List<String> propertyPaths, boolean recursive, boolean includeUnpublished, NodeSortMode sortMode);
|
50
|
|
51
|
/**
|
52
|
* Lists all direct child nodes of the given {@link UuidAndTitleCache} which
|
53
|
* represents the parent {@link TaxonNode}
|
54
|
* @param parent a UuidAndTitleCache object which represents a parent {@link TaxonNode}
|
55
|
* @return a list of UuidAndTitleCache objects that represent children of the
|
56
|
* parent
|
57
|
*/
|
58
|
public List<UuidAndTitleCache<TaxonNode>> listChildNodesAsUuidAndTitleCache(UuidAndTitleCache<TaxonNode> parent);
|
59
|
|
60
|
public List<TaxonNode> listChildrenOf(TaxonNode node, Integer pageSize, Integer pageIndex,
|
61
|
boolean recursive, boolean includeUnpublished, List<String> propertyPaths);
|
62
|
|
63
|
/**
|
64
|
* Retrieves a list of {@link UuidAndTitleCache} objects that have a matchin titleCache
|
65
|
* @param limit the maximum results
|
66
|
* @param pattern the titleCache that is searched for
|
67
|
* @param classificationUuid if specified only nodes of this classification are retrieved
|
68
|
* @return a list of matches
|
69
|
*/
|
70
|
public List<UuidAndTitleCache<TaxonNode>> getUuidAndTitleCache(Integer limit, String pattern, UUID classificationUuid);
|
71
|
|
72
|
/**
|
73
|
* Retrieves the parent node of the child {@link TaxonNode}
|
74
|
* @param child the child for which the parent should be retrieved
|
75
|
* @return the parent taxon node
|
76
|
*/
|
77
|
public UuidAndTitleCache<TaxonNode> getParentUuidAndTitleCache(ITaxonTreeNode child);
|
78
|
|
79
|
/**
|
80
|
* Retrieves the parent node of the {@link TaxonNode} represented by the given {@link UuidAndTitleCache}.
|
81
|
* @param child the child for which the parent should be retrieved
|
82
|
* @return an UuidAndTitleCache object representing the parent node
|
83
|
*/
|
84
|
public UuidAndTitleCache<TaxonNode> getParentUuidAndTitleCache(UuidAndTitleCache<TaxonNode> child);
|
85
|
|
86
|
/**
|
87
|
* Lists all direct child nodes of the given {@link ITaxonTreeNode}
|
88
|
* @param parent the parent ITaxonTreeNode
|
89
|
* @return a list of UuidAndTitleCache objects that represent children of the
|
90
|
* parent
|
91
|
*/
|
92
|
public List<UuidAndTitleCache<TaxonNode>> listChildNodesAsUuidAndTitleCache(ITaxonTreeNode parent);
|
93
|
|
94
|
/**
|
95
|
*returns the childnodes of the taxonNode, if recursive is true it returns all descendants, if sort is true the nodes are sorted
|
96
|
*
|
97
|
* @param taxonNode
|
98
|
* @param recursive
|
99
|
* @param doSynonyms if true also synonyms are returned as children
|
100
|
* @param sortMode
|
101
|
* @param pageSize
|
102
|
* @param pageIndex
|
103
|
*
|
104
|
* @return List<TaxonNodeDto>
|
105
|
*/
|
106
|
public Pager<TaxonNodeDto> pageChildNodesDTOs(UUID taxonNodeUuid, boolean recursive, boolean includeUnpublished,
|
107
|
boolean doSynonyms, NodeSortMode sortMode,
|
108
|
Integer pageSize, Integer pageIndex);
|
109
|
|
110
|
public TaxonNodeDto parentDto(UUID taxonNodeUuid);
|
111
|
|
112
|
/**
|
113
|
* Changes the taxon associated with the given taxon node into a synonym of the new accepted taxon node.
|
114
|
* All data associated with the former taxon are moved to the newly accepted taxon.
|
115
|
*
|
116
|
* @param oldTaxonNode
|
117
|
* @param newAcceptedTaxonNode
|
118
|
* @param synonymType
|
119
|
* @param citation
|
120
|
* @param citationMicroReference
|
121
|
* @return
|
122
|
*
|
123
|
*/
|
124
|
public DeleteResult makeTaxonNodeASynonymOfAnotherTaxonNode(TaxonNode oldTaxonNode, TaxonNode newAcceptedTaxonNode, SynonymType synonymType, Reference citation, String citationMicroReference) ;
|
125
|
|
126
|
/**
|
127
|
* Changes the taxa associated with the given taxon nodes into synonyms of the new accepted taxon node.
|
128
|
* All data associated with the former taxa are moved to the newly accepted taxon.
|
129
|
*
|
130
|
* @param oldTaxonNodes
|
131
|
* @param newAcceptedTaxonNode
|
132
|
* @param synonymType
|
133
|
* @param citation
|
134
|
* @param citationMicroReference
|
135
|
* @return
|
136
|
*
|
137
|
*/
|
138
|
UpdateResult makeTaxonNodeSynonymsOfAnotherTaxonNode(Set<UUID> oldTaxonNodeUuids, UUID newAcceptedTaxonNodeUUIDs,
|
139
|
SynonymType synonymType, Reference citation, String citationMicroReference);
|
140
|
|
141
|
|
142
|
public UpdateResult makeTaxonNodeASynonymOfAnotherTaxonNode(UUID oldTaxonNodeUuid,
|
143
|
UUID newAcceptedTaxonNodeUUID,
|
144
|
SynonymType synonymType,
|
145
|
Reference citation,
|
146
|
String citationMicroReference) ;
|
147
|
|
148
|
|
149
|
/**
|
150
|
* @param nodeUuids
|
151
|
* @param config
|
152
|
* @return
|
153
|
*/
|
154
|
public DeleteResult deleteTaxonNodes(Collection<UUID> nodeUuids, TaxonDeletionConfigurator config);
|
155
|
|
156
|
/**
|
157
|
* deletes the given taxon node the configurator defines whether the children will be deleted too or not
|
158
|
*
|
159
|
* @param node
|
160
|
* @param conf
|
161
|
* @return
|
162
|
*
|
163
|
*/
|
164
|
public DeleteResult deleteTaxonNode(TaxonNode node, TaxonDeletionConfigurator config);
|
165
|
/**
|
166
|
* Returns a List of all TaxonNodes of a given Classification.
|
167
|
*
|
168
|
* @param classification - according to the given classification the TaxonNodes are filtered.
|
169
|
* @param start - beginning of wanted row set, i.e. 0 if one want to start from the beginning.
|
170
|
* @param end - limit of how many rows are to be pulled from the database, i.e. 1000 rows.
|
171
|
* @return filtered List of TaxonNode according to the classification provided
|
172
|
*/
|
173
|
|
174
|
/**
|
175
|
* @param nodeUuid
|
176
|
* @param config
|
177
|
* @return
|
178
|
*/
|
179
|
public DeleteResult deleteTaxonNode(UUID nodeUuid, TaxonDeletionConfigurator config);
|
180
|
|
181
|
public List<TaxonNode> listAllNodesForClassification(Classification classification, Integer start, Integer end);
|
182
|
|
183
|
/**
|
184
|
* Counts all TaxonNodes for a given Classification
|
185
|
*
|
186
|
* @param classification - according to the given classification the TaxonNodes are filtered.
|
187
|
* @return
|
188
|
*/
|
189
|
public int countAllNodesForClassification(Classification classification);
|
190
|
|
191
|
|
192
|
/**
|
193
|
* @param taxonNodeUuid
|
194
|
* @param newParentTaxonNodeUuid
|
195
|
* @return
|
196
|
*/
|
197
|
public UpdateResult moveTaxonNode(UUID taxonNodeUuid, UUID newParentTaxonNodeUuid, int movingType);
|
198
|
|
199
|
|
200
|
|
201
|
|
202
|
|
203
|
/**
|
204
|
* @param taxonNode
|
205
|
* @param newParent
|
206
|
* @param parent
|
207
|
* @return
|
208
|
*/
|
209
|
UpdateResult moveTaxonNode(TaxonNode taxonNode, TaxonNode newParent, int movingType);
|
210
|
|
211
|
/**
|
212
|
* deletes the given taxon nodes
|
213
|
*
|
214
|
* @param nodes
|
215
|
* @param config
|
216
|
* @return
|
217
|
*
|
218
|
*/
|
219
|
public DeleteResult deleteTaxonNodes(List<TaxonNode> list, TaxonDeletionConfigurator config);
|
220
|
|
221
|
/**
|
222
|
* Returns the of TaxonNodeAgentRelation entities which are associated with the TaxonNode for the
|
223
|
* given TaxonUuid in the specified Classification.
|
224
|
*
|
225
|
* @param taxonUuid
|
226
|
* @param agentUuid TODO
|
227
|
* @param rankUuid TODO
|
228
|
* @param relTypeUuid TODO
|
229
|
* @param classification
|
230
|
* @return
|
231
|
*/
|
232
|
public Pager<TaxonNodeAgentRelation> pageTaxonNodeAgentRelations(UUID taxonUuid, UUID classificationUuid,
|
233
|
UUID agentUuid, UUID rankUuid, UUID relTypeUuid, Integer pageSize, Integer pageIndex, List<String> propertyPaths);
|
234
|
|
235
|
/**
|
236
|
* @param parentNodeUuid
|
237
|
* @param newTaxon
|
238
|
* @param ref
|
239
|
* @param microref
|
240
|
* @return
|
241
|
*/
|
242
|
public UpdateResult createNewTaxonNode(UUID parentNodeUuid, Taxon newTaxon, Reference ref, String microref);
|
243
|
|
244
|
/**
|
245
|
* @param taxonNodeUUID
|
246
|
* @param agentUUID
|
247
|
* @param relationshipType
|
248
|
* @return
|
249
|
*/
|
250
|
public UpdateResult addTaxonNodeAgentRelation(UUID taxonNodeUUID, UUID agentUUID, DefinedTerm relationshipType);
|
251
|
|
252
|
/**
|
253
|
* @param parentNodeUuid
|
254
|
* @param taxonUuid
|
255
|
* @param ref
|
256
|
* @param microref
|
257
|
* @return
|
258
|
*/
|
259
|
public UpdateResult createNewTaxonNode(UUID parentNodeUuid, UUID taxonUuid, Reference ref, String microref);
|
260
|
|
261
|
/**
|
262
|
* Sets the secundum reference for all taxa of the given subtree.
|
263
|
* Depending on the configuration, also synonym secundum will be set.
|
264
|
* See {@link SetSecundumForSubtreeConfigurator} for further configuration
|
265
|
* options.
|
266
|
* @param b
|
267
|
* @param configurator
|
268
|
* @return UpdateResult
|
269
|
*/
|
270
|
public UpdateResult setSecundumForSubtree(SecundumForSubtreeConfigurator config);
|
271
|
|
272
|
|
273
|
/**
|
274
|
* Sets the publish flag for all taxa and/or synonyms of the subtree.
|
275
|
* @param subtreeUuid
|
276
|
* @param publish
|
277
|
* @param includeAcceptedTaxa
|
278
|
* @param includeSynonyms
|
279
|
* @param overwriteExistingAccepted
|
280
|
* @param overwriteExistingSynonyms
|
281
|
* @param includeSharedTaxa
|
282
|
* @param progressMonitor
|
283
|
* @return
|
284
|
*/
|
285
|
public UpdateResult setPublishForSubtree(UUID subtreeUuid, boolean publish, boolean includeAcceptedTaxa,
|
286
|
boolean includeSynonyms, boolean includeSharedTaxa, IProgressMonitor progressMonitor);
|
287
|
|
288
|
|
289
|
/**
|
290
|
* Returns a list of taxon node {@link UUID uuids} according to the given filter.
|
291
|
* @param filter
|
292
|
* @return
|
293
|
*/
|
294
|
public long count(TaxonNodeFilter filter);
|
295
|
|
296
|
/**
|
297
|
* Returns a list of taxon node {@link UUID uuids} according to the given filter.
|
298
|
* @param filter
|
299
|
* @return
|
300
|
*/
|
301
|
public List<UUID> uuidList(TaxonNodeFilter filter);
|
302
|
|
303
|
/**
|
304
|
* Returns a list of taxon node IDs according to the given filter.
|
305
|
* @param filter
|
306
|
* @return
|
307
|
*/
|
308
|
public List<Integer> idList(TaxonNodeFilter filter);
|
309
|
|
310
|
// /**
|
311
|
// * @param configurator
|
312
|
// * @return
|
313
|
// */
|
314
|
// UUID monitSetSecundum(SecundumForSubtreeConfigurator configurator);
|
315
|
|
316
|
|
317
|
/**
|
318
|
* @param parent
|
319
|
* @return
|
320
|
*/
|
321
|
List<TaxonNodeDto> listChildNodesAsTaxonNodeDto(UuidAndTitleCache<TaxonNode> parent);
|
322
|
|
323
|
/**
|
324
|
* @param parent
|
325
|
* @return
|
326
|
*/
|
327
|
List<TaxonNodeDto> listChildNodesAsTaxonNodeDto(ITaxonTreeNode parent);
|
328
|
|
329
|
/**
|
330
|
* @param taxonNodeUuids
|
331
|
* @param newParentNodeUuid
|
332
|
* @param movingType
|
333
|
* @param monitor
|
334
|
* @return
|
335
|
*/
|
336
|
UpdateResult moveTaxonNodes(Set<UUID> taxonNodeUuids, UUID newParentNodeUuid, int movingType,
|
337
|
IProgressMonitor monitor);
|
338
|
|
339
|
/**
|
340
|
* Retrieves the first taxon node that is direct or indirect parent
|
341
|
* to all nodes of the given list of nodes. This can also return
|
342
|
* the root node of a classification<br>
|
343
|
* If no common parent node could be found <code>null</code> is returned.
|
344
|
* @param nodes the direct/indirect child taxon nodes for which the common
|
345
|
* parent should be retrieved
|
346
|
* @return the common direct/indirect parent of all nodes
|
347
|
*/
|
348
|
public TaxonNodeDto findCommonParentDto(Collection<TaxonNodeDto> nodes);
|
349
|
|
350
|
/**
|
351
|
* @param taxonNodeUuid
|
352
|
* @return
|
353
|
*/
|
354
|
TaxonNodeDto dto(UUID taxonNodeUuid);
|
355
|
|
356
|
/**
|
357
|
* @param parentNodeUuid
|
358
|
* @param areas
|
359
|
* @return
|
360
|
*/
|
361
|
List<TaxonDistributionDTO> getTaxonDistributionDTOForSubtree(UUID parentNodeUuid, List<String> propertyPaths);
|
362
|
|
363
|
/**
|
364
|
* @param parentNodeUuid
|
365
|
* @param newTaxonNode
|
366
|
* @return
|
367
|
*/
|
368
|
UpdateResult saveNewTaxonNode(TaxonNode newTaxonNode);
|
369
|
|
370
|
}
|