001// license-header java merge-point 002// 003// Attention: Generated code! Do not modify by hand! 004// Generated by: SpringDao.vsl in andromda-spring-cartridge. 005// 006package fr.ifremer.adagio.core.dao.administration.programStrategy; 007 008/* 009 * #%L 010 * SIH-Adagio :: Core 011 * $Id:$ 012 * $HeadURL:$ 013 * %% 014 * Copyright (C) 2012 - 2014 Ifremer 015 * %% 016 * This program is free software: you can redistribute it and/or modify 017 * it under the terms of the GNU Affero General Public License as published by 018 * the Free Software Foundation, either version 3 of the License, or 019 * (at your option) any later version. 020 * 021 * This program is distributed in the hope that it will be useful, 022 * but WITHOUT ANY WARRANTY; without even the implied warranty of 023 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 024 * GNU General Public License for more details. 025 * 026 * You should have received a copy of the GNU Affero General Public License 027 * along with this program. If not, see <http://www.gnu.org/licenses/>. 028 * #L% 029 */ 030 031import fr.ifremer.adagio.core.dao.Search; 032import fr.ifremer.adagio.core.dao.administration.user.Person; 033import java.sql.Timestamp; 034import java.util.Collection; 035import java.util.Date; 036import java.util.Set; 037import org.andromda.spring.PaginationResult; 038 039/** 040 * La stratégie définit a priori ce que devront être les données présentes dans le système de 041 * l'origine de la collecte des données. Il s'agit de la liste des paramètres à mesurer, ainsi que 042 * des méthodes préconisées pour chacun de ces paramètres. La stratégie permet ainsi d'aider à la 043 * saisie des données, en personnalisant les écrans, et facilite la consultation rapide du contenu 044 * théorique de la base. 045 * Par exemple, on pourra avoir les stratégies suivantes : 046 * - stratégie "échantillonnage pendant les marées observées" 047 * - stratégie "échantillonnage pendant les campagne à la mer" 048 * @see Strategy 049 */ 050public interface StrategyDao 051{ 052 /** 053 * This constant is used as a transformation flag; entities can be converted automatically into value objects 054 * or other types, different methods in a class implementing this interface support this feature: look for 055 * an <code>int</code> parameter called <code>transform</code>. 056 * <p> 057 * This specific flag denotes no transformation will occur. 058 */ 059 public static final int TRANSFORM_NONE = 0; 060 061 062 /** 063 * Transforms the given results to a collection of {@link Strategy} 064 * instances (this is useful when the returned results contains a row of data and you want just entities only). 065 * 066 * @param results the query results. 067 */ 068 public void toEntities(final Collection<?> results); 069 070 /** 071 * Gets an instance of Strategy from the persistent store. 072 * @param id 073 * @return Strategy 074 */ 075 public Strategy get(Integer id); 076 077 /** 078 * <p> 079 * Does the same thing as {@link #get(Integer)} with an 080 * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then 081 * the returned entity will <strong>NOT</strong> be transformed. If this flag is any of the other constants 082 * defined in this class then the result <strong>WILL BE</strong> passed through an operation which can 083 * optionally transform the entity (into a value object for example). By default, transformation does 084 * not occur. 085 * </p> 086 * 087 * @param transform flag to determine transformation type. 088 * @param id the identifier of the entity to get. 089 * @return either the entity or the object transformed from the entity. 090 */ 091 public Object get(int transform, Integer id); 092 093 /** 094 * Loads an instance of Strategy from the persistent store. 095 * @param id 096 * @return Strategy 097 */ 098 public Strategy load(Integer id); 099 100 /** 101 * <p> 102 * Does the same thing as {@link #load(Integer)} with an 103 * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then 104 * the returned entity will <strong>NOT</strong> be transformed. If this flag is any of the other constants 105 * defined in this class then the result <strong>WILL BE</strong> passed through an operation which can 106 * optionally transform the entity (into a value object for example). By default, transformation does 107 * not occur. 108 * </p> 109 * 110 * @param transform flag to determine transformation type. 111 * @param id the identifier of the entity to load. 112 * @return either the entity or the object transformed from the entity. 113 */ 114 public Object load(int transform, Integer id); 115 116 /** 117 * Loads all entities of type {@link Strategy}. 118 * 119 * @return the loaded entities. 120 */ 121 public Collection<Strategy> loadAll(); 122 123 /** 124 * <p> 125 * Does the same thing as {@link #loadAll()} with an 126 * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then 127 * the returned entity will <strong>NOT</strong> be transformed. If this flag is any of the other constants 128 * defined here then the result <strong>WILL BE</strong> passed through an operation which can optionally 129 * transform the entity (into a value object for example). By default, transformation does 130 * not occur. 131 * </p> 132 * 133 * @param transform the flag indicating what transformation to use. 134 * @return the loaded entities. 135 */ 136 public Collection<?> loadAll(final int transform); 137 138 /** 139 * <p> 140 * Does the same thing as {@link #loadAll()} with an 141 * additional two arguments called <code>pageNumber</code> and <code>pageSize</code>. The <code>pageNumber</code> 142 * 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 143 * page retrieved. 144 * </p> 145 * 146 * @param pageNumber the page number to retrieve when paging results. 147 * @param pageSize the size of the page to retrieve when paging results. 148 * @return the loaded entities. 149 */ 150 public Collection<?> loadAll(final int pageNumber, final int pageSize); 151 152 /** 153 * <p> 154 * Does the same thing as {@link #loadAll(int)} with an 155 * additional two arguments called <code>pageNumber</code> and <code>pageSize</code>. The <code>pageNumber</code> 156 * 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 157 * page retrieved. 158 * </p> 159 * 160 * @param transform the flag indicating what transformation to use. 161 * @param pageNumber the page number to retrieve when paging results. 162 * @param pageSize the size of the page to retrieve when paging results. 163 * @return the loaded entities. 164 */ 165 public Collection<?> loadAll(final int transform, final int pageNumber, final int pageSize); 166 167 /** 168 * Creates an instance of Strategy and adds it to the persistent store. 169 * @param strategy 170 * @return Strategy 171 */ 172 public Strategy create(Strategy strategy); 173 174 /** 175 * <p> 176 * Does the same thing as {@link #create(Strategy)} with an 177 * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then 178 * the returned entity will <strong>NOT</strong> be transformed. If this flag is any of the other constants 179 * defined here then the result <strong>WILL BE</strong> passed through an operation which can optionally 180 * transform the entity (into a value object for example). By default, transformation does 181 * not occur. 182 * </p> 183 * @param transform 184 * @param strategy 185 * @return Object 186 */ 187 public Object create(int transform, Strategy strategy); 188 189 /** 190 * Creates a new instance of Strategy and adds 191 * from the passed in <code>entities</code> collection 192 * 193 * @param entities the collection of Strategy 194 * instances to create. 195 * 196 * @return the created instances. 197 */ 198 public Collection<Strategy> create(Collection<Strategy> entities); 199 200 /** 201 * <p> 202 * Does the same thing as {@link #create(Strategy)} with an 203 * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then 204 * the returned entity will <strong>NOT</strong> be transformed. If this flag is any of the other constants 205 * defined here then the result <strong>WILL BE</strong> passed through an operation which can optionally 206 * transform the entities (into value objects for example). By default, transformation does 207 * not occur. 208 * </p> 209 * @param transform 210 * @param entities 211 * @return Collection 212 */ 213 public Collection<?> create(int transform, Collection<Strategy> entities); 214 215 /** 216 * <p> 217 * Creates a new <code>Strategy</code> 218 * instance from <strong>all</strong> attributes and adds it to 219 * the persistent store. 220 * </p> 221 * @param name 222 * @param description 223 * @param creationDate 224 * @param updateDate 225 * @return Strategy 226 */ 227 public Strategy create( 228 String name, 229 String description, 230 Date creationDate, 231 Timestamp updateDate); 232 233 /** 234 * <p> 235 * Does the same thing as {@link #create(String, String, Date, Timestamp)} with an 236 * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then 237 * the returned entity will <strong>NOT</strong> be transformed. If this flag is any of the other constants 238 * defined here then the result <strong>WILL BE</strong> passed through an operation which can optionally 239 * transform the entity (into a value object for example). By default, transformation does 240 * not occur. 241 * </p> 242 * @param transform 243 * @param name 244 * @param description 245 * @param creationDate 246 * @param updateDate 247 * @return Strategy 248 */ 249 public Object create( 250 int transform, 251 String name, 252 String description, 253 Date creationDate, 254 Timestamp updateDate); 255 256 /** 257 * <p> 258 * Creates a new <code>Strategy</code> 259 * instance from only <strong>required</strong> properties (attributes 260 * and association ends) and adds it to the persistent store. 261 * </p> 262 * @param creationDate 263 * @param description 264 * @param managersUsers 265 * @param name 266 * @param program 267 * @param updateDate 268 * @return Strategy 269 */ 270 public Strategy create( 271 Date creationDate, 272 String description, 273 Collection<Person> managersUsers, 274 String name, 275 Program program, 276 Timestamp updateDate); 277 278 /** 279 * <p> 280 * Does the same thing as {@link #create(String, String, Date, Timestamp)} with an 281 * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then 282 * the returned entity will <strong>NOT</strong> be transformed. If this flag is any of the other constants 283 * defined here then the result <strong>WILL BE</strong> passed through an operation which can optionally 284 * transform the entity (into a value object for example). By default, transformation does 285 * not occur. 286 * </p> 287 * @param transform flag to determine transformation type. 288 * @param creationDate 289 * @param description 290 * @param managersUsers 291 * @param name 292 * @param program 293 * @param updateDate 294 * @return Object 295 */ 296 public Object create( 297 int transform, 298 Date creationDate, 299 String description, 300 Collection<Person> managersUsers, 301 String name, 302 Program program, 303 Timestamp updateDate); 304 305 /** 306 * Updates the <code>strategy</code> instance in the persistent store. 307 * @param strategy 308 */ 309 public void update(Strategy strategy); 310 311 /** 312 * Updates all instances in the <code>entities</code> collection in the persistent store. 313 * @param entities 314 */ 315 public void update(Collection<Strategy> entities); 316 317 /** 318 * Removes the instance of Strategy from the persistent store. 319 * @param strategy 320 */ 321 public void remove(Strategy strategy); 322 323 /** 324 * Removes the instance of Strategy having the given 325 * <code>identifier</code> from the persistent store. 326 * @param id 327 */ 328 public void remove(Integer id); 329 330 /** 331 * Removes all entities in the given <code>entities</code> collection. 332 * @param entities 333 */ 334 public void remove(Collection<Strategy> entities); 335 336 337 /** 338 * Does the same thing as {@link #search(int, Search)} but with an 339 * additional two flags called <code>pageNumber</code> and <code>pageSize</code>. These flags allow you to 340 * limit your data to a specified page number and size. 341 * 342 * @param transform the transformation flag. 343 * @param pageNumber the page number in the data to retrieve 344 * @param pageSize the size of the page to retrieve. 345 * @param search the search object which provides the search parameters and pagination specification. 346 * @return any found results from the search wrapped in a {@link PaginationResult} instance. 347 */ 348 public PaginationResult search(final int transform, final int pageNumber, final int pageSize, final Search search); 349 350 /** 351 * Does the same thing as {@link #search(Search)} but with an 352 * additional two flags called <code>pageNumber</code> and <code>pageSize</code>. These flags allow you to 353 * limit your data to a specified page number and size. 354 * 355 * @param pageNumber the page number in the data to retrieve 356 * @param pageSize the size of the page to retrieve. 357 * @param search the search object which provides the search parameters and pagination specification. 358 * @return any found results from the search wrapped in a {@link PaginationResult} instance. 359 */ 360 public PaginationResult search(final int pageNumber, final int pageSize, final Search search); 361 362 /** 363 * Does the same thing as {@link #search(Search)} but with an 364 * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then 365 * finder results will <strong>NOT</strong> be transformed during retrieval. 366 * If this flag is any of the other constants defined here 367 * then results <strong>WILL BE</strong> passed through an operation which can optionally 368 * transform the entities (into value objects for example). By default, transformation does 369 * not occur. 370 * 371 * @param transform the transformation flag. 372 * @param search the search object which provides the search parameters and pagination specification. 373 * @return any found results from the search. 374 */ 375 public Set<?> search(final int transform, final Search search); 376 377 /** 378 * Performs a search using the parameters specified in the given <code>search</code> object. 379 * 380 * @param search the search object which provides the search parameters and pagination specification. 381 * @return any found results from the search. 382 */ 383 public Set<Strategy> search(final Search search); 384 385 /** 386 * Allows transformation of entities into value objects 387 * (or something else for that matter), when the <code>transform</code> 388 * flag is set to one of the constants defined in <code>fr.ifremer.adagio.core.dao.administration.programStrategy.StrategyDao</code>, please note 389 * that the {@link #TRANSFORM_NONE} constant denotes no transformation, so the entity itself 390 * will be returned. 391 * 392 * If the integer argument value is unknown {@link #TRANSFORM_NONE} is assumed. 393 * 394 * @param transform one of the constants declared in {@link fr.ifremer.adagio.core.dao.administration.programStrategy.StrategyDao} 395 * @param entity an entity that was found 396 * @return the transformed entity (i.e. new value object, etc) 397 * @see #transformEntities(int,Collection) 398 */ 399 public Object transformEntity(final int transform, final Strategy entity); 400 401 /** 402 * Transforms a collection of entities using the 403 * {@link #transformEntity(int,Strategy)} 404 * method. This method does not instantiate a new collection. 405 * <p> 406 * This method is to be used internally only. 407 * 408 * @param transform one of the constants declared in <code>fr.ifremer.adagio.core.dao.administration.programStrategy.StrategyDao</code> 409 * @param entities the collection of entities to transform 410 * @see #transformEntity(int,Strategy) 411 */ 412 public void transformEntities(final int transform, final Collection<?> entities); 413 414 // spring-dao merge-point 415}