001// -------------------------------------------------------------------------------- 002// Copyright 2002-2024 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 StringBuilder stringValue = new StringBuilder("{"); 146 147 stringValue.append("entityId=").append(getEntityId()); 148 149 stringValue.append(", entityAttributePK=").append(getEntityAttributePK()); 150 stringValue.append(", upperRangeLongValue=").append(getUpperRangeLongValue()); 151 stringValue.append(", upperLimitLongValue=").append(getUpperLimitLongValue()); 152 stringValue.append(", lowerLimitLongValue=").append(getLowerLimitLongValue()); 153 stringValue.append(", lowerRangeLongValue=").append(getLowerRangeLongValue()); 154 stringValue.append(", fromTime=").append(getFromTime()); 155 stringValue.append(", thruTime=").append(getThruTime()); 156 157 stringValue.append('}'); 158 159 _stringValue = stringValue.toString(); 160 } 161 return _stringValue; 162 } 163 164 @Override 165 public boolean equals(Object other) { 166 if(this == other) 167 return true; 168 169 if(!hasIdentity()) 170 return false; 171 172 if(other instanceof EntityAttributeLongValue) { 173 EntityAttributeLongValue that = (EntityAttributeLongValue)other; 174 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 = 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 EntityAttributeLongValue) { 193 EntityAttributeLongValue that = (EntityAttributeLongValue)other; 194 boolean objectsEqual = true; 195 196 197 if(objectsEqual) { 198 EntityAttributePK thisEntityAttributePK = getEntityAttributePK(); 199 EntityAttributePK thatEntityAttributePK = that.getEntityAttributePK(); 200 201 if(thisEntityAttributePK == null) { 202 objectsEqual = objectsEqual && (thatEntityAttributePK == null); 203 } else { 204 objectsEqual = objectsEqual && thisEntityAttributePK.equals(thatEntityAttributePK); 205 } 206 } 207 208 if(objectsEqual) { 209 Long thisUpperRangeLongValue = getUpperRangeLongValue(); 210 Long thatUpperRangeLongValue = that.getUpperRangeLongValue(); 211 212 if(thisUpperRangeLongValue == null) { 213 objectsEqual = objectsEqual && (thatUpperRangeLongValue == null); 214 } else { 215 objectsEqual = objectsEqual && thisUpperRangeLongValue.equals(thatUpperRangeLongValue); 216 } 217 } 218 219 if(objectsEqual) { 220 Long thisUpperLimitLongValue = getUpperLimitLongValue(); 221 Long thatUpperLimitLongValue = that.getUpperLimitLongValue(); 222 223 if(thisUpperLimitLongValue == null) { 224 objectsEqual = objectsEqual && (thatUpperLimitLongValue == null); 225 } else { 226 objectsEqual = objectsEqual && thisUpperLimitLongValue.equals(thatUpperLimitLongValue); 227 } 228 } 229 230 if(objectsEqual) { 231 Long thisLowerLimitLongValue = getLowerLimitLongValue(); 232 Long thatLowerLimitLongValue = that.getLowerLimitLongValue(); 233 234 if(thisLowerLimitLongValue == null) { 235 objectsEqual = objectsEqual && (thatLowerLimitLongValue == null); 236 } else { 237 objectsEqual = objectsEqual && thisLowerLimitLongValue.equals(thatLowerLimitLongValue); 238 } 239 } 240 241 if(objectsEqual) { 242 Long thisLowerRangeLongValue = getLowerRangeLongValue(); 243 Long thatLowerRangeLongValue = that.getLowerRangeLongValue(); 244 245 if(thisLowerRangeLongValue == null) { 246 objectsEqual = objectsEqual && (thatLowerRangeLongValue == null); 247 } else { 248 objectsEqual = objectsEqual && thisLowerRangeLongValue.equals(thatLowerRangeLongValue); 249 } 250 } 251 252 if(objectsEqual) { 253 Long thisFromTime = getFromTime(); 254 Long thatFromTime = that.getFromTime(); 255 256 if(thisFromTime == null) { 257 objectsEqual = objectsEqual && (thatFromTime == null); 258 } else { 259 objectsEqual = objectsEqual && thisFromTime.equals(thatFromTime); 260 } 261 } 262 263 if(objectsEqual) { 264 Long thisThruTime = getThruTime(); 265 Long thatThruTime = that.getThruTime(); 266 267 if(thisThruTime == null) { 268 objectsEqual = objectsEqual && (thatThruTime == null); 269 } else { 270 objectsEqual = objectsEqual && thisThruTime.equals(thatThruTime); 271 } 272 } 273 274 return objectsEqual; 275 } else { 276 return false; 277 } 278 } 279 280 @Override 281 public boolean hasBeenModified() { 282 return entityAttributePKHasBeenModified || upperRangeLongValueHasBeenModified || upperLimitLongValueHasBeenModified || lowerLimitLongValueHasBeenModified || lowerRangeLongValueHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified; 283 } 284 285 @Override 286 public void clearHasBeenModified() { 287 entityAttributePKHasBeenModified = false; 288 upperRangeLongValueHasBeenModified = false; 289 upperLimitLongValueHasBeenModified = false; 290 lowerLimitLongValueHasBeenModified = false; 291 lowerRangeLongValueHasBeenModified = false; 292 fromTimeHasBeenModified = false; 293 thruTimeHasBeenModified = false; 294 } 295 296 public EntityAttributePK getEntityAttributePK() { 297 return entityAttributePK; 298 } 299 300 public void setEntityAttributePK(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 public Long getUpperRangeLongValue() { 326 return upperRangeLongValue; 327 } 328 329 public void setUpperRangeLongValue(Long upperRangeLongValue) { 330 boolean update = true; 331 332 if(this.upperRangeLongValue != null) { 333 if(this.upperRangeLongValue.equals(upperRangeLongValue)) { 334 update = false; 335 } 336 } else if(upperRangeLongValue == null) { 337 update = false; 338 } 339 340 if(update) { 341 this.upperRangeLongValue = upperRangeLongValue; 342 upperRangeLongValueHasBeenModified = true; 343 clearHashAndString(); 344 } 345 } 346 347 public boolean getUpperRangeLongValueHasBeenModified() { 348 return upperRangeLongValueHasBeenModified; 349 } 350 351 public Long getUpperLimitLongValue() { 352 return upperLimitLongValue; 353 } 354 355 public void setUpperLimitLongValue(Long upperLimitLongValue) { 356 boolean update = true; 357 358 if(this.upperLimitLongValue != null) { 359 if(this.upperLimitLongValue.equals(upperLimitLongValue)) { 360 update = false; 361 } 362 } else if(upperLimitLongValue == null) { 363 update = false; 364 } 365 366 if(update) { 367 this.upperLimitLongValue = upperLimitLongValue; 368 upperLimitLongValueHasBeenModified = true; 369 clearHashAndString(); 370 } 371 } 372 373 public boolean getUpperLimitLongValueHasBeenModified() { 374 return upperLimitLongValueHasBeenModified; 375 } 376 377 public Long getLowerLimitLongValue() { 378 return lowerLimitLongValue; 379 } 380 381 public void setLowerLimitLongValue(Long lowerLimitLongValue) { 382 boolean update = true; 383 384 if(this.lowerLimitLongValue != null) { 385 if(this.lowerLimitLongValue.equals(lowerLimitLongValue)) { 386 update = false; 387 } 388 } else if(lowerLimitLongValue == null) { 389 update = false; 390 } 391 392 if(update) { 393 this.lowerLimitLongValue = lowerLimitLongValue; 394 lowerLimitLongValueHasBeenModified = true; 395 clearHashAndString(); 396 } 397 } 398 399 public boolean getLowerLimitLongValueHasBeenModified() { 400 return lowerLimitLongValueHasBeenModified; 401 } 402 403 public Long getLowerRangeLongValue() { 404 return lowerRangeLongValue; 405 } 406 407 public void setLowerRangeLongValue(Long lowerRangeLongValue) { 408 boolean update = true; 409 410 if(this.lowerRangeLongValue != null) { 411 if(this.lowerRangeLongValue.equals(lowerRangeLongValue)) { 412 update = false; 413 } 414 } else if(lowerRangeLongValue == null) { 415 update = false; 416 } 417 418 if(update) { 419 this.lowerRangeLongValue = lowerRangeLongValue; 420 lowerRangeLongValueHasBeenModified = true; 421 clearHashAndString(); 422 } 423 } 424 425 public boolean getLowerRangeLongValueHasBeenModified() { 426 return lowerRangeLongValueHasBeenModified; 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}