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