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 com.vividsolutions.jts.geom.Point; 032import java.io.Serializable; 033 034/** 035 * 036 */ 037// HibernateEntity.vsl annotations merge-point 038public abstract class SpatialItemPoint 039 implements Serializable, Comparable<SpatialItemPoint> 040{ 041 /** 042 * The serial version UID of this class. Needed for serialization. 043 */ 044 private static final long serialVersionUID = 1158031680335317423L; 045 046 // Generate 3 attributes 047 private Integer id; 048 049 /** 050 * Idenfiant interne. Généré par le système. 051 * @return this.id Integer 052 */ 053 public Integer getId() 054 { 055 return this.id; 056 } 057 058 /** 059 * Idenfiant interne. Généré par le système. 060 * @param idIn Integer 061 */ 062 public void setId(Integer idIn) 063 { 064 this.id = idIn; 065 } 066 067 private String localizedName; 068 069 /** 070 * Libellé régionalisé, valable sur la géométrie, pour l'entité correspondante. 071 * par exemple, pour une zone de présence d'une espèce comemrciale, cela peut etre le nom 072 * vernaculaire, etc. 073 * @return this.localizedName String 074 */ 075 public String getLocalizedName() 076 { 077 return this.localizedName; 078 } 079 080 /** 081 * Libellé régionalisé, valable sur la géométrie, pour l'entité correspondante. 082 * par exemple, pour une zone de présence d'une espèce comemrciale, cela peut etre le nom 083 * vernaculaire, etc. 084 * @param localizedNameIn String 085 */ 086 public void setLocalizedName(String localizedNameIn) 087 { 088 this.localizedName = localizedNameIn; 089 } 090 091 private Point position; 092 093 /** 094 * 095 * @return this.position Point 096 */ 097 public Point getPosition() 098 { 099 return this.position; 100 } 101 102 /** 103 * 104 * @param positionIn Point 105 */ 106 public void setPosition(Point positionIn) 107 { 108 this.position = positionIn; 109 } 110 111 // Generate 1 associations 112 private SpatialItem spatialItem; 113 114 /** 115 * Présence d'un élément d'une liste du référentiel sur une ou plusieurs zones géographiques. 116 * Une ou plusieurs géométrie (ponctuelle, linéraire ou polygonale) peuvent etre définies afin 117 * de 118 * géolocaliser un des éléments d'une liste. 119 * Une procédure stockée sous Oracle permet la mise à jour d'un lien vers le référentiel des 120 * lieux 121 * (table SPATIAL_ITEM2LOCATION) à partir des géométries définies. 122 * @return this.spatialItem SpatialItem 123 */ 124 public SpatialItem getSpatialItem() 125 { 126 return this.spatialItem; 127 } 128 129 /** 130 * Présence d'un élément d'une liste du référentiel sur une ou plusieurs zones géographiques. 131 * Une ou plusieurs géométrie (ponctuelle, linéraire ou polygonale) peuvent etre définies afin 132 * de 133 * géolocaliser un des éléments d'une liste. 134 * Une procédure stockée sous Oracle permet la mise à jour d'un lien vers le référentiel des 135 * lieux 136 * (table SPATIAL_ITEM2LOCATION) à partir des géométries définies. 137 * @param spatialItemIn SpatialItem 138 */ 139 public void setSpatialItem(SpatialItem spatialItemIn) 140 { 141 this.spatialItem = spatialItemIn; 142 } 143 144 /** 145 * Returns <code>true</code> if the argument is an SpatialItemPoint instance and all identifiers for this entity 146 * equal the identifiers of the argument entity. Returns <code>false</code> otherwise. 147 */ 148 @Override 149 public boolean equals(Object object) 150 { 151 if (this == object) 152 { 153 return true; 154 } 155 if (!(object instanceof SpatialItemPoint)) 156 { 157 return false; 158 } 159 final SpatialItemPoint that = (SpatialItemPoint)object; 160 if (this.id == null || that.getId() == null || !this.id.equals(that.getId())) 161 { 162 return false; 163 } 164 return true; 165 } 166 167 /** 168 * Returns a hash code based on this entity's identifiers. 169 */ 170 @Override 171 public int hashCode() 172 { 173 int hashCode = 0; 174 hashCode = 29 * hashCode + (this.id == null ? 0 : this.id.hashCode()); 175 176 return hashCode; 177 } 178 179 /** 180 * Constructs new instances of {@link SpatialItemPoint}. 181 */ 182 public static final class Factory 183 { 184 /** 185 * Constructs a new instance of {@link SpatialItemPoint}. 186 * @return new SpatialItemPointImpl() 187 */ 188 public static SpatialItemPoint newInstance() 189 { 190 return new SpatialItemPointImpl(); 191 } 192 193 /** 194 * Constructs a new instance of {@link SpatialItemPoint}, taking all required and/or 195 * read-only properties as arguments, except for identifiers. 196 * @param spatialItem SpatialItem 197 * @return newInstance 198 */ 199 public static SpatialItemPoint newInstance(SpatialItem spatialItem) 200 { 201 final SpatialItemPoint entity = new SpatialItemPointImpl(); 202 entity.setSpatialItem(spatialItem); 203 return entity; 204 } 205 206 /** 207 * Constructs a new instance of {@link SpatialItemPoint}, taking all possible properties 208 * (except the identifier(s))as arguments. 209 * @param localizedName String 210 * @param position Point 211 * @param spatialItem SpatialItem 212 * @return newInstance SpatialItemPoint 213 */ 214 public static SpatialItemPoint newInstance(String localizedName, Point position, SpatialItem spatialItem) 215 { 216 final SpatialItemPoint entity = new SpatialItemPointImpl(); 217 entity.setLocalizedName(localizedName); 218 entity.setPosition(position); 219 entity.setSpatialItem(spatialItem); 220 return entity; 221 } 222 } 223 224 /** 225 * @see Comparable#compareTo 226 */ 227 public int compareTo(SpatialItemPoint o) 228 { 229 int cmp = 0; 230 if (this.getId() != null) 231 { 232 cmp = this.getId().compareTo(o.getId()); 233 } 234 else 235 { 236 if (this.getLocalizedName() != null) 237 { 238 cmp = (cmp != 0 ? cmp : this.getLocalizedName().compareTo(o.getLocalizedName())); 239 } 240 if (this.getPosition() != null) 241 { 242 cmp = (cmp != 0 ? cmp : this.getPosition().compareTo(o.getPosition())); 243 } 244 } 245 return cmp; 246 } 247// HibernateEntity.vsl merge-point 248// SpatialItemPoint.java merge-point 249}