new createNewTaxonNode service method
[cdmlib.git] / cdmlib-services / src / main / java / eu / etaxonomy / cdm / api / service / ITaxonNodeService.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.Set;
16 import java.util.UUID;
17
18 import eu.etaxonomy.cdm.api.service.config.TaxonDeletionConfigurator;
19 import eu.etaxonomy.cdm.api.service.pager.Pager;
20 import eu.etaxonomy.cdm.model.reference.Reference;
21 import eu.etaxonomy.cdm.model.taxon.Classification;
22 import eu.etaxonomy.cdm.model.taxon.SynonymRelationshipType;
23 import eu.etaxonomy.cdm.model.taxon.Taxon;
24 import eu.etaxonomy.cdm.model.taxon.TaxonNode;
25 import eu.etaxonomy.cdm.model.taxon.TaxonNodeAgentRelation;
26
27
28 /**
29 * @author n.hoffmann
30 * @created Apr 9, 2010
31 * @version 1.0
32 */
33 public interface ITaxonNodeService extends IAnnotatableService<TaxonNode>{
34
35 /**
36 *returns the childnodes of the taxonNode, if recursive is true it returns all descendants, if sort is true the nodes are sorted
37 *
38 * @param taxonNode
39 * @param propertyPaths
40 * @param recursive
41 * @return List<TaxonNode>
42 */
43 public List<TaxonNode> loadChildNodesOfTaxonNode(TaxonNode taxonNode, List<String> propertyPaths, boolean recursive, NodeSortMode sortMode);
44
45 /**
46 * Changes the taxon associated with the given taxon node into a synonym of the new accepted taxon node.
47 * All data associated with the former taxon are moved to the newly accepted taxon.
48 *
49 * @param oldTaxonNode
50 * @param newAcceptedTaxonNode
51 * @param synonymRelationshipType
52 * @param citation
53 * @param citationMicroReference
54 * @return
55 *
56 */
57 public DeleteResult makeTaxonNodeASynonymOfAnotherTaxonNode(TaxonNode oldTaxonNode, TaxonNode newAcceptedTaxonNode, SynonymRelationshipType synonymRelationshipType, Reference citation, String citationMicroReference) ;
58
59 public UpdateResult makeTaxonNodeASynonymOfAnotherTaxonNode(UUID oldTaxonNodeUuid,
60 UUID newAcceptedTaxonNodeUUID,
61 SynonymRelationshipType synonymRelationshipType,
62 Reference citation,
63 String citationMicroReference) ;
64
65
66 /**
67 * @param nodeUuids
68 * @param config
69 * @return
70 */
71 public DeleteResult deleteTaxonNodes(Collection<UUID> nodeUuids, TaxonDeletionConfigurator config);
72
73 /**
74 * deletes the given taxon node the configurator defines whether the children will be deleted too or not
75 *
76 * @param node
77 * @param conf
78 * @return
79 *
80 */
81 public DeleteResult deleteTaxonNode(TaxonNode node, TaxonDeletionConfigurator config);
82 /**
83 * Returns a List of all TaxonNodes of a given Classification.
84 *
85 * @param classification - according to the given classification the TaxonNodes are filtered.
86 * @param start - beginning of wanted row set, i.e. 0 if one want to start from the beginning.
87 * @param end - limit of how many rows are to be pulled from the database, i.e. 1000 rows.
88 * @return filtered List of TaxonNode according to the classification provided
89 */
90
91 /**
92 * @param nodeUuid
93 * @param config
94 * @return
95 */
96 public DeleteResult deleteTaxonNode(UUID nodeUuid, TaxonDeletionConfigurator config);
97
98 public List<TaxonNode> listAllNodesForClassification(Classification classification, Integer start, Integer end);
99
100 /**
101 * Counts all TaxonNodes for a given Classification
102 *
103 * @param classification - according to the given classification the TaxonNodes are filtered.
104 * @return
105 */
106 public int countAllNodesForClassification(Classification classification);
107
108
109 /**
110 * @param taxonNodeUuid
111 * @param newParentTaxonNodeUuid
112 * @return
113 */
114 public UpdateResult moveTaxonNode(UUID taxonNodeUuid, UUID newParentTaxonNodeUuid, boolean parent);
115
116
117
118 /**
119 * @param taxonNodeUuids
120 * @param newParentNodeUuid
121 * @return
122 */
123 UpdateResult moveTaxonNodes(Set<UUID> taxonNodeUuids, UUID newParentNodeUuid, boolean parent);
124
125 /**
126 * @param taxonNode
127 * @param newParent
128 * @param parent
129 * @return
130 */
131 UpdateResult moveTaxonNode(TaxonNode taxonNode, TaxonNode newParent, boolean parent);
132
133 /**
134 * deletes the given taxon nodes
135 *
136 * @param nodes
137 * @param config
138 * @return
139 *
140 */
141 public DeleteResult deleteTaxonNodes(List<TaxonNode> list, TaxonDeletionConfigurator config);
142
143 /**
144 * Returns the of TaxonNodeAgentRelation entities which are associated with the TaxonNode for the
145 * given TaxonUuid in the specified Classification.
146 *
147 * @param taxonUuid
148 * @param agentUuid TODO
149 * @param rankUuid TODO
150 * @param relTypeUuid TODO
151 * @param classification
152 * @return
153 */
154 public Pager<TaxonNodeAgentRelation> pageTaxonNodeAgentRelations(UUID taxonUuid, UUID classificationUuid,
155 UUID agentUuid, UUID rankUuid, UUID relTypeUuid, Integer pageSize, Integer pageIndex, List<String> propertyPaths);
156
157 /**
158 * @param parentNodeUuid
159 * @param newTaxon
160 * @param ref
161 * @param microref
162 * @return
163 */
164 public UpdateResult createNewTaxonNode(UUID parentNodeUuid, Taxon newTaxon, Reference ref, String microref);
165
166
167 }