2 * Copyright (C) 2007 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
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.
10 package eu
.etaxonomy
.cdm
.api
.service
;
12 import java
.util
.Collection
;
13 import java
.util
.List
;
15 import java
.util
.UUID
;
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
.model
.common
.MarkerType
;
23 import eu
.etaxonomy
.cdm
.model
.media
.MediaRepresentation
;
24 import eu
.etaxonomy
.cdm
.model
.name
.Rank
;
25 import eu
.etaxonomy
.cdm
.model
.reference
.Reference
;
26 import eu
.etaxonomy
.cdm
.model
.taxon
.Classification
;
27 import eu
.etaxonomy
.cdm
.model
.taxon
.ITaxonTreeNode
;
28 import eu
.etaxonomy
.cdm
.model
.taxon
.Taxon
;
29 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonNode
;
30 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonRelationshipType
;
31 import eu
.etaxonomy
.cdm
.persistence
.dto
.ClassificationLookupDTO
;
32 import eu
.etaxonomy
.cdm
.persistence
.dto
.UuidAndTitleCache
;
33 import eu
.etaxonomy
.cdm
.persistence
.query
.OrderHint
;
40 public interface IClassificationService
extends IIdentifiableEntityService
<Classification
> {
47 public TaxonNode
getTaxonNodeByUuid(UUID uuid
);
54 public ITaxonTreeNode
getTreeNodeByUuid(UUID uuid
);
58 * Returns the root node of the the given classification (specified by its UUID)
59 * @param classificationUuid the uuid of the classification
60 * @return the root node of the classification
62 public TaxonNode
getRootNode(UUID classificationUuid
);
64 public UUID
getTaxonNodeUuidByTaxonUuid(UUID classificationUuid
, UUID taxonUuid
);
67 * Clones an existing classification including all taxa and taxon nodes.
70 * @param relationshipType
73 public UpdateResult
cloneClassification(UUID classificationUuid
, String name
, Reference sec
, TaxonRelationshipType relationshipType
);
80 * @param propertyPaths
83 public List
<Classification
> listClassifications(Integer limit
, Integer start
, List
<OrderHint
> orderHints
, List
<String
> propertyPaths
);
88 * @param classificationUuid
89 * @param propertyPaths
91 * @deprecated use loadTaxonNode(TaxonNode taxonNode, ...) instead
92 * if you have a classification and a taxon that is in it, you should also have the according taxonNode
95 public TaxonNode
loadTaxonNodeByTaxon(Taxon taxon
, UUID classificationUuid
, List
<String
> propertyPaths
);
100 * @param propertyPaths
102 * @deprecated use TaxonNodeService instead
105 public TaxonNode
loadTaxonNode(TaxonNode taxonNode
, List
<String
> propertyPaths
);
108 * Loads all TaxonNodes of the specified classification for a given Rank or lower.
109 * If a branch of the classification tree is not containing a TaxonNode with a Taxon at the given
110 * Rank the according node associated with the next lower Rank is taken as root node in this case.
111 * So the nodes returned may reference Taxa with different Ranks.
113 * If the <code>rank</code> is null the absolute root nodes will be returned.
115 * @param classification may be null for all classifications
116 * @param rank the set to null for to get the root nodes of classifications
117 * @param pageSize The maximum number of relationships returned (can be null for all relationships)
118 * @param pageIndex The offset (in pageSize chunks) from the start of the result set (0 - based)
119 * @param propertyPaths
123 public List
<TaxonNode
> listRankSpecificRootNodes(Classification classification
, Rank rank
, Integer pageSize
, Integer pageIndex
, List
<String
> propertyPaths
);
127 * Loads all TaxonNodes of the specified classification for a given Rank or lower.
128 * If a branch of the classification tree is not containing a TaxonNode with a Taxon at the given
129 * Rank the according node associated with the next lower Rank is taken as root node in this case.
130 * So the nodes returned may reference Taxa with different Ranks.
132 * If the <code>rank</code> is null the absolute root nodes will be returned.
134 * @param classification may be null for all classifications
135 * @param rank the set to null for to get the root nodes of classifications
136 * @param pageSize The maximum number of relationships returned (can be null for all relationships)
137 * @param pageIndex The offset (in pageSize chunks) from the start of the result set (0 - based)
138 * @param propertyPaths
142 public Pager
<TaxonNode
> pageRankSpecificRootNodes(Classification classification
, Rank rank
, Integer pageSize
, Integer pageIndex
, List
<String
> propertyPaths
);
147 * specifies the root level of the classification, may be null.
148 * Nodes of this rank or in case this rank does not exist in the
149 * current branch the next lower rank is taken as root node for
150 * this rank henceforth called the <b>base node</b>.
151 * @param propertyPaths
152 * the initialization strategy for the returned TaxonNode
154 * @return the path of nodes from the <b>base node</b> to the node of the
157 public List
<TaxonNode
> loadTreeBranch(TaxonNode taxonNode
, Rank baseRank
, List
<String
> propertyPaths
);
160 * Although this method seems to be a redundant alternative to {@link #loadChildNodesOfTaxonNode(TaxonNode, List)} it is an important
161 * alternative from which web services benefit. Without this method the web service controller method, which operates outside of the
162 * transaction, would have to initialize the full taxon tree with all nodes of the taxon.
163 * This would be rather slow compared to using this method.
165 * @param classification
166 * the classification to be used
168 * specifies the root level of the classification, may be null.
169 * Nodes of this rank or in case this rank does not exist in the
170 * current branch the next lower rank is taken as as root node for
171 * this rank henceforth called the <b>base node</b>.
172 * @param propertyPaths
173 * the initialization strategy for the returned TaxonNode
175 * @return the path of nodes from the <b>base node</b> to the node of the specified
178 public List
<TaxonNode
> loadTreeBranchToTaxon(Taxon taxon
, Classification classification
, Rank baseRank
, List
<String
> propertyPaths
);
180 public List
<TaxonNode
> listChildNodesOfTaxon(UUID taxonUuid
, UUID classificationUuid
, boolean includeUnpublished
,
181 Integer pageSize
, Integer pageIndex
, List
<String
> propertyPaths
);
185 * @param propertyPaths
186 * @deprecated move to TaxonNodeService
190 public List
<TaxonNode
> loadChildNodesOfTaxonNode(TaxonNode taxonNode
, List
<String
> propertyPaths
);
194 * @param classification
197 public List
<UuidAndTitleCache
<TaxonNode
>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(Classification classification
);
199 public Map
<UUID
, List
<MediaRepresentation
>> getAllMediaForChildNodes(TaxonNode taxonNode
, List
<String
> propertyPaths
, int size
, int height
, int widthOrDuration
, String
[] mimeTypes
);
205 * @deprecated use TaxonNodeService instead
208 public UUID
removeTaxonNode(TaxonNode taxonNode
);
214 * @deprecated use TaxonNodeService instead
217 public UUID
saveTaxonNode(TaxonNode taxonNode
);
221 * @param taxonNodeCollection
223 * @deprecated use TaxonNodeService instead
226 public Map
<UUID
, TaxonNode
> saveTaxonNodeAll(Collection
<TaxonNode
> taxonNodeCollection
);
228 public UUID
removeTreeNode(ITaxonTreeNode treeNode
);
230 public UUID
saveTreeNode(ITaxonTreeNode treeNode
);
232 public List
<TaxonNode
> getAllNodes();
234 public UpdateResult
createHierarchyInClassification(Classification classification
, CreateHierarchyForClassificationConfigurator configurator
);
236 public List
<UuidAndTitleCache
<TaxonNode
>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(UUID classificationUuid
);
238 public List
<UuidAndTitleCache
<TaxonNode
>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(
239 UUID classificationUuid
, Integer limit
, String pattern
);
241 public List
<UuidAndTitleCache
<TaxonNode
>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(
242 Classification classification
, Integer limit
, String pattern
);
244 public List
<TaxonNode
> listSiblingsOfTaxon(UUID taxonUuid
, UUID classificationUuid
, Integer pageSize
, Integer pageIndex
,
245 List
<String
> propertyPaths
);
247 public Pager
<TaxonNode
> pageSiblingsOfTaxon(UUID taxonUuid
, UUID classificationUuid
, Integer pageSize
, Integer pageIndex
,
248 List
<String
> propertyPaths
);
250 public ClassificationLookupDTO
classificationLookup(Classification classification
);
252 public DeleteResult
delete(UUID classificationUuid
, TaxonDeletionConfigurator config
);
255 * Returns the higher taxon id for each taxon in taxonUuids.
256 * The highter taxon is defined by rank where the lowest rank equal or above minRank
257 * is taken. If maxRank <> null and no taxon exists with minRank <= rank <= maxRank
258 * no higher taxon is returned for this taxon.
265 public List
<GroupedTaxonDTO
> groupTaxaByHigherTaxon(List
<UUID
> taxonUuids
, UUID classificationUuid
, Rank minRank
, Rank maxRank
);
269 * @param classificationUuid
274 public List
<GroupedTaxonDTO
> groupTaxaByMarkedParents(List
<UUID
> taxonUuids
, UUID classificationUuid
,
275 MarkerType markerType
, Boolean value
);
279 * Returns the most relevant data of a taxon/taxon node, including children, synonyms
280 * and certain ancestors if required.
281 * @param classificationUuid
284 * @param includeUnpublished
285 * @param ancestorMarkers
288 public TaxonInContextDTO
getTaxonInContext(UUID classificationUuid
, UUID taxonUuid
,
289 Boolean doChildren
, Boolean doSynonyms
, boolean includeUnpublished
, List
<UUID
> ancestorMarkers
,
290 NodeSortMode sortMode
);
293 * @param classification
296 public UUID
saveClassification(Classification classification
);
299 * @param classificationUuid
302 * @param searchForClassifications
305 public List
<UuidAndTitleCache
<TaxonNode
>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(
306 UUID classificationUuid
, Integer limit
, String pattern
, boolean searchForClassifications
);
309 * @param classification
312 * @param searchForClassifications
315 public List
<UuidAndTitleCache
<TaxonNode
>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(
316 Classification classification
, Integer limit
, String pattern
, boolean searchForClassifications
);
319 * @param classificationUuid
320 * @param searchForClassifications
323 public List
<UuidAndTitleCache
<TaxonNode
>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(
324 UUID classificationUuid
, boolean searchForClassifications
);
327 * @param classification
328 * @param searchForClassifications
331 public List
<UuidAndTitleCache
<TaxonNode
>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(
332 Classification classification
, boolean searchForClassifications
);