Project

General

Profile

Download (12.5 KB) Statistics
| Branch: | Tag: | Revision:
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.Set;
16
import java.util.UUID;
17

    
18
import org.springframework.security.core.Authentication;
19

    
20
import eu.etaxonomy.cdm.api.service.config.PublishForSubtreeConfigurator;
21
import eu.etaxonomy.cdm.api.service.config.SecundumForSubtreeConfigurator;
22
import eu.etaxonomy.cdm.api.service.config.SubtreeCloneConfigurator;
23
import eu.etaxonomy.cdm.api.service.config.TaxonDeletionConfigurator;
24
import eu.etaxonomy.cdm.api.service.dto.CreateTaxonDTO;
25
import eu.etaxonomy.cdm.api.service.dto.TaxonDistributionDTO;
26
import eu.etaxonomy.cdm.api.service.pager.Pager;
27
import eu.etaxonomy.cdm.common.monitor.IProgressMonitor;
28
import eu.etaxonomy.cdm.compare.taxon.TaxonNodeSortMode;
29
import eu.etaxonomy.cdm.filter.TaxonNodeFilter;
30
import eu.etaxonomy.cdm.model.common.Language;
31
import eu.etaxonomy.cdm.model.common.LanguageString;
32
import eu.etaxonomy.cdm.model.metadata.SecReferenceHandlingEnum;
33
import eu.etaxonomy.cdm.model.name.Rank;
34
import eu.etaxonomy.cdm.model.name.TaxonName;
35
import eu.etaxonomy.cdm.model.reference.NamedSource;
36
import eu.etaxonomy.cdm.model.reference.Reference;
37
import eu.etaxonomy.cdm.model.taxon.Classification;
38
import eu.etaxonomy.cdm.model.taxon.ITaxonTreeNode;
39
import eu.etaxonomy.cdm.model.taxon.SynonymType;
40
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
41
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
42
import eu.etaxonomy.cdm.model.taxon.TaxonNodeAgentRelation;
43
import eu.etaxonomy.cdm.model.taxon.TaxonNodeStatus;
44
import eu.etaxonomy.cdm.model.term.DefinedTerm;
45
import eu.etaxonomy.cdm.persistence.dao.common.Restriction;
46
import eu.etaxonomy.cdm.persistence.dto.HomotypicGroupDto;
47
import eu.etaxonomy.cdm.persistence.dto.TaxonNodeDto;
48
import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache;
49
import eu.etaxonomy.cdm.persistence.query.OrderHint;
50

    
51
/**
52
 * @author n.hoffmann
53
 * @since Apr 9, 2010
54
 */
