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 * 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 StringBuilder stringValue = new StringBuilder("{"); 164 165 stringValue.append("entityId=").append(getEntityId()); 166 167 stringValue.append(", shipmentPackagePK=").append(getShipmentPackagePK()); 168 stringValue.append(", shipmentTypePK=").append(getShipmentTypePK()); 169 stringValue.append(", shipmentPackageName=").append(getShipmentPackageName()); 170 stringValue.append(", parentShipmentPackagePK=").append(getParentShipmentPackagePK()); 171 stringValue.append(", shipmentPK=").append(getShipmentPK()); 172 stringValue.append(", packageTypePK=").append(getPackageTypePK()); 173 stringValue.append(", unitOfMeasureTypePK=").append(getUnitOfMeasureTypePK()); 174 stringValue.append(", weight=").append(getWeight()); 175 stringValue.append(", fromTime=").append(getFromTime()); 176 stringValue.append(", thruTime=").append(getThruTime()); 177 178 stringValue.append('}'); 179 180 _stringValue = stringValue.toString(); 181 } 182 return _stringValue; 183 } 184 185 @Override 186 public boolean equals(Object other) { 187 if(this == other) 188 return true; 189 190 if(!hasIdentity()) 191 return false; 192 193 if(other instanceof ShipmentPackageDetailValue) { 194 ShipmentPackageDetailValue that = (ShipmentPackageDetailValue)other; 195 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 = 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) { 214 ShipmentPackageDetailValue that = (ShipmentPackageDetailValue)other; 215 boolean objectsEqual = true; 216 217 218 if(objectsEqual) { 219 ShipmentPackagePK thisShipmentPackagePK = getShipmentPackagePK(); 220 ShipmentPackagePK thatShipmentPackagePK = that.getShipmentPackagePK(); 221 222 if(thisShipmentPackagePK == null) { 223 objectsEqual = objectsEqual && (thatShipmentPackagePK == null); 224 } else { 225 objectsEqual = objectsEqual && thisShipmentPackagePK.equals(thatShipmentPackagePK); 226 } 227 } 228 229 if(objectsEqual) { 230 ShipmentTypePK thisShipmentTypePK = getShipmentTypePK(); 231 ShipmentTypePK thatShipmentTypePK = that.getShipmentTypePK(); 232 233 if(thisShipmentTypePK == null) { 234 objectsEqual = objectsEqual && (thatShipmentTypePK == null); 235 } else { 236 objectsEqual = objectsEqual && thisShipmentTypePK.equals(thatShipmentTypePK); 237 } 238 } 239 240 if(objectsEqual) { 241 String thisShipmentPackageName = getShipmentPackageName(); 242 String thatShipmentPackageName = that.getShipmentPackageName(); 243 244 if(thisShipmentPackageName == null) { 245 objectsEqual = objectsEqual && (thatShipmentPackageName == null); 246 } else { 247 objectsEqual = objectsEqual && thisShipmentPackageName.equals(thatShipmentPackageName); 248 } 249 } 250 251 if(objectsEqual) { 252 ShipmentPackagePK thisParentShipmentPackagePK = getParentShipmentPackagePK(); 253 ShipmentPackagePK thatParentShipmentPackagePK = that.getParentShipmentPackagePK(); 254 255 if(thisParentShipmentPackagePK == null) { 256 objectsEqual = objectsEqual && (thatParentShipmentPackagePK == null); 257 } else { 258 objectsEqual = objectsEqual && thisParentShipmentPackagePK.equals(thatParentShipmentPackagePK); 259 } 260 } 261 262 if(objectsEqual) { 263 ShipmentPK thisShipmentPK = getShipmentPK(); 264 ShipmentPK thatShipmentPK = that.getShipmentPK(); 265 266 if(thisShipmentPK == null) { 267 objectsEqual = objectsEqual && (thatShipmentPK == null); 268 } else { 269 objectsEqual = objectsEqual && thisShipmentPK.equals(thatShipmentPK); 270 } 271 } 272 273 if(objectsEqual) { 274 PackageTypePK thisPackageTypePK = getPackageTypePK(); 275 PackageTypePK thatPackageTypePK = that.getPackageTypePK(); 276 277 if(thisPackageTypePK == null) { 278 objectsEqual = objectsEqual && (thatPackageTypePK == null); 279 } else { 280 objectsEqual = objectsEqual && thisPackageTypePK.equals(thatPackageTypePK); 281 } 282 } 283 284 if(objectsEqual) { 285 UnitOfMeasureTypePK thisUnitOfMeasureTypePK = getUnitOfMeasureTypePK(); 286 UnitOfMeasureTypePK thatUnitOfMeasureTypePK = that.getUnitOfMeasureTypePK(); 287 288 if(thisUnitOfMeasureTypePK == null) { 289 objectsEqual = objectsEqual && (thatUnitOfMeasureTypePK == null); 290 } else { 291 objectsEqual = objectsEqual && thisUnitOfMeasureTypePK.equals(thatUnitOfMeasureTypePK); 292 } 293 } 294 295 if(objectsEqual) { 296 Long thisWeight = getWeight(); 297 Long thatWeight = that.getWeight(); 298 299 if(thisWeight == null) { 300 objectsEqual = objectsEqual && (thatWeight == null); 301 } else { 302 objectsEqual = objectsEqual && thisWeight.equals(thatWeight); 303 } 304 } 305 306 if(objectsEqual) { 307 Long thisFromTime = getFromTime(); 308 Long thatFromTime = that.getFromTime(); 309 310 if(thisFromTime == null) { 311 objectsEqual = objectsEqual && (thatFromTime == null); 312 } else { 313 objectsEqual = objectsEqual && thisFromTime.equals(thatFromTime); 314 } 315 } 316 317 if(objectsEqual) { 318 Long thisThruTime = getThruTime(); 319 Long thatThruTime = that.getThruTime(); 320 321 if(thisThruTime == null) { 322 objectsEqual = objectsEqual && (thatThruTime == null); 323 } else { 324 objectsEqual = objectsEqual && thisThruTime.equals(thatThruTime); 325 } 326 } 327 328 return objectsEqual; 329 } else { 330 return false; 331 } 332 } 333 334 @Override 335 public boolean hasBeenModified() { 336 return shipmentPackagePKHasBeenModified || shipmentTypePKHasBeenModified || shipmentPackageNameHasBeenModified || parentShipmentPackagePKHasBeenModified || shipmentPKHasBeenModified || packageTypePKHasBeenModified || unitOfMeasureTypePKHasBeenModified || weightHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified; 337 } 338 339 @Override 340 public void clearHasBeenModified() { 341 shipmentPackagePKHasBeenModified = false; 342 shipmentTypePKHasBeenModified = false; 343 shipmentPackageNameHasBeenModified = false; 344 parentShipmentPackagePKHasBeenModified = false; 345 shipmentPKHasBeenModified = false; 346 packageTypePKHasBeenModified = false; 347 unitOfMeasureTypePKHasBeenModified = false; 348 weightHasBeenModified = false; 349 fromTimeHasBeenModified = false; 350 thruTimeHasBeenModified = false; 351 } 352 353 public ShipmentPackagePK getShipmentPackagePK() { 354 return shipmentPackagePK; 355 } 356 357 public void setShipmentPackagePK(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 public ShipmentTypePK getShipmentTypePK() { 383 return shipmentTypePK; 384 } 385 386 public void setShipmentTypePK(ShipmentTypePK shipmentTypePK) 387 throws PersistenceNotNullException { 388 checkForNull(shipmentTypePK); 389 390 boolean update = true; 391 392 if(this.shipmentTypePK != null) { 393 if(this.shipmentTypePK.equals(shipmentTypePK)) { 394 update = false; 395 } 396 } else if(shipmentTypePK == null) { 397 update = false; 398 } 399 400 if(update) { 401 this.shipmentTypePK = shipmentTypePK; 402 shipmentTypePKHasBeenModified = true; 403 clearHashAndString(); 404 } 405 } 406 407 public boolean getShipmentTypePKHasBeenModified() { 408 return shipmentTypePKHasBeenModified; 409 } 410 411 public String getShipmentPackageName() { 412 return shipmentPackageName; 413 } 414 415 public void setShipmentPackageName(String shipmentPackageName) 416 throws PersistenceNotNullException { 417 checkForNull(shipmentPackageName); 418 419 boolean update = true; 420 421 if(this.shipmentPackageName != null) { 422 if(this.shipmentPackageName.equals(shipmentPackageName)) { 423 update = false; 424 } 425 } else if(shipmentPackageName == null) { 426 update = false; 427 } 428 429 if(update) { 430 this.shipmentPackageName = shipmentPackageName; 431 shipmentPackageNameHasBeenModified = true; 432 clearHashAndString(); 433 } 434 } 435 436 public boolean getShipmentPackageNameHasBeenModified() { 437 return shipmentPackageNameHasBeenModified; 438 } 439 440 public ShipmentPackagePK getParentShipmentPackagePK() { 441 return parentShipmentPackagePK; 442 } 443 444 public void setParentShipmentPackagePK(ShipmentPackagePK parentShipmentPackagePK) { 445 boolean update = true; 446 447 if(this.parentShipmentPackagePK != null) { 448 if(this.parentShipmentPackagePK.equals(parentShipmentPackagePK)) { 449 update = false; 450 } 451 } else if(parentShipmentPackagePK == null) { 452 update = false; 453 } 454 455 if(update) { 456 this.parentShipmentPackagePK = parentShipmentPackagePK; 457 parentShipmentPackagePKHasBeenModified = true; 458 clearHashAndString(); 459 } 460 } 461 462 public boolean getParentShipmentPackagePKHasBeenModified() { 463 return parentShipmentPackagePKHasBeenModified; 464 } 465 466 public ShipmentPK getShipmentPK() { 467 return shipmentPK; 468 } 469 470 public void setShipmentPK(ShipmentPK shipmentPK) { 471 boolean update = true; 472 473 if(this.shipmentPK != null) { 474 if(this.shipmentPK.equals(shipmentPK)) { 475 update = false; 476 } 477 } else if(shipmentPK == null) { 478 update = false; 479 } 480 481 if(update) { 482 this.shipmentPK = shipmentPK; 483 shipmentPKHasBeenModified = true; 484 clearHashAndString(); 485 } 486 } 487 488 public boolean getShipmentPKHasBeenModified() { 489 return shipmentPKHasBeenModified; 490 } 491 492 public PackageTypePK getPackageTypePK() { 493 return packageTypePK; 494 } 495 496 public void setPackageTypePK(PackageTypePK packageTypePK) { 497 boolean update = true; 498 499 if(this.packageTypePK != null) { 500 if(this.packageTypePK.equals(packageTypePK)) { 501 update = false; 502 } 503 } else if(packageTypePK == null) { 504 update = false; 505 } 506 507 if(update) { 508 this.packageTypePK = packageTypePK; 509 packageTypePKHasBeenModified = true; 510 clearHashAndString(); 511 } 512 } 513 514 public boolean getPackageTypePKHasBeenModified() { 515 return packageTypePKHasBeenModified; 516 } 517 518 public UnitOfMeasureTypePK getUnitOfMeasureTypePK() { 519 return unitOfMeasureTypePK; 520 } 521 522 public void setUnitOfMeasureTypePK(UnitOfMeasureTypePK unitOfMeasureTypePK) { 523 boolean update = true; 524 525 if(this.unitOfMeasureTypePK != null) { 526 if(this.unitOfMeasureTypePK.equals(unitOfMeasureTypePK)) { 527 update = false; 528 } 529 } else if(unitOfMeasureTypePK == null) { 530 update = false; 531 } 532 533 if(update) { 534 this.unitOfMeasureTypePK = unitOfMeasureTypePK; 535 unitOfMeasureTypePKHasBeenModified = true; 536 clearHashAndString(); 537 } 538 } 539 540 public boolean getUnitOfMeasureTypePKHasBeenModified() { 541 return unitOfMeasureTypePKHasBeenModified; 542 } 543 544 public Long getWeight() { 545 return weight; 546 } 547 548 public void setWeight(Long weight) { 549 boolean update = true; 550 551 if(this.weight != null) { 552 if(this.weight.equals(weight)) { 553 update = false; 554 } 555 } else if(weight == null) { 556 update = false; 557 } 558 559 if(update) { 560 this.weight = weight; 561 weightHasBeenModified = true; 562 clearHashAndString(); 563 } 564 } 565 566 public boolean getWeightHasBeenModified() { 567 return weightHasBeenModified; 568 } 569 570 public Long getFromTime() { 571 return fromTime; 572 } 573 574 public void setFromTime(Long fromTime) 575 throws PersistenceNotNullException { 576 checkForNull(fromTime); 577 578 boolean update = true; 579 580 if(this.fromTime != null) { 581 if(this.fromTime.equals(fromTime)) { 582 update = false; 583 } 584 } else if(fromTime == null) { 585 update = false; 586 } 587 588 if(update) { 589 this.fromTime = fromTime; 590 fromTimeHasBeenModified = true; 591 clearHashAndString(); 592 } 593 } 594 595 public boolean getFromTimeHasBeenModified() { 596 return fromTimeHasBeenModified; 597 } 598 599 public Long getThruTime() { 600 return thruTime; 601 } 602 603 public void setThruTime(Long thruTime) 604 throws PersistenceNotNullException { 605 checkForNull(thruTime); 606 607 boolean update = true; 608 609 if(this.thruTime != null) { 610 if(this.thruTime.equals(thruTime)) { 611 update = false; 612 } 613 } else if(thruTime == null) { 614 update = false; 615 } 616 617 if(update) { 618 this.thruTime = thruTime; 619 thruTimeHasBeenModified = true; 620 clearHashAndString(); 621 } 622 } 623 624 public boolean getThruTimeHasBeenModified() { 625 return thruTimeHasBeenModified; 626 } 627 628}