Project

General

Profile

Download (9 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.persistence.dao.term;
11

    
12

    
13
import java.util.Collection;
14
import java.util.List;
15
import java.util.Map;
16
import java.util.Set;
17
import java.util.UUID;
18

    
19
import eu.etaxonomy.cdm.model.common.CdmClass;
20
import eu.etaxonomy.cdm.model.term.DefinedTermBase;
21
import eu.etaxonomy.cdm.model.term.TermType;
22
import eu.etaxonomy.cdm.model.term.TermVocabulary;
23
import eu.etaxonomy.cdm.persistence.dao.common.IIdentifiableDao;
24
import eu.etaxonomy.cdm.persistence.dto.TermDto;
25
import eu.etaxonomy.cdm.persistence.dto.TermVocabularyDto;
26
import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache;
27
import eu.etaxonomy.cdm.persistence.query.OrderHint;
28

    
29

    
30
/**
31
 * @author a.mueller
32
 *
33
 */
34
public interface ITermVocabularyDao extends IIdentifiableDao<TermVocabulary> {
35

    
36
	/**
37
	 * Return a count of terms that belong to the termVocabulary supplied
38
	 *
39
	 * @param termVocabulary The term vocabulary which 'owns' the terms of interest
40
	 * @return a count of terms
41
	 */
42
	public long countTerms(TermVocabulary termVocabulary);
43

    
44
	/**
45
	 * Return a List of terms that belong to the termVocabulary supplied
46
	 *
47
	 * @param termVocabulary The term vocabulary which 'owns' the terms of interest
48
	 * @param pageSize The maximum number of terms returned (can be null for all terms)
49
	 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
50
	 * @return a List of terms
51
	 */
52
	public <T extends DefinedTermBase> List<T> getTerms(TermVocabulary<T> termVocabulary, Integer pageSize, Integer pageNumber);
53

    
54
	public <T extends DefinedTermBase> TermVocabulary<T> findByUri(String termSourceUri, Class<T> clazz);
55

    
56
	/**
57
	 * Return a List of terms that belong to the termVocabulary supplied
58
	 *
59
	 * @param termVocabulary The term vocabulary which 'owns' the terms of interest
60
	 * @param pageSize The maximum number of terms returned (can be null for all terms)
61
	 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
62
	 * @param orderHints
63
	 *            Supports path like <code>orderHints.propertyNames</code> which
64
	 *            include *-to-one properties like createdBy.username or
65
	 *            authorTeam.persistentTitleCache
66
	 * @param propertyPaths properties to be initialized
67
	 * @return a List of terms
68
	 */
69
	public <T extends DefinedTermBase> List<T> getTerms(TermVocabulary<T> vocabulary,Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);
70

    
71
    /**
72
     * Return a List of vocabularies that belong to the term type supplied
73
     *
74
     * @param termType The term type corresponding to the vocabularies of interest
75
     * @param propertyPaths
76
     * @return a List of vocabularies
77
     */
78
    public <T extends DefinedTermBase> List<TermVocabulary<T>> findByTermType(TermType termType, List<String> propertyPaths);
79

    
80

    
81
	/**
82
     * Returns term vocabularies that contain terms of a certain {@link TermType} e.g. Feature, Modifier, State.
83
     *
84
     * @param <TERMTYPE>
85
     * @param termType the {@link TermType} of the terms in the vocabulary and of the vocabulary
86
     * @param includeSubtypes if <code>true</code> all subtypes will be included for computation of the result
87
     * @param limit The maximum number of vocabularies returned (can be null for all vocabularies)
88
     * @param start The offset from the start of the result set (0 - based, can be null - equivalent of starting at the beginning of the recordset)
89
     * @param orderHints
90
     *            Supports path like <code>orderHints.propertyNames</code> which
91
     *            include *-to-one properties like createdBy.username or
92
     *            authorTeam.persistentTitleCache
93
     * @param propertyPaths properties to be initialized
94
     * @return a list of term vocabularies
95
     */
96
	public List<TermVocabulary> listByTermType(TermType termType, boolean includeSubtypes, Integer limit, Integer start, List<OrderHint> orderHints, List<String> propertyPaths);
97

    
98
	/**
99
	 * Fills the response map with those term uuids which do exist in the requested map
100
	 * but not in the repository (missing terms). The map key is the vocabulary uuid in both cases.
101
	 * If parameter vocabularyRepsonse is not <code>null</code> the vocabularies will be fully loaded
102
	 * and returned within the map. The later is for using this method together with fast termloading.
103
	 * @param uuidsRequested
104
	 * @param uuidsRepsonse
105
	 * @param vocabularyResponse
106
	 */
107
	public void missingTermUuids(Map<UUID, Set<UUID>> uuidsRequested,
108
			Map<UUID, Set<UUID>> uuidsRepsonse,
109
			Map<UUID, TermVocabulary<?>> vocabularyResponse);
110

    
111
    /**
112
     * Loads all top level terms, i.e. terms that have no parent terms, for the given vocabulary
113
     * @param vocabularyUuid the id of the vocabulary
114
     * @return a collection of top level terms
115
     */
116
    public Collection<TermDto> getTopLevelTerms(UUID vocabularyUuid);
117

    
118
    /**
119
     * Loads all top level terms, i.e. terms that have no parent terms, for the given vocabulary
120
     * @param vocabularyUuid the id of the vocabulary
121
     * @return a collection of top level terms
122
     */
123
    public List<TermDto> getTopLevelTerms(UUID vocabularyUuid, TermType type);
124

    
125
    /**
126
     * Loads all terms for the given vocabulary
127
     * @param vocabularyUuid the id of the vocabulary
128
     * @return a collection of terms
129
     */
130
    public Collection<TermDto> getTerms(UUID vocabularyUuid);
131

    
132
    /**
133
     * Loads all terms for the given vocabularies
134
     * @param vocabularyUuids the ids of the vocabularies
135
     * @return a collection of terms
136
     */
137
    public Collection<TermDto> getTerms(List<UUID> vocabularyUuids);
138

    
139
    /**
140
     * Loads all namedArea term dtos with level information for the given vocabularies
141
     * @param vocabularyUuids the ids of the vocabularies
142
     * @return a collection of namedArea terms
143
     */
144
    public Collection<TermDto> getNamedAreaTerms(List<UUID> vocabularyUuids);
145

    
146
    /**
147
     * Returns term vocabularies that contain terms of a certain {@link TermType} e.g. Feature, Modifier, State.
148
     *
149
     * @param termType the {@link TermType} of the terms in the vocabulary and of the vocabulary
150
     * @return a list of term vocabularies
151
     */
152
    public List<TermVocabularyDto> findVocabularyDtoByTermType(TermType termType);
153

    
154
    /**
155
     * Returns term vocabularies that contain terms of a certain {@link TermType} e.g. Feature, Modifier, State. containing pattern
156
     *
157
     * @param termType the {@link TermType} of the terms in the vocabulary and of the vocabulary
158
     * @param pattern
159
     * @param includeSubTypes
160
     * @return a list of term vocabularies
161
     */
162
    public List<TermVocabularyDto> findVocabularyDtoByTermTypes(Set<TermType> termTypes, String pattern, boolean includeSubtypes);
163

    
164
    /**
165
     * Returns term vocabularies that contain terms of a certain {@link TermType} e.g. Feature, Modifier, State.
166
     *
167
     * @param termType the {@link TermType} of the terms in the vocabulary and of the vocabulary
168
     * @return a list of term vocabularies
169
     */
170
    public List<TermVocabularyDto> findVocabularyDtoByTermTypes(Set<TermType> termType);
171

    
172
    /**
173
     * Returns term vocabularies that contain terms of a certain {@link TermType} e.g. Feature, Modifier, State.
174
     *
175
     * @param termType the {@link TermType} of the terms in the vocabulary and of the vocabulary
176
     * @param includeSubtypes if <code>true</code> also the sub types of the given term types
177
     * will be considered
178
     * @return a list of term vocabularies
179
     */
180
    public List<TermVocabularyDto> findVocabularyDtoByTermTypes(Set<TermType> termType, boolean includeSubtypes);
181

    
182
    /**
183
     * Returns term vocabulary for UUID
184
     *
185
     * @param UUID the {@link UUID} of the vocabulary
186
     * @return term vocabularies
187
     */
188
    public TermVocabularyDto findVocabularyDtoByUuid(UUID vocUuid);
189

    
190
    /**
191
     * Returns list of term vocabularies for list of UUIDs
192
     *
193
     * @param vocUuids the {@link UUID} of the vocabularies
194
     * @return term vocabularies
195
     */
196
    public List<TermVocabularyDto> findVocabularyDtoByUuids(List<UUID> vocUuids);
197

    
198
    /**
199
     *
200
     * Like {@link #getUuidAndTitleCache(Class, Integer, String)} but filtering
201
     * the results by {@link TermType} of the vocabularies.
202
     *
203
     *
204
     * @param clazz
205
     *            the (sub)class
206
     * @param termType
207
     *            the {@link TermType} of the vocabularies to be retrieved
208
     * @param limit
209
     *            max number of results
210
     * @param pattern
211
     *            search pattern
212
     * @return a list of {@link UuidAndTitleCache}
213
     *
214
     * @see #getUuidAndTitleCache(Class, Integer, String))
215
     */
216
    public <S extends TermVocabulary> List<UuidAndTitleCache<S>> getUuidAndTitleCache(Class<S> clazz, TermType termType,
217
            Integer limit, String pattern);
218

    
219
    /**
220
     * @param availableFor
221
     * @return
222
     */
223
    List<TermVocabularyDto> findVocabularyDtoByAvailableFor(Set<CdmClass> availableFor);
224
}
(6-6/6)