55
public interface ITaxonNodeService extends IAnnotatableService<TaxonNode>{
56

    
57
	/**
58
	 * returns the childnodes of the taxonNode, if recursive is true it returns all descendants, if sort is true the nodes are sorted
59
	 *
60
	 * @param taxonNode
61
	 * @param propertyPaths
62
	 * @param recursive
63
	 * @return List<TaxonNode>
64
	 */
65
	public List<TaxonNode> loadChildNodesOfTaxonNode(TaxonNode taxonNode, List<String> propertyPaths, boolean recursive,  boolean includeUnpublished, TaxonNodeSortMode sortMode);
66

    
67
	/**
68
	 * Lists all direct child nodes of the given {@link UuidAndTitleCache} which
69
	 * represents the parent {@link TaxonNode}
70
	 * @param parent a UuidAndTitleCache object which represents a parent {@link TaxonNode}
71
	 * @return a list of UuidAndTitleCache objects that represent children of the
72
	 * parent
73
	 */
74
//	public List<UuidAndTitleCache<TaxonNode>> listChildNodesAsUuidAndTitleCache(UuidAndTitleCache<TaxonNode> parent);
75

    
76
    public List<TaxonNode> listChildrenOf(TaxonNode node, Integer pageSize, Integer pageIndex,
77
            boolean recursive, boolean includeUnpublished, List<String> propertyPaths);
78

    
79
	/**
80
     * Retrieves a list of {@link UuidAndTitleCache} objects that have a matchin titleCache
81
     *
82
     * @param limit the maximum results
83
     * @param pattern the titleCache that is searched for
84
     * @param classificationUuid if specified only nodes of this classification are retrieved
85
     * @return a list of matches
86
     */
87
	public List<TaxonNodeDto> getUuidAndTitleCache(Integer limit, String pattern, UUID classificationUuid);
88

    
89
    /**
90
     * Retrieves the parent node of the child {@link TaxonNode}
91
     * @param child the child for which the parent should be retrieved
92
     * @return the parent taxon node
93
     */
94
	public TaxonNodeDto getParentUuidAndTitleCache(ITaxonTreeNode child);
95

    
96
	/**
97
     * Retrieves the parent node of the {@link TaxonNode} represented by the given {@link UuidAndTitleCache}.
98
     * @param child the child for which the parent should be retrieved
99
     * @return an UuidAndTitleCache object representing the parent node
100
     */
101
	public TaxonNodeDto getParentUuidAndTitleCache(TaxonNodeDto child);
102

    
103
//	/**
104
//     * Lists all direct child nodes of the given {@link ITaxonTreeNode}
105
//     * @param parent the parent ITaxonTreeNode
106
//     * @return a list of UuidAndTitleCache objects that represent children of the
107
//     * parent
108
//     */
109
//	public List<UuidAndTitleCache<TaxonNode>> listChildNodesAsUuidAndTitleCache(ITaxonTreeNode parent);
110

    
111
	/**
112
     *Returns the childnodes of the taxonNode, if recursive is true it returns all descendants, if sort is true the nodes are sorted
113
     *
114
     * @param taxonNode
115
     * @param recursive
116
     * @param doSynonyms if true also synonyms are returned as children
117
     * @param sortMode
118
     * @param pageSize
119
     * @param pageIndex
120
     *
121
     * @return List<TaxonNodeDto>
122
     */
123
    public Pager<TaxonNodeDto> pageChildNodesDTOs(UUID taxonNodeUuid, boolean recursive, boolean includeUnpublished,
124
            boolean doSynonyms, TaxonNodeSortMode sortMode,
125
            Integer pageSize, Integer pageIndex);
126

    
127
    public TaxonNodeDto parentDto(UUID taxonNodeUuid);
128

    
129
	/**
130
	 * Changes the taxon associated with the given taxon node into a synonym of the new accepted taxon node.
131
	 * All data associated with the former taxon are moved to the newly accepted taxon.
132
	 */
133
	public DeleteResult makeTaxonNodeASynonymOfAnotherTaxonNode(TaxonNode oldTaxonNode, TaxonNode newAcceptedTaxonNode, SynonymType synonymType, Reference citation,  String microReference, SecReferenceHandlingEnum secHandling, boolean setNameInSource) ;
134

    
135
	/**
136
	 * Changes the taxa associated with the given taxon nodes into synonyms of the new accepted taxon node.
137
	 * All data associated with the former taxa are moved to the newly accepted taxon.
138
	 */
139
	public DeleteResult makeTaxonNodeSynonymsOfAnotherTaxonNode(Set<UUID> oldTaxonNodeUuids, UUID newAcceptedTaxonNodeUUIDs,
140
			SynonymType synonymType, UUID citationUuid, String microReference, SecReferenceHandlingEnum secHandling, boolean setNameInSource);
141

    
142
	public DeleteResult makeTaxonNodeASynonymOfAnotherTaxonNode(UUID oldTaxonNodeUuid,
143
	        UUID newAcceptedTaxonNodeUUID,
144
	        SynonymType synonymType,
145
	        UUID citationUuid,
146
	        String microReference,
147
	        SecReferenceHandlingEnum secHandling,
148
	        boolean setNameInSource) ;
149

    
150
    public DeleteResult deleteTaxonNodes(Collection<UUID> nodeUuids, TaxonDeletionConfigurator config);
151

    
152
	/**
153
	 * deletes the given taxon node the configurator defines whether the children will be deleted too or not
154
	 */
155
	public DeleteResult deleteTaxonNode(TaxonNode node, TaxonDeletionConfigurator config);
156

    
157
	/**
158
	 * Returns a List of all TaxonNodes of a given Classification.
159
	 *
160
	 * @param classification - according to the given classification the TaxonNodes are filtered.
161
	 * @param start -  beginning of wanted row set, i.e. 0 if one want to start from the beginning.
162
	 * @param end  - limit of how many rows are to be pulled from the database, i.e. 1000 rows.
163
	 * @return filtered List of TaxonNode according to the classification provided
164
	 */
165

    
166
    /**
167
     * @param nodeUuid
168
     * @param config
169
     * @return
170
     */
171
    public DeleteResult deleteTaxonNode(UUID nodeUuid, TaxonDeletionConfigurator config);
172

    
173
	public List<TaxonNode> listAllNodesForClassification(Classification classification, Integer start, Integer end);
174

    
175
	/**
176
	 * Counts all TaxonNodes for a given Classification
177
	 *
178
	 * @param classification - according to the given classification the TaxonNodes are filtered.
179
	 * @return the count result
180
	 */
181
	public int countAllNodesForClassification(Classification classification);
182

    
183
    public UpdateResult moveTaxonNode(UUID taxonNodeUuid, UUID newParentTaxonNodeUuid, int movingType, SecReferenceHandlingEnum secHandling, UUID secUuid);
184

    
185
    public UpdateResult moveTaxonNode(TaxonNode taxonNode, TaxonNode newParent, int movingType, SecReferenceHandlingEnum secHandling, Reference sec);
186

    
187
    public UpdateResult moveTaxonNodes(Set<UUID> taxonNodeUuids, UUID newParentNodeUuid, int movingType, SecReferenceHandlingEnum secHandling, UUID secUuid,            IProgressMonitor monitor);
188

    
189
    /**
190
     * deletes the given taxon nodes
191
     */
192
    public DeleteResult deleteTaxonNodes(List<TaxonNode> list, TaxonDeletionConfigurator config);
193

    
194
    /**
195
     * Returns the of TaxonNodeAgentRelation entities which are associated with the TaxonNode for the
196
     * given TaxonUuid in the specified Classification.
197
     *
198
     * @param taxonUuid
199
     * @param agentUuid TODO
200
     * @param rankUuid TODO
201
     * @param relTypeUuid TODO
202
     * @param classification
203
     * @return
204
     */
205
    public Pager<TaxonNodeAgentRelation> pageTaxonNodeAgentRelations(UUID taxonUuid, UUID classificationUuid,
206
            UUID agentUuid, UUID rankUuid, UUID relTypeUuid, Integer pageSize, Integer pageIndex, List<String> propertyPaths);
207

    
208
    public UpdateResult createNewTaxonNode(UUID parentNodeUuid, CreateTaxonDTO taxonDto, NamedSource source, String microref,
209
            TaxonNodeStatus status, Map<Language,LanguageString> statusNote);
210

    
211
    public UpdateResult addTaxonNodeAgentRelation(UUID taxonNodeUUID, UUID agentUUID, DefinedTerm relationshipType);
212

    
213
    /**
214
     * Creates a new taxon node for the given existing taxon with the given existing parent taxon node.
215
     */
216
//    public UpdateResult createNewTaxonNode(UUID parentNodeUuid, UUID taxonUuid, UUID refUuid, String microref);
217

    
218
    /**
219
     * Sets the secundum reference for all taxa of the given subtree.
220
     * Depending on the configuration, also synonym secundum will be set.
221
     * See {@link SetSecundumForSubtreeConfigurator} for further configuration
222
     * options.
223
     * @return UpdateResult
224
     */
225
    public UpdateResult setSecundumForSubtree(SecundumForSubtreeConfigurator config);
226

    
227

    
228
    /**
229
     * Sets the publish flag for all taxa and/or synonyms of the subtree.
230
     */
231
    public UpdateResult setPublishForSubtree(PublishForSubtreeConfigurator configurator);
232

    
233
    /**
234
     * Returns a list of taxon node {@link UUID uuids} according to the given filter.
235
     */
236
    public long count(TaxonNodeFilter filter);
237

    
238
    /**
239
     * Returns a list of taxon node {@link UUID uuids} according to the given filter.
240
     */
241
    public List<UUID> uuidList(TaxonNodeFilter filter);
242

    
243
    /**
244
     * Returns a list of taxon node IDs according to the given filter.
245
     */
246
    public List<Integer> idList(TaxonNodeFilter filter);
247

    
248
    public List<TaxonNodeDto> listChildNodesAsTaxonNodeDto(TaxonNodeDto parent);
249

    
250

    
251
    public List<TaxonNodeDto> listChildNodesAsTaxonNodeDto(ITaxonTreeNode parent);
252

    
253
    /**
254
     * Retrieves the first taxon node that is direct or indirect parent
255
     * to all nodes of the given list of nodes. This can also return
256
     * the root node of a classification<br>
257
     * If no common parent node could be found <code>null</code> is returned.
258
     * @param nodes the direct/indirect child taxon nodes for which the common
259
     * parent should be retrieved
260
     * @return the common direct/indirect parent of all nodes
261
     */
262
    public TaxonNodeDto findCommonParentDto(Collection<TaxonNodeDto> nodes);
263

    
264
    public TaxonNodeDto dto(UUID taxonNodeUuid);
265

    
266
    public TaxonNodeDto dto(UUID taxonUuid, UUID classificationUuid);
267

    
268
    public <S extends TaxonNode> Pager<S> page(Class<S> clazz, List<Restriction<?>> restrictions, Integer pageSize, Integer pageIndex,
269
            List<OrderHint> orderHints, List<String> propertyPaths, boolean includeUnpublished);
270

    
271
	public List<TaxonNodeDto> taxonNodeDtoParentRank(Classification classification, Rank rank, TaxonName name);
272

    
273
	public List<TaxonNodeDto> taxonNodeDtoParentRank(Classification classification, Rank rank, TaxonBase<?> taxonBase);
274

    
275
    public List<TaxonDistributionDTO> getTaxonDistributionDTO(List<UUID> nodeUuids, List<String> propertyPaths,
276
            Authentication authentication, boolean openChildren, TaxonNodeSortMode sortMode);
277

    
278
    public List<TaxonDistributionDTO> getTaxonDistributionDTO(List<UUID> nodeUuids, List<String> propertyPaths, boolean openChildren);
279

    
280
    /**
281
     * Clones a subtree including all taxa and taxon nodes.
282

    
283
     * @param config the configurator for the cloning
284
     */
285
    public UpdateResult cloneSubtree(SubtreeCloneConfigurator config);
286

    
287
    public HomotypicGroupDto getHomotypicGroupDto(UUID homotypicGroupUuid, UUID nodeUuid);
288

    
289
    /**
290
     * @param nodeUuids
291
     * @return
292
     */
293
    List<TaxonNodeDto> getTaxonNodeDtos(List<UUID> nodeUuids);
294

    
295
    /**
296
     * @param nodeUuid
297
     * @return
298
     */
299
    TaxonNodeDto getTaxonNodeDto(UUID nodeUuid);
300

    
301

    
302
}
(55-55/95)