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