(no commit message)
[cdmlib.git] / cdmlib-persistence / src / main / java / eu / etaxonomy / cdm / persistence / dao / name / ITaxonNameDao.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 package eu.etaxonomy.cdm.persistence.dao.name;
10
11 import java.util.List;
12
13 import org.hibernate.criterion.Criterion;
14
15 import eu.etaxonomy.cdm.model.common.RelationshipBase;
16 import eu.etaxonomy.cdm.model.name.BotanicalName;
17 import eu.etaxonomy.cdm.model.name.HybridRelationship;
18 import eu.etaxonomy.cdm.model.name.HybridRelationshipType;
19 import eu.etaxonomy.cdm.model.name.NameRelationship;
20 import eu.etaxonomy.cdm.model.name.NameRelationshipType;
21 import eu.etaxonomy.cdm.model.name.Rank;
22 import eu.etaxonomy.cdm.model.name.TaxonNameBase;
23 import eu.etaxonomy.cdm.model.name.TypeDesignationBase;
24 import eu.etaxonomy.cdm.model.name.SpecimenTypeDesignationStatus;
25 import eu.etaxonomy.cdm.persistence.dao.BeanInitializer;
26 import eu.etaxonomy.cdm.persistence.dao.common.IIdentifiableDao;
27 import eu.etaxonomy.cdm.persistence.query.MatchMode;
28 import eu.etaxonomy.cdm.persistence.query.OrderHint;
29
30 /**
31 * @author a.mueller
32 *
33 */
34 public interface ITaxonNameDao extends IIdentifiableDao<TaxonNameBase> {
35
36 /**
37 * Return a count of names related to this name, optionally filtered by
38 * relationship type
39 *
40 * @param name
41 * the name
42 * @param type
43 * the relationship type (or null to return all relationships)
44 * @return a count of NameRelationship instances
45 */
46 public int countRelatedNames(TaxonNameBase name, NameRelationshipType type);
47
48 /**
49 * Return a List of relationships related to this name, optionally filtered
50 * by relationship type
51 *
52 * @param name
53 * the name
54 * @param type
55 * the relationship type (or null to return all relationships)
56 * @param pageSize
57 * The maximum number of relationships returned (can be null for
58 * all relationships)
59 * @param pageNumber
60 * The offset (in pageSize chunks) from the start of the result
61 * set (0 - based) of the result set (0 - based)
62 * @param orderHints may be null
63 * @param propertyPaths properties to initialize - see {@link BeanInitializer#initialize(Object, List)}
64 * @return a List of NameRelationship instances
65 */
66 public List<NameRelationship> getRelatedNames(TaxonNameBase name, NameRelationshipType type, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);
67
68 /**
69 * Return a count of hybrids related to this name, optionally filtered by
70 * hybrid relationship type
71 *
72 * @param name
73 * the name
74 * @param type
75 * the hybrid relationship type (or null to return all hybrid)
76 * @return a count of HybridRelationship instances
77 */
78 public int countHybridNames(BotanicalName name, HybridRelationshipType type);
79
80 /**
81 * Return a List of hybrids related to this name, optionally filtered by
82 * hybrid relationship type
83 *
84 * @param name
85 * the name
86 * @param type
87 * the hybrid relationship type (or null to return all hybrids)
88 * @param pageSize
89 * The maximum number of hybrid relationships returned (can be
90 * null for all relationships)
91 * @param pageNumber
92 * The offset (in pageSize chunks) from the start of the result
93 * set (0 - based)
94 * @return a List of HybridRelationship instances
95 */
96 public List<HybridRelationship> getHybridNames(BotanicalName name, HybridRelationshipType type, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);
97
98 /**
99 * Return a count of types related to this name, optionally filtered by type
100 * designation status
101 *
102 * @param name
103 * the name
104 * @param status
105 * the type designation status (or null to return all types)
106 * @return a count of TypeDesignationBase instances
107 */
108 public int countTypeDesignations(TaxonNameBase name,
109 SpecimenTypeDesignationStatus status);
110
111 /**
112 * Return a List of types related to this name, optionally filtered by type
113 * designation status
114 *
115 * @param name
116 * the name
117 * @param status
118 * the type designation status (or null to return all types)
119 * @param pageSize
120 * The maximum number of types returned (can be null for all
121 * types)
122 * @param pageNumber
123 * The offset (in pageSize chunks) from the start of the result
124 * set (0 - based)
125 * @return a List of TypeDesignationBase instances
126 */
127 public List<TypeDesignationBase> getTypeDesignations(TaxonNameBase name,
128 SpecimenTypeDesignationStatus status, Integer pageSize, Integer pageNumber);
129
130 /**
131 * Return a List of types related to this name, optionally filtered by type
132 * designation status
133 *
134 * @param name
135 * the name
136 * @param status
137 * the type designation status (or null to return all types)
138 * @param pageSize
139 * The maximum number of types returned (can be null for all
140 * types)
141 * @param pageNumber
142 * The offset (in pageSize chunks) from the start of the result
143 * set (0 - based)
144 * @param propertyPaths
145 * @return a List of TypeDesignationBase instances
146 */
147 public List<TypeDesignationBase> getTypeDesignations(TaxonNameBase name,
148 SpecimenTypeDesignationStatus status, Integer pageSize, Integer pageNumber,
149 List<String> propertyPaths);
150
151 /**
152 * Returns a List of TaxonNameBase instances that match the properties
153 * passed
154 *
155 * @param uninomial
156 * @param infraGenericEpithet
157 * @param specificEpithet
158 * @param infraspecificEpithet
159 * @param rank
160 * @param pageSize
161 * The maximum number of names returned (can be null for all
162 * names)
163 * @param pageNumber
164 * The offset (in pageSize chunks) from the start of the result
165 * set (0 - based)
166 * @return a List of TaxonNameBase instances
167 */
168 public List<TaxonNameBase> searchNames(String uninomial,
169 String infraGenericEpithet, String specificEpithet,
170 String infraspecificEpithet, Rank rank, Integer pageSize,
171 Integer pageNumber);
172
173 /**
174 * Returns a count of TaxonNameBase instances that match the properties
175 * passed
176 *
177 * @param uninomial
178 * @param infraGenericEpithet
179 * @param specificEpithet
180 * @param infraspecificEpithet
181 * @param rank
182 * @return a count of TaxonNameBase instances
183 */
184 public int countNames(String uninomial, String infraGenericEpithet,
185 String specificEpithet, String infraspecificEpithet, Rank rank);
186
187 /**
188 * Returns a List of TaxonNameBase instances which nameCache matches the
189 * query string
190 *
191 * @param queryString
192 * @param pageSize
193 * The maximum number of names returned (can be null for all
194 * names)
195 * @param pageNumber
196 * The offset (in pageSize chunks) from the start of the result
197 * set (0 - based)
198 * @return a List of TaxonNameBase instances
199 */
200 public List<TaxonNameBase<?, ?>> searchNames(String queryString,
201 Integer pageSize, Integer pageNumber);
202
203 /**
204 * Returns a count of TaxonNameBase instances which nameCache matches the
205 * String queryString
206 *
207 * @param queryString
208 * @return a count of TaxonNameBase instances
209 */
210 public int countNames(String queryString);
211
212 /**
213 * @param queryString
214 * @param matchmode
215 * @param pageSize
216 * @param pageNumber
217 * @param criteria
218 * @return
219 */
220 public List<? extends TaxonNameBase<?, ?>> findByName(String queryString,
221 MatchMode matchmode, Integer pageSize, Integer pageNumber,
222 List<Criterion> criteria);
223
224
225 /**
226 * @param queryString
227 * @param matchmode
228 * @param criteria
229 * @return
230 */
231 public Integer countByName(String queryString,
232 MatchMode matchmode, List<Criterion> criteria);
233
234 public List<RelationshipBase> getAllRelationships(Integer limit, Integer start);
235 }