More work on #466, in particular on DefinedTermDao, AgentDao, TermVocabularyDao,...
[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.util.Enumeration;
13 import java.util.List;
14 import java.util.Locale;
15 import java.util.Set;
16
17 import eu.etaxonomy.cdm.model.common.DefinedTermBase;
18 import eu.etaxonomy.cdm.model.common.Language;
19 import eu.etaxonomy.cdm.model.common.Representation;
20 import eu.etaxonomy.cdm.model.location.NamedArea;
21 import eu.etaxonomy.cdm.model.location.NamedAreaLevel;
22 import eu.etaxonomy.cdm.model.location.NamedAreaType;
23 import eu.etaxonomy.cdm.model.location.WaterbodyOrCountry;
24 import eu.etaxonomy.cdm.model.media.Media;
25
26
27 public interface IDefinedTermDao extends ICdmEntityDao<DefinedTermBase>, ITitledDao<DefinedTermBase>{
28
29 /**
30 * @param iso639 a two or three letter language code according to iso639-1 or iso639-2
31 * @return the Language or null
32 */
33 //TODO refactor typo:
34 public Language getLanguageByIso(String iso639);
35
36 public List<Language> getLanguagesByIso(List<String> iso639List);
37
38 public List<Language> getLanguagesByLocale(Enumeration<Locale> locales);
39
40 public WaterbodyOrCountry getCountryByIso(String iso639);
41
42 public <TYPE extends DefinedTermBase> List<TYPE> getDefinedTermByRepresentationText(String text, Class<TYPE> clazz );
43
44 /**
45 * Returns a List of Media that represent a given DefinedTerm instance
46 *
47 * @param definedTerm the definedTerm represented by these media
48 * @param pageSize The maximum number of media returned (can be null for all related media)
49 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
50 * @return a List of media instances
51 */
52 public List<Media> getMedia(DefinedTermBase definedTerm, Integer pageSize, Integer pageNumber);
53
54 /**
55 * Returns a count of the Media that represent a given
56 * DefinedTermBase instance
57 *
58 * @param definedTerm the definedTerm represented by these media
59 * @return a count of Media entities
60 */
61 public int countMedia(DefinedTermBase definedTerm);
62
63 /**
64 * Returns a List of NamedArea instances (optionally filtered by type or level)
65 *
66 * @param level restrict the result set to named areas of a certain level (can be null)
67 * @param type restrict the result set to named areas of a certain type (can be null)
68 * @param pageSize The maximum number of namedAreas returned (can be null for all named areas)
69 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
70 * @return a List of named areas
71 */
72 public List<NamedArea> list(NamedAreaLevel level, NamedAreaType type, Integer pageSize, Integer pageNumber);
73
74 /**
75 * Returns a count of NamedArea instances (optionally filtered by type or level)
76 *
77 * @param level restrict the result set to named areas of a certain level (can be null)
78 * @param type restrict the result set to named areas of a certain type (can be null)
79 * @return a count of named areas
80 */
81 public int count(NamedAreaLevel level, NamedAreaType type);
82
83 /**
84 * Return a list of terms which are specializations of a given definedTerm
85 *
86 * @param definedTerm The term which is a generalization of the terms returned
87 * @param pageSize The maximum number of terms returned (can be null for all specializations)
88 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
89 * @return a List of DefinedTerms
90 */
91 public <T extends DefinedTermBase> List<T> getGeneralizationOf(T definedTerm, Integer pageSize, Integer pageNumber);
92
93 /**
94 * Return a count of terms which are specializations of a given definedTerm
95 *
96 * @param definedTerm The term which is a generalization of the terms returned
97 * @return a count of DefinedTerms
98 */
99 public <T extends DefinedTermBase> int countGeneralizationOf(T definedTerm);
100
101 /**
102 * Return a List of distinct terms which include the terms supplied
103 *
104 * @param definedTerms the set of terms which are part of the terms of interest
105 * @param pageSize The maximum number of terms returned (can be null for all terms)
106 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
107 * @return a List of DefinedTerms
108 */
109 public <T extends DefinedTermBase> List<T> getPartOf(Set<T> definedTerms, Integer pageSize, Integer pageNumber);
110
111 /**
112 * Return a count of distinct terms which include the terms supplied
113 *
114 * @param definedTerms the set of terms which are part of the terms of interest
115 * @return a count of DefinedTerms
116 */
117 public <T extends DefinedTermBase> int countPartOf(Set<T> definedTerms);
118
119 /**
120 * Return a List of terms which are part of the terms supplied
121 *
122 * @param definedTerms the set of terms which include the terms of interest
123 * @param pageSize The maximum number of terms returned (can be null for all terms)
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> getIncludes(Set<T> definedTerms, Integer pageSize, Integer pageNumber);
128
129 /**
130 * Return a count of terms which are part of the terms supplied
131 *
132 * @param definedTerms the set of terms which include the terms of interest
133 * @return a count of DefinedTerms
134 */
135 public <T extends DefinedTermBase> int countIncludes(Set<T> definedTerms);
136 }