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 * EntityGeoPointAttributeValue.java 021 */ 022 023package com.echothree.model.data.core.server.value; 024 025import com.echothree.model.data.core.common.pk.EntityGeoPointAttributePK; 026 027import com.echothree.model.data.core.server.factory.EntityGeoPointAttributeFactory; 028 029import com.echothree.model.data.core.common.pk.EntityAttributePK; 030import com.echothree.model.data.core.common.pk.EntityInstancePK; 031 032import com.echothree.util.common.exception.PersistenceCloneException; 033import com.echothree.util.common.exception.PersistenceNotNullException; 034 035import com.echothree.util.server.persistence.BaseValue; 036 037import java.io.Serializable; 038 039public class EntityGeoPointAttributeValue 040 extends BaseValue<EntityGeoPointAttributePK> 041 implements Cloneable, Serializable { 042 043 private EntityAttributePK entityAttributePK; 044 private boolean entityAttributePKHasBeenModified = false; 045 private EntityInstancePK entityInstancePK; 046 private boolean entityInstancePKHasBeenModified = false; 047 private Integer latitude; 048 private boolean latitudeHasBeenModified = false; 049 private Integer longitude; 050 private boolean longitudeHasBeenModified = false; 051 private Long elevation; 052 private boolean elevationHasBeenModified = false; 053 private Long altitude; 054 private boolean altitudeHasBeenModified = false; 055 private Long fromTime; 056 private boolean fromTimeHasBeenModified = false; 057 private Long thruTime; 058 private boolean thruTimeHasBeenModified = false; 059 060 private transient Integer _hashCode = null; 061 private transient String _stringValue = null; 062 063 private void constructFields(EntityAttributePK entityAttributePK, EntityInstancePK entityInstancePK, Integer latitude, Integer longitude, Long elevation, Long altitude, Long fromTime, Long thruTime) 064 throws PersistenceNotNullException { 065 checkForNull(entityAttributePK); 066 this.entityAttributePK = entityAttributePK; 067 checkForNull(entityInstancePK); 068 this.entityInstancePK = entityInstancePK; 069 checkForNull(latitude); 070 this.latitude = latitude; 071 checkForNull(longitude); 072 this.longitude = longitude; 073 this.elevation = elevation; 074 this.altitude = altitude; 075 checkForNull(fromTime); 076 this.fromTime = fromTime; 077 checkForNull(thruTime); 078 this.thruTime = thruTime; 079 } 080 081 /** Creates a new instance of EntityGeoPointAttributeValue */ 082 public EntityGeoPointAttributeValue(EntityGeoPointAttributePK entityGeoPointAttributePK, EntityAttributePK entityAttributePK, EntityInstancePK entityInstancePK, Integer latitude, Integer longitude, Long elevation, Long altitude, Long fromTime, Long thruTime) 083 throws PersistenceNotNullException { 084 super(entityGeoPointAttributePK); 085 constructFields(entityAttributePK, entityInstancePK, latitude, longitude, elevation, altitude, fromTime, thruTime); 086 } 087 088 /** Creates a new instance of EntityGeoPointAttributeValue */ 089 public EntityGeoPointAttributeValue(EntityAttributePK entityAttributePK, EntityInstancePK entityInstancePK, Integer latitude, Integer longitude, Long elevation, Long altitude, Long fromTime, Long thruTime) 090 throws PersistenceNotNullException { 091 super(); 092 constructFields(entityAttributePK, entityInstancePK, latitude, longitude, elevation, altitude, fromTime, thruTime); 093 } 094 095 @Override 096 public EntityGeoPointAttributeFactory getBaseFactoryInstance() { 097 return EntityGeoPointAttributeFactory.getInstance(); 098 } 099 100 @Override 101 public EntityGeoPointAttributeValue clone() { 102 Object result; 103 104 try { 105 result = super.clone(); 106 } catch (CloneNotSupportedException cnse) { 107 // This shouldn't happen, fail when it does. 108 throw new PersistenceCloneException(cnse); 109 } 110 111 return (EntityGeoPointAttributeValue)result; 112 } 113 114 @Override 115 public EntityGeoPointAttributePK getPrimaryKey() { 116 if(_primaryKey == null) { 117 _primaryKey = new EntityGeoPointAttributePK(entityId); 118 } 119 120 return _primaryKey; 121 } 122 123 private void clearHashAndString() { 124 _hashCode = null; 125 _stringValue = null; 126 } 127 128 @Override 129 public int hashCode() { 130 if(_hashCode == null) { 131 int hashCode = 17; 132 133 hashCode = 37 * hashCode + ((entityId != null) ? entityId.hashCode() : 0); 134 135 hashCode = 37 * hashCode + ((entityAttributePK != null) ? entityAttributePK.hashCode() : 0); 136 hashCode = 37 * hashCode + ((entityInstancePK != null) ? entityInstancePK.hashCode() : 0); 137 hashCode = 37 * hashCode + ((latitude != null) ? latitude.hashCode() : 0); 138 hashCode = 37 * hashCode + ((longitude != null) ? longitude.hashCode() : 0); 139 hashCode = 37 * hashCode + ((elevation != null) ? elevation.hashCode() : 0); 140 hashCode = 37 * hashCode + ((altitude != null) ? altitude.hashCode() : 0); 141 hashCode = 37 * hashCode + ((fromTime != null) ? fromTime.hashCode() : 0); 142 hashCode = 37 * hashCode + ((thruTime != null) ? thruTime.hashCode() : 0); 143 144 _hashCode = hashCode; 145 } 146 147 return _hashCode; 148 } 149 150 @Override 151 public String toString() { 152 if(_stringValue == null) { 153 _stringValue = "{" + 154 "entityId=" + getEntityId() + 155 ", entityAttributePK=" + getEntityAttributePK() + 156 ", entityInstancePK=" + getEntityInstancePK() + 157 ", latitude=" + getLatitude() + 158 ", longitude=" + getLongitude() + 159 ", elevation=" + getElevation() + 160 ", altitude=" + getAltitude() + 161 ", fromTime=" + getFromTime() + 162 ", thruTime=" + getThruTime() + 163 "}"; 164 } 165 return _stringValue; 166 } 167 168 @Override 169 public boolean equals(Object other) { 170 if(this == other) 171 return true; 172 173 if(!hasIdentity()) 174 return false; 175 176 if(other instanceof EntityGeoPointAttributeValue that) { 177 if(!that.hasIdentity()) 178 return false; 179 180 Long thisEntityId = getEntityId(); 181 Long thatEntityId = that.getEntityId(); 182 183 boolean objectsEqual = thisEntityId.equals(thatEntityId); 184 if(objectsEqual) 185 objectsEqual = isIdentical(that); 186 187 return objectsEqual; 188 } else { 189 return false; 190 } 191 } 192 193 public boolean isIdentical(Object other) { 194 if(other instanceof EntityGeoPointAttributeValue that) { 195 boolean objectsEqual = true; 196 197 198 if(objectsEqual) { 199 EntityAttributePK thisEntityAttributePK = getEntityAttributePK(); 200 EntityAttributePK thatEntityAttributePK = that.getEntityAttributePK(); 201 202 if(thisEntityAttributePK == null) { 203 objectsEqual = objectsEqual && (thatEntityAttributePK == null); 204 } else { 205 objectsEqual = objectsEqual && thisEntityAttributePK.equals(thatEntityAttributePK); 206 } 207 } 208 209 if(objectsEqual) { 210 EntityInstancePK thisEntityInstancePK = getEntityInstancePK(); 211 EntityInstancePK thatEntityInstancePK = that.getEntityInstancePK(); 212 213 if(thisEntityInstancePK == null) { 214 objectsEqual = objectsEqual && (thatEntityInstancePK == null); 215 } else { 216 objectsEqual = objectsEqual && thisEntityInstancePK.equals(thatEntityInstancePK); 217 } 218 } 219 220 if(objectsEqual) { 221 Integer thisLatitude = getLatitude(); 222 Integer thatLatitude = that.getLatitude(); 223 224 if(thisLatitude == null) { 225 objectsEqual = objectsEqual && (thatLatitude == null); 226 } else { 227 objectsEqual = objectsEqual && thisLatitude.equals(thatLatitude); 228 } 229 } 230 231 if(objectsEqual) { 232 Integer thisLongitude = getLongitude(); 233 Integer thatLongitude = that.getLongitude(); 234 235 if(thisLongitude == null) { 236 objectsEqual = objectsEqual && (thatLongitude == null); 237 } else { 238 objectsEqual = objectsEqual && thisLongitude.equals(thatLongitude); 239 } 240 } 241 242 if(objectsEqual) { 243 Long thisElevation = getElevation(); 244 Long thatElevation = that.getElevation(); 245 246 if(thisElevation == null) { 247 objectsEqual = objectsEqual && (thatElevation == null); 248 } else { 249 objectsEqual = objectsEqual && thisElevation.equals(thatElevation); 250 } 251 } 252 253 if(objectsEqual) { 254 Long thisAltitude = getAltitude(); 255 Long thatAltitude = that.getAltitude(); 256 257 if(thisAltitude == null) { 258 objectsEqual = objectsEqual && (thatAltitude == null); 259 } else { 260 objectsEqual = objectsEqual && thisAltitude.equals(thatAltitude); 261 } 262 } 263 264 if(objectsEqual) { 265 Long thisFromTime = getFromTime(); 266 Long thatFromTime = that.getFromTime(); 267 268 if(thisFromTime == null) { 269 objectsEqual = objectsEqual && (thatFromTime == null); 270 } else { 271 objectsEqual = objectsEqual && thisFromTime.equals(thatFromTime); 272 } 273 } 274 275 if(objectsEqual) { 276 Long thisThruTime = getThruTime(); 277 Long thatThruTime = that.getThruTime(); 278 279 if(thisThruTime == null) { 280 objectsEqual = objectsEqual && (thatThruTime == null); 281 } else { 282 objectsEqual = objectsEqual && thisThruTime.equals(thatThruTime); 283 } 284 } 285 286 return objectsEqual; 287 } else { 288 return false; 289 } 290 } 291 292 @Override 293 public boolean hasBeenModified() { 294 return entityAttributePKHasBeenModified || entityInstancePKHasBeenModified || latitudeHasBeenModified || longitudeHasBeenModified || elevationHasBeenModified || altitudeHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified; 295 } 296 297 @Override 298 public void clearHasBeenModified() { 299 entityAttributePKHasBeenModified = false; 300 entityInstancePKHasBeenModified = false; 301 latitudeHasBeenModified = false; 302 longitudeHasBeenModified = false; 303 elevationHasBeenModified = false; 304 altitudeHasBeenModified = false; 305 fromTimeHasBeenModified = false; 306 thruTimeHasBeenModified = false; 307 } 308 309 public EntityAttributePK getEntityAttributePK() { 310 return entityAttributePK; 311 } 312 313 public void setEntityAttributePK(EntityAttributePK entityAttributePK) 314 throws PersistenceNotNullException { 315 checkForNull(entityAttributePK); 316 317 boolean update = true; 318 319 if(this.entityAttributePK != null) { 320 if(this.entityAttributePK.equals(entityAttributePK)) { 321 update = false; 322 } 323 } else if(entityAttributePK == null) { 324 update = false; 325 } 326 327 if(update) { 328 this.entityAttributePK = entityAttributePK; 329 entityAttributePKHasBeenModified = true; 330 clearHashAndString(); 331 } 332 } 333 334 public boolean getEntityAttributePKHasBeenModified() { 335 return entityAttributePKHasBeenModified; 336 } 337 338 public EntityInstancePK getEntityInstancePK() { 339 return entityInstancePK; 340 } 341 342 public void setEntityInstancePK(EntityInstancePK entityInstancePK) 343 throws PersistenceNotNullException { 344 checkForNull(entityInstancePK); 345 346 boolean update = true; 347 348 if(this.entityInstancePK != null) { 349 if(this.entityInstancePK.equals(entityInstancePK)) { 350 update = false; 351 } 352 } else if(entityInstancePK == null) { 353 update = false; 354 } 355 356 if(update) { 357 this.entityInstancePK = entityInstancePK; 358 entityInstancePKHasBeenModified = true; 359 clearHashAndString(); 360 } 361 } 362 363 public boolean getEntityInstancePKHasBeenModified() { 364 return entityInstancePKHasBeenModified; 365 } 366 367 public Integer getLatitude() { 368 return latitude; 369 } 370 371 public void setLatitude(Integer latitude) 372 throws PersistenceNotNullException { 373 checkForNull(latitude); 374 375 boolean update = true; 376 377 if(this.latitude != null) { 378 if(this.latitude.equals(latitude)) { 379 update = false; 380 } 381 } else if(latitude == null) { 382 update = false; 383 } 384 385 if(update) { 386 this.latitude = latitude; 387 latitudeHasBeenModified = true; 388 clearHashAndString(); 389 } 390 } 391 392 public boolean getLatitudeHasBeenModified() { 393 return latitudeHasBeenModified; 394 } 395 396 public Integer getLongitude() { 397 return longitude; 398 } 399 400 public void setLongitude(Integer longitude) 401 throws PersistenceNotNullException { 402 checkForNull(longitude); 403 404 boolean update = true; 405 406 if(this.longitude != null) { 407 if(this.longitude.equals(longitude)) { 408 update = false; 409 } 410 } else if(longitude == null) { 411 update = false; 412 } 413 414 if(update) { 415 this.longitude = longitude; 416 longitudeHasBeenModified = true; 417 clearHashAndString(); 418 } 419 } 420 421 public boolean getLongitudeHasBeenModified() { 422 return longitudeHasBeenModified; 423 } 424 425 public Long getElevation() { 426 return elevation; 427 } 428 429 public void setElevation(Long elevation) { 430 boolean update = true; 431 432 if(this.elevation != null) { 433 if(this.elevation.equals(elevation)) { 434 update = false; 435 } 436 } else if(elevation == null) { 437 update = false; 438 } 439 440 if(update) { 441 this.elevation = elevation; 442 elevationHasBeenModified = true; 443 clearHashAndString(); 444 } 445 } 446 447 public boolean getElevationHasBeenModified() { 448 return elevationHasBeenModified; 449 } 450 451 public Long getAltitude() { 452 return altitude; 453 } 454 455 public void setAltitude(Long altitude) { 456 boolean update = true; 457 458 if(this.altitude != null) { 459 if(this.altitude.equals(altitude)) { 460 update = false; 461 } 462 } else if(altitude == null) { 463 update = false; 464 } 465 466 if(update) { 467 this.altitude = altitude; 468 altitudeHasBeenModified = true; 469 clearHashAndString(); 470 } 471 } 472 473 public boolean getAltitudeHasBeenModified() { 474 return altitudeHasBeenModified; 475 } 476 477 public Long getFromTime() { 478 return fromTime; 479 } 480 481 public void setFromTime(Long fromTime) 482 throws PersistenceNotNullException { 483 checkForNull(fromTime); 484 485 boolean update = true; 486 487 if(this.fromTime != null) { 488 if(this.fromTime.equals(fromTime)) { 489 update = false; 490 } 491 } else if(fromTime == null) { 492 update = false; 493 } 494 495 if(update) { 496 this.fromTime = fromTime; 497 fromTimeHasBeenModified = true; 498 clearHashAndString(); 499 } 500 } 501 502 public boolean getFromTimeHasBeenModified() { 503 return fromTimeHasBeenModified; 504 } 505 506 public Long getThruTime() { 507 return thruTime; 508 } 509 510 public void setThruTime(Long thruTime) 511 throws PersistenceNotNullException { 512 checkForNull(thruTime); 513 514 boolean update = true; 515 516 if(this.thruTime != null) { 517 if(this.thruTime.equals(thruTime)) { 518 update = false; 519 } 520 } else if(thruTime == null) { 521 update = false; 522 } 523 524 if(update) { 525 this.thruTime = thruTime; 526 thruTimeHasBeenModified = true; 527 clearHashAndString(); 528 } 529 } 530 531 public boolean getThruTimeHasBeenModified() { 532 return thruTimeHasBeenModified; 533 } 534 535}