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