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
.persistence
.dao
.taxon
;
12 import java
.util
.Collection
;
13 import java
.util
.List
;
16 import java
.util
.UUID
;
18 import eu
.etaxonomy
.cdm
.common
.monitor
.IProgressMonitor
;
19 import eu
.etaxonomy
.cdm
.model
.common
.TreeIndex
;
20 import eu
.etaxonomy
.cdm
.model
.name
.Rank
;
21 import eu
.etaxonomy
.cdm
.model
.name
.TaxonName
;
22 import eu
.etaxonomy
.cdm
.model
.reference
.Reference
;
23 import eu
.etaxonomy
.cdm
.model
.taxon
.Classification
;
24 import eu
.etaxonomy
.cdm
.model
.taxon
.Taxon
;
25 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonBase
;
26 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonNode
;
27 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonNodeAgentRelation
;
28 import eu
.etaxonomy
.cdm
.persistence
.dao
.common
.IAnnotatableDao
;
29 import eu
.etaxonomy
.cdm
.persistence
.dao
.common
.Restriction
;
30 import eu
.etaxonomy
.cdm
.persistence
.dto
.TaxonNodeDto
;
31 import eu
.etaxonomy
.cdm
.persistence
.dto
.UuidAndTitleCache
;
32 import eu
.etaxonomy
.cdm
.persistence
.query
.OrderHint
;
38 public interface ITaxonNodeDao
extends IAnnotatableDao
<TaxonNode
> {
40 public UUID
delete(TaxonNode persistentObject
, boolean deleteChildren
);
46 public List
<TaxonNode
> getTaxonOfAcceptedTaxaByClassification(Classification classification
, Integer start
, Integer end
);
49 * @param classification
52 public int countTaxonOfAcceptedTaxaByClassification(Classification classification
);
55 * Lists all direct child nodes of the given {@link UuidAndTitleCache} which
56 * represents the parent {@link TaxonNode}
57 * @param parent a UuidAndTitleCache object which represents a parent {@link TaxonNode}
58 * @return a list of UuidAndTitleCache objects that represent children of the
61 public List
<UuidAndTitleCache
<TaxonNode
>> listChildNodesAsUuidAndTitleCache(UuidAndTitleCache
<TaxonNode
> parent
);
64 * Retrieves the parent node of the {@link TaxonNode} represented by the given {@link UuidAndTitleCache}.
65 * @param child the child for which the parent should be retrieved
66 * @return an UuidAndTitleCache object representing the parent node
68 public UuidAndTitleCache
<TaxonNode
> getParentUuidAndTitleCache(UuidAndTitleCache
<TaxonNode
> child
);
71 * Retrieves a list of {@link UuidAndTitleCache} objects that have a matching titleCache
72 * @param limit the maximum results
73 * @param pattern the titleCache that is searched for
74 * @param classificationUuid if specified only nodes of this classification are retrieved
75 * @return a list of matches
77 public List
<UuidAndTitleCache
<TaxonNode
>> getUuidAndTitleCache(Integer limit
, String pattern
, UUID classificationUuid
);
79 public List
<TaxonNode
> listChildrenOf(TaxonNode node
, Integer pageSize
, Integer pageIndex
,
80 boolean recursive
, boolean includeUnpublished
, List
<String
> propertyPaths
);
82 public abstract Long
countChildrenOf(TaxonNode node
, Classification classification
, boolean recursive
, boolean includeUnpublished
);
85 * Returns the of TaxonNodeAgentRelation entities which are associated with the TaxonNode for the
86 * given TaxonUuid in the specified Classification.
89 * @param agentUuid TODO
90 * @param relTypeUuid TODO
93 * @param propertyPaths
95 * @param classification
98 List
<TaxonNodeAgentRelation
> listTaxonNodeAgentRelations(UUID taxonUuid
, UUID classificationUuid
,
99 UUID agentUuid
, UUID rankUuid
, UUID relTypeUuid
, Integer start
, Integer limit
, List
<String
> propertyPaths
);
102 * Returns the number of TaxonNodeAgentRelation entities which are associated with the TaxonNode for the
103 * given TaxonUuid in the specified Classification.
106 * @param agentUuid TODO
107 * @param relTypeUuid TODO
109 * @param classification
112 long countTaxonNodeAgentRelations(UUID taxonUuid
, UUID classificationUuid
, UUID agentUuid
, UUID rankUuid
, UUID relTypeUuid
);
115 * Computes a map treeIndex->rank(sortIndex) for each given taxon node treeIndex. Required by #5957.
116 * If the taxon represented by the treeindex is not in the given rank range no record is returned for the given
119 * @param treeIndex the list of treeIndexes
120 * @param minRankOrderIndex min rank
121 * @param maxRankOrderIndex max rank
124 Map
<TreeIndex
, Integer
> rankOrderIndexForTreeIndex(List
<TreeIndex
> treeIndex
, Integer minRankOrderIndex
,
125 Integer maxRankOrderIndex
);
128 * For a given set of taxon node tree indexes the uuid and title cache of the taxon represented
129 * by this treeindex is returned.
130 * @param treeIndexSet set of taxon node tree indexes
131 * @return map with treeindex and uuidAndTitleCache of the represented taxon
133 public Map
<TreeIndex
, UuidAndTitleCache
<?
>> taxonUuidsForTreeIndexes(Collection
<TreeIndex
> treeIndexSet
);
138 * @param subTreeIndex
140 * @param overwriteExistingAccepted
141 * @param includeSharedTaxa
142 * @param emptySecundumDetail
145 public int countSecundumForSubtreeAcceptedTaxa(TreeIndex subTreeIndex
, Reference newSec
,
146 boolean overwriteExistingAccepted
, boolean includeSharedTaxa
, boolean emptySecundumDetail
);
149 * @param subTreeIndex
151 * @param overwriteExistingSynonyms
152 * @param includeSharedTaxa
153 * @param emptySecundumDetail
156 public int countSecundumForSubtreeSynonyms(TreeIndex subTreeIndex
, Reference newSec
,
157 boolean overwriteExistingSynonyms
, boolean includeSharedTaxa
, boolean emptySecundumDetail
);
160 * @param subTreeIndex
162 * @param overwriteExisting
163 * @param includeSharedTaxa
168 public Set
<TaxonBase
> setSecundumForSubtreeAcceptedTaxa(TreeIndex subTreeIndex
, Reference newSec
, boolean overwriteExisting
, boolean includeSharedTaxa
, boolean emptyDetail
, IProgressMonitor monitor
);
170 public Set
<TaxonBase
> setSecundumForSubtreeSynonyms(TreeIndex subTreeIndex
, Reference newSec
, boolean overwriteExisting
, boolean includeSharedTaxa
, boolean emptyDetail
, IProgressMonitor monitor
);
174 * @param subTreeIndex
175 * @param includeSharedTaxa
176 * @param includeSharedTaxa2
179 public int countPublishForSubtreeAcceptedTaxa(TreeIndex subTreeIndex
, boolean publish
,
180 boolean includeSharedTaxa
, boolean includeHybrids
);
181 public Set
<TaxonBase
> setPublishForSubtreeAcceptedTaxa(TreeIndex subTreeIndex
, boolean publish
,
182 boolean includeSharedTaxa
, boolean includeHybrids
, IProgressMonitor monitor
);
185 * @param subTreeIndex
186 * @param includeSharedTaxa
189 public int countPublishForSubtreeSynonyms(TreeIndex subTreeIndex
, boolean publish
,
190 boolean includeSharedTaxa
, boolean includeHybrids
);
191 public Set
<TaxonBase
> setPublishForSubtreeSynonyms(TreeIndex subTreeIndex
, boolean publish
,
192 boolean includeSharedTaxa
, boolean includeHybrids
, IProgressMonitor monitor
);
194 public int countPublishForSubtreeRelatedTaxa(TreeIndex subTreeIndex
, boolean publish
,
195 boolean includeSharedTaxa
, boolean includeHybrids
);
196 public Set
<TaxonBase
> setPublishForSubtreeRelatedTaxa(TreeIndex subTreeIndex
, boolean publish
,
197 Set
<UUID
> relationTypes
, boolean includeSharedTaxa
, boolean includeHybrids
,
198 IProgressMonitor monitor
);
204 public List
<TaxonNodeDto
> listChildNodesAsTaxonNodeDto(UuidAndTitleCache
<TaxonNode
> parent
);
207 * @param classification
212 List
<UuidAndTitleCache
<TaxonNode
>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(
213 Classification classification
, Integer limit
, String pattern
, boolean searchForClassifications
);
217 * @param restrictions
221 * @param propertyPaths
222 * @param includePublished
225 public <S
extends TaxonNode
> List
<S
> list(Class
<S
> type
, List
<Restriction
<?
>> restrictions
, Integer limit
, Integer start
,
226 List
<OrderHint
> orderHints
, List
<String
> propertyPaths
, boolean includePublished
);
230 * @param restrictions
231 * @param includePublished
234 long count(Class
<?
extends TaxonNode
> type
, List
<Restriction
<?
>> restrictions
, boolean includePublished
);
236 * get taxonNodeDto of parent with given rank
237 * @param classification
241 public TaxonNodeDto
getParentTaxonNodeDtoForRank( Classification classification
, Rank rank
, TaxonName name
);