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 * ShipmentPackageDetailValue.java 021 */ 022 023package com.echothree.model.data.shipment.server.value; 024 025import com.echothree.model.data.shipment.common.pk.ShipmentPackageDetailPK; 026 027import com.echothree.model.data.shipment.server.factory.ShipmentPackageDetailFactory; 028 029import com.echothree.model.data.shipment.common.pk.ShipmentPackagePK; 030import com.echothree.model.data.shipment.common.pk.ShipmentTypePK; 031import com.echothree.model.data.shipment.common.pk.ShipmentPK; 032import com.echothree.model.data.warehouse.common.pk.PackageTypePK; 033import com.echothree.model.data.uom.common.pk.UnitOfMeasureTypePK; 034 035import com.echothree.util.common.exception.PersistenceCloneException; 036import com.echothree.util.common.exception.PersistenceNotNullException; 037 038import com.echothree.util.server.persistence.BaseValue; 039 040import java.io.Serializable; 041 042import javax.annotation.Nonnull; 043import javax.annotation.Nullable; 044 045public class ShipmentPackageDetailValue 046 extends BaseValue<ShipmentPackageDetailPK> 047 implements Cloneable, Serializable { 048 049 private ShipmentPackagePK shipmentPackagePK; 050 private boolean shipmentPackagePKHasBeenModified = false; 051 private ShipmentTypePK shipmentTypePK; 052 private boolean shipmentTypePKHasBeenModified = false; 053 private String shipmentPackageName; 054 private boolean shipmentPackageNameHasBeenModified = false; 055 private ShipmentPackagePK parentShipmentPackagePK; 056 private boolean parentShipmentPackagePKHasBeenModified = false; 057 private ShipmentPK shipmentPK; 058 private boolean shipmentPKHasBeenModified = false; 059 private PackageTypePK packageTypePK; 060 private boolean packageTypePKHasBeenModified = false; 061 private UnitOfMeasureTypePK unitOfMeasureTypePK; 062 private boolean unitOfMeasureTypePKHasBeenModified = false; 063 private Long weight; 064 private boolean weightHasBeenModified = 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(ShipmentPackagePK shipmentPackagePK, ShipmentTypePK shipmentTypePK, String shipmentPackageName, ShipmentPackagePK parentShipmentPackagePK, ShipmentPK shipmentPK, PackageTypePK packageTypePK, UnitOfMeasureTypePK unitOfMeasureTypePK, Long weight, Long fromTime, Long thruTime) 074 throws PersistenceNotNullException { 075 checkForNull(shipmentPackagePK); 076 this.shipmentPackagePK = shipmentPackagePK; 077 checkForNull(shipmentTypePK); 078 this.shipmentTypePK = shipmentTypePK; 079 checkForNull(shipmentPackageName); 080 this.shipmentPackageName = shipmentPackageName; 081 this.parentShipmentPackagePK = parentShipmentPackagePK; 082 this.shipmentPK = shipmentPK; 083 this.packageTypePK = packageTypePK; 084 this.unitOfMeasureTypePK = unitOfMeasureTypePK; 085 this.weight = weight; 086 checkForNull(fromTime); 087 this.fromTime = fromTime; 088 checkForNull(thruTime); 089 this.thruTime = thruTime; 090 } 091 092 /** Creates a new instance of ShipmentPackageDetailValue */ 093 public ShipmentPackageDetailValue(ShipmentPackageDetailPK shipmentPackageDetailPK, ShipmentPackagePK shipmentPackagePK, ShipmentTypePK shipmentTypePK, String shipmentPackageName, ShipmentPackagePK parentShipmentPackagePK, ShipmentPK shipmentPK, PackageTypePK packageTypePK, UnitOfMeasureTypePK unitOfMeasureTypePK, Long weight, Long fromTime, Long thruTime) 094 throws PersistenceNotNullException { 095 super(shipmentPackageDetailPK); 096 constructFields(shipmentPackagePK, shipmentTypePK, shipmentPackageName, parentShipmentPackagePK, shipmentPK, packageTypePK, unitOfMeasureTypePK, weight, fromTime, thruTime); 097 } 098 099 /** Creates a new instance of ShipmentPackageDetailValue */ 100 public ShipmentPackageDetailValue(ShipmentPackagePK shipmentPackagePK, ShipmentTypePK shipmentTypePK, String shipmentPackageName, ShipmentPackagePK parentShipmentPackagePK, ShipmentPK shipmentPK, PackageTypePK packageTypePK, UnitOfMeasureTypePK unitOfMeasureTypePK, Long weight, Long fromTime, Long thruTime) 101 throws PersistenceNotNullException { 102 super(); 103 constructFields(shipmentPackagePK, shipmentTypePK, shipmentPackageName, parentShipmentPackagePK, shipmentPK, packageTypePK, unitOfMeasureTypePK, weight, fromTime, thruTime); 104 } 105 106 @Override 107 @Nonnull 108 public ShipmentPackageDetailFactory getBaseFactoryInstance() { 109 return ShipmentPackageDetailFactory.getInstance(); 110 } 111 112 @Override 113 @Nonnull 114 public ShipmentPackageDetailValue clone() { 115 Object result; 116 117 try { 118 result = super.clone(); 119 } catch (CloneNotSupportedException cnse) { 120 // This shouldn't happen, fail when it does. 121 throw new PersistenceCloneException(cnse); 122 } 123 124 return (ShipmentPackageDetailValue)result; 125 } 126 127 @Override 128 @Nonnull 129 public ShipmentPackageDetailPK getPrimaryKey() { 130 if(_primaryKey == null) { 131 _primaryKey = new ShipmentPackageDetailPK(entityId); 132 } 133 134 return _primaryKey; 135 } 136 137 private void clearHashAndString() { 138 _hashCode = null; 139 _stringValue = null; 140 } 141 142 @Override 143 public int hashCode() { 144 if(_hashCode == null) { 145 int hashCode = 17; 146 147 hashCode = 37 * hashCode + ((entityId != null) ? entityId.hashCode() : 0); 148 149 hashCode = 37 * hashCode + ((shipmentPackagePK != null) ? shipmentPackagePK.hashCode() : 0); 150 hashCode = 37 * hashCode + ((shipmentTypePK != null) ? shipmentTypePK.hashCode() : 0); 151 hashCode = 37 * hashCode + ((shipmentPackageName != null) ? shipmentPackageName.hashCode() : 0); 152 hashCode = 37 * hashCode + ((parentShipmentPackagePK != null) ? parentShipmentPackagePK.hashCode() : 0); 153 hashCode = 37 * hashCode + ((shipmentPK != null) ? shipmentPK.hashCode() : 0); 154 hashCode = 37 * hashCode + ((packageTypePK != null) ? packageTypePK.hashCode() : 0); 155 hashCode = 37 * hashCode + ((unitOfMeasureTypePK != null) ? unitOfMeasureTypePK.hashCode() : 0); 156 hashCode = 37 * hashCode + ((weight != null) ? weight.hashCode() : 0); 157 hashCode = 37 * hashCode + ((fromTime != null) ? fromTime.hashCode() : 0); 158 hashCode = 37 * hashCode + ((thruTime != null) ? thruTime.hashCode() : 0); 159 160 _hashCode = hashCode; 161 } 162 163 return _hashCode; 164 } 165 166 @Override 167 @Nonnull 168 public String toString() { 169 if(_stringValue == null) { 170 _stringValue = "{" + 171 "entityId=" + getEntityId() + 172 ", shipmentPackagePK=" + getShipmentPackagePK() + 173 ", shipmentTypePK=" + getShipmentTypePK() + 174 ", shipmentPackageName=" + getShipmentPackageName() + 175 ", parentShipmentPackagePK=" + getParentShipmentPackagePK() + 176 ", shipmentPK=" + getShipmentPK() + 177 ", packageTypePK=" + getPackageTypePK() + 178 ", unitOfMeasureTypePK=" + getUnitOfMeasureTypePK() + 179 ", weight=" + getWeight() + 180 ", fromTime=" + getFromTime() + 181 ", thruTime=" + getThruTime() + 182 "}"; 183 } 184 return _stringValue; 185 } 186 187 @Override 188 public boolean equals(Object other) { 189 if(this == other) 190 return true; 191 192 if(!hasIdentity()) 193 return false; 194 195 if(other instanceof ShipmentPackageDetailValue that) { 196 if(!that.hasIdentity()) 197 return false; 198 199 Long thisEntityId = getEntityId(); 200 Long thatEntityId = that.getEntityId(); 201 202 boolean objectsEqual = thisEntityId.equals(thatEntityId); 203 if(objectsEqual) 204 objectsEqual = isIdentical(that); 205 206 return objectsEqual; 207 } else { 208 return false; 209 } 210 } 211 212 public boolean isIdentical(Object other) { 213 if(other instanceof ShipmentPackageDetailValue that) { 214 boolean objectsEqual = true; 215 216 217 if(objectsEqual) { 218 ShipmentPackagePK thisShipmentPackagePK = getShipmentPackagePK(); 219 ShipmentPackagePK thatShipmentPackagePK = that.getShipmentPackagePK(); 220 221 if(thisShipmentPackagePK == null) { 222 objectsEqual = objectsEqual && (thatShipmentPackagePK == null); 223 } else { 224 objectsEqual = objectsEqual && thisShipmentPackagePK.equals(thatShipmentPackagePK); 225 } 226 } 227 228 if(objectsEqual) { 229 ShipmentTypePK thisShipmentTypePK = getShipmentTypePK(); 230 ShipmentTypePK thatShipmentTypePK = that.getShipmentTypePK(); 231 232 if(thisShipmentTypePK == null) { 233 objectsEqual = objectsEqual && (thatShipmentTypePK == null); 234 } else { 235 objectsEqual = objectsEqual && thisShipmentTypePK.equals(thatShipmentTypePK); 236 } 237 } 238 239 if(objectsEqual) { 240 String thisShipmentPackageName = getShipmentPackageName(); 241 String thatShipmentPackageName = that.getShipmentPackageName(); 242 243 if(thisShipmentPackageName == null) { 244 objectsEqual = objectsEqual && (thatShipmentPackageName == null); 245 } else { 246 objectsEqual = objectsEqual && thisShipmentPackageName.equals(thatShipmentPackageName); 247 } 248 } 249 250 if(objectsEqual) { 251 ShipmentPackagePK thisParentShipmentPackagePK = getParentShipmentPackagePK(); 252 ShipmentPackagePK thatParentShipmentPackagePK = that.getParentShipmentPackagePK(); 253 254 if(thisParentShipmentPackagePK == null) { 255 objectsEqual = objectsEqual && (thatParentShipmentPackagePK == null); 256 } else { 257 objectsEqual = objectsEqual && thisParentShipmentPackagePK.equals(thatParentShipmentPackagePK); 258 } 259 } 260 261 if(objectsEqual) { 262 ShipmentPK thisShipmentPK = getShipmentPK(); 263 ShipmentPK thatShipmentPK = that.getShipmentPK(); 264 265 if(thisShipmentPK == null) { 266 objectsEqual = objectsEqual && (thatShipmentPK == null); 267 } else { 268 objectsEqual = objectsEqual && thisShipmentPK.equals(thatShipmentPK); 269 } 270 } 271 272 if(objectsEqual) { 273 PackageTypePK thisPackageTypePK = getPackageTypePK(); 274 PackageTypePK thatPackageTypePK = that.getPackageTypePK(); 275 276 if(thisPackageTypePK == null) { 277 objectsEqual = objectsEqual && (thatPackageTypePK == null); 278 } else { 279 objectsEqual = objectsEqual && thisPackageTypePK.equals(thatPackageTypePK); 280 } 281 } 282 283 if(objectsEqual) { 284 UnitOfMeasureTypePK thisUnitOfMeasureTypePK = getUnitOfMeasureTypePK(); 285 UnitOfMeasureTypePK thatUnitOfMeasureTypePK = that.getUnitOfMeasureTypePK(); 286 287 if(thisUnitOfMeasureTypePK == null) { 288 objectsEqual = objectsEqual && (thatUnitOfMeasureTypePK == null); 289 } else { 290 objectsEqual = objectsEqual && thisUnitOfMeasureTypePK.equals(thatUnitOfMeasureTypePK); 291 } 292 } 293 294 if(objectsEqual) { 295 Long thisWeight = getWeight(); 296 Long thatWeight = that.getWeight(); 297 298 if(thisWeight == null) { 299 objectsEqual = objectsEqual && (thatWeight == null); 300 } else { 301 objectsEqual = objectsEqual && thisWeight.equals(thatWeight); 302 } 303 } 304 305 if(objectsEqual) { 306 Long thisFromTime = getFromTime(); 307 Long thatFromTime = that.getFromTime(); 308 309 if(thisFromTime == null) { 310 objectsEqual = objectsEqual && (thatFromTime == null); 311 } else { 312 objectsEqual = objectsEqual && thisFromTime.equals(thatFromTime); 313 } 314 } 315 316 if(objectsEqual) { 317 Long thisThruTime = getThruTime(); 318 Long thatThruTime = that.getThruTime(); 319 320 if(thisThruTime == null) { 321 objectsEqual = objectsEqual && (thatThruTime == null); 322 } else { 323 objectsEqual = objectsEqual && thisThruTime.equals(thatThruTime); 324 } 325 } 326 327 return objectsEqual; 328 } else { 329 return false; 330 } 331 } 332 333 @Override 334 public boolean hasBeenModified() { 335 return shipmentPackagePKHasBeenModified || shipmentTypePKHasBeenModified || shipmentPackageNameHasBeenModified || parentShipmentPackagePKHasBeenModified || shipmentPKHasBeenModified || packageTypePKHasBeenModified || unitOfMeasureTypePKHasBeenModified || weightHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified; 336 } 337 338 @Override 339 public void clearHasBeenModified() { 340 shipmentPackagePKHasBeenModified = false; 341 shipmentTypePKHasBeenModified = false; 342 shipmentPackageNameHasBeenModified = false; 343 parentShipmentPackagePKHasBeenModified = false; 344 shipmentPKHasBeenModified = false; 345 packageTypePKHasBeenModified = false; 346 unitOfMeasureTypePKHasBeenModified = false; 347 weightHasBeenModified = false; 348 fromTimeHasBeenModified = false; 349 thruTimeHasBeenModified = false; 350 } 351 352 @Nonnull 353 public ShipmentPackagePK getShipmentPackagePK() { 354 return shipmentPackagePK; 355 } 356 357 public void setShipmentPackagePK(@Nonnull ShipmentPackagePK shipmentPackagePK) 358 throws PersistenceNotNullException { 359 checkForNull(shipmentPackagePK); 360 361 boolean update = true; 362 363 if(this.shipmentPackagePK != null) { 364 if(this.shipmentPackagePK.equals(shipmentPackagePK)) { 365 update = false; 366 } 367 } else if(shipmentPackagePK == null) { 368 update = false; 369 } 370 371 if(update) { 372 this.shipmentPackagePK = shipmentPackagePK; 373 shipmentPackagePKHasBeenModified = true; 374 clearHashAndString(); 375 } 376 } 377 378 public boolean getShipmentPackagePKHasBeenModified() { 379 return shipmentPackagePKHasBeenModified; 380 } 381 382 @Nonnull 383 public ShipmentTypePK getShipmentTypePK() { 384 return shipmentTypePK; 385 } 386 387 public void setShipmentTypePK(@Nonnull ShipmentTypePK shipmentTypePK) 388 throws PersistenceNotNullException { 389 checkForNull(shipmentTypePK); 390 391 boolean update = true; 392 393 if(this.shipmentTypePK != null) { 394 if(this.shipmentTypePK.equals(shipmentTypePK)) { 395 update = false; 396 } 397 } else if(shipmentTypePK == null) { 398 update = false; 399 } 400 401 if(update) { 402 this.shipmentTypePK = shipmentTypePK; 403 shipmentTypePKHasBeenModified = true; 404 clearHashAndString(); 405 } 406 } 407 408 public boolean getShipmentTypePKHasBeenModified() { 409 return shipmentTypePKHasBeenModified; 410 } 411 412 @Nonnull 413 public String getShipmentPackageName() { 414 return shipmentPackageName; 415 } 416 417 public void setShipmentPackageName(@Nonnull String shipmentPackageName) 418 throws PersistenceNotNullException { 419 checkForNull(shipmentPackageName); 420 421 boolean update = true; 422 423 if(this.shipmentPackageName != null) { 424 if(this.shipmentPackageName.equals(shipmentPackageName)) { 425 update = false; 426 } 427 } else if(shipmentPackageName == null) { 428 update = false; 429 } 430 431 if(update) { 432 this.shipmentPackageName = shipmentPackageName; 433 shipmentPackageNameHasBeenModified = true; 434 clearHashAndString(); 435 } 436 } 437 438 public boolean getShipmentPackageNameHasBeenModified() { 439 return shipmentPackageNameHasBeenModified; 440 } 441 442 @Nullable 443 public ShipmentPackagePK getParentShipmentPackagePK() { 444 return parentShipmentPackagePK; 445 } 446 447 public void setParentShipmentPackagePK(@Nullable ShipmentPackagePK parentShipmentPackagePK) { 448 boolean update = true; 449 450 if(this.parentShipmentPackagePK != null) { 451 if(this.parentShipmentPackagePK.equals(parentShipmentPackagePK)) { 452 update = false; 453 } 454 } else if(parentShipmentPackagePK == null) { 455 update = false; 456 } 457 458 if(update) { 459 this.parentShipmentPackagePK = parentShipmentPackagePK; 460 parentShipmentPackagePKHasBeenModified = true; 461 clearHashAndString(); 462 } 463 } 464 465 public boolean getParentShipmentPackagePKHasBeenModified() { 466 return parentShipmentPackagePKHasBeenModified; 467 } 468 469 @Nullable 470 public ShipmentPK getShipmentPK() { 471 return shipmentPK; 472 } 473 474 public void setShipmentPK(@Nullable ShipmentPK shipmentPK) { 475 boolean update = true; 476 477 if(this.shipmentPK != null) { 478 if(this.shipmentPK.equals(shipmentPK)) { 479 update = false; 480 } 481 } else if(shipmentPK == null) { 482 update = false; 483 } 484 485 if(update) { 486 this.shipmentPK = shipmentPK; 487 shipmentPKHasBeenModified = true; 488 clearHashAndString(); 489 } 490 } 491 492 public boolean getShipmentPKHasBeenModified() { 493 return shipmentPKHasBeenModified; 494 } 495 496 @Nullable 497 public PackageTypePK getPackageTypePK() { 498 return packageTypePK; 499 } 500 501 public void setPackageTypePK(@Nullable PackageTypePK packageTypePK) { 502 boolean update = true; 503 504 if(this.packageTypePK != null) { 505 if(this.packageTypePK.equals(packageTypePK)) { 506 update = false; 507 } 508 } else if(packageTypePK == null) { 509 update = false; 510 } 511 512 if(update) { 513 this.packageTypePK = packageTypePK; 514 packageTypePKHasBeenModified = true; 515 clearHashAndString(); 516 } 517 } 518 519 public boolean getPackageTypePKHasBeenModified() { 520 return packageTypePKHasBeenModified; 521 } 522 523 @Nullable 524 public UnitOfMeasureTypePK getUnitOfMeasureTypePK() { 525 return unitOfMeasureTypePK; 526 } 527 528 public void setUnitOfMeasureTypePK(@Nullable UnitOfMeasureTypePK unitOfMeasureTypePK) { 529 boolean update = true; 530 531 if(this.unitOfMeasureTypePK != null) { 532 if(this.unitOfMeasureTypePK.equals(unitOfMeasureTypePK)) { 533 update = false; 534 } 535 } else if(unitOfMeasureTypePK == null) { 536 update = false; 537 } 538 539 if(update) { 540 this.unitOfMeasureTypePK = unitOfMeasureTypePK; 541 unitOfMeasureTypePKHasBeenModified = true; 542 clearHashAndString(); 543 } 544 } 545 546 public boolean getUnitOfMeasureTypePKHasBeenModified() { 547 return unitOfMeasureTypePKHasBeenModified; 548 } 549 550 @Nullable 551 public Long getWeight() { 552 return weight; 553 } 554 555 public void setWeight(@Nullable Long weight) { 556 boolean update = true; 557 558 if(this.weight != null) { 559 if(this.weight.equals(weight)) { 560 update = false; 561 } 562 } else if(weight == null) { 563 update = false; 564 } 565 566 if(update) { 567 this.weight = weight; 568 weightHasBeenModified = true; 569 clearHashAndString(); 570 } 571 } 572 573 public boolean getWeightHasBeenModified() { 574 return weightHasBeenModified; 575 } 576 577 @Nonnull 578 public Long getFromTime() { 579 return fromTime; 580 } 581 582 public void setFromTime(@Nonnull Long fromTime) 583 throws PersistenceNotNullException { 584 checkForNull(fromTime); 585 586 boolean update = true; 587 588 if(this.fromTime != null) { 589 if(this.fromTime.equals(fromTime)) { 590 update = false; 591 } 592 } else if(fromTime == null) { 593 update = false; 594 } 595 596 if(update) { 597 this.fromTime = fromTime; 598 fromTimeHasBeenModified = true; 599 clearHashAndString(); 600 } 601 } 602 603 public boolean getFromTimeHasBeenModified() { 604 return fromTimeHasBeenModified; 605 } 606 607 @Nonnull 608 public Long getThruTime() { 609 return thruTime; 610 } 611 612 public void setThruTime(@Nonnull Long thruTime) 613 throws PersistenceNotNullException { 614 checkForNull(thruTime); 615 616 boolean update = true; 617 618 if(this.thruTime != null) { 619 if(this.thruTime.equals(thruTime)) { 620 update = false; 621 } 622 } else if(thruTime == null) { 623 update = false; 624 } 625 626 if(update) { 627 this.thruTime = thruTime; 628 thruTimeHasBeenModified = true; 629 clearHashAndString(); 630 } 631 } 632 633 public boolean getThruTimeHasBeenModified() { 634 return thruTimeHasBeenModified; 635 } 636 637}