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.InventoryCostingPoolPK; 031import com.echothree.model.data.inventory.common.pk.InventoryTransactionLinePK; 032 033import com.echothree.util.common.exception.PersistenceCloneException; 034import com.echothree.util.common.exception.PersistenceNotNullException; 035 036import com.echothree.util.server.persistence.BaseValue; 037 038import java.io.Serializable; 039 040import javax.annotation.Nonnull; 041import javax.annotation.Nullable; 042 043public class InventoryLayerDetailValue 044 extends BaseValue<InventoryLayerDetailPK> 045 implements Cloneable, Serializable { 046 047 private InventoryLayerPK inventoryLayerPK; 048 private boolean inventoryLayerPKHasBeenModified = false; 049 private InventoryCostingPoolPK inventoryCostingPoolPK; 050 private boolean inventoryCostingPoolPKHasBeenModified = false; 051 private Integer inventoryLayerSequence; 052 private boolean inventoryLayerSequenceHasBeenModified = false; 053 private InventoryTransactionLinePK inventoryTransactionLinePK; 054 private boolean inventoryTransactionLinePKHasBeenModified = false; 055 private Long receiptQuantity; 056 private boolean receiptQuantityHasBeenModified = false; 057 private Long unitCost; 058 private boolean unitCostHasBeenModified = false; 059 private String description; 060 private boolean descriptionHasBeenModified = false; 061 private Long fromTime; 062 private boolean fromTimeHasBeenModified = false; 063 private Long thruTime; 064 private boolean thruTimeHasBeenModified = false; 065 066 private transient Integer _hashCode = null; 067 private transient String _stringValue = null; 068 069 private void constructFields(InventoryLayerPK inventoryLayerPK, InventoryCostingPoolPK inventoryCostingPoolPK, Integer inventoryLayerSequence, InventoryTransactionLinePK inventoryTransactionLinePK, Long receiptQuantity, Long unitCost, String description, Long fromTime, Long thruTime) 070 throws PersistenceNotNullException { 071 checkForNull(inventoryLayerPK); 072 this.inventoryLayerPK = inventoryLayerPK; 073 checkForNull(inventoryCostingPoolPK); 074 this.inventoryCostingPoolPK = inventoryCostingPoolPK; 075 checkForNull(inventoryLayerSequence); 076 this.inventoryLayerSequence = inventoryLayerSequence; 077 checkForNull(inventoryTransactionLinePK); 078 this.inventoryTransactionLinePK = inventoryTransactionLinePK; 079 checkForNull(receiptQuantity); 080 this.receiptQuantity = receiptQuantity; 081 this.unitCost = unitCost; 082 this.description = description; 083 checkForNull(fromTime); 084 this.fromTime = fromTime; 085 checkForNull(thruTime); 086 this.thruTime = thruTime; 087 } 088 089 /** Creates a new instance of InventoryLayerDetailValue */ 090 public InventoryLayerDetailValue(InventoryLayerDetailPK inventoryLayerDetailPK, InventoryLayerPK inventoryLayerPK, InventoryCostingPoolPK inventoryCostingPoolPK, Integer inventoryLayerSequence, InventoryTransactionLinePK inventoryTransactionLinePK, Long receiptQuantity, Long unitCost, String description, Long fromTime, Long thruTime) 091 throws PersistenceNotNullException { 092 super(inventoryLayerDetailPK); 093 constructFields(inventoryLayerPK, inventoryCostingPoolPK, inventoryLayerSequence, inventoryTransactionLinePK, receiptQuantity, unitCost, description, fromTime, thruTime); 094 } 095 096 /** Creates a new instance of InventoryLayerDetailValue */ 097 public InventoryLayerDetailValue(InventoryLayerPK inventoryLayerPK, InventoryCostingPoolPK inventoryCostingPoolPK, Integer inventoryLayerSequence, InventoryTransactionLinePK inventoryTransactionLinePK, Long receiptQuantity, Long unitCost, String description, Long fromTime, Long thruTime) 098 throws PersistenceNotNullException { 099 super(); 100 constructFields(inventoryLayerPK, inventoryCostingPoolPK, inventoryLayerSequence, inventoryTransactionLinePK, receiptQuantity, unitCost, description, fromTime, thruTime); 101 } 102 103 @Override 104 @Nonnull 105 public InventoryLayerDetailFactory getBaseFactoryInstance() { 106 return InventoryLayerDetailFactory.getInstance(); 107 } 108 109 @Override 110 @Nonnull 111 public InventoryLayerDetailValue clone() { 112 Object result; 113 114 try { 115 result = super.clone(); 116 } catch (CloneNotSupportedException cnse) { 117 // This shouldn't happen, fail when it does. 118 throw new PersistenceCloneException(cnse); 119 } 120 121 return (InventoryLayerDetailValue)result; 122 } 123 124 @Override 125 @Nonnull 126 public InventoryLayerDetailPK getPrimaryKey() { 127 if(_primaryKey == null) { 128 _primaryKey = new InventoryLayerDetailPK(entityId); 129 } 130 131 return _primaryKey; 132 } 133 134 private void clearHashAndString() { 135 _hashCode = null; 136 _stringValue = null; 137 } 138 139 @Override 140 public int hashCode() { 141 if(_hashCode == null) { 142 int hashCode = 17; 143 144 hashCode = 37 * hashCode + ((entityId != null) ? entityId.hashCode() : 0); 145 146 hashCode = 37 * hashCode + ((inventoryLayerPK != null) ? inventoryLayerPK.hashCode() : 0); 147 hashCode = 37 * hashCode + ((inventoryCostingPoolPK != null) ? inventoryCostingPoolPK.hashCode() : 0); 148 hashCode = 37 * hashCode + ((inventoryLayerSequence != null) ? inventoryLayerSequence.hashCode() : 0); 149 hashCode = 37 * hashCode + ((inventoryTransactionLinePK != null) ? inventoryTransactionLinePK.hashCode() : 0); 150 hashCode = 37 * hashCode + ((receiptQuantity != null) ? receiptQuantity.hashCode() : 0); 151 hashCode = 37 * hashCode + ((unitCost != null) ? unitCost.hashCode() : 0); 152 hashCode = 37 * hashCode + ((description != null) ? description.hashCode() : 0); 153 hashCode = 37 * hashCode + ((fromTime != null) ? fromTime.hashCode() : 0); 154 hashCode = 37 * hashCode + ((thruTime != null) ? thruTime.hashCode() : 0); 155 156 _hashCode = hashCode; 157 } 158 159 return _hashCode; 160 } 161 162 @Override 163 @Nonnull 164 public String toString() { 165 if(_stringValue == null) { 166 _stringValue = "{" + 167 "entityId=" + getEntityId() + 168 ", inventoryLayerPK=" + getInventoryLayerPK() + 169 ", inventoryCostingPoolPK=" + getInventoryCostingPoolPK() + 170 ", inventoryLayerSequence=" + getInventoryLayerSequence() + 171 ", inventoryTransactionLinePK=" + getInventoryTransactionLinePK() + 172 ", receiptQuantity=" + getReceiptQuantity() + 173 ", unitCost=" + getUnitCost() + 174 ", description=" + getDescription() + 175 ", fromTime=" + getFromTime() + 176 ", thruTime=" + getThruTime() + 177 "}"; 178 } 179 return _stringValue; 180 } 181 182 @Override 183 public boolean equals(Object other) { 184 if(this == other) 185 return true; 186 187 if(!hasIdentity()) 188 return false; 189 190 if(other instanceof InventoryLayerDetailValue that) { 191 if(!that.hasIdentity()) 192 return false; 193 194 Long thisEntityId = getEntityId(); 195 Long thatEntityId = that.getEntityId(); 196 197 boolean objectsEqual = thisEntityId.equals(thatEntityId); 198 if(objectsEqual) 199 objectsEqual = isIdentical(that); 200 201 return objectsEqual; 202 } else { 203 return false; 204 } 205 } 206 207 public boolean isIdentical(Object other) { 208 if(other instanceof InventoryLayerDetailValue that) { 209 boolean objectsEqual = true; 210 211 212 if(objectsEqual) { 213 InventoryLayerPK thisInventoryLayerPK = getInventoryLayerPK(); 214 InventoryLayerPK thatInventoryLayerPK = that.getInventoryLayerPK(); 215 216 if(thisInventoryLayerPK == null) { 217 objectsEqual = objectsEqual && (thatInventoryLayerPK == null); 218 } else { 219 objectsEqual = objectsEqual && thisInventoryLayerPK.equals(thatInventoryLayerPK); 220 } 221 } 222 223 if(objectsEqual) { 224 InventoryCostingPoolPK thisInventoryCostingPoolPK = getInventoryCostingPoolPK(); 225 InventoryCostingPoolPK thatInventoryCostingPoolPK = that.getInventoryCostingPoolPK(); 226 227 if(thisInventoryCostingPoolPK == null) { 228 objectsEqual = objectsEqual && (thatInventoryCostingPoolPK == null); 229 } else { 230 objectsEqual = objectsEqual && thisInventoryCostingPoolPK.equals(thatInventoryCostingPoolPK); 231 } 232 } 233 234 if(objectsEqual) { 235 Integer thisInventoryLayerSequence = getInventoryLayerSequence(); 236 Integer thatInventoryLayerSequence = that.getInventoryLayerSequence(); 237 238 if(thisInventoryLayerSequence == null) { 239 objectsEqual = objectsEqual && (thatInventoryLayerSequence == null); 240 } else { 241 objectsEqual = objectsEqual && thisInventoryLayerSequence.equals(thatInventoryLayerSequence); 242 } 243 } 244 245 if(objectsEqual) { 246 InventoryTransactionLinePK thisInventoryTransactionLinePK = getInventoryTransactionLinePK(); 247 InventoryTransactionLinePK thatInventoryTransactionLinePK = that.getInventoryTransactionLinePK(); 248 249 if(thisInventoryTransactionLinePK == null) { 250 objectsEqual = objectsEqual && (thatInventoryTransactionLinePK == null); 251 } else { 252 objectsEqual = objectsEqual && thisInventoryTransactionLinePK.equals(thatInventoryTransactionLinePK); 253 } 254 } 255 256 if(objectsEqual) { 257 Long thisReceiptQuantity = getReceiptQuantity(); 258 Long thatReceiptQuantity = that.getReceiptQuantity(); 259 260 if(thisReceiptQuantity == null) { 261 objectsEqual = objectsEqual && (thatReceiptQuantity == null); 262 } else { 263 objectsEqual = objectsEqual && thisReceiptQuantity.equals(thatReceiptQuantity); 264 } 265 } 266 267 if(objectsEqual) { 268 Long thisUnitCost = getUnitCost(); 269 Long thatUnitCost = that.getUnitCost(); 270 271 if(thisUnitCost == null) { 272 objectsEqual = objectsEqual && (thatUnitCost == null); 273 } else { 274 objectsEqual = objectsEqual && thisUnitCost.equals(thatUnitCost); 275 } 276 } 277 278 if(objectsEqual) { 279 String thisDescription = getDescription(); 280 String thatDescription = that.getDescription(); 281 282 if(thisDescription == null) { 283 objectsEqual = objectsEqual && (thatDescription == null); 284 } else { 285 objectsEqual = objectsEqual && thisDescription.equals(thatDescription); 286 } 287 } 288 289 if(objectsEqual) { 290 Long thisFromTime = getFromTime(); 291 Long thatFromTime = that.getFromTime(); 292 293 if(thisFromTime == null) { 294 objectsEqual = objectsEqual && (thatFromTime == null); 295 } else { 296 objectsEqual = objectsEqual && thisFromTime.equals(thatFromTime); 297 } 298 } 299 300 if(objectsEqual) { 301 Long thisThruTime = getThruTime(); 302 Long thatThruTime = that.getThruTime(); 303 304 if(thisThruTime == null) { 305 objectsEqual = objectsEqual && (thatThruTime == null); 306 } else { 307 objectsEqual = objectsEqual && thisThruTime.equals(thatThruTime); 308 } 309 } 310 311 return objectsEqual; 312 } else { 313 return false; 314 } 315 } 316 317 @Override 318 public boolean hasBeenModified() { 319 return inventoryLayerPKHasBeenModified || inventoryCostingPoolPKHasBeenModified || inventoryLayerSequenceHasBeenModified || inventoryTransactionLinePKHasBeenModified || receiptQuantityHasBeenModified || unitCostHasBeenModified || descriptionHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified; 320 } 321 322 @Override 323 public void clearHasBeenModified() { 324 inventoryLayerPKHasBeenModified = false; 325 inventoryCostingPoolPKHasBeenModified = false; 326 inventoryLayerSequenceHasBeenModified = false; 327 inventoryTransactionLinePKHasBeenModified = false; 328 receiptQuantityHasBeenModified = false; 329 unitCostHasBeenModified = false; 330 descriptionHasBeenModified = false; 331 fromTimeHasBeenModified = false; 332 thruTimeHasBeenModified = false; 333 } 334 335 @Nonnull 336 public InventoryLayerPK getInventoryLayerPK() { 337 return inventoryLayerPK; 338 } 339 340 public void setInventoryLayerPK(@Nonnull InventoryLayerPK inventoryLayerPK) 341 throws PersistenceNotNullException { 342 checkForNull(inventoryLayerPK); 343 344 boolean update = true; 345 346 if(this.inventoryLayerPK != null) { 347 if(this.inventoryLayerPK.equals(inventoryLayerPK)) { 348 update = false; 349 } 350 } else if(inventoryLayerPK == null) { 351 update = false; 352 } 353 354 if(update) { 355 this.inventoryLayerPK = inventoryLayerPK; 356 inventoryLayerPKHasBeenModified = true; 357 clearHashAndString(); 358 } 359 } 360 361 public boolean getInventoryLayerPKHasBeenModified() { 362 return inventoryLayerPKHasBeenModified; 363 } 364 365 @Nonnull 366 public InventoryCostingPoolPK getInventoryCostingPoolPK() { 367 return inventoryCostingPoolPK; 368 } 369 370 public void setInventoryCostingPoolPK(@Nonnull InventoryCostingPoolPK inventoryCostingPoolPK) 371 throws PersistenceNotNullException { 372 checkForNull(inventoryCostingPoolPK); 373 374 boolean update = true; 375 376 if(this.inventoryCostingPoolPK != null) { 377 if(this.inventoryCostingPoolPK.equals(inventoryCostingPoolPK)) { 378 update = false; 379 } 380 } else if(inventoryCostingPoolPK == null) { 381 update = false; 382 } 383 384 if(update) { 385 this.inventoryCostingPoolPK = inventoryCostingPoolPK; 386 inventoryCostingPoolPKHasBeenModified = true; 387 clearHashAndString(); 388 } 389 } 390 391 public boolean getInventoryCostingPoolPKHasBeenModified() { 392 return inventoryCostingPoolPKHasBeenModified; 393 } 394 395 @Nonnull 396 public Integer getInventoryLayerSequence() { 397 return inventoryLayerSequence; 398 } 399 400 public void setInventoryLayerSequence(@Nonnull Integer inventoryLayerSequence) 401 throws PersistenceNotNullException { 402 checkForNull(inventoryLayerSequence); 403 404 boolean update = true; 405 406 if(this.inventoryLayerSequence != null) { 407 if(this.inventoryLayerSequence.equals(inventoryLayerSequence)) { 408 update = false; 409 } 410 } else if(inventoryLayerSequence == null) { 411 update = false; 412 } 413 414 if(update) { 415 this.inventoryLayerSequence = inventoryLayerSequence; 416 inventoryLayerSequenceHasBeenModified = true; 417 clearHashAndString(); 418 } 419 } 420 421 public boolean getInventoryLayerSequenceHasBeenModified() { 422 return inventoryLayerSequenceHasBeenModified; 423 } 424 425 @Nonnull 426 public InventoryTransactionLinePK getInventoryTransactionLinePK() { 427 return inventoryTransactionLinePK; 428 } 429 430 public void setInventoryTransactionLinePK(@Nonnull InventoryTransactionLinePK inventoryTransactionLinePK) 431 throws PersistenceNotNullException { 432 checkForNull(inventoryTransactionLinePK); 433 434 boolean update = true; 435 436 if(this.inventoryTransactionLinePK != null) { 437 if(this.inventoryTransactionLinePK.equals(inventoryTransactionLinePK)) { 438 update = false; 439 } 440 } else if(inventoryTransactionLinePK == null) { 441 update = false; 442 } 443 444 if(update) { 445 this.inventoryTransactionLinePK = inventoryTransactionLinePK; 446 inventoryTransactionLinePKHasBeenModified = true; 447 clearHashAndString(); 448 } 449 } 450 451 public boolean getInventoryTransactionLinePKHasBeenModified() { 452 return inventoryTransactionLinePKHasBeenModified; 453 } 454 455 @Nonnull 456 public Long getReceiptQuantity() { 457 return receiptQuantity; 458 } 459 460 public void setReceiptQuantity(@Nonnull Long receiptQuantity) 461 throws PersistenceNotNullException { 462 checkForNull(receiptQuantity); 463 464 boolean update = true; 465 466 if(this.receiptQuantity != null) { 467 if(this.receiptQuantity.equals(receiptQuantity)) { 468 update = false; 469 } 470 } else if(receiptQuantity == null) { 471 update = false; 472 } 473 474 if(update) { 475 this.receiptQuantity = receiptQuantity; 476 receiptQuantityHasBeenModified = true; 477 clearHashAndString(); 478 } 479 } 480 481 public boolean getReceiptQuantityHasBeenModified() { 482 return receiptQuantityHasBeenModified; 483 } 484 485 @Nullable 486 public Long getUnitCost() { 487 return unitCost; 488 } 489 490 public void setUnitCost(@Nullable Long unitCost) { 491 boolean update = true; 492 493 if(this.unitCost != null) { 494 if(this.unitCost.equals(unitCost)) { 495 update = false; 496 } 497 } else if(unitCost == null) { 498 update = false; 499 } 500 501 if(update) { 502 this.unitCost = unitCost; 503 unitCostHasBeenModified = true; 504 clearHashAndString(); 505 } 506 } 507 508 public boolean getUnitCostHasBeenModified() { 509 return unitCostHasBeenModified; 510 } 511 512 @Nullable 513 public String getDescription() { 514 return description; 515 } 516 517 public void setDescription(@Nullable String description) { 518 boolean update = true; 519 520 if(this.description != null) { 521 if(this.description.equals(description)) { 522 update = false; 523 } 524 } else if(description == null) { 525 update = false; 526 } 527 528 if(update) { 529 this.description = description; 530 descriptionHasBeenModified = true; 531 clearHashAndString(); 532 } 533 } 534 535 public boolean getDescriptionHasBeenModified() { 536 return descriptionHasBeenModified; 537 } 538 539 @Nonnull 540 public Long getFromTime() { 541 return fromTime; 542 } 543 544 public void setFromTime(@Nonnull Long fromTime) 545 throws PersistenceNotNullException { 546 checkForNull(fromTime); 547 548 boolean update = true; 549 550 if(this.fromTime != null) { 551 if(this.fromTime.equals(fromTime)) { 552 update = false; 553 } 554 } else if(fromTime == null) { 555 update = false; 556 } 557 558 if(update) { 559 this.fromTime = fromTime; 560 fromTimeHasBeenModified = true; 561 clearHashAndString(); 562 } 563 } 564 565 public boolean getFromTimeHasBeenModified() { 566 return fromTimeHasBeenModified; 567 } 568 569 @Nonnull 570 public Long getThruTime() { 571 return thruTime; 572 } 573 574 public void setThruTime(@Nonnull Long thruTime) 575 throws PersistenceNotNullException { 576 checkForNull(thruTime); 577 578 boolean update = true; 579 580 if(this.thruTime != null) { 581 if(this.thruTime.equals(thruTime)) { 582 update = false; 583 } 584 } else if(thruTime == null) { 585 update = false; 586 } 587 588 if(update) { 589 this.thruTime = thruTime; 590 thruTimeHasBeenModified = true; 591 clearHashAndString(); 592 } 593 } 594 595 public boolean getThruTimeHasBeenModified() { 596 return thruTimeHasBeenModified; 597 } 598 599}