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