Project

General

Profile

Download (11.2 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.term;
10

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

    
19
import eu.etaxonomy.cdm.common.URI;
20
import eu.etaxonomy.cdm.model.common.CdmBase;
21
import eu.etaxonomy.cdm.model.common.Language;
22
import eu.etaxonomy.cdm.model.location.Country;
23
import eu.etaxonomy.cdm.model.location.NamedArea;
24
import eu.etaxonomy.cdm.model.location.NamedAreaLevel;
25
import eu.etaxonomy.cdm.model.location.NamedAreaType;
26
import eu.etaxonomy.cdm.model.media.Media;
27
import eu.etaxonomy.cdm.model.metadata.TermSearchField;
28
import eu.etaxonomy.cdm.model.term.DefinedTermBase;
29
import eu.etaxonomy.cdm.model.term.TermType;
30
import eu.etaxonomy.cdm.model.term.TermVocabulary;
31
import eu.etaxonomy.cdm.persistence.dao.common.IIdentifiableDao;
32
import eu.etaxonomy.cdm.persistence.dao.common.ITitledDao;
33
import eu.etaxonomy.cdm.persistence.dao.initializer.IBeanInitializer;
34
import eu.etaxonomy.cdm.persistence.dto.TermDto;
35
import eu.etaxonomy.cdm.persistence.query.MatchMode;
36
import eu.etaxonomy.cdm.persistence.query.OrderHint;
37

    
38
public interface IDefinedTermDao
39
        extends IIdentifiableDao<DefinedTermBase>, ITitledDao<DefinedTermBase>{
40

    
41
	/**
42
	 * @param iso639 a two or three letter language code according to iso639-1 or iso639-2
43
	 * @return the Language or null
44
	 */
45
	//TODO refactor typo:
46
	public Language getLanguageByIso(String iso639);
47

    
48
	public List<Language> getLanguagesByIso(List<String> iso639List);
49

    
50
	public List<Language> getLanguagesByLocale(Enumeration<Locale> locales);
51

    
52
	 /**
53
     * Returns the country with the isoCode iso639, works only with string length 2 or 3
54
     *
55
     * @param iso639 the isoCode of the searched country
56
     *
57
     * @return country with isoCode iso639
58
     */
59
	public Country getCountryByIso(String iso639);
60

    
61
	public <TYPE extends DefinedTermBase> List<TYPE> getDefinedTermByRepresentationText(String text, Class<TYPE> clazz );
62

    
63
	public <TYPE extends DefinedTermBase> List<TYPE> getDefinedTermByRepresentationText(String text, Class<TYPE> clazz, Integer pageSize,Integer  pageNumber);
64

    
65
	public long countDefinedTermByRepresentationText(String text, Class<? extends DefinedTermBase> clazz);
66

    
67
	public <TYPE extends DefinedTermBase> List<TYPE> getDefinedTermByRepresentationAbbrev(String text, Class<TYPE> clazz, Integer pageSize,Integer  pageNumber);
68

    
69
	public long countDefinedTermByRepresentationAbbrev(String text, Class<? extends DefinedTermBase> clazz);
70

    
71
    /**
72
     * Returns a List of Media that represent a given DefinedTerm instance
73
     *
74
	 * @param definedTerm the definedTerm represented by these media
75
	 * @param pageSize The maximum number of media returned (can be null for all related media)
76
	 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
77
     * @return a List of media instances
78
     */
79
	public List<Media> getMedia(DefinedTermBase definedTerm, Integer pageSize, Integer pageNumber);
80

    
81
	/**
82
	 * Returns a count of the Media that represent a given
83
	 * DefinedTermBase instance
84
	 *
85
	 * @param definedTerm the definedTerm represented by these media
86
	 * @return a count of Media entities
87
	 */
88
	public long countMedia(DefinedTermBase definedTerm);
89

    
90
	/**
91
	 * Returns a List of NamedArea instances (optionally filtered by type or level)
92
	 *
93
	 * @param level restrict the result set to named areas of a certain level (can be null)
94
	 * @param type restrict the result set to named areas of a certain type (can be null)
95
	 * @param pageSize The maximum number of namedAreas returned (can be null for all named areas)
96
	 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
97
	 * @return a List of named areas
98
	 */
99
	public List<NamedArea> list(NamedAreaLevel level, NamedAreaType type, Integer pageSize, Integer pageNumber);
100

    
101
	/**
102
	 * @param level
103
	 * @param type
104
	 * @param pageSize
105
	 * @param pageNumber
106
	 * @param orderHints
107
	 * @param propertyPaths
108
	 * @return
109
	 */
110
	public List<NamedArea> list(NamedAreaLevel level, NamedAreaType type, Integer pageSize, Integer pageNumber,  List<OrderHint> orderHints, List<String> propertyPaths);
111

    
112
	/**
113
	 * Returns a count of NamedArea instances (optionally filtered by type or level)
114
	 *
115
	 * @param level restrict the result set to named areas of a certain level (can be null)
116
	 * @param type restrict the result set to named areas of a certain type (can be null)
117
	 * @return a count of named areas
118
	 */
119
	public long count(NamedAreaLevel level, NamedAreaType type);
120

    
121
	/**
122
	 * Return a list of terms which are specializations of a given definedTerm
123
	 *
124
	 * @param definedTerm The term which is a generalization of the terms returned
125
	 * @param pageSize The maximum number of terms returned (can be null for all specializations)
126
	 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
127
	 * @return a List of DefinedTerms
128
	 */
129
	public <T extends DefinedTermBase> List<T> getGeneralizationOf(T definedTerm, Integer pageSize, Integer pageNumber);
130

    
131
	/**
132
	 * Return a count of terms which are specializations of a given definedTerm
133
	 *
134
	 * @param definedTerm The term which is a generalization of the terms returned
135
	 * @return a count of DefinedTerms
136
	 */
137
	public <T extends DefinedTermBase> long countGeneralizationOf(T definedTerm);
138

    
139
	/**
140
	 * Return a List of distinct terms which include the terms supplied
141
	 *
142
	 * @param definedTerms the set of terms which are part of the terms of interest
143
	 * @param pageSize The maximum number of terms returned (can be null for all terms)
144
	 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
145
	 * @param propertyPaths properties to initialize - see {@link IBeanInitializer#initialize(Object, List)}
146
	 * @return a List of DefinedTerms
147
	 */
148
	public <T extends DefinedTermBase> List<T> getPartOf(Set<T> definedTerms, Integer pageSize, Integer pageNumber, List<String> propertyPaths);
149

    
150
	/**
151
	 * Return a count of distinct terms which include the terms supplied
152
	 *
153
	 * @param definedTerms the set of terms which are part of the terms of interest
154
	 * @return a count of DefinedTerms
155
	 */
156
	public <T extends DefinedTermBase> long countPartOf(Set<T> definedTerms);
157

    
158
	/**
159
	 * Return a List of terms which are part of the terms supplied
160
	 *
161
	 * @param definedTerms the collection of terms which include the terms of interest
162
	 * @param pageSize The maximum number of terms returned (can be null for all terms)
163
	 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
164
	 * @param propertyPaths properties to initialize - see {@link IBeanInitializer#initialize(Object, List)}
165
	 * @return a List of DefinedTerms
166
	 */
167
	public <T extends DefinedTermBase> List<T> getIncludes(Collection<T> definedTerms, Integer pageSize, Integer pageNumber, List<String> propertyPaths);
168

    
169
	/**
170
	 * Return a count of terms which are part of the terms supplied
171
	 *
172
	 * @param definedTerms the set of terms which include the terms of interest
173
	 * @return a count of DefinedTerms
174
	 */
175
	public <T extends DefinedTermBase> long countIncludes(Collection<T> definedTerms);
176

    
177
	public DefinedTermBase findByUri(URI uri);
178

    
179

    
180
    /**
181
     * Searches by representation label
182
     */
183
	public List<DefinedTermBase> findByLabel(String queryString);
184

    
185
	/**
186
     * Searches by representation label
187
     */
188
    public List<DefinedTermBase> findByLabel(String queryString, CdmBase sessionObject);
189

    
190

    
191
	/**
192
	 * Retrieves all {@link DefinedTermBase}s with the given {@link TermType}
193
	 * @param termType the term type to filter the terms
194
	 * @param limit
195
	 * @param start
196
	 * @param orderHints
197
	 * @param propertyPaths
198
	 * @return a list containing the terms
199
	 */
200
	public <T extends DefinedTermBase> List<T> listByTermType(TermType termType, Integer limit, Integer start, List<OrderHint> orderHints, List<String> propertyPaths);
201

    
202
	public <TERM extends DefinedTermBase> List<TERM> listByTermClass(Class<TERM> clazz, Integer limit, Integer start, List<OrderHint> orderHints, List<String> propertyPaths);
203

    
204
	/**
205
	 * Returns a term or a list of terms depending of the label/id used in its vocabulary.
206
	 * @param idInVoc
207
	 * @param vocUuid
208
	 * @param clazz
209
	 * @param pageSize
210
	 * @param pageNumber
211
	 * @return
212
	 */
213
	public <TERM extends DefinedTermBase> List<TERM> getDefinedTermByIdInVocabulary(String idInVoc, UUID vocUuid, Class<TERM> clazz, Integer pageSize, Integer pageNumber);
214

    
215
    public <S extends DefinedTermBase> List<S> list(Class<S> clazz, List<TermVocabulary> vocs, Integer limit, String pattern);
216

    
217
    public <S extends DefinedTermBase> List<S> list(Class<S> clazz, List<TermVocabulary> vocs, Integer pageNumber, Integer limit, String pattern, MatchMode matchMode);
218

    
219
    public <S extends DefinedTermBase> List<S> listByAbbrev(Class<S> clazz, List<TermVocabulary> vocs, Integer pageNumber, Integer limit, String pattern, MatchMode matchmode, TermSearchField type);
220

    
221
    public <S extends DefinedTermBase> List<S> listByAbbrev(Class<S> clazz, List<TermVocabulary> vocs, Integer limit, String pattern, TermSearchField type);
222

    
223
    /**
224
     * Returns all terms that are included in the given parent term resp. a part of the given term.
225
     * @param parentTerm the parent term
226
     * @return a collection of included terms
227
     */
228
    public Collection<TermDto> getIncludesAsDto(TermDto parentTerm);
229

    
230
    /**
231
     * Returns all terms that the given term is a generalization of resp. that are a kind of the given term
232
     * @param parentTerm the parent term
233
     * @return a collection of included terms
234
     */
235
    public Collection<TermDto> getKindOfsAsDto(TermDto parentTerm);
236

    
237
    public TermDto getTermDto(UUID uuid);
238

    
239

    
240
    /**
241
     * Returns a collection of {@link TermDto}s that match the given search parameters.
242
     * @param title  the term label that the terms have to match
243
     * @param termType the termType that the terms have to match
244
     * @return a collection of matching term DTOs
245
     */
246
    public Collection<TermDto> findByTitleAsDto(String title, TermType termType);
247

    
248
    /**
249
     * Returns a collection of {@link TermDto}s that match the given search parameters.
250
     * @param uri the {@link URI} that the terms have to match
251
     * @param termLabel  the term label that the terms have to match
252
     * @param termType the termType that the terms have to match
253
     * @return a collection of matching term DTOs
254
     */
255
    public Collection<TermDto> findByUriAsDto(URI uri, String termLabel, TermType termType);
256

    
257
    /**
258
     * Returns all states for all supportedCategoricalEnumeration of the categorical features
259
     * @param set of featureUuids the feature which has to support categorical data
260
     * @return map of lists of all supported states
261
     */
262
    public Map<UUID, List<TermDto>> getSupportedStatesForFeature(Set<UUID> featureUuids);
263

    
264
    public Collection<TermDto> findByUUIDsAsDto(List<UUID> uuidList);
265

    
266
    public Collection<TermDto> findByTypeAsDto(TermType termType);
267

    
268
    public Collection<TermDto> findFeatureByUUIDsAsDto(List<UUID> uuidList);
269

    
270
    public Collection<TermDto> findFeatureByTitleAsDto(String pattern);
271

    
272
    public TermDto findByUUIDAsDto(UUID uuid);
273

    
274
}
(1-1/6)