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.spatial; 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 * Présence d'un élément d'une liste du référentiel sur une ou plusieurs zones géographiques. 038 * Une ou plusieurs géométrie (ponctuelle, linéraire ou polygonale) peuvent etre définies afin de 039 * géolocaliser un des éléments d'une liste. 040 * Une procédure stockée sous Oracle permet la mise à jour d'un lien vers le référentiel des lieux 041 * (table SPATIAL_ITEM2LOCATION) à partir des géométries définies. 042 */ 043// HibernateEntity.vsl annotations merge-point 044public abstract class SpatialItem 045 implements Serializable, Comparable<SpatialItem> 046{ 047 /** 048 * The serial version UID of this class. Needed for serialization. 049 */ 050 private static final long serialVersionUID = 1992571232686464187L; 051 052 // Generate 3 attributes 053 private Integer id; 054 055 /** 056 * Idenfiant interne. Généré par le système. 057 * @return this.id Integer 058 */ 059 public Integer getId() 060 { 061 return this.id; 062 } 063 064 /** 065 * Idenfiant interne. Généré par le système. 066 * @param idIn Integer 067 */ 068 public void setId(Integer idIn) 069 { 070 this.id = idIn; 071 } 072 073 private Integer objectId; 074 075 /** 076 * 077 * @return this.objectId Integer 078 */ 079 public Integer getObjectId() 080 { 081 return this.objectId; 082 } 083 084 /** 085 * 086 * @param objectIdIn Integer 087 */ 088 public void setObjectId(Integer objectIdIn) 089 { 090 this.objectId = objectIdIn; 091 } 092 093 private Timestamp updateDate; 094 095 /** 096 * 097 * @return this.updateDate Timestamp 098 */ 099 public Timestamp getUpdateDate() 100 { 101 return this.updateDate; 102 } 103 104 /** 105 * 106 * @param updateDateIn Timestamp 107 */ 108 public void setUpdateDate(Timestamp updateDateIn) 109 { 110 this.updateDate = updateDateIn; 111 } 112 113 // Generate 5 associations 114 private Collection<SpatialItem2Location> spatialItem2Locations = new HashSet<SpatialItem2Location>(); 115 116 /** 117 * 118 * @return this.spatialItem2Locations Collection<SpatialItem2Location> 119 */ 120 public Collection<SpatialItem2Location> getSpatialItem2Locations() 121 { 122 return this.spatialItem2Locations; 123 } 124 125 /** 126 * 127 * @param spatialItem2LocationsIn Collection<SpatialItem2Location> 128 */ 129 public void setSpatialItem2Locations(Collection<SpatialItem2Location> spatialItem2LocationsIn) 130 { 131 this.spatialItem2Locations = spatialItem2LocationsIn; 132 } 133 134 /** 135 * 136 * @param elementToAdd SpatialItem2Location 137 * @return <tt>true</tt> if this collection changed as a result of the 138 * call 139 */ 140 public boolean addSpatialItem2Locations(SpatialItem2Location elementToAdd) 141 { 142 return this.spatialItem2Locations.add(elementToAdd); 143 } 144 145 /** 146 * 147 * @param elementToRemove SpatialItem2Location 148 * @return <tt>true</tt> if this collection changed as a result of the 149 * call 150 */ 151 public boolean removeSpatialItem2Locations(SpatialItem2Location elementToRemove) 152 { 153 return this.spatialItem2Locations.remove(elementToRemove); 154 } 155 156 private Collection<SpatialItemArea> spatialItemAreas = new HashSet<SpatialItemArea>(); 157 158 /** 159 * 160 * @return this.spatialItemAreas Collection<SpatialItemArea> 161 */ 162 public Collection<SpatialItemArea> getSpatialItemAreas() 163 { 164 return this.spatialItemAreas; 165 } 166 167 /** 168 * 169 * @param spatialItemAreasIn Collection<SpatialItemArea> 170 */ 171 public void setSpatialItemAreas(Collection<SpatialItemArea> spatialItemAreasIn) 172 { 173 this.spatialItemAreas = spatialItemAreasIn; 174 } 175 176 /** 177 * 178 * @param elementToAdd SpatialItemArea 179 * @return <tt>true</tt> if this collection changed as a result of the 180 * call 181 */ 182 public boolean addSpatialItemAreas(SpatialItemArea elementToAdd) 183 { 184 return this.spatialItemAreas.add(elementToAdd); 185 } 186 187 /** 188 * 189 * @param elementToRemove SpatialItemArea 190 * @return <tt>true</tt> if this collection changed as a result of the 191 * call 192 */ 193 public boolean removeSpatialItemAreas(SpatialItemArea elementToRemove) 194 { 195 return this.spatialItemAreas.remove(elementToRemove); 196 } 197 198 private Collection<SpatialItemPoint> spatialItemPoints = new HashSet<SpatialItemPoint>(); 199 200 /** 201 * 202 * @return this.spatialItemPoints Collection<SpatialItemPoint> 203 */ 204 public Collection<SpatialItemPoint> getSpatialItemPoints() 205 { 206 return this.spatialItemPoints; 207 } 208 209 /** 210 * 211 * @param spatialItemPointsIn Collection<SpatialItemPoint> 212 */ 213 public void setSpatialItemPoints(Collection<SpatialItemPoint> spatialItemPointsIn) 214 { 215 this.spatialItemPoints = spatialItemPointsIn; 216 } 217 218 /** 219 * 220 * @param elementToAdd SpatialItemPoint 221 * @return <tt>true</tt> if this collection changed as a result of the 222 * call 223 */ 224 public boolean addSpatialItemPoints(SpatialItemPoint elementToAdd) 225 { 226 return this.spatialItemPoints.add(elementToAdd); 227 } 228 229 /** 230 * 231 * @param elementToRemove SpatialItemPoint 232 * @return <tt>true</tt> if this collection changed as a result of the 233 * call 234 */ 235 public boolean removeSpatialItemPoints(SpatialItemPoint elementToRemove) 236 { 237 return this.spatialItemPoints.remove(elementToRemove); 238 } 239 240 private Collection<SpatialItemLine> spatialItemLines = new HashSet<SpatialItemLine>(); 241 242 /** 243 * 244 * @return this.spatialItemLines Collection<SpatialItemLine> 245 */ 246 public Collection<SpatialItemLine> getSpatialItemLines() 247 { 248 return this.spatialItemLines; 249 } 250 251 /** 252 * 253 * @param spatialItemLinesIn Collection<SpatialItemLine> 254 */ 255 public void setSpatialItemLines(Collection<SpatialItemLine> spatialItemLinesIn) 256 { 257 this.spatialItemLines = spatialItemLinesIn; 258 } 259 260 /** 261 * 262 * @param elementToAdd SpatialItemLine 263 * @return <tt>true</tt> if this collection changed as a result of the 264 * call 265 */ 266 public boolean addSpatialItemLines(SpatialItemLine elementToAdd) 267 { 268 return this.spatialItemLines.add(elementToAdd); 269 } 270 271 /** 272 * 273 * @param elementToRemove SpatialItemLine 274 * @return <tt>true</tt> if this collection changed as a result of the 275 * call 276 */ 277 public boolean removeSpatialItemLines(SpatialItemLine elementToRemove) 278 { 279 return this.spatialItemLines.remove(elementToRemove); 280 } 281 282 private SpatialItemType spatialItemType; 283 284 /** 285 * Type de régionalisation d'une liste du réfétentiel. 286 * Il peut y avoir plusieurs type de régionalisation pour une meme liste (pour un meme 287 * OBJECT_TYPE_FK). 288 * Par exemple : 289 * - régionalisation des gradients de profondeur (utile pour les Antilles) 290 * @return this.spatialItemType SpatialItemType 291 */ 292 public SpatialItemType getSpatialItemType() 293 { 294 return this.spatialItemType; 295 } 296 297 /** 298 * Type de régionalisation d'une liste du réfétentiel. 299 * Il peut y avoir plusieurs type de régionalisation pour une meme liste (pour un meme 300 * OBJECT_TYPE_FK). 301 * Par exemple : 302 * - régionalisation des gradients de profondeur (utile pour les Antilles) 303 * @param spatialItemTypeIn SpatialItemType 304 */ 305 public void setSpatialItemType(SpatialItemType spatialItemTypeIn) 306 { 307 this.spatialItemType = spatialItemTypeIn; 308 } 309 310 /** 311 * Returns <code>true</code> if the argument is an SpatialItem instance and all identifiers for this entity 312 * equal the identifiers of the argument entity. Returns <code>false</code> otherwise. 313 */ 314 @Override 315 public boolean equals(Object object) 316 { 317 if (this == object) 318 { 319 return true; 320 } 321 if (!(object instanceof SpatialItem)) 322 { 323 return false; 324 } 325 final SpatialItem that = (SpatialItem)object; 326 if (this.id == null || that.getId() == null || !this.id.equals(that.getId())) 327 { 328 return false; 329 } 330 return true; 331 } 332 333 /** 334 * Returns a hash code based on this entity's identifiers. 335 */ 336 @Override 337 public int hashCode() 338 { 339 int hashCode = 0; 340 hashCode = 29 * hashCode + (this.id == null ? 0 : this.id.hashCode()); 341 342 return hashCode; 343 } 344 345 /** 346 * Constructs new instances of {@link SpatialItem}. 347 */ 348 public static final class Factory 349 { 350 /** 351 * Constructs a new instance of {@link SpatialItem}. 352 * @return new SpatialItemImpl() 353 */ 354 public static SpatialItem newInstance() 355 { 356 return new SpatialItemImpl(); 357 } 358 359 /** 360 * Constructs a new instance of {@link SpatialItem}, taking all required and/or 361 * read-only properties as arguments, except for identifiers. 362 * @param objectId Integer 363 * @param updateDate Timestamp 364 * @param spatialItemType SpatialItemType 365 * @return newInstance 366 */ 367 public static SpatialItem newInstance(Integer objectId, Timestamp updateDate, SpatialItemType spatialItemType) 368 { 369 final SpatialItem entity = new SpatialItemImpl(); 370 entity.setObjectId(objectId); 371 entity.setUpdateDate(updateDate); 372 entity.setSpatialItemType(spatialItemType); 373 return entity; 374 } 375 376 /** 377 * Constructs a new instance of {@link SpatialItem}, taking all possible properties 378 * (except the identifier(s))as arguments. 379 * @param objectId Integer 380 * @param updateDate Timestamp 381 * @param spatialItem2Locations Collection<SpatialItem2Location> 382 * @param spatialItemAreas Collection<SpatialItemArea> 383 * @param spatialItemPoints Collection<SpatialItemPoint> 384 * @param spatialItemLines Collection<SpatialItemLine> 385 * @param spatialItemType SpatialItemType 386 * @return newInstance SpatialItem 387 */ 388 public static SpatialItem newInstance(Integer objectId, Timestamp updateDate, Collection<SpatialItem2Location> spatialItem2Locations, Collection<SpatialItemArea> spatialItemAreas, Collection<SpatialItemPoint> spatialItemPoints, Collection<SpatialItemLine> spatialItemLines, SpatialItemType spatialItemType) 389 { 390 final SpatialItem entity = new SpatialItemImpl(); 391 entity.setObjectId(objectId); 392 entity.setUpdateDate(updateDate); 393 entity.setSpatialItem2Locations(spatialItem2Locations); 394 entity.setSpatialItemAreas(spatialItemAreas); 395 entity.setSpatialItemPoints(spatialItemPoints); 396 entity.setSpatialItemLines(spatialItemLines); 397 entity.setSpatialItemType(spatialItemType); 398 return entity; 399 } 400 } 401 402 /** 403 * @see Comparable#compareTo 404 */ 405 public int compareTo(SpatialItem o) 406 { 407 int cmp = 0; 408 if (this.getId() != null) 409 { 410 cmp = this.getId().compareTo(o.getId()); 411 } 412 else 413 { 414 if (this.getObjectId() != null) 415 { 416 cmp = (cmp != 0 ? cmp : this.getObjectId().compareTo(o.getObjectId())); 417 } 418 if (this.getUpdateDate() != null) 419 { 420 cmp = (cmp != 0 ? cmp : this.getUpdateDate().compareTo(o.getUpdateDate())); 421 } 422 } 423 return cmp; 424 } 425// HibernateEntity.vsl merge-point 426// SpatialItem.java merge-point 427}