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