Project

General

Profile

Download (10.8 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.Set;
16
import java.util.UUID;
17

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

    
36
public interface IDefinedTermDao
37
        extends IIdentifiableDao<DefinedTermBase>, ITitledDao<DefinedTermBase>{
38

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

    
46
	public List<Language> getLanguagesByIso(List<String> iso639List);
47

    
48
	public List<Language> getLanguagesByLocale(Enumeration<Locale> locales);
49

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
175
	public DefinedTermBase findByUri(URI uri);
176

    
177
	/**
178
	 * Retrieves all {@link DefinedTermBase}s with the given {@link TermType}
179
	 * @param termType the term type to filter the terms
180
	 * @param limit
181
	 * @param start
182
	 * @param orderHints
183
	 * @param propertyPaths
184
	 * @return a list containing the terms
185
	 */
186
	public <T extends DefinedTermBase> List<T> listByTermType(TermType termType, Integer limit, Integer start, List<OrderHint> orderHints, List<String> propertyPaths);
187

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

    
190
	/**
191
	 * Returns a term or a list of terms depending of the label/id used in its vocabulary.
192
	 * @param idInVoc
193
	 * @param vocUuid
194
	 * @param clazz
195
	 * @param pageSize
196
	 * @param pageNumber
197
	 * @return
198
	 */
199
	public <TERM extends DefinedTermBase> List<TERM> getDefinedTermByIdInVocabulary(String idInVoc, UUID vocUuid, Class<TERM> clazz, Integer pageSize, Integer pageNumber);
200

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

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

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

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

    
209
    /**
210
     * Returns all terms that are included in the given parent term resp. a part of the given term.
211
     * @param parentTerm the parent term
212
     * @return a collection of included terms
213
     */
214
    public Collection<TermDto> getIncludesAsDto(TermDto parentTerm);
215

    
216
    /**
217
     * Returns all terms that the given term is a generalization of resp. that are a kind of the given term
218
     * @param parentTerm the parent term
219
     * @return a collection of included terms
220
     */
221
    public Collection<TermDto> getKindOfsAsDto(TermDto parentTerm);
222

    
223

    
224
    /**
225
     * Returns a collection of {@link TermDto}s that match the given search parameters.
226
     * @param title  the term label that the terms have to match
227
     * @param termType the termType that the terms have to match
228
     * @return a collection of matching term DTOs
229
     */
230
    public Collection<TermDto> findByTitleAsDto(String title, TermType termType);
231

    
232
    /**
233
     * Returns a collection of {@link TermDto}s that match the given search parameters.
234
     * @param uri the {@link URI} that the terms have to match
235
     * @param termLabel  the term label that the terms have to match
236
     * @param termType the termType that the terms have to match
237
     * @return a collection of matching term DTOs
238
     */
239
    public Collection<TermDto> findByUriAsDto(URI uri, String termLabel, TermType termType);
240

    
241
    /**
242
     * Returns all states for all supportedCategoricalEnumeration of this categorical feature
243
     * @param featureUuid the feature which has to support categorical data
244
     * @return list of all supported states
245
     */
246
    public List<TermDto> getSupportedStatesForFeature(UUID featureUuid);
247

    
248
    public Collection<TermDto> findByUUIDsAsDto(List<UUID> uuidList);
249

    
250
    public Collection<TermDto> findByTypeAsDto(TermType termType);
251

    
252
    public Collection<TermDto> findFeatureByUUIDsAsDto(List<UUID> uuidList);
253

    
254
    public Collection<TermDto> findFeatureByTitleAsDto(String pattern);
255

    
256
}
(1-1/6)