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.pmfm; 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.referential.Status; 032import java.io.Serializable; 033import java.sql.Timestamp; 034import java.util.Date; 035 036/** 037 * Unité d'une mesure. 038 * Nombre de lignes : 30 039 */ 040// HibernateEntity.vsl annotations merge-point 041public abstract class Unit 042 implements Serializable, Comparable<Unit> 043{ 044 /** 045 * The serial version UID of this class. Needed for serialization. 046 */ 047 private static final long serialVersionUID = -8401207792754239624L; 048 049 // Generate 5 attributes 050 private Integer id; 051 052 /** 053 * Idenfiant interne. Généré par le système. 054 * @return this.id Integer 055 */ 056 public Integer getId() 057 { 058 return this.id; 059 } 060 061 /** 062 * Idenfiant interne. Généré par le système. 063 * @param idIn Integer 064 */ 065 public void setId(Integer idIn) 066 { 067 this.id = idIn; 068 } 069 070 private String symbol; 071 072 /** 073 * 074 * @return this.symbol String 075 */ 076 public String getSymbol() 077 { 078 return this.symbol; 079 } 080 081 /** 082 * 083 * @param symbolIn String 084 */ 085 public void setSymbol(String symbolIn) 086 { 087 this.symbol = symbolIn; 088 } 089 090 private String name; 091 092 /** 093 * 094 * @return this.name String 095 */ 096 public String getName() 097 { 098 return this.name; 099 } 100 101 /** 102 * 103 * @param nameIn String 104 */ 105 public void setName(String nameIn) 106 { 107 this.name = nameIn; 108 } 109 110 private Date creationDate; 111 112 /** 113 * 114 * @return this.creationDate Date 115 */ 116 public Date getCreationDate() 117 { 118 return this.creationDate; 119 } 120 121 /** 122 * 123 * @param creationDateIn Date 124 */ 125 public void setCreationDate(Date creationDateIn) 126 { 127 this.creationDate = creationDateIn; 128 } 129 130 private Timestamp updateDate; 131 132 /** 133 * 134 * @return this.updateDate Timestamp 135 */ 136 public Timestamp getUpdateDate() 137 { 138 return this.updateDate; 139 } 140 141 /** 142 * 143 * @param updateDateIn Timestamp 144 */ 145 public void setUpdateDate(Timestamp updateDateIn) 146 { 147 this.updateDate = updateDateIn; 148 } 149 150 // Generate 9 associations 151 private Status status; 152 153 /** 154 * Pour les données du référentiel, information permettant de déterminer si une donnée est 155 * valide, 156 * obsolète ou temporaire. 157 * - obsolète (=inactif) : '0' 158 * - valide (=actif) : '1' 159 * - temporaire : '2' 160 * - en cours de suppression : '3' 161 * - : '4' 162 * note : on a préfère ici 'valide' au terme 'actif' (utilisé dans Harmonie), pour ne pas 163 * confondre 164 * avec par exemple l'activité d'un navire sur un mois. 165 * @return this.status Status 166 */ 167 public Status getStatus() 168 { 169 return this.status; 170 } 171 172 /** 173 * Pour les données du référentiel, information permettant de déterminer si une donnée est 174 * valide, 175 * obsolète ou temporaire. 176 * - obsolète (=inactif) : '0' 177 * - valide (=actif) : '1' 178 * - temporaire : '2' 179 * - en cours de suppression : '3' 180 * - : '4' 181 * note : on a préfère ici 'valide' au terme 'actif' (utilisé dans Harmonie), pour ne pas 182 * confondre 183 * avec par exemple l'activité d'un navire sur un mois. 184 * @param statusIn Status 185 */ 186 public void setStatus(Status statusIn) 187 { 188 this.status = statusIn; 189 } 190 191 /** 192 * Returns <code>true</code> if the argument is an Unit instance and all identifiers for this entity 193 * equal the identifiers of the argument entity. Returns <code>false</code> otherwise. 194 */ 195 @Override 196 public boolean equals(Object object) 197 { 198 if (this == object) 199 { 200 return true; 201 } 202 if (!(object instanceof Unit)) 203 { 204 return false; 205 } 206 final Unit that = (Unit)object; 207 if (this.id == null || that.getId() == null || !this.id.equals(that.getId())) 208 { 209 return false; 210 } 211 return true; 212 } 213 214 /** 215 * Returns a hash code based on this entity's identifiers. 216 */ 217 @Override 218 public int hashCode() 219 { 220 int hashCode = 0; 221 hashCode = 29 * hashCode + (this.id == null ? 0 : this.id.hashCode()); 222 223 return hashCode; 224 } 225 226 /** 227 * Constructs new instances of {@link Unit}. 228 */ 229 public static final class Factory 230 { 231 /** 232 * Constructs a new instance of {@link Unit}. 233 * @return new UnitImpl() 234 */ 235 public static Unit newInstance() 236 { 237 return new UnitImpl(); 238 } 239 240 241 /** 242 * Constructs a new instance of {@link Unit}, taking all possible properties 243 * (except the identifier(s))as arguments. 244 * @param symbol String 245 * @param name String 246 * @param creationDate Date 247 * @param updateDate Timestamp 248 * @param status Status 249 * @return newInstance Unit 250 */ 251 public static Unit newInstance(String symbol, String name, Date creationDate, Timestamp updateDate, Status status) 252 { 253 final Unit entity = new UnitImpl(); 254 entity.setSymbol(symbol); 255 entity.setName(name); 256 entity.setCreationDate(creationDate); 257 entity.setUpdateDate(updateDate); 258 entity.setStatus(status); 259 return entity; 260 } 261 } 262 263 /** 264 * @see Comparable#compareTo 265 */ 266 public int compareTo(Unit o) 267 { 268 int cmp = 0; 269 if (this.getId() != null) 270 { 271 cmp = this.getId().compareTo(o.getId()); 272 } 273 else 274 { 275 if (this.getSymbol() != null) 276 { 277 cmp = (cmp != 0 ? cmp : this.getSymbol().compareTo(o.getSymbol())); 278 } 279 if (this.getName() != null) 280 { 281 cmp = (cmp != 0 ? cmp : this.getName().compareTo(o.getName())); 282 } 283 if (this.getCreationDate() != null) 284 { 285 cmp = (cmp != 0 ? cmp : this.getCreationDate().compareTo(o.getCreationDate())); 286 } 287 if (this.getUpdateDate() != null) 288 { 289 cmp = (cmp != 0 ? cmp : this.getUpdateDate().compareTo(o.getUpdateDate())); 290 } 291 } 292 return cmp; 293 } 294// HibernateEntity.vsl merge-point 295// Unit.java merge-point 296}