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 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 = -2026847727392251534L; 061 062 // Generate 4 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 private String comments; 126 127 /** 128 * 129 * @return this.comments String 130 */ 131 public String getComments() 132 { 133 return this.comments; 134 } 135 136 /** 137 * 138 * @param commentsIn String 139 */ 140 public void setComments(String commentsIn) 141 { 142 this.comments = commentsIn; 143 } 144 145 // Generate 2 associations 146 private Status status; 147 148 /** 149 * Pour les données du référentiel, information permettant de déterminer si une donnée est 150 * valide, 151 * obsolète ou temporaire. 152 * - obsolète (=inactif) : '0' 153 * - valide (=actif) : '1' 154 * - temporaire : '2' 155 * - en cours de suppression : '3' 156 * - : '4' 157 * note : on a préfère ici 'valide' au terme 'actif' (utilisé dans Harmonie), pour ne pas 158 * confondre 159 * avec par exemple l'activité d'un navire sur un mois. 160 * @return this.status Status 161 */ 162 public Status getStatus() 163 { 164 return this.status; 165 } 166 167 /** 168 * Pour les données du référentiel, information permettant de déterminer si une donnée est 169 * valide, 170 * obsolète ou temporaire. 171 * - obsolète (=inactif) : '0' 172 * - valide (=actif) : '1' 173 * - temporaire : '2' 174 * - en cours de suppression : '3' 175 * - : '4' 176 * note : on a préfère ici 'valide' au terme 'actif' (utilisé dans Harmonie), pour ne pas 177 * confondre 178 * avec par exemple l'activité d'un navire sur un mois. 179 * @param statusIn Status 180 */ 181 public void setStatus(Status statusIn) 182 { 183 this.status = statusIn; 184 } 185 186 private Collection<ProcessingHistory> processingHistories = new HashSet<ProcessingHistory>(); 187 188 /** 189 * <html> 190 * <head> 191 * <style> 192 * p {padding:0px; margin:0px;} 193 * </style> 194 * </head> 195 * <body> 196 * <p> 197 * Historique des traitements, qu’il s’agisse de flux (comme historiquement 198 * la table HIS_FLUX) ou non (traitement d’agrégation, CQ auto, etc.). 199 * </p> 200 * <p> 201 * </p> 202 * <p style="font-family:Times New 203 * Roman,serif;margin-bottom:.0001pt;margin-left:0cm;margin-top:0cm;font-size:12.0pt;"> 204 * Permet donc de conserver l'historique des traitements qui se sont 205 * exécutés sur le système, notamment ceux qui ont impactés la base de 206 * données brutes (Adagio). 207 * </p> 208 * <p style="font-family:Times New 209 * Roman,serif;margin-bottom:.0001pt;margin-left:0cm;margin-top:0cm;font-size:12.0pt;"> 210 * </p> 211 * <p style="font-family:Times New 212 * Roman,serif;margin-bottom:.0001pt;margin-left:0cm;margin-top:0cm;font-size:12.0pt;"> 213 * L’exécution des traitements en erreur peuvent également être tracée. 214 * </p> 215 * </body> 216 * </html> 217 * @return this.processingHistories Collection<ProcessingHistory> 218 */ 219 public Collection<ProcessingHistory> getProcessingHistories() 220 { 221 return this.processingHistories; 222 } 223 224 /** 225 * <html> 226 * <head> 227 * <style> 228 * p {padding:0px; margin:0px;} 229 * </style> 230 * </head> 231 * <body> 232 * <p> 233 * Historique des traitements, qu’il s’agisse de flux (comme historiquement 234 * la table HIS_FLUX) ou non (traitement d’agrégation, CQ auto, etc.). 235 * </p> 236 * <p> 237 * </p> 238 * <p style="font-family:Times New 239 * Roman,serif;margin-bottom:.0001pt;margin-left:0cm;margin-top:0cm;font-size:12.0pt;"> 240 * Permet donc de conserver l'historique des traitements qui se sont 241 * exécutés sur le système, notamment ceux qui ont impactés la base de 242 * données brutes (Adagio). 243 * </p> 244 * <p style="font-family:Times New 245 * Roman,serif;margin-bottom:.0001pt;margin-left:0cm;margin-top:0cm;font-size:12.0pt;"> 246 * </p> 247 * <p style="font-family:Times New 248 * Roman,serif;margin-bottom:.0001pt;margin-left:0cm;margin-top:0cm;font-size:12.0pt;"> 249 * L’exécution des traitements en erreur peuvent également être tracée. 250 * </p> 251 * </body> 252 * </html> 253 * @param processingHistoriesIn Collection<ProcessingHistory> 254 */ 255 public void setProcessingHistories(Collection<ProcessingHistory> processingHistoriesIn) 256 { 257 this.processingHistories = processingHistoriesIn; 258 } 259 260 /** 261 * <html> 262 * <head> 263 * <style> 264 * p {padding:0px; margin:0px;} 265 * </style> 266 * </head> 267 * <body> 268 * <p> 269 * Historique des traitements, qu’il s’agisse de flux (comme historiquement 270 * la table HIS_FLUX) ou non (traitement d’agrégation, CQ auto, etc.). 271 * </p> 272 * <p> 273 * </p> 274 * <p style="font-family:Times New 275 * Roman,serif;margin-bottom:.0001pt;margin-left:0cm;margin-top:0cm;font-size:12.0pt;"> 276 * Permet donc de conserver l'historique des traitements qui se sont 277 * exécutés sur le système, notamment ceux qui ont impactés la base de 278 * données brutes (Adagio). 279 * </p> 280 * <p style="font-family:Times New 281 * Roman,serif;margin-bottom:.0001pt;margin-left:0cm;margin-top:0cm;font-size:12.0pt;"> 282 * </p> 283 * <p style="font-family:Times New 284 * Roman,serif;margin-bottom:.0001pt;margin-left:0cm;margin-top:0cm;font-size:12.0pt;"> 285 * L’exécution des traitements en erreur peuvent également être tracée. 286 * </p> 287 * </body> 288 * </html> 289 * @param elementToAdd ProcessingHistory 290 * @return <tt>true</tt> if this collection changed as a result of the 291 * call 292 */ 293 public boolean addProcessingHistories(ProcessingHistory elementToAdd) 294 { 295 return this.processingHistories.add(elementToAdd); 296 } 297 298 /** 299 * <html> 300 * <head> 301 * <style> 302 * p {padding:0px; margin:0px;} 303 * </style> 304 * </head> 305 * <body> 306 * <p> 307 * Historique des traitements, qu’il s’agisse de flux (comme historiquement 308 * la table HIS_FLUX) ou non (traitement d’agrégation, CQ auto, etc.). 309 * </p> 310 * <p> 311 * </p> 312 * <p style="font-family:Times New 313 * Roman,serif;margin-bottom:.0001pt;margin-left:0cm;margin-top:0cm;font-size:12.0pt;"> 314 * Permet donc de conserver l'historique des traitements qui se sont 315 * exécutés sur le système, notamment ceux qui ont impactés la base de 316 * données brutes (Adagio). 317 * </p> 318 * <p style="font-family:Times New 319 * Roman,serif;margin-bottom:.0001pt;margin-left:0cm;margin-top:0cm;font-size:12.0pt;"> 320 * </p> 321 * <p style="font-family:Times New 322 * Roman,serif;margin-bottom:.0001pt;margin-left:0cm;margin-top:0cm;font-size:12.0pt;"> 323 * L’exécution des traitements en erreur peuvent également être tracée. 324 * </p> 325 * </body> 326 * </html> 327 * @param elementToRemove ProcessingHistory 328 * @return <tt>true</tt> if this collection changed as a result of the 329 * call 330 */ 331 public boolean removeProcessingHistories(ProcessingHistory elementToRemove) 332 { 333 return this.processingHistories.remove(elementToRemove); 334 } 335 336 /** 337 * Returns <code>true</code> if the argument is an ProcessingStatus instance and all identifiers for this entity 338 * equal the identifiers of the argument entity. Returns <code>false</code> otherwise. 339 */ 340 @Override 341 public boolean equals(Object object) 342 { 343 if (this == object) 344 { 345 return true; 346 } 347 if (!(object instanceof ProcessingStatus)) 348 { 349 return false; 350 } 351 final ProcessingStatus that = (ProcessingStatus)object; 352 if (this.code == null || that.getCode() == null || !this.code.equals(that.getCode())) 353 { 354 return false; 355 } 356 return true; 357 } 358 359 /** 360 * Returns a hash code based on this entity's identifiers. 361 */ 362 @Override 363 public int hashCode() 364 { 365 int hashCode = 0; 366 hashCode = 29 * hashCode + (this.code == null ? 0 : this.code.hashCode()); 367 368 return hashCode; 369 } 370 371 /** 372 * Constructs new instances of {@link ProcessingStatus}. 373 */ 374 public static final class Factory 375 { 376 /** 377 * Constructs a new instance of {@link ProcessingStatus}. 378 * @return new ProcessingStatusImpl() 379 */ 380 public static ProcessingStatus newInstance() 381 { 382 return new ProcessingStatusImpl(); 383 } 384 385 /** 386 * Constructs a new instance of {@link ProcessingStatus}, taking all required and/or 387 * read-only properties as arguments, except for identifiers. 388 * @param name String 389 * @param updateDate Timestamp 390 * @param status Status 391 * @return newInstance 392 */ 393 public static ProcessingStatus newInstance(String name, Timestamp updateDate, Status status) 394 { 395 final ProcessingStatus entity = new ProcessingStatusImpl(); 396 entity.setName(name); 397 entity.setUpdateDate(updateDate); 398 entity.setStatus(status); 399 return entity; 400 } 401 402 /** 403 * Constructs a new instance of {@link ProcessingStatus}, taking all possible properties 404 * (except the identifier(s))as arguments. 405 * @param name String 406 * @param updateDate Timestamp 407 * @param comments String 408 * @param status Status 409 * @param processingHistories Collection<ProcessingHistory> 410 * @return newInstance ProcessingStatus 411 */ 412 public static ProcessingStatus newInstance(String name, Timestamp updateDate, String comments, Status status, Collection<ProcessingHistory> processingHistories) 413 { 414 final ProcessingStatus entity = new ProcessingStatusImpl(); 415 entity.setName(name); 416 entity.setUpdateDate(updateDate); 417 entity.setComments(comments); 418 entity.setStatus(status); 419 entity.setProcessingHistories(processingHistories); 420 return entity; 421 } 422 } 423 424 /** 425 * @see Comparable#compareTo 426 */ 427 public int compareTo(ProcessingStatus o) 428 { 429 int cmp = 0; 430 if (this.getCode() != null) 431 { 432 cmp = this.getCode().compareTo(o.getCode()); 433 } 434 else 435 { 436 if (this.getName() != null) 437 { 438 cmp = (cmp != 0 ? cmp : this.getName().compareTo(o.getName())); 439 } 440 if (this.getUpdateDate() != null) 441 { 442 cmp = (cmp != 0 ? cmp : this.getUpdateDate().compareTo(o.getUpdateDate())); 443 } 444 if (this.getComments() != null) 445 { 446 cmp = (cmp != 0 ? cmp : this.getComments().compareTo(o.getComments())); 447 } 448 } 449 return cmp; 450 } 451// HibernateEntity.vsl merge-point 452// ProcessingStatus.java merge-point 453}