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.referential; 007 008/* 009 * #%L 010 * SIH-Adagio :: Core for Allegro 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 java.util.Collection; 033import java.util.Set; 034import org.andromda.spring.PaginationResult; 035 036/** 037 * Pour les données du référentiel, information permettant de déterminer si une donnée est valide, 038 * obsolète ou temporaire. 039 * - obsolète (=inactif) : '0' 040 * - valide (=actif) : '1' 041 * - temporaire : '2' 042 * note : on a préfère ici 'valide' au terme 'actif' (utilisé dans Harmonie), pour ne pas confondre 043 * avec par exemple l'activité d'un navire sur un mois. 044 * @see Status 045 */ 046public interface StatusDao 047{ 048 /** 049 * This constant is used as a transformation flag; entities can be converted automatically into value objects 050 * or other types, different methods in a class implementing this interface support this feature: look for 051 * an <code>int</code> parameter called <code>transform</code>. 052 * <p> 053 * This specific flag denotes no transformation will occur. 054 */ 055 public static final int TRANSFORM_NONE = 0; 056 057 058 /** 059 * Transforms the given results to a collection of {@link Status} 060 * instances (this is useful when the returned results contains a row of data and you want just entities only). 061 * 062 * @param results the query results. 063 */ 064 public void toEntities(final Collection<?> results); 065 066 /** 067 * Gets an instance of Status from the persistent store. 068 * @param code 069 * @return Status 070 */ 071 public Status get(String code); 072 073 /** 074 * <p> 075 * Does the same thing as {@link #get(String)} with an 076 * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then 077 * the returned entity will <strong>NOT</strong> be transformed. If this flag is any of the other constants 078 * defined in this class then the result <strong>WILL BE</strong> passed through an operation which can 079 * optionally transform the entity (into a value object for example). By default, transformation does 080 * not occur. 081 * </p> 082 * 083 * @param transform flag to determine transformation type. 084 * @param code the identifier of the entity to get. 085 * @return either the entity or the object transformed from the entity. 086 */ 087 public Object get(int transform, String code); 088 089 /** 090 * Loads an instance of Status from the persistent store. 091 * @param code 092 * @return Status 093 */ 094 public Status load(String code); 095 096 /** 097 * <p> 098 * Does the same thing as {@link #load(String)} with an 099 * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then 100 * the returned entity will <strong>NOT</strong> be transformed. If this flag is any of the other constants 101 * defined in this class then the result <strong>WILL BE</strong> passed through an operation which can 102 * optionally transform the entity (into a value object for example). By default, transformation does 103 * not occur. 104 * </p> 105 * 106 * @param transform flag to determine transformation type. 107 * @param code the identifier of the entity to load. 108 * @return either the entity or the object transformed from the entity. 109 */ 110 public Object load(int transform, String code); 111 112 /** 113 * Loads all entities of type {@link Status}. 114 * 115 * @return the loaded entities. 116 */ 117 public Collection<Status> loadAll(); 118 119 /** 120 * <p> 121 * Does the same thing as {@link #loadAll()} with an 122 * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then 123 * the returned entity will <strong>NOT</strong> be transformed. If this flag is any of the other constants 124 * defined here then the result <strong>WILL BE</strong> passed through an operation which can optionally 125 * transform the entity (into a value object for example). By default, transformation does 126 * not occur. 127 * </p> 128 * 129 * @param transform the flag indicating what transformation to use. 130 * @return the loaded entities. 131 */ 132 public Collection<?> loadAll(final int transform); 133 134 /** 135 * <p> 136 * Does the same thing as {@link #loadAll()} with an 137 * additional two arguments called <code>pageNumber</code> and <code>pageSize</code>. The <code>pageNumber</code> 138 * 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 139 * page retrieved. 140 * </p> 141 * 142 * @param pageNumber the page number to retrieve when paging results. 143 * @param pageSize the size of the page to retrieve when paging results. 144 * @return the loaded entities. 145 */ 146 public Collection<?> loadAll(final int pageNumber, final int pageSize); 147 148 /** 149 * <p> 150 * Does the same thing as {@link #loadAll(int)} with an 151 * additional two arguments called <code>pageNumber</code> and <code>pageSize</code>. The <code>pageNumber</code> 152 * 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 153 * page retrieved. 154 * </p> 155 * 156 * @param transform the flag indicating what transformation to use. 157 * @param pageNumber the page number to retrieve when paging results. 158 * @param pageSize the size of the page to retrieve when paging results. 159 * @return the loaded entities. 160 */ 161 public Collection<?> loadAll(final int transform, final int pageNumber, final int pageSize); 162 163 /** 164 * Creates an instance of Status and adds it to the persistent store. 165 * @param status 166 * @return Status 167 */ 168 public Status create(Status status); 169 170 /** 171 * <p> 172 * Does the same thing as {@link #create(Status)} with an 173 * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then 174 * the returned entity will <strong>NOT</strong> be transformed. If this flag is any of the other constants 175 * defined here then the result <strong>WILL BE</strong> passed through an operation which can optionally 176 * transform the entity (into a value object for example). By default, transformation does 177 * not occur. 178 * </p> 179 * @param transform 180 * @param status 181 * @return Object 182 */ 183 public Object create(int transform, Status status); 184 185 /** 186 * Creates a new instance of Status and adds 187 * from the passed in <code>entities</code> collection 188 * 189 * @param entities the collection of Status 190 * instances to create. 191 * 192 * @return the created instances. 193 */ 194 public Collection<Status> create(Collection<Status> entities); 195 196 /** 197 * <p> 198 * Does the same thing as {@link #create(Status)} with an 199 * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then 200 * the returned entity will <strong>NOT</strong> be transformed. If this flag is any of the other constants 201 * defined here then the result <strong>WILL BE</strong> passed through an operation which can optionally 202 * transform the entities (into value objects for example). By default, transformation does 203 * not occur. 204 * </p> 205 * @param transform 206 * @param entities 207 * @return Collection 208 */ 209 public Collection<?> create(int transform, Collection<Status> entities); 210 211 /** 212 * <p> 213 * Creates a new <code>Status</code> 214 * instance from <strong>all</strong> attributes and adds it to 215 * the persistent store. 216 * </p> 217 * @param code 218 * @param name 219 * @return Status 220 */ 221 public Status create( 222 String code, 223 String name); 224 225 /** 226 * <p> 227 * Does the same thing as {@link #create(String)} with an 228 * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then 229 * the returned entity will <strong>NOT</strong> be transformed. If this flag is any of the other constants 230 * defined here then the result <strong>WILL BE</strong> passed through an operation which can optionally 231 * transform the entity (into a value object for example). By default, transformation does 232 * not occur. 233 * </p> 234 * @param transform 235 * @param code 236 * @param name 237 * @return Status 238 */ 239 public Object create( 240 int transform, 241 String code, 242 String name); 243 244 245 /** 246 * Updates the <code>status</code> instance in the persistent store. 247 * @param status 248 */ 249 public void update(Status status); 250 251 /** 252 * Updates all instances in the <code>entities</code> collection in the persistent store. 253 * @param entities 254 */ 255 public void update(Collection<Status> entities); 256 257 /** 258 * Removes the instance of Status from the persistent store. 259 * @param status 260 */ 261 public void remove(Status status); 262 263 /** 264 * Removes the instance of Status having the given 265 * <code>identifier</code> from the persistent store. 266 * @param code 267 */ 268 public void remove(String code); 269 270 /** 271 * Removes all entities in the given <code>entities</code> collection. 272 * @param entities 273 */ 274 public void remove(Collection<Status> entities); 275 276 277 /** 278 * Does the same thing as {@link #search(int, Search)} but with an 279 * additional two flags called <code>pageNumber</code> and <code>pageSize</code>. These flags allow you to 280 * limit your data to a specified page number and size. 281 * 282 * @param transform the transformation flag. 283 * @param pageNumber the page number in the data to retrieve 284 * @param pageSize the size of the page to retrieve. 285 * @param search the search object which provides the search parameters and pagination specification. 286 * @return any found results from the search wrapped in a {@link PaginationResult} instance. 287 */ 288 public PaginationResult search(final int transform, final int pageNumber, final int pageSize, final Search search); 289 290 /** 291 * Does the same thing as {@link #search(Search)} but with an 292 * additional two flags called <code>pageNumber</code> and <code>pageSize</code>. These flags allow you to 293 * limit your data to a specified page number and size. 294 * 295 * @param pageNumber the page number in the data to retrieve 296 * @param pageSize the size of the page to retrieve. 297 * @param search the search object which provides the search parameters and pagination specification. 298 * @return any found results from the search wrapped in a {@link PaginationResult} instance. 299 */ 300 public PaginationResult search(final int pageNumber, final int pageSize, final Search search); 301 302 /** 303 * Does the same thing as {@link #search(Search)} but with an 304 * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then 305 * finder results will <strong>NOT</strong> be transformed during retrieval. 306 * If this flag is any of the other constants defined here 307 * then results <strong>WILL BE</strong> passed through an operation which can optionally 308 * transform the entities (into value objects for example). By default, transformation does 309 * not occur. 310 * 311 * @param transform the transformation flag. 312 * @param search the search object which provides the search parameters and pagination specification. 313 * @return any found results from the search. 314 */ 315 public Set<?> search(final int transform, final Search search); 316 317 /** 318 * Performs a search using the parameters specified in the given <code>search</code> object. 319 * 320 * @param search the search object which provides the search parameters and pagination specification. 321 * @return any found results from the search. 322 */ 323 public Set<Status> search(final Search search); 324 325 /** 326 * Allows transformation of entities into value objects 327 * (or something else for that matter), when the <code>transform</code> 328 * flag is set to one of the constants defined in <code>fr.ifremer.adagio.core.dao.referential.StatusDao</code>, please note 329 * that the {@link #TRANSFORM_NONE} constant denotes no transformation, so the entity itself 330 * will be returned. 331 * 332 * If the integer argument value is unknown {@link #TRANSFORM_NONE} is assumed. 333 * 334 * @param transform one of the constants declared in {@link fr.ifremer.adagio.core.dao.referential.StatusDao} 335 * @param entity an entity that was found 336 * @return the transformed entity (i.e. new value object, etc) 337 * @see #transformEntities(int,Collection) 338 */ 339 public Object transformEntity(final int transform, final Status entity); 340 341 /** 342 * Transforms a collection of entities using the 343 * {@link #transformEntity(int,Status)} 344 * method. This method does not instantiate a new collection. 345 * <p> 346 * This method is to be used internally only. 347 * 348 * @param transform one of the constants declared in <code>fr.ifremer.adagio.core.dao.referential.StatusDao</code> 349 * @param entities the collection of entities to transform 350 * @see #transformEntity(int,Status) 351 */ 352 public void transformEntities(final int transform, final Collection<?> entities); 353 354 // spring-dao merge-point 355}