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 * LotDetailValue.java 021 */ 022 023package com.echothree.model.data.inventory.server.value; 024 025import com.echothree.model.data.inventory.common.pk.LotDetailPK; 026 027import com.echothree.model.data.inventory.server.factory.LotDetailFactory; 028 029import com.echothree.model.data.inventory.common.pk.LotPK; 030import com.echothree.model.data.party.common.pk.PartyPK; 031import com.echothree.model.data.item.common.pk.ItemPK; 032import com.echothree.model.data.uom.common.pk.UnitOfMeasureTypePK; 033import com.echothree.model.data.inventory.common.pk.InventoryConditionPK; 034import com.echothree.model.data.accounting.common.pk.CurrencyPK; 035 036import com.echothree.util.common.exception.PersistenceCloneException; 037import com.echothree.util.common.exception.PersistenceNotNullException; 038 039import com.echothree.util.server.persistence.BaseValue; 040 041import java.io.Serializable; 042 043public class LotDetailValue 044 extends BaseValue<LotDetailPK> 045 implements Cloneable, Serializable { 046 047 private LotPK lotPK; 048 private boolean lotPKHasBeenModified = false; 049 private String lotName; 050 private boolean lotNameHasBeenModified = false; 051 private PartyPK ownerPartyPK; 052 private boolean ownerPartyPKHasBeenModified = false; 053 private ItemPK itemPK; 054 private boolean itemPKHasBeenModified = false; 055 private UnitOfMeasureTypePK unitOfMeasureTypePK; 056 private boolean unitOfMeasureTypePKHasBeenModified = false; 057 private InventoryConditionPK inventoryConditionPK; 058 private boolean inventoryConditionPKHasBeenModified = false; 059 private Long quantity; 060 private boolean quantityHasBeenModified = false; 061 private CurrencyPK currencyPK; 062 private boolean currencyPKHasBeenModified = false; 063 private Long unitCost; 064 private boolean unitCostHasBeenModified = false; 065 private Long fromTime; 066 private boolean fromTimeHasBeenModified = false; 067 private Long thruTime; 068 private boolean thruTimeHasBeenModified = false; 069 070 private transient Integer _hashCode = null; 071 private transient String _stringValue = null; 072 073 private void constructFields(LotPK lotPK, String lotName, PartyPK ownerPartyPK, ItemPK itemPK, UnitOfMeasureTypePK unitOfMeasureTypePK, InventoryConditionPK inventoryConditionPK, Long quantity, CurrencyPK currencyPK, Long unitCost, Long fromTime, Long thruTime) 074 throws PersistenceNotNullException { 075 checkForNull(lotPK); 076 this.lotPK = lotPK; 077 checkForNull(lotName); 078 this.lotName = lotName; 079 checkForNull(ownerPartyPK); 080 this.ownerPartyPK = ownerPartyPK; 081 checkForNull(itemPK); 082 this.itemPK = itemPK; 083 checkForNull(unitOfMeasureTypePK); 084 this.unitOfMeasureTypePK = unitOfMeasureTypePK; 085 checkForNull(inventoryConditionPK); 086 this.inventoryConditionPK = inventoryConditionPK; 087 checkForNull(quantity); 088 this.quantity = quantity; 089 this.currencyPK = currencyPK; 090 this.unitCost = unitCost; 091 checkForNull(fromTime); 092 this.fromTime = fromTime; 093 checkForNull(thruTime); 094 this.thruTime = thruTime; 095 } 096 097 /** Creates a new instance of LotDetailValue */ 098 public LotDetailValue(LotDetailPK lotDetailPK, LotPK lotPK, String lotName, PartyPK ownerPartyPK, ItemPK itemPK, UnitOfMeasureTypePK unitOfMeasureTypePK, InventoryConditionPK inventoryConditionPK, Long quantity, CurrencyPK currencyPK, Long unitCost, Long fromTime, Long thruTime) 099 throws PersistenceNotNullException { 100 super(lotDetailPK); 101 constructFields(lotPK, lotName, ownerPartyPK, itemPK, unitOfMeasureTypePK, inventoryConditionPK, quantity, currencyPK, unitCost, fromTime, thruTime); 102 } 103 104 /** Creates a new instance of LotDetailValue */ 105 public LotDetailValue(LotPK lotPK, String lotName, PartyPK ownerPartyPK, ItemPK itemPK, UnitOfMeasureTypePK unitOfMeasureTypePK, InventoryConditionPK inventoryConditionPK, Long quantity, CurrencyPK currencyPK, Long unitCost, Long fromTime, Long thruTime) 106 throws PersistenceNotNullException { 107 super(); 108 constructFields(lotPK, lotName, ownerPartyPK, itemPK, unitOfMeasureTypePK, inventoryConditionPK, quantity, currencyPK, unitCost, fromTime, thruTime); 109 } 110 111 @Override 112 public LotDetailFactory getBaseFactoryInstance() { 113 return LotDetailFactory.getInstance(); 114 } 115 116 @Override 117 public LotDetailValue clone() { 118 Object result; 119 120 try { 121 result = super.clone(); 122 } catch (CloneNotSupportedException cnse) { 123 // This shouldn't happen, fail when it does. 124 throw new PersistenceCloneException(cnse); 125 } 126 127 return (LotDetailValue)result; 128 } 129 130 @Override 131 public LotDetailPK getPrimaryKey() { 132 if(_primaryKey == null) { 133 _primaryKey = new LotDetailPK(entityId); 134 } 135 136 return _primaryKey; 137 } 138 139 private void clearHashAndString() { 140 _hashCode = null; 141 _stringValue = null; 142 } 143 144 @Override 145 public int hashCode() { 146 if(_hashCode == null) { 147 int hashCode = 17; 148 149 hashCode = 37 * hashCode + ((entityId != null) ? entityId.hashCode() : 0); 150 151 hashCode = 37 * hashCode + ((lotPK != null) ? lotPK.hashCode() : 0); 152 hashCode = 37 * hashCode + ((lotName != null) ? lotName.hashCode() : 0); 153 hashCode = 37 * hashCode + ((ownerPartyPK != null) ? ownerPartyPK.hashCode() : 0); 154 hashCode = 37 * hashCode + ((itemPK != null) ? itemPK.hashCode() : 0); 155 hashCode = 37 * hashCode + ((unitOfMeasureTypePK != null) ? unitOfMeasureTypePK.hashCode() : 0); 156 hashCode = 37 * hashCode + ((inventoryConditionPK != null) ? inventoryConditionPK.hashCode() : 0); 157 hashCode = 37 * hashCode + ((quantity != null) ? quantity.hashCode() : 0); 158 hashCode = 37 * hashCode + ((currencyPK != null) ? currencyPK.hashCode() : 0); 159 hashCode = 37 * hashCode + ((unitCost != null) ? unitCost.hashCode() : 0); 160 hashCode = 37 * hashCode + ((fromTime != null) ? fromTime.hashCode() : 0); 161 hashCode = 37 * hashCode + ((thruTime != null) ? thruTime.hashCode() : 0); 162 163 _hashCode = hashCode; 164 } 165 166 return _hashCode; 167 } 168 169 @Override 170 public String toString() { 171 if(_stringValue == null) { 172 StringBuilder stringValue = new StringBuilder("{"); 173 174 stringValue.append("entityId=").append(getEntityId()); 175 176 stringValue.append(", lotPK=").append(getLotPK()); 177 stringValue.append(", lotName=").append(getLotName()); 178 stringValue.append(", ownerPartyPK=").append(getOwnerPartyPK()); 179 stringValue.append(", itemPK=").append(getItemPK()); 180 stringValue.append(", unitOfMeasureTypePK=").append(getUnitOfMeasureTypePK()); 181 stringValue.append(", inventoryConditionPK=").append(getInventoryConditionPK()); 182 stringValue.append(", quantity=").append(getQuantity()); 183 stringValue.append(", currencyPK=").append(getCurrencyPK()); 184 stringValue.append(", unitCost=").append(getUnitCost()); 185 stringValue.append(", fromTime=").append(getFromTime()); 186 stringValue.append(", thruTime=").append(getThruTime()); 187 188 stringValue.append('}'); 189 190 _stringValue = stringValue.toString(); 191 } 192 return _stringValue; 193 } 194 195 @Override 196 public boolean equals(Object other) { 197 if(this == other) 198 return true; 199 200 if(!hasIdentity()) 201 return false; 202 203 if(other instanceof LotDetailValue) { 204 LotDetailValue that = (LotDetailValue)other; 205 206 if(!that.hasIdentity()) 207 return false; 208 209 Long thisEntityId = getEntityId(); 210 Long thatEntityId = that.getEntityId(); 211 212 boolean objectsEqual = thisEntityId.equals(thatEntityId); 213 if(objectsEqual) 214 objectsEqual = objectsEqual && isIdentical(that); 215 216 return objectsEqual; 217 } else { 218 return false; 219 } 220 } 221 222 public boolean isIdentical(Object other) { 223 if(other instanceof LotDetailValue) { 224 LotDetailValue that = (LotDetailValue)other; 225 boolean objectsEqual = true; 226 227 228 if(objectsEqual) { 229 LotPK thisLotPK = getLotPK(); 230 LotPK thatLotPK = that.getLotPK(); 231 232 if(thisLotPK == null) { 233 objectsEqual = objectsEqual && (thatLotPK == null); 234 } else { 235 objectsEqual = objectsEqual && thisLotPK.equals(thatLotPK); 236 } 237 } 238 239 if(objectsEqual) { 240 String thisLotName = getLotName(); 241 String thatLotName = that.getLotName(); 242 243 if(thisLotName == null) { 244 objectsEqual = objectsEqual && (thatLotName == null); 245 } else { 246 objectsEqual = objectsEqual && thisLotName.equals(thatLotName); 247 } 248 } 249 250 if(objectsEqual) { 251 PartyPK thisOwnerPartyPK = getOwnerPartyPK(); 252 PartyPK thatOwnerPartyPK = that.getOwnerPartyPK(); 253 254 if(thisOwnerPartyPK == null) { 255 objectsEqual = objectsEqual && (thatOwnerPartyPK == null); 256 } else { 257 objectsEqual = objectsEqual && thisOwnerPartyPK.equals(thatOwnerPartyPK); 258 } 259 } 260 261 if(objectsEqual) { 262 ItemPK thisItemPK = getItemPK(); 263 ItemPK thatItemPK = that.getItemPK(); 264 265 if(thisItemPK == null) { 266 objectsEqual = objectsEqual && (thatItemPK == null); 267 } else { 268 objectsEqual = objectsEqual && thisItemPK.equals(thatItemPK); 269 } 270 } 271 272 if(objectsEqual) { 273 UnitOfMeasureTypePK thisUnitOfMeasureTypePK = getUnitOfMeasureTypePK(); 274 UnitOfMeasureTypePK thatUnitOfMeasureTypePK = that.getUnitOfMeasureTypePK(); 275 276 if(thisUnitOfMeasureTypePK == null) { 277 objectsEqual = objectsEqual && (thatUnitOfMeasureTypePK == null); 278 } else { 279 objectsEqual = objectsEqual && thisUnitOfMeasureTypePK.equals(thatUnitOfMeasureTypePK); 280 } 281 } 282 283 if(objectsEqual) { 284 InventoryConditionPK thisInventoryConditionPK = getInventoryConditionPK(); 285 InventoryConditionPK thatInventoryConditionPK = that.getInventoryConditionPK(); 286 287 if(thisInventoryConditionPK == null) { 288 objectsEqual = objectsEqual && (thatInventoryConditionPK == null); 289 } else { 290 objectsEqual = objectsEqual && thisInventoryConditionPK.equals(thatInventoryConditionPK); 291 } 292 } 293 294 if(objectsEqual) { 295 Long thisQuantity = getQuantity(); 296 Long thatQuantity = that.getQuantity(); 297 298 if(thisQuantity == null) { 299 objectsEqual = objectsEqual && (thatQuantity == null); 300 } else { 301 objectsEqual = objectsEqual && thisQuantity.equals(thatQuantity); 302 } 303 } 304 305 if(objectsEqual) { 306 CurrencyPK thisCurrencyPK = getCurrencyPK(); 307 CurrencyPK thatCurrencyPK = that.getCurrencyPK(); 308 309 if(thisCurrencyPK == null) { 310 objectsEqual = objectsEqual && (thatCurrencyPK == null); 311 } else { 312 objectsEqual = objectsEqual && thisCurrencyPK.equals(thatCurrencyPK); 313 } 314 } 315 316 if(objectsEqual) { 317 Long thisUnitCost = getUnitCost(); 318 Long thatUnitCost = that.getUnitCost(); 319 320 if(thisUnitCost == null) { 321 objectsEqual = objectsEqual && (thatUnitCost == null); 322 } else { 323 objectsEqual = objectsEqual && thisUnitCost.equals(thatUnitCost); 324 } 325 } 326 327 if(objectsEqual) { 328 Long thisFromTime = getFromTime(); 329 Long thatFromTime = that.getFromTime(); 330 331 if(thisFromTime == null) { 332 objectsEqual = objectsEqual && (thatFromTime == null); 333 } else { 334 objectsEqual = objectsEqual && thisFromTime.equals(thatFromTime); 335 } 336 } 337 338 if(objectsEqual) { 339 Long thisThruTime = getThruTime(); 340 Long thatThruTime = that.getThruTime(); 341 342 if(thisThruTime == null) { 343 objectsEqual = objectsEqual && (thatThruTime == null); 344 } else { 345 objectsEqual = objectsEqual && thisThruTime.equals(thatThruTime); 346 } 347 } 348 349 return objectsEqual; 350 } else { 351 return false; 352 } 353 } 354 355 @Override 356 public boolean hasBeenModified() { 357 return lotPKHasBeenModified || lotNameHasBeenModified || ownerPartyPKHasBeenModified || itemPKHasBeenModified || unitOfMeasureTypePKHasBeenModified || inventoryConditionPKHasBeenModified || quantityHasBeenModified || currencyPKHasBeenModified || unitCostHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified; 358 } 359 360 @Override 361 public void clearHasBeenModified() { 362 lotPKHasBeenModified = false; 363 lotNameHasBeenModified = false; 364 ownerPartyPKHasBeenModified = false; 365 itemPKHasBeenModified = false; 366 unitOfMeasureTypePKHasBeenModified = false; 367 inventoryConditionPKHasBeenModified = false; 368 quantityHasBeenModified = false; 369 currencyPKHasBeenModified = false; 370 unitCostHasBeenModified = false; 371 fromTimeHasBeenModified = false; 372 thruTimeHasBeenModified = false; 373 } 374 375 public LotPK getLotPK() { 376 return lotPK; 377 } 378 379 public void setLotPK(LotPK lotPK) 380 throws PersistenceNotNullException { 381 checkForNull(lotPK); 382 383 boolean update = true; 384 385 if(this.lotPK != null) { 386 if(this.lotPK.equals(lotPK)) { 387 update = false; 388 } 389 } else if(lotPK == null) { 390 update = false; 391 } 392 393 if(update) { 394 this.lotPK = lotPK; 395 lotPKHasBeenModified = true; 396 clearHashAndString(); 397 } 398 } 399 400 public boolean getLotPKHasBeenModified() { 401 return lotPKHasBeenModified; 402 } 403 404 public String getLotName() { 405 return lotName; 406 } 407 408 public void setLotName(String lotName) 409 throws PersistenceNotNullException { 410 checkForNull(lotName); 411 412 boolean update = true; 413 414 if(this.lotName != null) { 415 if(this.lotName.equals(lotName)) { 416 update = false; 417 } 418 } else if(lotName == null) { 419 update = false; 420 } 421 422 if(update) { 423 this.lotName = lotName; 424 lotNameHasBeenModified = true; 425 clearHashAndString(); 426 } 427 } 428 429 public boolean getLotNameHasBeenModified() { 430 return lotNameHasBeenModified; 431 } 432 433 public PartyPK getOwnerPartyPK() { 434 return ownerPartyPK; 435 } 436 437 public void setOwnerPartyPK(PartyPK ownerPartyPK) 438 throws PersistenceNotNullException { 439 checkForNull(ownerPartyPK); 440 441 boolean update = true; 442 443 if(this.ownerPartyPK != null) { 444 if(this.ownerPartyPK.equals(ownerPartyPK)) { 445 update = false; 446 } 447 } else if(ownerPartyPK == null) { 448 update = false; 449 } 450 451 if(update) { 452 this.ownerPartyPK = ownerPartyPK; 453 ownerPartyPKHasBeenModified = true; 454 clearHashAndString(); 455 } 456 } 457 458 public boolean getOwnerPartyPKHasBeenModified() { 459 return ownerPartyPKHasBeenModified; 460 } 461 462 public ItemPK getItemPK() { 463 return itemPK; 464 } 465 466 public void setItemPK(ItemPK itemPK) 467 throws PersistenceNotNullException { 468 checkForNull(itemPK); 469 470 boolean update = true; 471 472 if(this.itemPK != null) { 473 if(this.itemPK.equals(itemPK)) { 474 update = false; 475 } 476 } else if(itemPK == null) { 477 update = false; 478 } 479 480 if(update) { 481 this.itemPK = itemPK; 482 itemPKHasBeenModified = true; 483 clearHashAndString(); 484 } 485 } 486 487 public boolean getItemPKHasBeenModified() { 488 return itemPKHasBeenModified; 489 } 490 491 public UnitOfMeasureTypePK getUnitOfMeasureTypePK() { 492 return unitOfMeasureTypePK; 493 } 494 495 public void setUnitOfMeasureTypePK(UnitOfMeasureTypePK unitOfMeasureTypePK) 496 throws PersistenceNotNullException { 497 checkForNull(unitOfMeasureTypePK); 498 499 boolean update = true; 500 501 if(this.unitOfMeasureTypePK != null) { 502 if(this.unitOfMeasureTypePK.equals(unitOfMeasureTypePK)) { 503 update = false; 504 } 505 } else if(unitOfMeasureTypePK == null) { 506 update = false; 507 } 508 509 if(update) { 510 this.unitOfMeasureTypePK = unitOfMeasureTypePK; 511 unitOfMeasureTypePKHasBeenModified = true; 512 clearHashAndString(); 513 } 514 } 515 516 public boolean getUnitOfMeasureTypePKHasBeenModified() { 517 return unitOfMeasureTypePKHasBeenModified; 518 } 519 520 public InventoryConditionPK getInventoryConditionPK() { 521 return inventoryConditionPK; 522 } 523 524 public void setInventoryConditionPK(InventoryConditionPK inventoryConditionPK) 525 throws PersistenceNotNullException { 526 checkForNull(inventoryConditionPK); 527 528 boolean update = true; 529 530 if(this.inventoryConditionPK != null) { 531 if(this.inventoryConditionPK.equals(inventoryConditionPK)) { 532 update = false; 533 } 534 } else if(inventoryConditionPK == null) { 535 update = false; 536 } 537 538 if(update) { 539 this.inventoryConditionPK = inventoryConditionPK; 540 inventoryConditionPKHasBeenModified = true; 541 clearHashAndString(); 542 } 543 } 544 545 public boolean getInventoryConditionPKHasBeenModified() { 546 return inventoryConditionPKHasBeenModified; 547 } 548 549 public Long getQuantity() { 550 return quantity; 551 } 552 553 public void setQuantity(Long quantity) 554 throws PersistenceNotNullException { 555 checkForNull(quantity); 556 557 boolean update = true; 558 559 if(this.quantity != null) { 560 if(this.quantity.equals(quantity)) { 561 update = false; 562 } 563 } else if(quantity == null) { 564 update = false; 565 } 566 567 if(update) { 568 this.quantity = quantity; 569 quantityHasBeenModified = true; 570 clearHashAndString(); 571 } 572 } 573 574 public boolean getQuantityHasBeenModified() { 575 return quantityHasBeenModified; 576 } 577 578 public CurrencyPK getCurrencyPK() { 579 return currencyPK; 580 } 581 582 public void setCurrencyPK(CurrencyPK currencyPK) { 583 boolean update = true; 584 585 if(this.currencyPK != null) { 586 if(this.currencyPK.equals(currencyPK)) { 587 update = false; 588 } 589 } else if(currencyPK == null) { 590 update = false; 591 } 592 593 if(update) { 594 this.currencyPK = currencyPK; 595 currencyPKHasBeenModified = true; 596 clearHashAndString(); 597 } 598 } 599 600 public boolean getCurrencyPKHasBeenModified() { 601 return currencyPKHasBeenModified; 602 } 603 604 public Long getUnitCost() { 605 return unitCost; 606 } 607 608 public void setUnitCost(Long unitCost) { 609 boolean update = true; 610 611 if(this.unitCost != null) { 612 if(this.unitCost.equals(unitCost)) { 613 update = false; 614 } 615 } else if(unitCost == null) { 616 update = false; 617 } 618 619 if(update) { 620 this.unitCost = unitCost; 621 unitCostHasBeenModified = true; 622 clearHashAndString(); 623 } 624 } 625 626 public boolean getUnitCostHasBeenModified() { 627 return unitCostHasBeenModified; 628 } 629 630 public Long getFromTime() { 631 return fromTime; 632 } 633 634 public void setFromTime(Long fromTime) 635 throws PersistenceNotNullException { 636 checkForNull(fromTime); 637 638 boolean update = true; 639 640 if(this.fromTime != null) { 641 if(this.fromTime.equals(fromTime)) { 642 update = false; 643 } 644 } else if(fromTime == null) { 645 update = false; 646 } 647 648 if(update) { 649 this.fromTime = fromTime; 650 fromTimeHasBeenModified = true; 651 clearHashAndString(); 652 } 653 } 654 655 public boolean getFromTimeHasBeenModified() { 656 return fromTimeHasBeenModified; 657 } 658 659 public Long getThruTime() { 660 return thruTime; 661 } 662 663 public void setThruTime(Long thruTime) 664 throws PersistenceNotNullException { 665 checkForNull(thruTime); 666 667 boolean update = true; 668 669 if(this.thruTime != null) { 670 if(this.thruTime.equals(thruTime)) { 671 update = false; 672 } 673 } else if(thruTime == null) { 674 update = false; 675 } 676 677 if(update) { 678 this.thruTime = thruTime; 679 thruTimeHasBeenModified = true; 680 clearHashAndString(); 681 } 682 } 683 684 public boolean getThruTimeHasBeenModified() { 685 return thruTimeHasBeenModified; 686 } 687 688}