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 * InventoryLayerDetailValue.java 021 */ 022 023package com.echothree.model.data.inventory.server.value; 024 025import com.echothree.model.data.inventory.common.pk.InventoryLayerDetailPK; 026 027import com.echothree.model.data.inventory.server.factory.InventoryLayerDetailFactory; 028 029import com.echothree.model.data.inventory.common.pk.InventoryLayerPK; 030import com.echothree.model.data.inventory.common.pk.InventoryTransactionLinePK; 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 InventoryLayerDetailValue 043 extends BaseValue<InventoryLayerDetailPK> 044 implements Cloneable, Serializable { 045 046 private InventoryLayerPK inventoryLayerPK; 047 private boolean inventoryLayerPKHasBeenModified = false; 048 private Integer inventoryLayerSequence; 049 private boolean inventoryLayerSequenceHasBeenModified = false; 050 private InventoryTransactionLinePK inventoryTransactionLinePK; 051 private boolean inventoryTransactionLinePKHasBeenModified = false; 052 private Long receiptQuantity; 053 private boolean receiptQuantityHasBeenModified = false; 054 private Long unitAmount; 055 private boolean unitAmountHasBeenModified = false; 056 private String description; 057 private boolean descriptionHasBeenModified = 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(InventoryLayerPK inventoryLayerPK, Integer inventoryLayerSequence, InventoryTransactionLinePK inventoryTransactionLinePK, Long receiptQuantity, Long unitAmount, String description, Long fromTime, Long thruTime) 067 throws PersistenceNotNullException { 068 checkForNull(inventoryLayerPK); 069 this.inventoryLayerPK = inventoryLayerPK; 070 checkForNull(inventoryLayerSequence); 071 this.inventoryLayerSequence = inventoryLayerSequence; 072 checkForNull(inventoryTransactionLinePK); 073 this.inventoryTransactionLinePK = inventoryTransactionLinePK; 074 checkForNull(receiptQuantity); 075 this.receiptQuantity = receiptQuantity; 076 this.unitAmount = unitAmount; 077 this.description = description; 078 checkForNull(fromTime); 079 this.fromTime = fromTime; 080 checkForNull(thruTime); 081 this.thruTime = thruTime; 082 } 083 084 /** Creates a new instance of InventoryLayerDetailValue */ 085 public InventoryLayerDetailValue(InventoryLayerDetailPK inventoryLayerDetailPK, InventoryLayerPK inventoryLayerPK, Integer inventoryLayerSequence, InventoryTransactionLinePK inventoryTransactionLinePK, Long receiptQuantity, Long unitAmount, String description, Long fromTime, Long thruTime) 086 throws PersistenceNotNullException { 087 super(inventoryLayerDetailPK); 088 constructFields(inventoryLayerPK, inventoryLayerSequence, inventoryTransactionLinePK, receiptQuantity, unitAmount, description, fromTime, thruTime); 089 } 090 091 /** Creates a new instance of InventoryLayerDetailValue */ 092 public InventoryLayerDetailValue(InventoryLayerPK inventoryLayerPK, Integer inventoryLayerSequence, InventoryTransactionLinePK inventoryTransactionLinePK, Long receiptQuantity, Long unitAmount, String description, Long fromTime, Long thruTime) 093 throws PersistenceNotNullException { 094 super(); 095 constructFields(inventoryLayerPK, inventoryLayerSequence, inventoryTransactionLinePK, receiptQuantity, unitAmount, description, fromTime, thruTime); 096 } 097 098 @Override 099 @Nonnull 100 public InventoryLayerDetailFactory getBaseFactoryInstance() { 101 return InventoryLayerDetailFactory.getInstance(); 102 } 103 104 @Override 105 @Nonnull 106 public InventoryLayerDetailValue 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 (InventoryLayerDetailValue)result; 117 } 118 119 @Override 120 @Nonnull 121 public InventoryLayerDetailPK getPrimaryKey() { 122 if(_primaryKey == null) { 123 _primaryKey = new InventoryLayerDetailPK(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 + ((inventoryLayerPK != null) ? inventoryLayerPK.hashCode() : 0); 142 hashCode = 37 * hashCode + ((inventoryLayerSequence != null) ? inventoryLayerSequence.hashCode() : 0); 143 hashCode = 37 * hashCode + ((inventoryTransactionLinePK != null) ? inventoryTransactionLinePK.hashCode() : 0); 144 hashCode = 37 * hashCode + ((receiptQuantity != null) ? receiptQuantity.hashCode() : 0); 145 hashCode = 37 * hashCode + ((unitAmount != null) ? unitAmount.hashCode() : 0); 146 hashCode = 37 * hashCode + ((description != null) ? description.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 ", inventoryLayerPK=" + getInventoryLayerPK() + 163 ", inventoryLayerSequence=" + getInventoryLayerSequence() + 164 ", inventoryTransactionLinePK=" + getInventoryTransactionLinePK() + 165 ", receiptQuantity=" + getReceiptQuantity() + 166 ", unitAmount=" + getUnitAmount() + 167 ", description=" + getDescription() + 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 InventoryLayerDetailValue 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 InventoryLayerDetailValue that) { 202 boolean objectsEqual = true; 203 204 205 if(objectsEqual) { 206 InventoryLayerPK thisInventoryLayerPK = getInventoryLayerPK(); 207 InventoryLayerPK thatInventoryLayerPK = that.getInventoryLayerPK(); 208 209 if(thisInventoryLayerPK == null) { 210 objectsEqual = objectsEqual && (thatInventoryLayerPK == null); 211 } else { 212 objectsEqual = objectsEqual && thisInventoryLayerPK.equals(thatInventoryLayerPK); 213 } 214 } 215 216 if(objectsEqual) { 217 Integer thisInventoryLayerSequence = getInventoryLayerSequence(); 218 Integer thatInventoryLayerSequence = that.getInventoryLayerSequence(); 219 220 if(thisInventoryLayerSequence == null) { 221 objectsEqual = objectsEqual && (thatInventoryLayerSequence == null); 222 } else { 223 objectsEqual = objectsEqual && thisInventoryLayerSequence.equals(thatInventoryLayerSequence); 224 } 225 } 226 227 if(objectsEqual) { 228 InventoryTransactionLinePK thisInventoryTransactionLinePK = getInventoryTransactionLinePK(); 229 InventoryTransactionLinePK thatInventoryTransactionLinePK = that.getInventoryTransactionLinePK(); 230 231 if(thisInventoryTransactionLinePK == null) { 232 objectsEqual = objectsEqual && (thatInventoryTransactionLinePK == null); 233 } else { 234 objectsEqual = objectsEqual && thisInventoryTransactionLinePK.equals(thatInventoryTransactionLinePK); 235 } 236 } 237 238 if(objectsEqual) { 239 Long thisReceiptQuantity = getReceiptQuantity(); 240 Long thatReceiptQuantity = that.getReceiptQuantity(); 241 242 if(thisReceiptQuantity == null) { 243 objectsEqual = objectsEqual && (thatReceiptQuantity == null); 244 } else { 245 objectsEqual = objectsEqual && thisReceiptQuantity.equals(thatReceiptQuantity); 246 } 247 } 248 249 if(objectsEqual) { 250 Long thisUnitAmount = getUnitAmount(); 251 Long thatUnitAmount = that.getUnitAmount(); 252 253 if(thisUnitAmount == null) { 254 objectsEqual = objectsEqual && (thatUnitAmount == null); 255 } else { 256 objectsEqual = objectsEqual && thisUnitAmount.equals(thatUnitAmount); 257 } 258 } 259 260 if(objectsEqual) { 261 String thisDescription = getDescription(); 262 String thatDescription = that.getDescription(); 263 264 if(thisDescription == null) { 265 objectsEqual = objectsEqual && (thatDescription == null); 266 } else { 267 objectsEqual = objectsEqual && thisDescription.equals(thatDescription); 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 inventoryLayerPKHasBeenModified || inventoryLayerSequenceHasBeenModified || inventoryTransactionLinePKHasBeenModified || receiptQuantityHasBeenModified || unitAmountHasBeenModified || descriptionHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified; 302 } 303 304 @Override 305 public void clearHasBeenModified() { 306 inventoryLayerPKHasBeenModified = false; 307 inventoryLayerSequenceHasBeenModified = false; 308 inventoryTransactionLinePKHasBeenModified = false; 309 receiptQuantityHasBeenModified = false; 310 unitAmountHasBeenModified = false; 311 descriptionHasBeenModified = false; 312 fromTimeHasBeenModified = false; 313 thruTimeHasBeenModified = false; 314 } 315 316 @Nonnull 317 public InventoryLayerPK getInventoryLayerPK() { 318 return inventoryLayerPK; 319 } 320 321 public void setInventoryLayerPK(@Nonnull InventoryLayerPK inventoryLayerPK) 322 throws PersistenceNotNullException { 323 checkForNull(inventoryLayerPK); 324 325 boolean update = true; 326 327 if(this.inventoryLayerPK != null) { 328 if(this.inventoryLayerPK.equals(inventoryLayerPK)) { 329 update = false; 330 } 331 } else if(inventoryLayerPK == null) { 332 update = false; 333 } 334 335 if(update) { 336 this.inventoryLayerPK = inventoryLayerPK; 337 inventoryLayerPKHasBeenModified = true; 338 clearHashAndString(); 339 } 340 } 341 342 public boolean getInventoryLayerPKHasBeenModified() { 343 return inventoryLayerPKHasBeenModified; 344 } 345 346 @Nonnull 347 public Integer getInventoryLayerSequence() { 348 return inventoryLayerSequence; 349 } 350 351 public void setInventoryLayerSequence(@Nonnull Integer inventoryLayerSequence) 352 throws PersistenceNotNullException { 353 checkForNull(inventoryLayerSequence); 354 355 boolean update = true; 356 357 if(this.inventoryLayerSequence != null) { 358 if(this.inventoryLayerSequence.equals(inventoryLayerSequence)) { 359 update = false; 360 } 361 } else if(inventoryLayerSequence == null) { 362 update = false; 363 } 364 365 if(update) { 366 this.inventoryLayerSequence = inventoryLayerSequence; 367 inventoryLayerSequenceHasBeenModified = true; 368 clearHashAndString(); 369 } 370 } 371 372 public boolean getInventoryLayerSequenceHasBeenModified() { 373 return inventoryLayerSequenceHasBeenModified; 374 } 375 376 @Nonnull 377 public InventoryTransactionLinePK getInventoryTransactionLinePK() { 378 return inventoryTransactionLinePK; 379 } 380 381 public void setInventoryTransactionLinePK(@Nonnull InventoryTransactionLinePK inventoryTransactionLinePK) 382 throws PersistenceNotNullException { 383 checkForNull(inventoryTransactionLinePK); 384 385 boolean update = true; 386 387 if(this.inventoryTransactionLinePK != null) { 388 if(this.inventoryTransactionLinePK.equals(inventoryTransactionLinePK)) { 389 update = false; 390 } 391 } else if(inventoryTransactionLinePK == null) { 392 update = false; 393 } 394 395 if(update) { 396 this.inventoryTransactionLinePK = inventoryTransactionLinePK; 397 inventoryTransactionLinePKHasBeenModified = true; 398 clearHashAndString(); 399 } 400 } 401 402 public boolean getInventoryTransactionLinePKHasBeenModified() { 403 return inventoryTransactionLinePKHasBeenModified; 404 } 405 406 @Nonnull 407 public Long getReceiptQuantity() { 408 return receiptQuantity; 409 } 410 411 public void setReceiptQuantity(@Nonnull Long receiptQuantity) 412 throws PersistenceNotNullException { 413 checkForNull(receiptQuantity); 414 415 boolean update = true; 416 417 if(this.receiptQuantity != null) { 418 if(this.receiptQuantity.equals(receiptQuantity)) { 419 update = false; 420 } 421 } else if(receiptQuantity == null) { 422 update = false; 423 } 424 425 if(update) { 426 this.receiptQuantity = receiptQuantity; 427 receiptQuantityHasBeenModified = true; 428 clearHashAndString(); 429 } 430 } 431 432 public boolean getReceiptQuantityHasBeenModified() { 433 return receiptQuantityHasBeenModified; 434 } 435 436 @Nullable 437 public Long getUnitAmount() { 438 return unitAmount; 439 } 440 441 public void setUnitAmount(@Nullable Long unitAmount) { 442 boolean update = true; 443 444 if(this.unitAmount != null) { 445 if(this.unitAmount.equals(unitAmount)) { 446 update = false; 447 } 448 } else if(unitAmount == null) { 449 update = false; 450 } 451 452 if(update) { 453 this.unitAmount = unitAmount; 454 unitAmountHasBeenModified = true; 455 clearHashAndString(); 456 } 457 } 458 459 public boolean getUnitAmountHasBeenModified() { 460 return unitAmountHasBeenModified; 461 } 462 463 @Nullable 464 public String getDescription() { 465 return description; 466 } 467 468 public void setDescription(@Nullable String description) { 469 boolean update = true; 470 471 if(this.description != null) { 472 if(this.description.equals(description)) { 473 update = false; 474 } 475 } else if(description == null) { 476 update = false; 477 } 478 479 if(update) { 480 this.description = description; 481 descriptionHasBeenModified = true; 482 clearHashAndString(); 483 } 484 } 485 486 public boolean getDescriptionHasBeenModified() { 487 return descriptionHasBeenModified; 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}