001// -------------------------------------------------------------------------------- 002// Copyright 2002-2025 Echo Three, LLC 003// 004// Licensed under the Apache License, Version 2.0 (the "License"); 005// you may not use this file except in compliance with the License. 006// You may obtain a copy of the License at 007// 008// http://www.apache.org/licenses/LICENSE-2.0 009// 010// Unless required by applicable law or agreed to in writing, software 011// distributed under the License is distributed on an "AS IS" BASIS, 012// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013// See the License for the specific language governing permissions and 014// limitations under the License. 015// -------------------------------------------------------------------------------- 016// Generated File -- DO NOT EDIT BY HAND 017// -------------------------------------------------------------------------------- 018 019/** 020 * EntityGeoPointDefaultValue.java 021 */ 022 023package com.echothree.model.data.core.server.value; 024 025import com.echothree.model.data.core.common.pk.EntityGeoPointDefaultPK; 026 027import com.echothree.model.data.core.server.factory.EntityGeoPointDefaultFactory; 028 029import com.echothree.model.data.core.common.pk.EntityAttributePK; 030 031import com.echothree.util.common.exception.PersistenceCloneException; 032import com.echothree.util.common.exception.PersistenceNotNullException; 033 034import com.echothree.util.server.persistence.BaseValue; 035 036import java.io.Serializable; 037 038public class EntityGeoPointDefaultValue 039 extends BaseValue<EntityGeoPointDefaultPK> 040 implements Cloneable, Serializable { 041 042 private EntityAttributePK entityAttributePK; 043 private boolean entityAttributePKHasBeenModified = false; 044 private Integer latitude; 045 private boolean latitudeHasBeenModified = false; 046 private Integer longitude; 047 private boolean longitudeHasBeenModified = false; 048 private Long elevation; 049 private boolean elevationHasBeenModified = false; 050 private Long altitude; 051 private boolean altitudeHasBeenModified = false; 052 private Long fromTime; 053 private boolean fromTimeHasBeenModified = false; 054 private Long thruTime; 055 private boolean thruTimeHasBeenModified = false; 056 057 private transient Integer _hashCode = null; 058 private transient String _stringValue = null; 059 060 private void constructFields(EntityAttributePK entityAttributePK, Integer latitude, Integer longitude, Long elevation, Long altitude, Long fromTime, Long thruTime) 061 throws PersistenceNotNullException { 062 checkForNull(entityAttributePK); 063 this.entityAttributePK = entityAttributePK; 064 checkForNull(latitude); 065 this.latitude = latitude; 066 checkForNull(longitude); 067 this.longitude = longitude; 068 this.elevation = elevation; 069 this.altitude = altitude; 070 checkForNull(fromTime); 071 this.fromTime = fromTime; 072 checkForNull(thruTime); 073 this.thruTime = thruTime; 074 } 075 076 /** Creates a new instance of EntityGeoPointDefaultValue */ 077 public EntityGeoPointDefaultValue(EntityGeoPointDefaultPK entityGeoPointDefaultPK, EntityAttributePK entityAttributePK, Integer latitude, Integer longitude, Long elevation, Long altitude, Long fromTime, Long thruTime) 078 throws PersistenceNotNullException { 079 super(entityGeoPointDefaultPK); 080 constructFields(entityAttributePK, latitude, longitude, elevation, altitude, fromTime, thruTime); 081 } 082 083 /** Creates a new instance of EntityGeoPointDefaultValue */ 084 public EntityGeoPointDefaultValue(EntityAttributePK entityAttributePK, Integer latitude, Integer longitude, Long elevation, Long altitude, Long fromTime, Long thruTime) 085 throws PersistenceNotNullException { 086 super(); 087 constructFields(entityAttributePK, latitude, longitude, elevation, altitude, fromTime, thruTime); 088 } 089 090 @Override 091 public EntityGeoPointDefaultFactory getBaseFactoryInstance() { 092 return EntityGeoPointDefaultFactory.getInstance(); 093 } 094 095 @Override 096 public EntityGeoPointDefaultValue clone() { 097 Object result; 098 099 try { 100 result = super.clone(); 101 } catch (CloneNotSupportedException cnse) { 102 // This shouldn't happen, fail when it does. 103 throw new PersistenceCloneException(cnse); 104 } 105 106 return (EntityGeoPointDefaultValue)result; 107 } 108 109 @Override 110 public EntityGeoPointDefaultPK getPrimaryKey() { 111 if(_primaryKey == null) { 112 _primaryKey = new EntityGeoPointDefaultPK(entityId); 113 } 114 115 return _primaryKey; 116 } 117 118 private void clearHashAndString() { 119 _hashCode = null; 120 _stringValue = null; 121 } 122 123 @Override 124 public int hashCode() { 125 if(_hashCode == null) { 126 int hashCode = 17; 127 128 hashCode = 37 * hashCode + ((entityId != null) ? entityId.hashCode() : 0); 129 130 hashCode = 37 * hashCode + ((entityAttributePK != null) ? entityAttributePK.hashCode() : 0); 131 hashCode = 37 * hashCode + ((latitude != null) ? latitude.hashCode() : 0); 132 hashCode = 37 * hashCode + ((longitude != null) ? longitude.hashCode() : 0); 133 hashCode = 37 * hashCode + ((elevation != null) ? elevation.hashCode() : 0); 134 hashCode = 37 * hashCode + ((altitude != null) ? altitude.hashCode() : 0); 135 hashCode = 37 * hashCode + ((fromTime != null) ? fromTime.hashCode() : 0); 136 hashCode = 37 * hashCode + ((thruTime != null) ? thruTime.hashCode() : 0); 137 138 _hashCode = hashCode; 139 } 140 141 return _hashCode; 142 } 143 144 @Override 145 public String toString() { 146 if(_stringValue == null) { 147 _stringValue = "{" + 148 "entityId=" + getEntityId() + 149 ", entityAttributePK=" + getEntityAttributePK() + 150 ", latitude=" + getLatitude() + 151 ", longitude=" + getLongitude() + 152 ", elevation=" + getElevation() + 153 ", altitude=" + getAltitude() + 154 ", fromTime=" + getFromTime() + 155 ", thruTime=" + getThruTime() + 156 "}"; 157 } 158 return _stringValue; 159 } 160 161 @Override 162 public boolean equals(Object other) { 163 if(this == other) 164 return true; 165 166 if(!hasIdentity()) 167 return false; 168 169 if(other instanceof EntityGeoPointDefaultValue that) { 170 if(!that.hasIdentity()) 171 return false; 172 173 Long thisEntityId = getEntityId(); 174 Long thatEntityId = that.getEntityId(); 175 176 boolean objectsEqual = thisEntityId.equals(thatEntityId); 177 if(objectsEqual) 178 objectsEqual = isIdentical(that); 179 180 return objectsEqual; 181 } else { 182 return false; 183 } 184 } 185 186 public boolean isIdentical(Object other) { 187 if(other instanceof EntityGeoPointDefaultValue that) { 188 boolean objectsEqual = true; 189 190 191 if(objectsEqual) { 192 EntityAttributePK thisEntityAttributePK = getEntityAttributePK(); 193 EntityAttributePK thatEntityAttributePK = that.getEntityAttributePK(); 194 195 if(thisEntityAttributePK == null) { 196 objectsEqual = objectsEqual && (thatEntityAttributePK == null); 197 } else { 198 objectsEqual = objectsEqual && thisEntityAttributePK.equals(thatEntityAttributePK); 199 } 200 } 201 202 if(objectsEqual) { 203 Integer thisLatitude = getLatitude(); 204 Integer thatLatitude = that.getLatitude(); 205 206 if(thisLatitude == null) { 207 objectsEqual = objectsEqual && (thatLatitude == null); 208 } else { 209 objectsEqual = objectsEqual && thisLatitude.equals(thatLatitude); 210 } 211 } 212 213 if(objectsEqual) { 214 Integer thisLongitude = getLongitude(); 215 Integer thatLongitude = that.getLongitude(); 216 217 if(thisLongitude == null) { 218 objectsEqual = objectsEqual && (thatLongitude == null); 219 } else { 220 objectsEqual = objectsEqual && thisLongitude.equals(thatLongitude); 221 } 222 } 223 224 if(objectsEqual) { 225 Long thisElevation = getElevation(); 226 Long thatElevation = that.getElevation(); 227 228 if(thisElevation == null) { 229 objectsEqual = objectsEqual && (thatElevation == null); 230 } else { 231 objectsEqual = objectsEqual && thisElevation.equals(thatElevation); 232 } 233 } 234 235 if(objectsEqual) { 236 Long thisAltitude = getAltitude(); 237 Long thatAltitude = that.getAltitude(); 238 239 if(thisAltitude == null) { 240 objectsEqual = objectsEqual && (thatAltitude == null); 241 } else { 242 objectsEqual = objectsEqual && thisAltitude.equals(thatAltitude); 243 } 244 } 245 246 if(objectsEqual) { 247 Long thisFromTime = getFromTime(); 248 Long thatFromTime = that.getFromTime(); 249 250 if(thisFromTime == null) { 251 objectsEqual = objectsEqual && (thatFromTime == null); 252 } else { 253 objectsEqual = objectsEqual && thisFromTime.equals(thatFromTime); 254 } 255 } 256 257 if(objectsEqual) { 258 Long thisThruTime = getThruTime(); 259 Long thatThruTime = that.getThruTime(); 260 261 if(thisThruTime == null) { 262 objectsEqual = objectsEqual && (thatThruTime == null); 263 } else { 264 objectsEqual = objectsEqual && thisThruTime.equals(thatThruTime); 265 } 266 } 267 268 return objectsEqual; 269 } else { 270 return false; 271 } 272 } 273 274 @Override 275 public boolean hasBeenModified() { 276 return entityAttributePKHasBeenModified || latitudeHasBeenModified || longitudeHasBeenModified || elevationHasBeenModified || altitudeHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified; 277 } 278 279 @Override 280 public void clearHasBeenModified() { 281 entityAttributePKHasBeenModified = false; 282 latitudeHasBeenModified = false; 283 longitudeHasBeenModified = false; 284 elevationHasBeenModified = false; 285 altitudeHasBeenModified = false; 286 fromTimeHasBeenModified = false; 287 thruTimeHasBeenModified = false; 288 } 289 290 public EntityAttributePK getEntityAttributePK() { 291 return entityAttributePK; 292 } 293 294 public void setEntityAttributePK(EntityAttributePK entityAttributePK) 295 throws PersistenceNotNullException { 296 checkForNull(entityAttributePK); 297 298 boolean update = true; 299 300 if(this.entityAttributePK != null) { 301 if(this.entityAttributePK.equals(entityAttributePK)) { 302 update = false; 303 } 304 } else if(entityAttributePK == null) { 305 update = false; 306 } 307 308 if(update) { 309 this.entityAttributePK = entityAttributePK; 310 entityAttributePKHasBeenModified = true; 311 clearHashAndString(); 312 } 313 } 314 315 public boolean getEntityAttributePKHasBeenModified() { 316 return entityAttributePKHasBeenModified; 317 } 318 319 public Integer getLatitude() { 320 return latitude; 321 } 322 323 public void setLatitude(Integer latitude) 324 throws PersistenceNotNullException { 325 checkForNull(latitude); 326 327 boolean update = true; 328 329 if(this.latitude != null) { 330 if(this.latitude.equals(latitude)) { 331 update = false; 332 } 333 } else if(latitude == null) { 334 update = false; 335 } 336 337 if(update) { 338 this.latitude = latitude; 339 latitudeHasBeenModified = true; 340 clearHashAndString(); 341 } 342 } 343 344 public boolean getLatitudeHasBeenModified() { 345 return latitudeHasBeenModified; 346 } 347 348 public Integer getLongitude() { 349 return longitude; 350 } 351 352 public void setLongitude(Integer longitude) 353 throws PersistenceNotNullException { 354 checkForNull(longitude); 355 356 boolean update = true; 357 358 if(this.longitude != null) { 359 if(this.longitude.equals(longitude)) { 360 update = false; 361 } 362 } else if(longitude == null) { 363 update = false; 364 } 365 366 if(update) { 367 this.longitude = longitude; 368 longitudeHasBeenModified = true; 369 clearHashAndString(); 370 } 371 } 372 373 public boolean getLongitudeHasBeenModified() { 374 return longitudeHasBeenModified; 375 } 376 377 public Long getElevation() { 378 return elevation; 379 } 380 381 public void setElevation(Long elevation) { 382 boolean update = true; 383 384 if(this.elevation != null) { 385 if(this.elevation.equals(elevation)) { 386 update = false; 387 } 388 } else if(elevation == null) { 389 update = false; 390 } 391 392 if(update) { 393 this.elevation = elevation; 394 elevationHasBeenModified = true; 395 clearHashAndString(); 396 } 397 } 398 399 public boolean getElevationHasBeenModified() { 400 return elevationHasBeenModified; 401 } 402 403 public Long getAltitude() { 404 return altitude; 405 } 406 407 public void setAltitude(Long altitude) { 408 boolean update = true; 409 410 if(this.altitude != null) { 411 if(this.altitude.equals(altitude)) { 412 update = false; 413 } 414 } else if(altitude == null) { 415 update = false; 416 } 417 418 if(update) { 419 this.altitude = altitude; 420 altitudeHasBeenModified = true; 421 clearHashAndString(); 422 } 423 } 424 425 public boolean getAltitudeHasBeenModified() { 426 return altitudeHasBeenModified; 427 } 428 429 public Long getFromTime() { 430 return fromTime; 431 } 432 433 public void setFromTime(Long fromTime) 434 throws PersistenceNotNullException { 435 checkForNull(fromTime); 436 437 boolean update = true; 438 439 if(this.fromTime != null) { 440 if(this.fromTime.equals(fromTime)) { 441 update = false; 442 } 443 } else if(fromTime == null) { 444 update = false; 445 } 446 447 if(update) { 448 this.fromTime = fromTime; 449 fromTimeHasBeenModified = true; 450 clearHashAndString(); 451 } 452 } 453 454 public boolean getFromTimeHasBeenModified() { 455 return fromTimeHasBeenModified; 456 } 457 458 public Long getThruTime() { 459 return thruTime; 460 } 461 462 public void setThruTime(Long thruTime) 463 throws PersistenceNotNullException { 464 checkForNull(thruTime); 465 466 boolean update = true; 467 468 if(this.thruTime != null) { 469 if(this.thruTime.equals(thruTime)) { 470 update = false; 471 } 472 } else if(thruTime == null) { 473 update = false; 474 } 475 476 if(update) { 477 this.thruTime = thruTime; 478 thruTimeHasBeenModified = true; 479 clearHashAndString(); 480 } 481 } 482 483 public boolean getThruTimeHasBeenModified() { 484 return thruTimeHasBeenModified; 485 } 486 487}