Project

General

Profile

Download (12 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.description.DescriptionElementSource;
31
import eu.etaxonomy.cdm.model.name.Rank;
32
import eu.etaxonomy.cdm.model.name.TaxonName;
33
import eu.etaxonomy.cdm.model.reference.Reference;
34
import eu.etaxonomy.cdm.model.taxon.Classification;
35
import eu.etaxonomy.cdm.model.taxon.ITaxonTreeNode;
36
import eu.etaxonomy.cdm.model.taxon.SynonymType;
37
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
38
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
39
import eu.etaxonomy.cdm.model.taxon.TaxonNodeAgentRelation;
40
import eu.etaxonomy.cdm.model.taxon.TaxonNodeStatus;
41
import eu.etaxonomy.cdm.model.term.DefinedTerm;
42
import eu.etaxonomy.cdm.persistence.dao.common.Restriction;
43
import eu.etaxonomy.cdm.persistence.dto.TaxonNodeDto;
44
import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache;
45
import eu.etaxonomy.cdm.persistence.query.OrderHint;
46

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

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

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

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

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

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

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

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

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

    
123
    public TaxonNodeDto parentDto(UUID taxonNodeUuid);
124

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
223

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

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

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

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

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

    
246

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

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

    
260
    public TaxonNodeDto dto(UUID taxonNodeUuid);
261

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

    
266
    public UpdateResult saveNewTaxonNode(TaxonNode newTaxonNode);
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
    /**
276
     * @param nodeUuids
277
     * @param propertyPaths
278
     * @param authentication
279
     * @param openChildren
280
     * @return
281
     */
282
    List<TaxonDistributionDTO> getTaxonDistributionDTO(List<UUID> nodeUuids, List<String> propertyPaths,
283
            Authentication authentication, boolean openChildren);
284

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