Project

General

Profile

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

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

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

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

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

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

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

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

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

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

    
124
    public TaxonNodeDto parentDto(UUID taxonNodeUuid);
125

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
224

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

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

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

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

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

    
247

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

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

    
261
    public TaxonNodeDto dto(UUID taxonNodeUuid);
262

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

    
267
    public UpdateResult saveNewTaxonNode(TaxonNode newTaxonNode);
268

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

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

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

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

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

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

    
284
     * @param config the configurator for the cloning
285
     */
286
    public UpdateResult cloneSubtree(SubtreeCloneConfigurator config);
287
}
(59-59/100)