001// license-header java merge-point 002// 003// Attention: Generated code! Do not modify by hand! 004// Generated by: hibernate/HibernateEntity.vsl in andromda-hibernate-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.data.history.ProcessingHistory; 032import java.io.Serializable; 033import java.sql.Timestamp; 034import java.util.Collection; 035import java.util.HashSet; 036 037/** 038 * <html> 039 * <head> 040 * </head> 041 * <body> 042 * <p> 043 * Etat d'un traitement. 044 * </p> 045 * <p> 046 * </p> 047 * <p> 048 * Par exemple :<br>- succès<br>- échec<br>- etc. 049 * </p> 050 * </body> 051 * </html> 052 */ 053// HibernateEntity.vsl annotations merge-point 054public abstract class ProcessingStatus 055 implements Serializable, Comparable<ProcessingStatus> 056{ 057 /** 058 * The serial version UID of this class. Needed for serialization. 059 */ 060 private static final long serialVersionUID = -1760311780122299188L; 061 062 // Generate 3 attributes 063 private String code; 064 065 /** 066 * Code de l'état d'un traitement. 067 * Gébnéralement, parmi : SUCCESS, ERROR, WARNING, etc. 068 * @return this.code String 069 */ 070 public String getCode() 071 { 072 return this.code; 073 } 074 075 /** 076 * Code de l'état d'un traitement. 077 * Gébnéralement, parmi : SUCCESS, ERROR, WARNING, etc. 078 * @param codeIn String 079 */ 080 public void setCode(String codeIn) 081 { 082 this.code = codeIn; 083 } 084 085 private String name; 086 087 /** 088 * Libellé de l'état d'execution d'un traitement 089 * @return this.name String 090 */ 091 public String getName() 092 { 093 return this.name; 094 } 095 096 /** 097 * Libellé de l'état d'execution d'un traitement 098 * @param nameIn String 099 */ 100 public void setName(String nameIn) 101 { 102 this.name = nameIn; 103 } 104 105 private Timestamp updateDate; 106 107 /** 108 * 109 * @return this.updateDate Timestamp 110 */ 111 public Timestamp getUpdateDate() 112 { 113 return this.updateDate; 114 } 115 116 /** 117 * 118 * @param updateDateIn Timestamp 119 */ 120 public void setUpdateDate(Timestamp updateDateIn) 121 { 122 this.updateDate = updateDateIn; 123 } 124 125 // Generate 2 associations 126 private Status status; 127 128 /** 129 * Pour les données du référentiel, information permettant de déterminer si une donnée est 130 * valide, 131 * obsolète ou temporaire. 132 * - obsolète (=inactif) : '0' 133 * - valide (=actif) : '1' 134 * - temporaire : '2' 135 * note : on a préfère ici 'valide' au terme 'actif' (utilisé dans Harmonie), pour ne pas 136 * confondre 137 * avec par exemple l'activité d'un navire sur un mois. 138 * @return this.status Status 139 */ 140 public Status getStatus() 141 { 142 return this.status; 143 } 144 145 /** 146 * Pour les données du référentiel, information permettant de déterminer si une donnée est 147 * valide, 148 * obsolète ou temporaire. 149 * - obsolète (=inactif) : '0' 150 * - valide (=actif) : '1' 151 * - temporaire : '2' 152 * note : on a préfère ici 'valide' au terme 'actif' (utilisé dans Harmonie), pour ne pas 153 * confondre 154 * avec par exemple l'activité d'un navire sur un mois. 155 * @param statusIn Status 156 */ 157 public void setStatus(Status statusIn) 158 { 159 this.status = statusIn; 160 } 161 162 private Collection<ProcessingHistory> processingHistories = new HashSet<ProcessingHistory>(); 163 164 /** 165 * <html> 166 * <head> 167 * <style> 168 * p {padding:0px; margin:0px;} 169 * </style> 170 * </head> 171 * <body> 172 * <p> 173 * Historique des traitements, qu’il s’agisse de flux (comme historiquement 174 * la table HIS_FLUX) ou non (traitement d’agrégation, CQ auto, etc.). 175 * </p> 176 * <p> 177 * </p> 178 * <p style="font-family:Times New 179 * Roman,serif;margin-bottom:.0001pt;margin-left:0cm;margin-top:0cm;font-size:12.0pt;"> 180 * Permet donc de conserver l'historique des traitements qui se sont 181 * exécutés sur le système, notamment ceux qui ont impactés la base de 182 * données brutes (Adagio). 183 * </p> 184 * <p style="font-family:Times New 185 * Roman,serif;margin-bottom:.0001pt;margin-left:0cm;margin-top:0cm;font-size:12.0pt;"> 186 * </p> 187 * <p style="font-family:Times New 188 * Roman,serif;margin-bottom:.0001pt;margin-left:0cm;margin-top:0cm;font-size:12.0pt;"> 189 * L’exécution des traitements en erreur peuvent également être tracée. 190 * </p> 191 * </body> 192 * </html> 193 * @return this.processingHistories Collection<ProcessingHistory> 194 */ 195 public Collection<ProcessingHistory> getProcessingHistories() 196 { 197 return this.processingHistories; 198 } 199 200 /** 201 * <html> 202 * <head> 203 * <style> 204 * p {padding:0px; margin:0px;} 205 * </style> 206 * </head> 207 * <body> 208 * <p> 209 * Historique des traitements, qu’il s’agisse de flux (comme historiquement 210 * la table HIS_FLUX) ou non (traitement d’agrégation, CQ auto, etc.). 211 * </p> 212 * <p> 213 * </p> 214 * <p style="font-family:Times New 215 * Roman,serif;margin-bottom:.0001pt;margin-left:0cm;margin-top:0cm;font-size:12.0pt;"> 216 * Permet donc de conserver l'historique des traitements qui se sont 217 * exécutés sur le système, notamment ceux qui ont impactés la base de 218 * données brutes (Adagio). 219 * </p> 220 * <p style="font-family:Times New 221 * Roman,serif;margin-bottom:.0001pt;margin-left:0cm;margin-top:0cm;font-size:12.0pt;"> 222 * </p> 223 * <p style="font-family:Times New 224 * Roman,serif;margin-bottom:.0001pt;margin-left:0cm;margin-top:0cm;font-size:12.0pt;"> 225 * L’exécution des traitements en erreur peuvent également être tracée. 226 * </p> 227 * </body> 228 * </html> 229 * @param processingHistoriesIn Collection<ProcessingHistory> 230 */ 231 public void setProcessingHistories(Collection<ProcessingHistory> processingHistoriesIn) 232 { 233 this.processingHistories = processingHistoriesIn; 234 } 235 236 /** 237 * <html> 238 * <head> 239 * <style> 240 * p {padding:0px; margin:0px;} 241 * </style> 242 * </head> 243 * <body> 244 * <p> 245 * Historique des traitements, qu’il s’agisse de flux (comme historiquement 246 * la table HIS_FLUX) ou non (traitement d’agrégation, CQ auto, etc.). 247 * </p> 248 * <p> 249 * </p> 250 * <p style="font-family:Times New 251 * Roman,serif;margin-bottom:.0001pt;margin-left:0cm;margin-top:0cm;font-size:12.0pt;"> 252 * Permet donc de conserver l'historique des traitements qui se sont 253 * exécutés sur le système, notamment ceux qui ont impactés la base de 254 * données brutes (Adagio). 255 * </p> 256 * <p style="font-family:Times New 257 * Roman,serif;margin-bottom:.0001pt;margin-left:0cm;margin-top:0cm;font-size:12.0pt;"> 258 * </p> 259 * <p style="font-family:Times New 260 * Roman,serif;margin-bottom:.0001pt;margin-left:0cm;margin-top:0cm;font-size:12.0pt;"> 261 * L’exécution des traitements en erreur peuvent également être tracée. 262 * </p> 263 * </body> 264 * </html> 265 * @param elementToAdd ProcessingHistory 266 * @return <tt>true</tt> if this collection changed as a result of the 267 * call 268 */ 269 public boolean addProcessingHistories(ProcessingHistory elementToAdd) 270 { 271 return this.processingHistories.add(elementToAdd); 272 } 273 274 /** 275 * <html> 276 * <head> 277 * <style> 278 * p {padding:0px; margin:0px;} 279 * </style> 280 * </head> 281 * <body> 282 * <p> 283 * Historique des traitements, qu’il s’agisse de flux (comme historiquement 284 * la table HIS_FLUX) ou non (traitement d’agrégation, CQ auto, etc.). 285 * </p> 286 * <p> 287 * </p> 288 * <p style="font-family:Times New 289 * Roman,serif;margin-bottom:.0001pt;margin-left:0cm;margin-top:0cm;font-size:12.0pt;"> 290 * Permet donc de conserver l'historique des traitements qui se sont 291 * exécutés sur le système, notamment ceux qui ont impactés la base de 292 * données brutes (Adagio). 293 * </p> 294 * <p style="font-family:Times New 295 * Roman,serif;margin-bottom:.0001pt;margin-left:0cm;margin-top:0cm;font-size:12.0pt;"> 296 * </p> 297 * <p style="font-family:Times New 298 * Roman,serif;margin-bottom:.0001pt;margin-left:0cm;margin-top:0cm;font-size:12.0pt;"> 299 * L’exécution des traitements en erreur peuvent également être tracée. 300 * </p> 301 * </body> 302 * </html> 303 * @param elementToRemove ProcessingHistory 304 * @return <tt>true</tt> if this collection changed as a result of the 305 * call 306 */ 307 public boolean removeProcessingHistories(ProcessingHistory elementToRemove) 308 { 309 return this.processingHistories.remove(elementToRemove); 310 } 311 312 /** 313 * Returns <code>true</code> if the argument is an ProcessingStatus instance and all identifiers for this entity 314 * equal the identifiers of the argument entity. Returns <code>false</code> otherwise. 315 */ 316 @Override 317 public boolean equals(Object object) 318 { 319 if (this == object) 320 { 321 return true; 322 } 323 if (!(object instanceof ProcessingStatus)) 324 { 325 return false; 326 } 327 final ProcessingStatus that = (ProcessingStatus)object; 328 if (this.code == null || that.getCode() == null || !this.code.equals(that.getCode())) 329 { 330 return false; 331 } 332 return true; 333 } 334 335 /** 336 * Returns a hash code based on this entity's identifiers. 337 */ 338 @Override 339 public int hashCode() 340 { 341 int hashCode = 0; 342 hashCode = 29 * hashCode + (this.code == null ? 0 : this.code.hashCode()); 343 344 return hashCode; 345 } 346 347 /** 348 * Constructs new instances of {@link ProcessingStatus}. 349 */ 350 public static final class Factory 351 { 352 /** 353 * Constructs a new instance of {@link ProcessingStatus}. 354 * @return new ProcessingStatusImpl() 355 */ 356 public static ProcessingStatus newInstance() 357 { 358 return new ProcessingStatusImpl(); 359 } 360 361 /** 362 * Constructs a new instance of {@link ProcessingStatus}, taking all required and/or 363 * read-only properties as arguments, except for identifiers. 364 * @param name String 365 * @param status Status 366 * @return newInstance 367 */ 368 public static ProcessingStatus newInstance(String name, Status status) 369 { 370 final ProcessingStatus entity = new ProcessingStatusImpl(); 371 entity.setName(name); 372 entity.setStatus(status); 373 return entity; 374 } 375 376 /** 377 * Constructs a new instance of {@link ProcessingStatus}, taking all possible properties 378 * (except the identifier(s))as arguments. 379 * @param name String 380 * @param updateDate Timestamp 381 * @param status Status 382 * @param processingHistories Collection<ProcessingHistory> 383 * @return newInstance ProcessingStatus 384 */ 385 public static ProcessingStatus newInstance(String name, Timestamp updateDate, Status status, Collection<ProcessingHistory> processingHistories) 386 { 387 final ProcessingStatus entity = new ProcessingStatusImpl(); 388 entity.setName(name); 389 entity.setUpdateDate(updateDate); 390 entity.setStatus(status); 391 entity.setProcessingHistories(processingHistories); 392 return entity; 393 } 394 } 395 396 /** 397 * @see Comparable#compareTo 398 */ 399 public int compareTo(ProcessingStatus o) 400 { 401 int cmp = 0; 402 if (this.getCode() != null) 403 { 404 cmp = this.getCode().compareTo(o.getCode()); 405 } 406 else 407 { 408 if (this.getName() != null) 409 { 410 cmp = (cmp != 0 ? cmp : this.getName().compareTo(o.getName())); 411 } 412 if (this.getUpdateDate() != null) 413 { 414 cmp = (cmp != 0 ? cmp : this.getUpdateDate().compareTo(o.getUpdateDate())); 415 } 416 } 417 return cmp; 418 } 419// HibernateEntity.vsl merge-point 420// ProcessingStatus.java merge-point 421}