1 // license-header java merge-point
2 //
3 // Attention: Generated code! Do not modify by hand!
4 // Generated by: SpringDao.vsl in andromda-spring-cartridge.
5 //
6 package fr.ifremer.quadrige3.core.dao.referential.taxon;
7
8 /*-
9 * #%L
10 * Quadrige3 Core :: Client API
11 * %%
12 * Copyright (C) 2017 - 2024 Ifremer
13 * %%
14 * This program is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Affero General Public License as published by
16 * the Free Software Foundation, either version 3 of the License, or
17 * (at your option) any later version.
18 *
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * You should have received a copy of the GNU Affero General Public License
25 * along with this program. If not, see <http://www.gnu.org/licenses/>.
26 * #L%
27 */
28 import fr.ifremer.quadrige3.core.dao.Search;
29 import java.util.Collection;
30 import java.util.Set;
31 import org.andromda.spring.PaginationResult;
32
33 /**
34 *
35 * @see VirtualComponent
36 */
37 public interface VirtualComponentDao
38 {
39 /**
40 * This constant is used as a transformation flag; entities can be converted automatically into value objects
41 * or other types, different methods in a class implementing this interface support this feature: look for
42 * an <code>int</code> parameter called <code>transform</code>.
43 * <p>
44 * This specific flag denotes no transformation will occur.
45 */
46 public static final int TRANSFORM_NONE = 0;
47
48
49 /**
50 * Transforms the given results to a collection of {@link VirtualComponent}
51 * instances (this is useful when the returned results contains a row of data and you want just entities only).
52 *
53 * @param results the query results.
54 */
55 public void toEntities(final Collection<?> results);
56
57 /**
58 * Gets an instance of VirtualComponent from the persistent store.
59 * @param virtualComponentPk
60 * @return VirtualComponent
61 */
62 public VirtualComponent get(VirtualComponentPK virtualComponentPk);
63
64 /**
65 * <p>
66 * Does the same thing as {@link #get(VirtualComponentPK)} with an
67 * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then
68 * the returned entity will <strong>NOT</strong> be transformed. If this flag is any of the other constants
69 * defined in this class then the result <strong>WILL BE</strong> passed through an operation which can
70 * optionally transform the entity (into a value object for example). By default, transformation does
71 * not occur.
72 * </p>
73 *
74 * @param transform flag to determine transformation type.
75 * @param virtualComponentPk the identifier of the entity to get.
76 * @return either the entity or the object transformed from the entity.
77 */
78 public Object get(int transform, VirtualComponentPK virtualComponentPk);
79
80 /**
81 * Loads an instance of VirtualComponent from the persistent store.
82 * @param virtualComponentPk
83 * @return VirtualComponent
84 */
85 public VirtualComponent load(VirtualComponentPK virtualComponentPk);
86
87 /**
88 * <p>
89 * Does the same thing as {@link #load(VirtualComponentPK)} with an
90 * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then
91 * the returned entity will <strong>NOT</strong> be transformed. If this flag is any of the other constants
92 * defined in this class then the result <strong>WILL BE</strong> passed through an operation which can
93 * optionally transform the entity (into a value object for example). By default, transformation does
94 * not occur.
95 * </p>
96 *
97 * @param transform flag to determine transformation type.
98 * @param virtualComponentPk the identifier of the entity to load.
99 * @return either the entity or the object transformed from the entity.
100 */
101 public Object load(int transform, VirtualComponentPK virtualComponentPk);
102
103 /**
104 * Loads all entities of type {@link VirtualComponent}.
105 *
106 * @return the loaded entities.
107 */
108 public Collection<VirtualComponent> loadAll();
109
110 /**
111 * <p>
112 * Does the same thing as {@link #loadAll()} with an
113 * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then
114 * the returned entity will <strong>NOT</strong> be transformed. If this flag is any of the other constants
115 * defined here then the result <strong>WILL BE</strong> passed through an operation which can optionally
116 * transform the entity (into a value object for example). By default, transformation does
117 * not occur.
118 * </p>
119 *
120 * @param transform the flag indicating what transformation to use.
121 * @return the loaded entities.
122 */
123 public Collection<?> loadAll(final int transform);
124
125 /**
126 * <p>
127 * Does the same thing as {@link #loadAll()} with an
128 * additional two arguments called <code>pageNumber</code> and <code>pageSize</code>. The <code>pageNumber</code>
129 * argument allows you to specify the page number when you are paging the results and the pageSize allows you to specify the size of the
130 * page retrieved.
131 * </p>
132 *
133 * @param pageNumber the page number to retrieve when paging results.
134 * @param pageSize the size of the page to retrieve when paging results.
135 * @return the loaded entities.
136 */
137 public Collection<?> loadAll(final int pageNumber, final int pageSize);
138
139 /**
140 * <p>
141 * Does the same thing as {@link #loadAll(int)} with an
142 * additional two arguments called <code>pageNumber</code> and <code>pageSize</code>. The <code>pageNumber</code>
143 * argument allows you to specify the page number when you are paging the results and the pageSize allows you to specify the size of the
144 * page retrieved.
145 * </p>
146 *
147 * @param transform the flag indicating what transformation to use.
148 * @param pageNumber the page number to retrieve when paging results.
149 * @param pageSize the size of the page to retrieve when paging results.
150 * @return the loaded entities.
151 */
152 public Collection<?> loadAll(final int transform, final int pageNumber, final int pageSize);
153
154 /**
155 * Creates an instance of VirtualComponent and adds it to the persistent store.
156 * @param virtualComponent
157 * @return VirtualComponent
158 */
159 public VirtualComponent create(VirtualComponent virtualComponent);
160
161 /**
162 * <p>
163 * Does the same thing as {@link #create(VirtualComponent)} with an
164 * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then
165 * the returned entity will <strong>NOT</strong> be transformed. If this flag is any of the other constants
166 * defined here then the result <strong>WILL BE</strong> passed through an operation which can optionally
167 * transform the entity (into a value object for example). By default, transformation does
168 * not occur.
169 * </p>
170 * @param transform
171 * @param virtualComponent
172 * @return Object
173 */
174 public Object create(int transform, VirtualComponent virtualComponent);
175
176 /**
177 * Creates a new instance of VirtualComponent and adds
178 * from the passed in <code>entities</code> collection
179 *
180 * @param entities the collection of VirtualComponent
181 * instances to create.
182 *
183 * @return the created instances.
184 */
185 public Collection<VirtualComponent> create(Collection<VirtualComponent> entities);
186
187 /**
188 * <p>
189 * Does the same thing as {@link #create(VirtualComponent)} with an
190 * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then
191 * the returned entity will <strong>NOT</strong> be transformed. If this flag is any of the other constants
192 * defined here then the result <strong>WILL BE</strong> passed through an operation which can optionally
193 * transform the entities (into value objects for example). By default, transformation does
194 * not occur.
195 * </p>
196 * @param transform
197 * @param entities
198 * @return Collection
199 */
200 public Collection<?> create(int transform, Collection<VirtualComponent> entities);
201
202 /**
203 * <p>
204 * Creates a new <code>VirtualComponent</code>
205 * instance from only <strong>required</strong> properties (attributes
206 * and association ends) and adds it to the persistent store.
207 * </p>
208 * @param referenceTaxon
209 * @param taxonName
210 * @return VirtualComponent
211 */
212 public VirtualComponent create(
213 ReferenceTaxon referenceTaxon,
214 TaxonName taxonName);
215
216 /**
217 * <p>
218 * Does the same thing as {@link #create()} with an
219 * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then
220 * the returned entity will <strong>NOT</strong> be transformed. If this flag is any of the other constants
221 * defined here then the result <strong>WILL BE</strong> passed through an operation which can optionally
222 * transform the entity (into a value object for example). By default, transformation does
223 * not occur.
224 * </p>
225 * @param transform flag to determine transformation type.
226 * @param referenceTaxon
227 * @param taxonName
228 * @return Object
229 */
230 public Object create(
231 int transform,
232 ReferenceTaxon referenceTaxon,
233 TaxonName taxonName);
234
235 /**
236 * Updates the <code>virtualComponent</code> instance in the persistent store.
237 * @param virtualComponent
238 */
239 public void update(VirtualComponent virtualComponent);
240
241 /**
242 * Updates all instances in the <code>entities</code> collection in the persistent store.
243 * @param entities
244 */
245 public void update(Collection<VirtualComponent> entities);
246
247 /**
248 * Removes the instance of VirtualComponent from the persistent store.
249 * @param virtualComponent
250 */
251 public void remove(VirtualComponent virtualComponent);
252
253 /**
254 * Removes the instance of VirtualComponent having the given
255 * <code>identifier</code> from the persistent store.
256 * @param virtualComponentPk
257 */
258 public void remove(VirtualComponentPK virtualComponentPk);
259
260 /**
261 * Removes all entities in the given <code>entities</code> collection.
262 * @param entities
263 */
264 public void remove(Collection<VirtualComponent> entities);
265
266
267 /**
268 * Does the same thing as {@link #search(int, Search)} but with an
269 * additional two flags called <code>pageNumber</code> and <code>pageSize</code>. These flags allow you to
270 * limit your data to a specified page number and size.
271 *
272 * @param transform the transformation flag.
273 * @param pageNumber the page number in the data to retrieve
274 * @param pageSize the size of the page to retrieve.
275 * @param search the search object which provides the search parameters and pagination specification.
276 * @return any found results from the search wrapped in a {@link PaginationResult} instance.
277 */
278 public PaginationResult search(final int transform, final int pageNumber, final int pageSize, final Search search);
279
280 /**
281 * Does the same thing as {@link #search(Search)} but with an
282 * additional two flags called <code>pageNumber</code> and <code>pageSize</code>. These flags allow you to
283 * limit your data to a specified page number and size.
284 *
285 * @param pageNumber the page number in the data to retrieve
286 * @param pageSize the size of the page to retrieve.
287 * @param search the search object which provides the search parameters and pagination specification.
288 * @return any found results from the search wrapped in a {@link PaginationResult} instance.
289 */
290 public PaginationResult search(final int pageNumber, final int pageSize, final Search search);
291
292 /**
293 * Does the same thing as {@link #search(Search)} but with an
294 * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then
295 * finder results will <strong>NOT</strong> be transformed during retrieval.
296 * If this flag is any of the other constants defined here
297 * then results <strong>WILL BE</strong> passed through an operation which can optionally
298 * transform the entities (into value objects for example). By default, transformation does
299 * not occur.
300 *
301 * @param transform the transformation flag.
302 * @param search the search object which provides the search parameters and pagination specification.
303 * @return any found results from the search.
304 */
305 public Set<?> search(final int transform, final Search search);
306
307 /**
308 * Performs a search using the parameters specified in the given <code>search</code> object.
309 *
310 * @param search the search object which provides the search parameters and pagination specification.
311 * @return any found results from the search.
312 */
313 public Set<VirtualComponent> search(final Search search);
314
315 /**
316 * Allows transformation of entities into value objects
317 * (or something else for that matter), when the <code>transform</code>
318 * flag is set to one of the constants defined in <code>fr.ifremer.quadrige3.core.dao.referential.taxon.VirtualComponentDao</code>, please note
319 * that the {@link #TRANSFORM_NONE} constant denotes no transformation, so the entity itself
320 * will be returned.
321 *
322 * If the integer argument value is unknown {@link #TRANSFORM_NONE} is assumed.
323 *
324 * @param transform one of the constants declared in {@link fr.ifremer.quadrige3.core.dao.referential.taxon.VirtualComponentDao}
325 * @param entity an entity that was found
326 * @return the transformed entity (i.e. new value object, etc)
327 * @see #transformEntities(int,Collection)
328 */
329 public Object transformEntity(final int transform, final VirtualComponent entity);
330
331 /**
332 * Transforms a collection of entities using the
333 * {@link #transformEntity(int,VirtualComponent)}
334 * method. This method does not instantiate a new collection.
335 * <p>
336 * This method is to be used internally only.
337 *
338 * @param transform one of the constants declared in <code>fr.ifremer.quadrige3.core.dao.referential.taxon.VirtualComponentDao</code>
339 * @param entities the collection of entities to transform
340 * @see #transformEntity(int,VirtualComponent)
341 */
342 public void transformEntities(final int transform, final Collection<?> entities);
343
344 // spring-dao merge-point
345 }