Project

General

Profile

Download (11.9 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.TaxonDeletionConfigurator;
23
import eu.etaxonomy.cdm.api.service.dto.CreateTaxonDTO;
24
import eu.etaxonomy.cdm.api.service.dto.TaxonDistributionDTO;
25
import eu.etaxonomy.cdm.api.service.pager.Pager;
26
import eu.etaxonomy.cdm.common.monitor.IProgressMonitor;
27
import eu.etaxonomy.cdm.filter.TaxonNodeFilter;
28
import eu.etaxonomy.cdm.model.common.Language;
29
import eu.etaxonomy.cdm.model.common.LanguageString;
30
import eu.etaxonomy.cdm.model.name.Rank;
31
import eu.etaxonomy.cdm.model.name.TaxonName;
32
import eu.etaxonomy.cdm.model.reference.Reference;
33
import eu.etaxonomy.cdm.model.taxon.Classification;
34
import eu.etaxonomy.cdm.model.taxon.ITaxonTreeNode;
35
import eu.etaxonomy.cdm.model.taxon.SynonymType;
36
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
37
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
38
import eu.etaxonomy.cdm.model.taxon.TaxonNodeAgentRelation;
39
import eu.etaxonomy.cdm.model.taxon.TaxonNodeStatus;
40
import eu.etaxonomy.cdm.model.term.DefinedTerm;
41
import eu.etaxonomy.cdm.persistence.dao.common.Restriction;
42
import eu.etaxonomy.cdm.persistence.dto.TaxonNodeDto;
43
import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache;
44
import eu.etaxonomy.cdm.persistence.query.OrderHint;
45

    
46
/**
47
 * @author n.hoffmann
48
 * @since Apr 9, 2010
49
 */
50
public interface ITaxonNodeService extends IAnnotatableService<TaxonNode>{
51

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

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

    
71
    public List<TaxonNode> listChildrenOf(TaxonNode node, Integer pageSize, Integer pageIndex,
72
            boolean recursive, boolean includeUnpublished, List<String> propertyPaths);
73

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

    
84
    /**
85
     * Retrieves the parent node of the child {@link TaxonNode}
86
     * @param child the child for which the parent should be retrieved
87
     * @return the parent taxon node
88
     */
89
	public TaxonNodeDto getParentUuidAndTitleCache(ITaxonTreeNode child);
90

    
91
	/**
92
     * Retrieves the parent node of the {@link TaxonNode} represented by the given {@link UuidAndTitleCache}.
93
     * @param child the child for which the parent should be retrieved
94
     * @return an UuidAndTitleCache object representing the parent node
95
     */
96
	public TaxonNodeDto getParentUuidAndTitleCache(TaxonNodeDto child);
97

    
98
//	/**
99
//     * Lists all direct child nodes of the given {@link ITaxonTreeNode}
100
//     * @param parent the parent ITaxonTreeNode
101
//     * @return a list of UuidAndTitleCache objects that represent children of the
102
//     * parent
103
//     */
104
//	public List<UuidAndTitleCache<TaxonNode>> listChildNodesAsUuidAndTitleCache(ITaxonTreeNode parent);
105

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

    
122
    public TaxonNodeDto parentDto(UUID taxonNodeUuid);
123

    
124
	/**
125
	 * Changes the taxon associated with the given taxon node into a synonym of the new accepted taxon node.
126
	 * All data associated with the former taxon are moved to the newly accepted taxon.
127
	 */
128
	public DeleteResult makeTaxonNodeASynonymOfAnotherTaxonNode(TaxonNode oldTaxonNode, TaxonNode newAcceptedTaxonNode, SynonymType synonymType, Reference citation, String citationMicroReference, boolean setNameInSource) ;
129

    
130
	/**
131
	 * Changes the taxa associated with the given taxon nodes into synonyms of the new accepted taxon node.
132
	 * All data associated with the former taxa are moved to the newly accepted taxon.
133
	 */
134
	public UpdateResult makeTaxonNodeSynonymsOfAnotherTaxonNode(Set<UUID> oldTaxonNodeUuids, UUID newAcceptedTaxonNodeUUIDs,
135
			SynonymType synonymType, Reference citation, String citationMicroReference, boolean setNameInSource);
136

    
137
	public UpdateResult makeTaxonNodeASynonymOfAnotherTaxonNode(UUID oldTaxonNodeUuid,
138
	        UUID newAcceptedTaxonNodeUUID,
139
	        SynonymType synonymType,
140
	        Reference citation,
141
	        String citationMicroReference,
142
	        boolean setNameInSource) ;
143

    
144
    public DeleteResult deleteTaxonNodes(Collection<UUID> nodeUuids, TaxonDeletionConfigurator config);
145

    
146
	/**
147
	 * deletes the given taxon node the configurator defines whether the children will be deleted too or not
148
	 */
149
	public DeleteResult deleteTaxonNode(TaxonNode node, TaxonDeletionConfigurator config);
150

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

    
160
    /**
161
     * @param nodeUuid
162
     * @param config
163
     * @return
164
     */
165
    public DeleteResult deleteTaxonNode(UUID nodeUuid, TaxonDeletionConfigurator config);
166

    
167
	public List<TaxonNode> listAllNodesForClassification(Classification classification, Integer start, Integer end);
168

    
169
	/**
170
	 * Counts all TaxonNodes for a given Classification
171
	 *
172
	 * @param classification - according to the given classification the TaxonNodes are filtered.
173
	 * @return the count result
174
	 */
175
	public int countAllNodesForClassification(Classification classification);
176

    
177
    public UpdateResult moveTaxonNode(UUID taxonNodeUuid, UUID newParentTaxonNodeUuid, int movingType);
178

    
179
    public UpdateResult moveTaxonNode(TaxonNode taxonNode, TaxonNode newParent, int movingType);
180

    
181
    public UpdateResult moveTaxonNodes(Set<UUID> taxonNodeUuids, UUID newParentNodeUuid, int movingType,
182
            IProgressMonitor monitor);
183

    
184
    /**
185
     * deletes the given taxon nodes
186
     */
187
    public DeleteResult deleteTaxonNodes(List<TaxonNode> list, TaxonDeletionConfigurator config);
188

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

    
203
    public UpdateResult createNewTaxonNode(UUID parentNodeUuid, CreateTaxonDTO taxonDto, UUID refUuid, String microref,
204
            TaxonNodeStatus status, Map<Language,LanguageString> statusNote);
205

    
206
    public UpdateResult addTaxonNodeAgentRelation(UUID taxonNodeUUID, UUID agentUUID, DefinedTerm relationshipType);
207

    
208
    /**
209
     * Creates a new taxon node for the given existing taxon with the given existing parent taxon node.
210
     */
211
    public UpdateResult createNewTaxonNode(UUID parentNodeUuid, UUID taxonUuid, UUID refUuid, String microref);
212

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

    
222

    
223
    /**
224
     * Sets the publish flag for all taxa and/or synonyms of the subtree.
225
     */
226
    public UpdateResult setPublishForSubtree(PublishForSubtreeConfigurator configurator);
227

    
228
    /**
229
     * Returns a list of taxon node {@link UUID uuids} according to the given filter.
230
     */
231
    public long count(TaxonNodeFilter filter);
232

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

    
238
    /**
239
     * Returns a list of taxon node IDs according to the given filter.
240
     */
241
    public List<Integer> idList(TaxonNodeFilter filter);
242

    
243
    public List<TaxonNodeDto> listChildNodesAsTaxonNodeDto(TaxonNodeDto parent);
244

    
245

    
246
    public List<TaxonNodeDto> listChildNodesAsTaxonNodeDto(ITaxonTreeNode parent);
247

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

    
259
    public TaxonNodeDto dto(UUID taxonNodeUuid);
260

    
261
//    public List<TaxonDistributionDTO> getTaxonDistributionDTOForSubtree(UUID parentNodeUuid, List<String> propertyPaths, Authentication authentication, boolean openChildren);
262
//
263
//    public List<TaxonDistributionDTO> getTaxonDistributionDTOForSubtree(UUID parentNodeUuid, List<String> propertyPaths, boolean openChildren);
264

    
265
    public UpdateResult saveNewTaxonNode(TaxonNode newTaxonNode);
266

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

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

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

    
274
    /**
275
     * @param nodeUuids
276
     * @param propertyPaths
277
     * @param authentication
278
     * @param openChildren
279
     * @return
280
     */
281
    List<TaxonDistributionDTO> getTaxonDistributionDTO(List<UUID> nodeUuids, List<String> propertyPaths,
282
            Authentication authentication, boolean openChildren);
283

    
284
    /**
285
     * @param nodeUuids
286
     * @param propertyPaths
287
     * @return
288
     */
289
    List<TaxonDistributionDTO> getTaxonDistributionDTO(List<UUID> nodeUuids, List<String> propertyPaths, boolean openChildren);
290
}
(59-59/100)