Project

General

Profile

Download (16.6 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.UUID;
16

    
17
import eu.etaxonomy.cdm.api.service.config.CreateHierarchyForClassificationConfigurator;
18
import eu.etaxonomy.cdm.api.service.config.TaxonDeletionConfigurator;
19
import eu.etaxonomy.cdm.api.service.dto.GroupedTaxonDTO;
20
import eu.etaxonomy.cdm.api.service.dto.TaxonInContextDTO;
21
import eu.etaxonomy.cdm.api.service.pager.Pager;
22
import eu.etaxonomy.cdm.exception.FilterException;
23
import eu.etaxonomy.cdm.exception.UnpublishedException;
24
import eu.etaxonomy.cdm.model.common.MarkerType;
25
import eu.etaxonomy.cdm.model.media.MediaRepresentation;
26
import eu.etaxonomy.cdm.model.name.Rank;
27
import eu.etaxonomy.cdm.model.taxon.Classification;
28
import eu.etaxonomy.cdm.model.taxon.ITaxonTreeNode;
29
import eu.etaxonomy.cdm.model.taxon.Taxon;
30
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
31
import eu.etaxonomy.cdm.persistence.dto.ClassificationLookupDTO;
32
import eu.etaxonomy.cdm.persistence.dto.TaxonNodeDto;
33
import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache;
34
import eu.etaxonomy.cdm.persistence.query.OrderHint;
35

    
36

    
37
/**
38
 * @author n.hoffmann
39
 * @since Sep 21, 2009
40
 */
41
public interface IClassificationService extends IIdentifiableEntityService<Classification> {
42

    
43
    public ITaxonTreeNode getTreeNodeByUuid(UUID uuid);
44

    
45
    /**
46
     * Returns the root node of the the given classification (specified by its UUID)
47
     * @param classificationUuid the uuid of the classification
48
     * @return the root node of the classification
49
     */
50
    public TaxonNode getRootNode(UUID classificationUuid);
51

    
52
    public UUID getTaxonNodeUuidByTaxonUuid(UUID classificationUuid, UUID taxonUuid);
53

    
54
    public List<Classification> listClassifications(Integer limit, Integer start, List<OrderHint> orderHints, List<String> propertyPaths);
55

    
56
    /**
57
     *
58
     * @param taxon
59
     * @param classificationUuid
60
     * @param propertyPaths
61
     * @return
62
     * @deprecated use loadTaxonNode(TaxonNode taxonNode, ...) instead
63
     * if you have a classification and a taxon that is in it, you should also have the according taxonNode
64
     */
65
    @Deprecated
66
    public TaxonNode loadTaxonNodeByTaxon(Taxon taxon, UUID classificationUuid, List<String> propertyPaths);
67

    
68
    /**
69
     * Loads all TaxonNodes of the specified classification for a given Rank or lower.
70
     * If a branch of the classification tree is not containing a TaxonNode with a Taxon at the given
71
     * Rank the according node associated with the next lower Rank is taken as root node in this case.
72
     * So the nodes returned may reference Taxa with different Ranks.
73
     *
74
     * If the <code>rank</code> is null the absolute root nodes will be returned.
75

    
76
     * @param classification may be null for all classifications
77
     * @param subtree filter on a taxonomic subtree
78
     * @param rank the set to null for to get the root nodes of classifications
79
     * @param includeUnpublished if <code>true</code> unpublished taxa are also exported
80
     * @param pageSize The maximum number of relationships returned (can be null for all relationships)
81
     * @param pageIndex The offset (in pageSize chunks) from the start of the result set (0 - based)
82
     * @param propertyPaths
83
     * @return
84
     * @see #pageRankSpecificRootNodes(Classification, TaxonNode, Rank, boolean, Integer, Integer, List)
85
     * @deprecated use according DTO method instead
86
     */
87
    @Deprecated
88
    public List<TaxonNode> listRankSpecificRootNodes(Classification classification, TaxonNode subtree,
89
            Rank rank, boolean includeUnpublished, Integer pageSize, Integer pageIndex,
90
            List<String> propertyPaths);
91

    
92
    /**
93
     * Loads all TaxonNodes of the specified classification for a given Rank or lower.
94
     * If a branch of the classification tree is not containing a TaxonNode with a Taxon at the given
95
     * Rank the according node associated with the next lower Rank is taken as root node in this case.
96
     * So the nodes returned may reference Taxa with different Ranks.
97
     *
98
     * If the <code>rank</code> is null the absolute root nodes will be returned.
99

    
100
     * @param classification may be null for all classifications
101
     * @param subtree filter on a taxonomic subtree
102
     * @param rank the set to null for to get the root nodes of classifications
103
     * @param includeUnpublished if <code>true</code> unpublished taxa are also exported
104
     * @param pageSize The maximum number of relationships returned (can be null for all relationships)
105
     * @param pageIndex The offset (in pageSize chunks) from the start of the result set (0 - based)
106
     * @param propertyPaths
107
     * @return
108
     * @see #pageRankSpecificRootNodes(Classification, TaxonNode, Rank, boolean, Integer, Integer, List)
109
     *
110
     */
111
    public List<TaxonNodeDto> listRankSpecificRootNodeDtos(Classification classification, TaxonNode subtree,
112
            Rank rank, boolean includeUnpublished, Integer pageSize, Integer pageIndex, TaxonNodeDtoSortMode sortMode,
113
            List<String> propertyPaths);
114

    
115

    
116
    /**
117
     * Loads all TaxonNodes of the specified classification for a given Rank or lower.
118
     * If a branch of the classification tree is not containing a TaxonNode with a Taxon at the given
119
     * Rank the according node associated with the next lower Rank is taken as root node in this case.
120
     * So the nodes returned may reference Taxa with different Ranks.
121
     *
122
     * If the <code>rank</code> is null the absolute root nodes will be returned.
123
     *
124
     * @param classification may be null for all classifications
125
     * @param subtree the taxonomic subtree filter
126
     * @param rank the set to null for to get the root nodes of classifications
127
     * @param includeUnpublished if <code>true</code> unpublished taxa are also exported
128
     * @param pageSize The maximum number of relationships returned (can be null for all relationships)
129
     * @param pageIndex The offset (in pageSize chunks) from the start of the result set (0 - based)
130
     * @param propertyPaths
131
     * @return
132
     *
133
     * @see #listRankSpecificRootNodes(Classification, TaxonNode, Rank, boolean, Integer, Integer, List)
134
     */
135
    public Pager<TaxonNode> pageRankSpecificRootNodes(Classification classification, TaxonNode subtree,
136
            Rank rank, boolean includeUnpublished, Integer pageSize, Integer pageIndex,
137
            List<String> propertyPaths);
138
    /**
139
     * @see #pageRankSpecificRootNodes(Classification, TaxonNode, Rank, boolean, Integer, Integer, List)
140
     * @deprecated keep this for compatibility to older versions, might be removed in versions >5.3
141
     */
142
    @Deprecated
143
    public Pager<TaxonNode> pageRankSpecificRootNodes(Classification classification,
144
            Rank rank, boolean includeUnpublished, Integer pageSize, Integer pageIndex,
145
            List<String> propertyPaths);
146

    
147
    /**
148
     * @param taxonNode
149
     * @param baseRank
150
     *            specifies the root level of the classification, may be null.
151
     *            Nodes of this rank or in case this rank does not exist in the
152
     *            current branch the next lower rank is taken as root node for
153
     *            this rank henceforth called the <b>base node</b>.
154
     * @param propertyPaths
155
     *            the initialization strategy for the returned TaxonNode
156
     *            instances.
157
     * @param includeUnpublished
158
     *            if <code>true</code> no {@link UnpublishedException}
159
     *            is thrown if any of the taxa in the branch are unpublished
160
     * @return the path of nodes from the <b>base node</b> to the node of the
161
     *            specified taxon.
162
     * @throws UnpublishedException
163
     *            if any of the taxa in the path is unpublished an {@link UnpublishedException} is thrown.
164
     */
165
    public List<TaxonNode> loadTreeBranch(TaxonNode taxonNode, TaxonNode subtree, Rank baseRank, boolean includeUnpublished,
166
            List<String> propertyPaths) throws UnpublishedException;
167
    public List<TaxonNode> loadTreeBranch(TaxonNode taxonNode, Rank baseRank, boolean includeUnpublished,
168
            List<String> propertyPaths) throws UnpublishedException;
169

    
170
    /**
171
     * Although this method seems to be a redundant alternative to {@link #loadChildNodesOfTaxonNode(TaxonNode, List)} it is an important
172
     * alternative from which web services benefit. Without this method the web service controller method, which operates outside of the
173
     * transaction, would have to initialize the full taxon tree with all nodes of the taxon.
174
     * This would be rather slow compared to using this method.
175
     * @param taxon
176
     * @param classification
177
     *            the classification to be used
178
     * @param baseRank
179
     *            specifies the root level of the classification, may be null.
180
     *            Nodes of this rank or in case this rank does not exist in the
181
     *            current branch the next lower rank is taken as as root node for
182
     *            this rank henceforth called the <b>base node</b>.
183
     * @param includeUnpublished
184
     *            if <code>true</code> no {@link UnpublishedException}
185
     *            is thrown if any of the taxa in the branch are unpublished
186
     * @param propertyPaths
187
     *            the initialization strategy for the returned TaxonNode
188
     *            instances.
189
     * @return the path of nodes from the <b>base node</b> to the node of the specified
190
     *            taxon.
191
     * @throws UnpublishedException
192
     *            if any of the taxa in the path is unpublished an {@link UnpublishedException} is thrown
193
     */
194
    public List<TaxonNode> loadTreeBranchToTaxon(Taxon taxon, Classification classification,
195
            TaxonNode subtree, Rank baseRank,
196
            boolean includeUnpublished, List<String> propertyPaths) throws UnpublishedException;
197

    
198
    /**
199
     * Although this method seems to be a redundant alternative to {@link #loadChildNodesOfTaxonNode(TaxonNode, List)} it is an important
200
     * alternative from which web services benefit. Without this method the web service controller method, which operates outside of the
201
     * transaction, would have to initialize the full taxon tree with all nodes of the taxon.
202
     * This would be rather slow compared to using this method.
203
     * @param taxon
204
     * @param classification
205
     *            the classification to be used
206
     * @param baseRank
207
     *            specifies the root level of the classification, may be null.
208
     *            Nodes of this rank or in case this rank does not exist in the
209
     *            current branch the next lower rank is taken as as root node for
210
     *            this rank henceforth called the <b>base node</b>.
211
     * @param includeUnpublished
212
     *            if <code>true</code> no {@link UnpublishedException}
213
     *            is thrown if any of the taxa in the branch are unpublished
214
     * @param propertyPaths
215
     *            the initialization strategy for the returned TaxonNode
216
     *            instances.
217
     * @return the path of nodes from the <b>base node</b> to the node of the specified
218
     *            taxon.
219
     * @throws UnpublishedException
220
     *            if any of the taxa in the path is unpublished an {@link UnpublishedException} is thrown
221
     */
222
    public List<TaxonNodeDto> loadTreeBranchDTOsToTaxon(Taxon taxon, Classification classification,
223
            TaxonNode subtree, Rank baseRank,
224
            boolean includeUnpublished, List<String> propertyPaths) throws UnpublishedException;
225

    
226
    public List<TaxonNode> loadTreeBranchToTaxon(Taxon taxon, Classification classification,
227
            Rank baseRank,
228
            boolean includeUnpublished, List<String> propertyPaths) throws UnpublishedException;
229

    
230
    public List<TaxonNode> listChildNodesOfTaxon(UUID taxonUuid, UUID classificationUuid, boolean includeUnpublished,
231
            Integer pageSize, Integer pageIndex, List<String> propertyPaths);
232

    
233
    public List<TaxonNode> listChildNodesOfTaxon(UUID taxonUuid, UUID classificationUuid, UUID subtreeUuid, boolean includeUnpublished,
234
            Integer pageSize, Integer pageIndex, List<String> propertyPaths) throws FilterException;
235

    
236
    public List<TaxonNodeDto> listChildNodeDtosOfTaxon(UUID taxonUuid, UUID classificationUuid, UUID subtreeUuid, boolean includeUnpublished,
237
            Integer pageSize, Integer pageIndex, TaxonNodeDtoSortMode comparator, List<String> propertyPaths) throws FilterException;
238

    
239
    /**
240
     * @param taxonNode
241
     * @param propertyPaths
242
     * @deprecated move to TaxonNodeService
243
     * @return
244
     */
245
    @Deprecated
246
    public List<TaxonNode> loadChildNodesOfTaxonNode(TaxonNode taxonNode, List<String> propertyPaths);
247

    
248
    public List<UuidAndTitleCache<TaxonNode>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(Classification classification);
249

    
250
    public Map<UUID, List<MediaRepresentation>> getAllMediaForChildNodes(TaxonNode taxonNode, List<String> propertyPaths, int size, int height, int widthOrDuration, String[] mimeTypes);
251

    
252
    /**
253
     * @param taxonNodeCollection
254
     * @return
255
     * @deprecated use TaxonNodeService instead
256
     */
257
    @Deprecated
258
    public Map<UUID, TaxonNode> saveTaxonNodeAll(Collection<TaxonNode> taxonNodeCollection);
259

    
260
    public UUID removeTreeNode(ITaxonTreeNode treeNode);
261

    
262
    public UUID saveTreeNode(ITaxonTreeNode treeNode);
263

    
264
    public List<TaxonNode> getAllNodes();
265

    
266
	public UpdateResult createHierarchyInClassification(Classification classification, CreateHierarchyForClassificationConfigurator configurator);
267

    
268
    public List<UuidAndTitleCache<TaxonNode>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(UUID classificationUuid);
269

    
270
    public List<UuidAndTitleCache<TaxonNode>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(
271
            UUID classificationUuid, Integer limit, String pattern);
272

    
273
    public List<UuidAndTitleCache<TaxonNode>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(
274
            Classification classification, Integer limit, String pattern);
275

    
276
    public List<TaxonNode> listSiblingsOfTaxon(UUID taxonUuid, UUID classificationUuid, boolean includeUnpublished,
277
            Integer pageSize, Integer pageIndex, List<String> propertyPaths);
278

    
279
    public Pager<TaxonNode> pageSiblingsOfTaxon(UUID taxonUuid, UUID classificationUuid, boolean includeUnpublished, Integer pageSize, Integer pageIndex,
280
            List<String> propertyPaths);
281

    
282
    public ClassificationLookupDTO classificationLookup(Classification classification);
283

    
284
    public DeleteResult delete(UUID classificationUuid, TaxonDeletionConfigurator config);
285

    
286
    /**
287
     * Returns the higher taxon id for each taxon in taxonUuids.
288
     * The highter taxon is defined by rank where the lowest rank equal or above minRank
289
     * is taken. If maxRank <> null and no taxon exists with minRank <= rank <= maxRank
290
     * no higher taxon is returned for this taxon.
291
     */
292
    public List<GroupedTaxonDTO> groupTaxaByHigherTaxon(List<UUID> taxonUuids, UUID classificationUuid, Rank minRank, Rank maxRank);
293

    
294
    public List<GroupedTaxonDTO> groupTaxaByMarkedParents(List<UUID> taxonUuids, UUID classificationUuid,
295
            MarkerType markerType, Boolean value);
296

    
297
    /**
298
     * Returns the most relevant data of a taxon/taxon node, including children, synonyms
299
     * and certain ancestors if required.
300
     */
301
    public TaxonInContextDTO getTaxonInContext(UUID classificationUuid, UUID taxonUuid,
302
            Boolean doChildren, Boolean doSynonyms, boolean includeUnpublished, List<UUID> ancestorMarkers,
303
            TaxonNodeSortMode sortMode);
304

    
305
    public UUID saveClassification(Classification classification);
306

    
307
    public List<UuidAndTitleCache<TaxonNode>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(
308
            UUID classificationUuid, Integer limit, String pattern, boolean searchForClassifications);
309

    
310
    public List<UuidAndTitleCache<TaxonNode>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(
311
            Classification classification, Integer limit, String pattern, boolean searchForClassifications);
312

    
313
    public List<UuidAndTitleCache<TaxonNode>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(
314
            UUID classificationUuid, boolean searchForClassifications);
315

    
316
    public List<UuidAndTitleCache<TaxonNode>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(
317
            Classification classification, boolean searchForClassifications);
318

    
319
    List<UuidAndTitleCache<TaxonNode>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(
320
            UUID classificationUuid, Integer limit, String pattern, boolean searchForClassifications,
321
            boolean includeDoubtful);
322

    
323
}
(26-26/100)