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.
9 package eu
.etaxonomy
.cdm
.persistence
.dao
.term
;
12 import java
.util
.Collection
;
13 import java
.util
.Enumeration
;
14 import java
.util
.List
;
15 import java
.util
.Locale
;
17 import java
.util
.UUID
;
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
.NamedAreaSearchField
;
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
;
36 public interface IDefinedTermDao
37 extends IIdentifiableDao
<DefinedTermBase
>, ITitledDao
<DefinedTermBase
>{
40 * @param iso639 a two or three letter language code according to iso639-1 or iso639-2
41 * @return the Language or null
44 public Language
getLanguageByIso(String iso639
);
46 public List
<Language
> getLanguagesByIso(List
<String
> iso639List
);
48 public List
<Language
> getLanguagesByLocale(Enumeration
<Locale
> locales
);
51 * Returns the country with the isoCode iso639, works only with string length 2 or 3
53 * @param iso639 the isoCode of the searched country
55 * @return country with isoCode iso639
57 public Country
getCountryByIso(String iso639
);
59 public <TYPE
extends DefinedTermBase
> List
<TYPE
> getDefinedTermByRepresentationText(String text
, Class
<TYPE
> clazz
);
61 public <TYPE
extends DefinedTermBase
> List
<TYPE
> getDefinedTermByRepresentationText(String text
, Class
<TYPE
> clazz
, Integer pageSize
,Integer pageNumber
);
63 public long countDefinedTermByRepresentationText(String text
, Class
<?
extends DefinedTermBase
> clazz
);
65 public <TYPE
extends DefinedTermBase
> List
<TYPE
> getDefinedTermByRepresentationAbbrev(String text
, Class
<TYPE
> clazz
, Integer pageSize
,Integer pageNumber
);
67 public long countDefinedTermByRepresentationAbbrev(String text
, Class
<?
extends DefinedTermBase
> clazz
);
70 * Returns a List of Media that represent a given DefinedTerm instance
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
77 public List
<Media
> getMedia(DefinedTermBase definedTerm
, Integer pageSize
, Integer pageNumber
);
80 * Returns a count of the Media that represent a given
81 * DefinedTermBase instance
83 * @param definedTerm the definedTerm represented by these media
84 * @return a count of Media entities
86 public long countMedia(DefinedTermBase definedTerm
);
89 * Returns a List of NamedArea instances (optionally filtered by type or level)
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
97 public List
<NamedArea
> list(NamedAreaLevel level
, NamedAreaType type
, Integer pageSize
, Integer pageNumber
);
105 * @param propertyPaths
108 public List
<NamedArea
> list(NamedAreaLevel level
, NamedAreaType type
, Integer pageSize
, Integer pageNumber
, List
<OrderHint
> orderHints
, List
<String
> propertyPaths
);
111 * Returns a count of NamedArea instances (optionally filtered by type or level)
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
117 public long count(NamedAreaLevel level
, NamedAreaType type
);
120 * Return a list of terms which are specializations of a given definedTerm
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
127 public <T
extends DefinedTermBase
> List
<T
> getGeneralizationOf(T definedTerm
, Integer pageSize
, Integer pageNumber
);
130 * Return a count of terms which are specializations of a given definedTerm
132 * @param definedTerm The term which is a generalization of the terms returned
133 * @return a count of DefinedTerms
135 public <T
extends DefinedTermBase
> long countGeneralizationOf(T definedTerm
);
138 * Return a List of distinct terms which include the terms supplied
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
146 public <T
extends DefinedTermBase
> List
<T
> getPartOf(Set
<T
> definedTerms
, Integer pageSize
, Integer pageNumber
, List
<String
> propertyPaths
);
149 * Return a count of distinct terms which include the terms supplied
151 * @param definedTerms the set of terms which are part of the terms of interest
152 * @return a count of DefinedTerms
154 public <T
extends DefinedTermBase
> long countPartOf(Set
<T
> definedTerms
);
157 * Return a List of terms which are part of the terms supplied
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
165 public <T
extends DefinedTermBase
> List
<T
> getIncludes(Collection
<T
> definedTerms
, Integer pageSize
, Integer pageNumber
, List
<String
> propertyPaths
);
168 * Return a count of terms which are part of the terms supplied
170 * @param definedTerms the set of terms which include the terms of interest
171 * @return a count of DefinedTerms
173 public <T
extends DefinedTermBase
> long countIncludes(Collection
<T
> definedTerms
);
175 public DefinedTermBase
findByUri(URI uri
);
178 * Retrieves all {@link DefinedTermBase}s with the given {@link TermType}
179 * @param termType the term type to filter the terms
183 * @param propertyPaths
184 * @return a list containing the terms
186 public <T
extends DefinedTermBase
> List
<T
> listByTermType(TermType termType
, Integer limit
, Integer start
, List
<OrderHint
> orderHints
, List
<String
> propertyPaths
);
188 public <TERM
extends DefinedTermBase
> List
<TERM
> listByTermClass(Class
<TERM
> clazz
, Integer limit
, Integer start
, List
<OrderHint
> orderHints
, List
<String
> propertyPaths
);
191 * Returns a term or a list of terms depending of the label/id used in its vocabulary.
199 public <TERM
extends DefinedTermBase
> List
<TERM
> getDefinedTermByIdInVocabulary(String idInVoc
, UUID vocUuid
, Class
<TERM
> clazz
, Integer pageSize
, Integer pageNumber
);
208 public List
<NamedArea
> listNamedArea(List
<TermVocabulary
> vocs
, Integer limit
,
212 * Returns all terms that are included in the given parent term resp. a part of the given term.
213 * @param parentTerm the parent term
214 * @return a collection of included terms
216 public Collection
<TermDto
> getIncludesAsDto(TermDto parentTerm
);
219 * Returns all terms that the given term is a generalization of resp. that are a kind of the given term
220 * @param parentTerm the parent term
221 * @return a collection of included terms
223 public Collection
<TermDto
> getKindOfsAsDto(TermDto parentTerm
);
227 * Returns a collection of {@link TermDto}s that match the given search parameters.
228 * @param title the term label that the terms have to match
229 * @param termType the termType that the terms have to match
230 * @return a collection of matching term DTOs
232 public Collection
<TermDto
> findByTitleAsDto(String title
, TermType termType
);
235 * Returns a collection of {@link TermDto}s that match the given search parameters.
236 * @param uri the {@link URI} that the terms have to match
237 * @param termLabel the term label that the terms have to match
238 * @param termType the termType that the terms have to match
239 * @return a collection of matching term DTOs
241 public Collection
<TermDto
> findByUriAsDto(URI uri
, String termLabel
, TermType termType
);
244 * Returns the number of terms in the vocabularies vocs filteres by the given pattern
249 public long count(List
<TermVocabulary
> vocs
, String pattern
);
258 public List
<NamedArea
> listNamedArea(List
<TermVocabulary
> vocs
, Integer pageNumber
, Integer limit
, String pattern
, MatchMode matchMode
);
266 public List
<NamedArea
> listNamedAreaByAbbrev(List
<TermVocabulary
> vocs
, Integer pageNumber
, Integer limit
, String pattern
, MatchMode matchmode
, NamedAreaSearchField type
);
274 public List
<NamedArea
> listNamedAreaByAbbrev(List
<TermVocabulary
> vocs
, Integer limit
, String pattern
, NamedAreaSearchField type
);
277 * Returns all states for all supportedCategoricalEnumeration of this categorical feature
278 * @param featureUuid the feature which has to support categorical data
279 * @return list of all supported states
281 public List
<TermDto
> getSupportedStatesForFeature(UUID featureUuid
);
287 public Collection
<TermDto
> findByUUIDsAsDto(List
<UUID
> uuidList
);
294 public Collection
<TermDto
> findByTypeAsDto(TermType termType
);
296 public Collection
<TermDto
> findFeatureByUUIDsAsDto(List
<UUID
> uuidList
);
297 public Collection
<TermDto
> findFeatureByTitleAsDto(String pattern
);