remove old TermsDataSet
[cdmlib.git] / cdmlib-persistence / src / main / java / eu / etaxonomy / cdm / persistence / dao / common / IDefinedTermDao.java
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.common;
11
12 import java.net.URI;
13 import java.util.Enumeration;
14 import java.util.List;
15 import java.util.Locale;
16 import java.util.Set;
17 import java.util.UUID;
18
19 import eu.etaxonomy.cdm.model.common.DefinedTermBase;
20 import eu.etaxonomy.cdm.model.common.Language;
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.location.Country;
25 import eu.etaxonomy.cdm.model.media.Media;
26 import eu.etaxonomy.cdm.persistence.dao.IBeanInitializer;
27 import eu.etaxonomy.cdm.persistence.query.OrderHint;
28
29
30 public interface IDefinedTermDao extends IIdentifiableDao<DefinedTermBase>, ITitledDao<DefinedTermBase>{
31
32 /**
33 * @param iso639 a two or three letter language code according to iso639-1 or iso639-2
34 * @return the Language or null
35 */
36 //TODO refactor typo:
37 public Language getLanguageByIso(String iso639);
38
39 public List<Language> getLanguagesByIso(List<String> iso639List);
40
41 public List<Language> getLanguagesByLocale(Enumeration<Locale> locales);
42
43 public Country getCountryByIso(String iso639);
44
45 public <TYPE extends DefinedTermBase> List<TYPE> getDefinedTermByRepresentationText(String text, Class<TYPE> clazz );
46
47 public <TYPE extends DefinedTermBase> List<TYPE> getDefinedTermByRepresentationText(String text, Class<TYPE> clazz, Integer pageSize,Integer pageNumber);
48
49 public int countDefinedTermByRepresentationText(String text, Class<? extends DefinedTermBase> clazz);
50
51 public <TYPE extends DefinedTermBase> List<TYPE> getDefinedTermByRepresentationAbbrev(String text, Class<TYPE> clazz, Integer pageSize,Integer pageNumber);
52
53 public int countDefinedTermByRepresentationAbbrev(String text, Class<? extends DefinedTermBase> clazz);
54
55
56 /**
57 * Returns a List of Media that represent a given DefinedTerm instance
58 *
59 * @param definedTerm the definedTerm represented by these media
60 * @param pageSize The maximum number of media returned (can be null for all related media)
61 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
62 * @return a List of media instances
63 */
64 public List<Media> getMedia(DefinedTermBase definedTerm, Integer pageSize, Integer pageNumber);
65
66 /**
67 * Returns a count of the Media that represent a given
68 * DefinedTermBase instance
69 *
70 * @param definedTerm the definedTerm represented by these media
71 * @return a count of Media entities
72 */
73 public int countMedia(DefinedTermBase definedTerm);
74
75 /**
76 * Returns a List of NamedArea instances (optionally filtered by type or level)
77 *
78 * @param level restrict the result set to named areas of a certain level (can be null)
79 * @param type restrict the result set to named areas of a certain type (can be null)
80 * @param pageSize The maximum number of namedAreas returned (can be null for all named areas)
81 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
82 * @return a List of named areas
83 */
84 public List<NamedArea> list(NamedAreaLevel level, NamedAreaType type, Integer pageSize, Integer pageNumber);
85
86 /**
87 * @param level
88 * @param type
89 * @param pageSize
90 * @param pageNumber
91 * @param orderHints
92 * @param propertyPaths
93 * @return
94 */
95 public List<NamedArea> list(NamedAreaLevel level, NamedAreaType type, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);
96
97
98 /**
99 * Returns a count of NamedArea instances (optionally filtered by type or level)
100 *
101 * @param level restrict the result set to named areas of a certain level (can be null)
102 * @param type restrict the result set to named areas of a certain type (can be null)
103 * @return a count of named areas
104 */
105 public int count(NamedAreaLevel level, NamedAreaType type);
106
107 /**
108 * Return a list of terms which are specializations of a given definedTerm
109 *
110 * @param definedTerm The term which is a generalization of the terms returned
111 * @param pageSize The maximum number of terms returned (can be null for all specializations)
112 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
113 * @return a List of DefinedTerms
114 */
115 public <T extends DefinedTermBase> List<T> getGeneralizationOf(T definedTerm, Integer pageSize, Integer pageNumber);
116
117 /**
118 * Return a count of terms which are specializations of a given definedTerm
119 *
120 * @param definedTerm The term which is a generalization of the terms returned
121 * @return a count of DefinedTerms
122 */
123 public <T extends DefinedTermBase> int countGeneralizationOf(T definedTerm);
124
125 /**
126 * Return a List of distinct terms which include the terms supplied
127 *
128 * @param definedTerms the set of terms which are part of the terms of interest
129 * @param pageSize The maximum number of terms returned (can be null for all terms)
130 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
131 * @param propertyPaths properties to initialize - see {@link IBeanInitializer#initialize(Object, List)}
132 * @return a List of DefinedTerms
133 */
134 public <T extends DefinedTermBase> List<T> getPartOf(Set<T> definedTerms, Integer pageSize, Integer pageNumber, List<String> propertyPaths);
135
136 /**
137 * Return a count of distinct terms which include the terms supplied
138 *
139 * @param definedTerms the set of terms which are part of the terms of interest
140 * @return a count of DefinedTerms
141 */
142 public <T extends DefinedTermBase> int countPartOf(Set<T> definedTerms);
143
144 /**
145 * Return a List of terms which are part of the terms supplied
146 *
147 * @param definedTerms the set of terms which include the terms of interest
148 * @param pageSize The maximum number of terms returned (can be null for all terms)
149 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
150 * @param propertyPaths properties to initialize - see {@link IBeanInitializer#initialize(Object, List)}
151 * @return a List of DefinedTerms
152 */
153 public <T extends DefinedTermBase> List<T> getIncludes(Set<T> definedTerms, Integer pageSize, Integer pageNumber, List<String> propertyPaths);
154
155 /**
156 * Return a count of terms which are part of the terms supplied
157 *
158 * @param definedTerms the set of terms which include the terms of interest
159 * @return a count of DefinedTerms
160 */
161 public <T extends DefinedTermBase> int countIncludes(Set<T> definedTerms);
162
163 public DefinedTermBase findByUri(URI uri);
164
165 public <TERM extends DefinedTermBase> List<TERM> listByTermClass(Class<TERM> clazz, Integer limit, Integer start, List<OrderHint> orderHints, List<String> propertyPaths);
166
167 /**
168 * Returns a term or a list of terms depending of the label/id used in its vocabulary.
169 * @param idInVoc
170 * @param vocUuid
171 * @param clazz
172 * @param pageSize
173 * @param pageNumber
174 * @return
175 */
176 public <TERM extends DefinedTermBase> List<TERM> getDefinedTermByIdInVocabulary(String idInVoc, UUID vocUuid, Class<TERM> clazz, Integer pageSize, Integer pageNumber);
177 }