Project

General

Profile

Download (9.61 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
package eu.etaxonomy.cdm.persistence.dao.taxon;
10

    
11
import java.util.Collection;
12
import java.util.Comparator;
13
import java.util.List;
14
import java.util.Map;
15
import java.util.Set;
16
import java.util.UUID;
17

    
18
import eu.etaxonomy.cdm.common.monitor.IProgressMonitor;
19
import eu.etaxonomy.cdm.model.common.CdmBase;
20
import eu.etaxonomy.cdm.model.common.TreeIndex;
21
import eu.etaxonomy.cdm.model.name.Rank;
22
import eu.etaxonomy.cdm.model.name.TaxonName;
23
import eu.etaxonomy.cdm.model.reference.Reference;
24
import eu.etaxonomy.cdm.model.taxon.Classification;
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;
33

    
34
/**
35
 * @author a.mueller
36
 */
37
public interface ITaxonNodeDao extends IAnnotatableDao<TaxonNode> {
38

    
39
	public UUID delete(TaxonNode persistentObject, boolean deleteChildren);
40

    
41
    public List<TaxonNode> getTaxonOfAcceptedTaxaByClassification(Classification classification, Integer start, Integer end);
42

    
43
    public int countTaxonOfAcceptedTaxaByClassification(Classification classification);
44

    
45
    /**
46
     * Lists all direct child nodes of the given {@link UuidAndTitleCache} which
47
     * represents the parent {@link TaxonNode}
48
     * @param parent a UuidAndTitleCache object which represents a parent {@link TaxonNode}
49
     * @return a list of UuidAndTitleCache objects that represent children of the
50
     * parent
51
     */
52
    public List<TaxonNodeDto> listChildNodesAsUuidAndTitleCache(TaxonNodeDto parent);
53

    
54
    /**
55
     * Retrieves the parent node of the {@link TaxonNode} represented by the given {@link UuidAndTitleCache}.
56
     * @param child the child for which the parent should be retrieved
57
     * @return an UuidAndTitleCache object representing the parent node
58
     */
59
    public TaxonNodeDto getParentUuidAndTitleCache(TaxonNodeDto child);
60

    
61
    /**
62
     * Retrieves a list of {@link UuidAndTitleCache} objects that have a matching titleCache
63
     * @param limit the maximum results
64
     * @param pattern the titleCache that is searched for
65
     * @param classificationUuid if specified only nodes of this classification are retrieved
66
     * @return a list of matches
67
     */
68
    public List<TaxonNodeDto> getUuidAndTitleCache(Integer limit, String pattern, UUID classificationUuid);
69

    
70
    public List<TaxonNode> listChildrenOf(TaxonNode node, Integer pageSize, Integer pageIndex,
71
            boolean recursive, boolean includeUnpublished, List<String> propertyPaths, Comparator<TaxonNode> comparator);
72

    
73
    public abstract Long countChildrenOf(TaxonNode node, Classification classification, boolean recursive, boolean includeUnpublished);
74

    
75
    /**
76
     * Returns the of TaxonNodeAgentRelation entities which are associated with the TaxonNode for the
77
     * given TaxonUuid in the specified Classification.
78
     *
79
     * @param taxonUuid
80
     * @param agentUuid TODO
81
     * @param relTypeUuid TODO
82
     * @param start
83
     * @param limit
84
     * @param propertyPaths
85
     * @param rankId TODO
86
     * @param classification
87
     * @return
88
     */
89
   public List<TaxonNodeAgentRelation> listTaxonNodeAgentRelations(UUID taxonUuid, UUID classificationUuid,
90
            UUID agentUuid, UUID rankUuid, UUID relTypeUuid, Integer start, Integer limit, List<String> propertyPaths);
91

    
92
    /**
93
     * Returns the number of TaxonNodeAgentRelation entities which are associated with the TaxonNode for the
94
     * given TaxonUuid in the specified Classification.
95
     *
96
     * @param taxonUuid
97
     * @param agentUuid TODO
98
     * @param relTypeUuid TODO
99
     * @param rankId TODO
100
     * @param classification
101
     * @return
102
     */
103
    public long countTaxonNodeAgentRelations(UUID taxonUuid, UUID classificationUuid, UUID agentUuid, UUID rankUuid, UUID relTypeUuid);
104

    
105
    /**
106
     * Computes a map treeIndex->rank(sortIndex) for each given taxon node treeIndex. Required by #5957.
107
     * If the taxon represented by the treeindex is not in the given rank range no record is returned for the given
108
     * treeindex.
109
     *
110
     * @param treeIndex the list of treeIndexes
111
     * @param minRankOrderIndex min rank
112
     * @param maxRankOrderIndex max rank
113
     * @return
114
     */
115
    public Map<TreeIndex, Integer> rankOrderIndexForTreeIndex(List<TreeIndex> treeIndex, Integer minRankOrderIndex,
116
            Integer maxRankOrderIndex);
117

    
118
    /**
119
     * For a given set of taxon node tree indexes the uuid and title cache of the taxon represented
120
     * by this treeindex is returned.
121
     * @param treeIndexSet set of taxon node tree indexes
122
     * @return map with treeindex and uuidAndTitleCache of the represented taxon
123
     */
124
    public Map<TreeIndex, UuidAndTitleCache<?>> taxonUuidsForTreeIndexes(Collection<TreeIndex> treeIndexSet);
125

    
126
//----------------------------- SEC FOR SUBTREE -------------------------------/
127

    
128
    public int countSecundumForSubtreeAcceptedTaxa(TreeIndex subTreeIndex, Reference newSec,
129
            boolean overwriteExistingAccepted, boolean includeSharedTaxa, boolean emptySecundumDetail);
130

    
131
    public int countSecundumForSubtreeSynonyms(TreeIndex subTreeIndex, Reference newSec,
132
            boolean overwriteExistingSynonyms, boolean includeSharedTaxa, boolean emptySecundumDetail);
133

    
134
    public int countSecundumForSubtreeRelations(TreeIndex subTreeIndex, Reference newSec,
135
            boolean overwriteExistingRelations, boolean includeSharedTaxa, boolean emptySecundumDetail);
136

    
137
    public Set<CdmBase> setSecundumForSubtreeAcceptedTaxa(TreeIndex subTreeIndex, Reference newSec,
138
            boolean overwriteExisting, boolean includeSharedTaxa, boolean emptyDetail, IProgressMonitor monitor);
139

    
140
    public  Set<CdmBase> setSecundumForSubtreeSynonyms(TreeIndex subTreeIndex, Reference newSec,
141
            boolean overwriteExisting, boolean includeSharedTaxa, boolean emptyDetail, IProgressMonitor monitor);
142

    
143
    public  Set<CdmBase> setSecundumForSubtreeRelations(TreeIndex subTreeIndex, Reference newSec,
144
            Set<UUID> relationTypes, boolean overwriteExisting, boolean includeSharedTaxa, boolean emptyDetail,
145
            IProgressMonitor monitor);
146

    
147
//----------------------------- PUBLISH FOR SUBTREE -------------------------------/
148

    
149
    public int countPublishForSubtreeAcceptedTaxa(TreeIndex subTreeIndex, boolean publish,
150
            boolean includeSharedTaxa, boolean includeHybrids);
151
    public Set<TaxonBase> setPublishForSubtreeAcceptedTaxa(TreeIndex subTreeIndex, boolean publish,
152
            boolean includeSharedTaxa, boolean includeHybrids, IProgressMonitor monitor);
153

    
154
    public int countPublishForSubtreeSynonyms(TreeIndex subTreeIndex, boolean publish,
155
            boolean includeSharedTaxa, boolean includeHybrids);
156
    public Set<TaxonBase> setPublishForSubtreeSynonyms(TreeIndex subTreeIndex, boolean publish,
157
            boolean includeSharedTaxa, boolean includeHybrids, IProgressMonitor monitor);
158

    
159
    public int countPublishForSubtreeRelatedTaxa(TreeIndex subTreeIndex, boolean publish,
160
            boolean includeSharedTaxa, boolean includeHybrids);
161
    public Set<TaxonBase> setPublishForSubtreeRelatedTaxa(TreeIndex subTreeIndex, boolean publish,
162
            Set<UUID> relationTypes, boolean includeSharedTaxa, boolean includeHybrids,
163
            IProgressMonitor monitor);
164

    
165
//---------------------------------------------------------------------------------/
166

    
167
    public List<TaxonNodeDto> listChildNodesAsTaxonNodeDto(TaxonNodeDto parent);
168

    
169
    public List<UuidAndTitleCache<TaxonNode>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(
170
            Classification classification, Integer limit, String pattern, boolean searchForClassifications);
171

    
172
    public <S extends TaxonNode> List<S> list(Class<S> type, List<Restriction<?>> restrictions, Integer limit, Integer start,
173
            List<OrderHint> orderHints, List<String> propertyPaths, boolean includePublished);
174

    
175
    long count(Class<? extends TaxonNode> type, List<Restriction<?>> restrictions, boolean includePublished);
176

    
177
	public List<TaxonNodeDto> getParentTaxonNodeDtoForRank( Classification classification, Rank rank, TaxonName name);
178

    
179
	public List<TaxonNodeDto> getParentTaxonNodeDtoForRank( Classification classification, Rank rank, TaxonBase<?> taxonBase);
180

    
181
    public List<TaxonNodeDto> getTaxonNodeDto(Integer limit, String pattern, UUID classificationUuid);
182

    
183
    public List<TaxonNodeDto> getUuidAndTitleCache(Integer limit, String pattern, UUID classificationUuid, boolean includeDoubtful);
184

    
185
    public List<UuidAndTitleCache<TaxonNode>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(
186
            Classification classification, Integer limit, String pattern, boolean searchForClassifications,
187
            boolean includeDoubtful);
188

    
189
    /**
190
     * @param taxonUUID
191
     * @param classificationUuid
192
     * @return
193
     */
194
    List<TaxonNodeDto> getTaxonNodeForTaxonInClassificationDto(UUID taxonUUID, UUID classificationUuid);
195

    
196
    /**
197
     * @param nodeUuid
198
     * @return
199
     */
200
    TaxonNodeDto getTaxonNodeDto(UUID nodeUuid);
201

    
202
    /**
203
     * @param nodeUuid
204
     * @return
205
     */
206
    List<TaxonNodeDto> getTaxonNodeDtos(List<UUID> nodeUuid);
207
}
(3-3/5)