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.location; 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 java.io.Serializable; 032import java.sql.Timestamp; 033import java.util.Collection; 034import java.util.HashSet; 035 036/** 037 * Niveau de lieu, ou catégorie. Il s'agit d'un regroupement de haut niveau d'un ensemble de lieux 038 * de meme nature géographique. 039 * Par exemple, pour la classification de lieu "Secteur maritime", on aura : 040 * - Zone FAO, 041 * - Sous-Zone FAO, 042 * - Division CIEM, 043 * - Sous-division CIEM 044 * - etc. 045 * Pour la classification de lieu "lieux territoriaux", on aura : 046 * - Pays 047 * - Region, 048 * - Département, 049 * - Quartier Maritme, 050 * - Port 051 * - ... 052 * On pourra trouver d'autre niveau de lieu, comme : 053 * - implantation Ifremer 054 * - laboratoire côtier, ... 055 */ 056// HibernateEntity.vsl annotations merge-point 057public abstract class LocationLevel 058 implements Serializable, Comparable<LocationLevel> 059{ 060 /** 061 * The serial version UID of this class. Needed for serialization. 062 */ 063 private static final long serialVersionUID = -4684353052216145542L; 064 065 // Generate 5 attributes 066 private Integer id; 067 068 /** 069 * Idenfiant interne. 070 * @return this.id Integer 071 */ 072 public Integer getId() 073 { 074 return this.id; 075 } 076 077 /** 078 * Idenfiant interne. 079 * @param idIn Integer 080 */ 081 public void setId(Integer idIn) 082 { 083 this.id = idIn; 084 } 085 086 private String name; 087 088 /** 089 * 090 * @return this.name String 091 */ 092 public String getName() 093 { 094 return this.name; 095 } 096 097 /** 098 * 099 * @param nameIn String 100 */ 101 public void setName(String nameIn) 102 { 103 this.name = nameIn; 104 } 105 106 private String description; 107 108 /** 109 * 110 * @return this.description String 111 */ 112 public String getDescription() 113 { 114 return this.description; 115 } 116 117 /** 118 * 119 * @param descriptionIn String 120 */ 121 public void setDescription(String descriptionIn) 122 { 123 this.description = descriptionIn; 124 } 125 126 private String comments; 127 128 /** 129 * 130 * @return this.comments String 131 */ 132 public String getComments() 133 { 134 return this.comments; 135 } 136 137 /** 138 * 139 * @param commentsIn String 140 */ 141 public void setComments(String commentsIn) 142 { 143 this.comments = commentsIn; 144 } 145 146 private Timestamp updateDate; 147 148 /** 149 * 150 * @return this.updateDate Timestamp 151 */ 152 public Timestamp getUpdateDate() 153 { 154 return this.updateDate; 155 } 156 157 /** 158 * 159 * @param updateDateIn Timestamp 160 */ 161 public void setUpdateDate(Timestamp updateDateIn) 162 { 163 this.updateDate = updateDateIn; 164 } 165 166 // Generate 4 associations 167 private LocationLevel parentLocationLevel; 168 169 /** 170 * Niveau de lieu parent 171 * @return this.parentLocationLevel LocationLevel 172 */ 173 public LocationLevel getParentLocationLevel() 174 { 175 return this.parentLocationLevel; 176 } 177 178 /** 179 * Niveau de lieu parent 180 * @param parentLocationLevelIn LocationLevel 181 */ 182 public void setParentLocationLevel(LocationLevel parentLocationLevelIn) 183 { 184 this.parentLocationLevel = parentLocationLevelIn; 185 } 186 187 private Collection<LocationLevel> locationLevels = new HashSet<LocationLevel>(); 188 189 /** 190 * Niveaux de lieu fils 191 * @return this.locationLevels Collection<LocationLevel> 192 */ 193 public Collection<LocationLevel> getLocationLevels() 194 { 195 return this.locationLevels; 196 } 197 198 /** 199 * Niveaux de lieu fils 200 * @param locationLevelsIn Collection<LocationLevel> 201 */ 202 public void setLocationLevels(Collection<LocationLevel> locationLevelsIn) 203 { 204 this.locationLevels = locationLevelsIn; 205 } 206 207 /** 208 * Niveaux de lieu fils 209 * @param elementToAdd LocationLevel 210 * @return <tt>true</tt> if this collection changed as a result of the 211 * call 212 */ 213 public boolean addLocationLevels(LocationLevel elementToAdd) 214 { 215 return this.locationLevels.add(elementToAdd); 216 } 217 218 /** 219 * Niveaux de lieu fils 220 * @param elementToRemove LocationLevel 221 * @return <tt>true</tt> if this collection changed as a result of the 222 * call 223 */ 224 public boolean removeLocationLevels(LocationLevel elementToRemove) 225 { 226 return this.locationLevels.remove(elementToRemove); 227 } 228 229 private LocationClassification locationClassification; 230 231 /** 232 * Classification de lieu duquel dépend le niveau 233 * @return this.locationClassification LocationClassification 234 */ 235 public LocationClassification getLocationClassification() 236 { 237 return this.locationClassification; 238 } 239 240 /** 241 * Classification de lieu duquel dépend le niveau 242 * @param locationClassificationIn LocationClassification 243 */ 244 public void setLocationClassification(LocationClassification locationClassificationIn) 245 { 246 this.locationClassification = locationClassificationIn; 247 } 248 249 /** 250 * Returns <code>true</code> if the argument is an LocationLevel instance and all identifiers for this entity 251 * equal the identifiers of the argument entity. Returns <code>false</code> otherwise. 252 */ 253 @Override 254 public boolean equals(Object object) 255 { 256 if (this == object) 257 { 258 return true; 259 } 260 if (!(object instanceof LocationLevel)) 261 { 262 return false; 263 } 264 final LocationLevel that = (LocationLevel)object; 265 if (this.id == null || that.getId() == null || !this.id.equals(that.getId())) 266 { 267 return false; 268 } 269 return true; 270 } 271 272 /** 273 * Returns a hash code based on this entity's identifiers. 274 */ 275 @Override 276 public int hashCode() 277 { 278 int hashCode = 0; 279 hashCode = 29 * hashCode + (this.id == null ? 0 : this.id.hashCode()); 280 281 return hashCode; 282 } 283 284 /** 285 * Constructs new instances of {@link LocationLevel}. 286 */ 287 public static final class Factory 288 { 289 /** 290 * Constructs a new instance of {@link LocationLevel}. 291 * @return new LocationLevelImpl() 292 */ 293 public static LocationLevel newInstance() 294 { 295 return new LocationLevelImpl(); 296 } 297 298 /** 299 * Constructs a new instance of {@link LocationLevel}, taking all required and/or 300 * read-only properties as arguments, except for identifiers. 301 * @param name String 302 * @param updateDate Timestamp 303 * @param locationClassification LocationClassification 304 * @return newInstance 305 */ 306 public static LocationLevel newInstance(String name, Timestamp updateDate, LocationClassification locationClassification) 307 { 308 final LocationLevel entity = new LocationLevelImpl(); 309 entity.setName(name); 310 entity.setUpdateDate(updateDate); 311 entity.setLocationClassification(locationClassification); 312 return entity; 313 } 314 315 /** 316 * Constructs a new instance of {@link LocationLevel}, taking all possible properties 317 * (except the identifier(s))as arguments. 318 * @param name String 319 * @param description String 320 * @param comments String 321 * @param updateDate Timestamp 322 * @param parentLocationLevel LocationLevel 323 * @param locationLevels Collection<LocationLevel> 324 * @param locationClassification LocationClassification 325 * @return newInstance LocationLevel 326 */ 327 public static LocationLevel newInstance(String name, String description, String comments, Timestamp updateDate, LocationLevel parentLocationLevel, Collection<LocationLevel> locationLevels, LocationClassification locationClassification) 328 { 329 final LocationLevel entity = new LocationLevelImpl(); 330 entity.setName(name); 331 entity.setDescription(description); 332 entity.setComments(comments); 333 entity.setUpdateDate(updateDate); 334 entity.setParentLocationLevel(parentLocationLevel); 335 entity.setLocationLevels(locationLevels); 336 entity.setLocationClassification(locationClassification); 337 return entity; 338 } 339 } 340 341 /** 342 * @see Comparable#compareTo 343 */ 344 public int compareTo(LocationLevel o) 345 { 346 int cmp = 0; 347 if (this.getId() != null) 348 { 349 cmp = this.getId().compareTo(o.getId()); 350 } 351 else 352 { 353 if (this.getName() != null) 354 { 355 cmp = (cmp != 0 ? cmp : this.getName().compareTo(o.getName())); 356 } 357 if (this.getDescription() != null) 358 { 359 cmp = (cmp != 0 ? cmp : this.getDescription().compareTo(o.getDescription())); 360 } 361 if (this.getComments() != null) 362 { 363 cmp = (cmp != 0 ? cmp : this.getComments().compareTo(o.getComments())); 364 } 365 if (this.getUpdateDate() != null) 366 { 367 cmp = (cmp != 0 ? cmp : this.getUpdateDate().compareTo(o.getUpdateDate())); 368 } 369 } 370 return cmp; 371 } 372// HibernateEntity.vsl merge-point 373// LocationLevel.java merge-point 374}