2 * Copyright (C) 2007 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
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.
10 package eu
.etaxonomy
.cdm
.api
.service
;
12 import java
.util
.Collection
;
13 import java
.util
.List
;
15 import java
.util
.UUID
;
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
.pager
.Pager
;
20 import eu
.etaxonomy
.cdm
.common
.monitor
.IProgressMonitor
;
21 import eu
.etaxonomy
.cdm
.filter
.TaxonNodeFilter
;
22 import eu
.etaxonomy
.cdm
.model
.common
.DefinedTerm
;
23 import eu
.etaxonomy
.cdm
.model
.reference
.Reference
;
24 import eu
.etaxonomy
.cdm
.model
.taxon
.Classification
;
25 import eu
.etaxonomy
.cdm
.model
.taxon
.ITaxonTreeNode
;
26 import eu
.etaxonomy
.cdm
.model
.taxon
.SynonymType
;
27 import eu
.etaxonomy
.cdm
.model
.taxon
.Taxon
;
28 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonNode
;
29 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonNodeAgentRelation
;
30 import eu
.etaxonomy
.cdm
.persistence
.dto
.TaxonNodeDto
;
31 import eu
.etaxonomy
.cdm
.persistence
.dto
.UuidAndTitleCache
;
38 public interface ITaxonNodeService
extends IAnnotatableService
<TaxonNode
>{
41 * returns the childnodes of the taxonNode, if recursive is true it returns all descendants, if sort is true the nodes are sorted
44 * @param propertyPaths
46 * @return List<TaxonNode>
48 public List
<TaxonNode
> loadChildNodesOfTaxonNode(TaxonNode taxonNode
, List
<String
> propertyPaths
, boolean recursive
, boolean includeUnpublished
, NodeSortMode sortMode
);
51 * Lists all direct child nodes of the given {@link UuidAndTitleCache} which
52 * represents the parent {@link TaxonNode}
53 * @param parent a UuidAndTitleCache object which represents a parent {@link TaxonNode}
54 * @return a list of UuidAndTitleCache objects that represent children of the
57 public List
<UuidAndTitleCache
<TaxonNode
>> listChildNodesAsUuidAndTitleCache(UuidAndTitleCache
<TaxonNode
> parent
);
60 * Retrieves a list of {@link UuidAndTitleCache} objects that have a matchin titleCache
61 * @param limit the maximum results
62 * @param pattern the titleCache that is searched for
63 * @param classificationUuid if specified only nodes of this classification are retrieved
64 * @return a list of matches
66 public List
<UuidAndTitleCache
<TaxonNode
>> getUuidAndTitleCache(Integer limit
, String pattern
, UUID classificationUuid
);
69 * Retrieves the parent node of the child {@link TaxonNode}
70 * @param child the child for which the parent should be retrieved
71 * @return the parent taxon node
73 public UuidAndTitleCache
<TaxonNode
> getParentUuidAndTitleCache(ITaxonTreeNode child
);
76 * Retrieves the parent node of the {@link TaxonNode} represented by the given {@link UuidAndTitleCache}.
77 * @param child the child for which the parent should be retrieved
78 * @return an UuidAndTitleCache object representing the parent node
80 public UuidAndTitleCache
<TaxonNode
> getParentUuidAndTitleCache(UuidAndTitleCache
<TaxonNode
> child
);
83 * Lists all direct child nodes of the given {@link ITaxonTreeNode}
84 * @param parent the parent ITaxonTreeNode
85 * @return a list of UuidAndTitleCache objects that represent children of the
88 public List
<UuidAndTitleCache
<TaxonNode
>> listChildNodesAsUuidAndTitleCache(ITaxonTreeNode parent
);
91 *returns the childnodes of the taxonNode, if recursive is true it returns all descendants, if sort is true the nodes are sorted
95 * @param doSynonyms if true also synonyms are returned as children
100 * @return List<TaxonNodeDto>
102 public Pager
<TaxonNodeDto
> pageChildNodesDTOs(UUID taxonNodeUuid
, boolean recursive
, boolean includeUnpublished
,
103 boolean doSynonyms
, NodeSortMode sortMode
,
104 Integer pageSize
, Integer pageIndex
);
106 public TaxonNodeDto
parentDto(UUID taxonNodeUuid
);
109 * Changes the taxon associated with the given taxon node into a synonym of the new accepted taxon node.
110 * All data associated with the former taxon are moved to the newly accepted taxon.
112 * @param oldTaxonNode
113 * @param newAcceptedTaxonNode
116 * @param citationMicroReference
120 public DeleteResult
makeTaxonNodeASynonymOfAnotherTaxonNode(TaxonNode oldTaxonNode
, TaxonNode newAcceptedTaxonNode
, SynonymType synonymType
, Reference citation
, String citationMicroReference
) ;
123 * Changes the taxa associated with the given taxon nodes into synonyms of the new accepted taxon node.
124 * All data associated with the former taxa are moved to the newly accepted taxon.
126 * @param oldTaxonNodes
127 * @param newAcceptedTaxonNode
130 * @param citationMicroReference
134 UpdateResult
makeTaxonNodeSynonymsOfAnotherTaxonNode(Set
<UUID
> oldTaxonNodeUuids
, UUID newAcceptedTaxonNodeUUIDs
,
135 SynonymType synonymType
, Reference citation
, String citationMicroReference
);
138 public UpdateResult
makeTaxonNodeASynonymOfAnotherTaxonNode(UUID oldTaxonNodeUuid
,
139 UUID newAcceptedTaxonNodeUUID
,
140 SynonymType synonymType
,
142 String citationMicroReference
) ;
150 public DeleteResult
deleteTaxonNodes(Collection
<UUID
> nodeUuids
, TaxonDeletionConfigurator config
);
153 * deletes the given taxon node the configurator defines whether the children will be deleted too or not
160 public DeleteResult
deleteTaxonNode(TaxonNode node
, TaxonDeletionConfigurator config
);
162 * Returns a List of all TaxonNodes of a given Classification.
164 * @param classification - according to the given classification the TaxonNodes are filtered.
165 * @param start - beginning of wanted row set, i.e. 0 if one want to start from the beginning.
166 * @param end - limit of how many rows are to be pulled from the database, i.e. 1000 rows.
167 * @return filtered List of TaxonNode according to the classification provided
175 public DeleteResult
deleteTaxonNode(UUID nodeUuid
, TaxonDeletionConfigurator config
);
177 public List
<TaxonNode
> listAllNodesForClassification(Classification classification
, Integer start
, Integer end
);
180 * Counts all TaxonNodes for a given Classification
182 * @param classification - according to the given classification the TaxonNodes are filtered.
185 public int countAllNodesForClassification(Classification classification
);
189 * @param taxonNodeUuid
190 * @param newParentTaxonNodeUuid
193 public UpdateResult
moveTaxonNode(UUID taxonNodeUuid
, UUID newParentTaxonNodeUuid
, int movingType
);
205 UpdateResult
moveTaxonNode(TaxonNode taxonNode
, TaxonNode newParent
, int movingType
);
208 * deletes the given taxon nodes
215 public DeleteResult
deleteTaxonNodes(List
<TaxonNode
> list
, TaxonDeletionConfigurator config
);
218 * Returns the of TaxonNodeAgentRelation entities which are associated with the TaxonNode for the
219 * given TaxonUuid in the specified Classification.
222 * @param agentUuid TODO
223 * @param rankUuid TODO
224 * @param relTypeUuid TODO
225 * @param classification
228 public Pager
<TaxonNodeAgentRelation
> pageTaxonNodeAgentRelations(UUID taxonUuid
, UUID classificationUuid
,
229 UUID agentUuid
, UUID rankUuid
, UUID relTypeUuid
, Integer pageSize
, Integer pageIndex
, List
<String
> propertyPaths
);
232 * @param parentNodeUuid
238 public UpdateResult
createNewTaxonNode(UUID parentNodeUuid
, Taxon newTaxon
, Reference ref
, String microref
);
241 * @param taxonNodeUUID
243 * @param relationshipType
246 public UpdateResult
addTaxonNodeAgentRelation(UUID taxonNodeUUID
, UUID agentUUID
, DefinedTerm relationshipType
);
249 * @param parentNodeUuid
255 public UpdateResult
createNewTaxonNode(UUID parentNodeUuid
, UUID taxonUuid
, Reference ref
, String microref
);
258 * Sets the secundum reference for all taxa of the given subtree.
259 * Depending on the configuration, also synonym secundum will be set.
260 * See {@link SetSecundumForSubtreeConfigurator} for further configuration
263 * @param configurator
264 * @return UpdateResult
266 public UpdateResult
setSecundumForSubtree(SecundumForSubtreeConfigurator config
);
270 * Sets the publish flag for all taxa and/or synonyms of the subtree.
273 * @param includeAcceptedTaxa
274 * @param includeSynonyms
275 * @param overwriteExistingAccepted
276 * @param overwriteExistingSynonyms
277 * @param includeSharedTaxa
278 * @param progressMonitor
281 public UpdateResult
setPublishForSubtree(UUID subtreeUuid
, boolean publish
, boolean includeAcceptedTaxa
,
282 boolean includeSynonyms
, boolean includeSharedTaxa
, IProgressMonitor progressMonitor
);
286 * Returns a list of taxon node {@link UUID uuids} according to the given filter.
290 public long count(TaxonNodeFilter filter
);
293 * Returns a list of taxon node {@link UUID uuids} according to the given filter.
297 public List
<UUID
> uuidList(TaxonNodeFilter filter
);
300 * Returns a list of taxon node IDs according to the given filter.
304 public List
<Integer
> idList(TaxonNodeFilter filter
);
307 // * @param configurator
310 // UUID monitSetSecundum(SecundumForSubtreeConfigurator configurator);
317 List
<TaxonNodeDto
> listChildNodesAsTaxonNodeDto(UuidAndTitleCache
<TaxonNode
> parent
);
323 List
<TaxonNodeDto
> listChildNodesAsTaxonNodeDto(ITaxonTreeNode parent
);
326 * @param taxonNodeUuids
327 * @param newParentNodeUuid
332 UpdateResult
moveTaxonNodes(Set
<UUID
> taxonNodeUuids
, UUID newParentNodeUuid
, int movingType
,
333 IProgressMonitor monitor
);
336 * Retrieves the first taxon node that is direct or indirect parent
337 * to all nodes of the given list of nodes. This can also return
338 * the root node of a classification<br>
339 * If no common parent node could be found <code>null</code> is returned.
340 * @param nodes the direct/indirect child taxon nodes for which the common
341 * parent should be retrieved
342 * @return the common direct/indirect parent of all nodes
344 public TaxonNodeDto
findCommonParentDto(Collection
<TaxonNodeDto
> nodes
);