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 * VendorItemDetailValue.java 021 */ 022 023package com.echothree.model.data.vendor.server.value; 024 025import com.echothree.model.data.vendor.common.pk.VendorItemDetailPK; 026 027import com.echothree.model.data.vendor.server.factory.VendorItemDetailFactory; 028 029import com.echothree.model.data.vendor.common.pk.VendorItemPK; 030import com.echothree.model.data.item.common.pk.ItemPK; 031import com.echothree.model.data.party.common.pk.PartyPK; 032import com.echothree.model.data.cancellationpolicy.common.pk.CancellationPolicyPK; 033import com.echothree.model.data.returnpolicy.common.pk.ReturnPolicyPK; 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 VendorItemDetailValue 046 extends BaseValue<VendorItemDetailPK> 047 implements Cloneable, Serializable { 048 049 private VendorItemPK vendorItemPK; 050 private boolean vendorItemPKHasBeenModified = false; 051 private ItemPK itemPK; 052 private boolean itemPKHasBeenModified = false; 053 private PartyPK vendorPartyPK; 054 private boolean vendorPartyPKHasBeenModified = false; 055 private String vendorItemName; 056 private boolean vendorItemNameHasBeenModified = false; 057 private String description; 058 private boolean descriptionHasBeenModified = false; 059 private Integer priority; 060 private boolean priorityHasBeenModified = false; 061 private CancellationPolicyPK cancellationPolicyPK; 062 private boolean cancellationPolicyPKHasBeenModified = false; 063 private ReturnPolicyPK returnPolicyPK; 064 private boolean returnPolicyPKHasBeenModified = 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(VendorItemPK vendorItemPK, ItemPK itemPK, PartyPK vendorPartyPK, String vendorItemName, String description, Integer priority, CancellationPolicyPK cancellationPolicyPK, ReturnPolicyPK returnPolicyPK, Long fromTime, Long thruTime) 074 throws PersistenceNotNullException { 075 checkForNull(vendorItemPK); 076 this.vendorItemPK = vendorItemPK; 077 checkForNull(itemPK); 078 this.itemPK = itemPK; 079 checkForNull(vendorPartyPK); 080 this.vendorPartyPK = vendorPartyPK; 081 checkForNull(vendorItemName); 082 this.vendorItemName = vendorItemName; 083 this.description = description; 084 checkForNull(priority); 085 this.priority = priority; 086 this.cancellationPolicyPK = cancellationPolicyPK; 087 this.returnPolicyPK = returnPolicyPK; 088 checkForNull(fromTime); 089 this.fromTime = fromTime; 090 checkForNull(thruTime); 091 this.thruTime = thruTime; 092 } 093 094 /** Creates a new instance of VendorItemDetailValue */ 095 public VendorItemDetailValue(VendorItemDetailPK vendorItemDetailPK, VendorItemPK vendorItemPK, ItemPK itemPK, PartyPK vendorPartyPK, String vendorItemName, String description, Integer priority, CancellationPolicyPK cancellationPolicyPK, ReturnPolicyPK returnPolicyPK, Long fromTime, Long thruTime) 096 throws PersistenceNotNullException { 097 super(vendorItemDetailPK); 098 constructFields(vendorItemPK, itemPK, vendorPartyPK, vendorItemName, description, priority, cancellationPolicyPK, returnPolicyPK, fromTime, thruTime); 099 } 100 101 /** Creates a new instance of VendorItemDetailValue */ 102 public VendorItemDetailValue(VendorItemPK vendorItemPK, ItemPK itemPK, PartyPK vendorPartyPK, String vendorItemName, String description, Integer priority, CancellationPolicyPK cancellationPolicyPK, ReturnPolicyPK returnPolicyPK, Long fromTime, Long thruTime) 103 throws PersistenceNotNullException { 104 super(); 105 constructFields(vendorItemPK, itemPK, vendorPartyPK, vendorItemName, description, priority, cancellationPolicyPK, returnPolicyPK, fromTime, thruTime); 106 } 107 108 @Override 109 @Nonnull 110 public VendorItemDetailFactory getBaseFactoryInstance() { 111 return VendorItemDetailFactory.getInstance(); 112 } 113 114 @Override 115 @Nonnull 116 public VendorItemDetailValue clone() { 117 Object result; 118 119 try { 120 result = super.clone(); 121 } catch (CloneNotSupportedException cnse) { 122 // This shouldn't happen, fail when it does. 123 throw new PersistenceCloneException(cnse); 124 } 125 126 return (VendorItemDetailValue)result; 127 } 128 129 @Override 130 @Nonnull 131 public VendorItemDetailPK getPrimaryKey() { 132 if(_primaryKey == null) { 133 _primaryKey = new VendorItemDetailPK(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 + ((vendorItemPK != null) ? vendorItemPK.hashCode() : 0); 152 hashCode = 37 * hashCode + ((itemPK != null) ? itemPK.hashCode() : 0); 153 hashCode = 37 * hashCode + ((vendorPartyPK != null) ? vendorPartyPK.hashCode() : 0); 154 hashCode = 37 * hashCode + ((vendorItemName != null) ? vendorItemName.hashCode() : 0); 155 hashCode = 37 * hashCode + ((description != null) ? description.hashCode() : 0); 156 hashCode = 37 * hashCode + ((priority != null) ? priority.hashCode() : 0); 157 hashCode = 37 * hashCode + ((cancellationPolicyPK != null) ? cancellationPolicyPK.hashCode() : 0); 158 hashCode = 37 * hashCode + ((returnPolicyPK != null) ? returnPolicyPK.hashCode() : 0); 159 hashCode = 37 * hashCode + ((fromTime != null) ? fromTime.hashCode() : 0); 160 hashCode = 37 * hashCode + ((thruTime != null) ? thruTime.hashCode() : 0); 161 162 _hashCode = hashCode; 163 } 164 165 return _hashCode; 166 } 167 168 @Override 169 @Nonnull 170 public String toString() { 171 if(_stringValue == null) { 172 _stringValue = "{" + 173 "entityId=" + getEntityId() + 174 ", vendorItemPK=" + getVendorItemPK() + 175 ", itemPK=" + getItemPK() + 176 ", vendorPartyPK=" + getVendorPartyPK() + 177 ", vendorItemName=" + getVendorItemName() + 178 ", description=" + getDescription() + 179 ", priority=" + getPriority() + 180 ", cancellationPolicyPK=" + getCancellationPolicyPK() + 181 ", returnPolicyPK=" + getReturnPolicyPK() + 182 ", fromTime=" + getFromTime() + 183 ", thruTime=" + getThruTime() + 184 "}"; 185 } 186 return _stringValue; 187 } 188 189 @Override 190 public boolean equals(Object other) { 191 if(this == other) 192 return true; 193 194 if(!hasIdentity()) 195 return false; 196 197 if(other instanceof VendorItemDetailValue that) { 198 if(!that.hasIdentity()) 199 return false; 200 201 Long thisEntityId = getEntityId(); 202 Long thatEntityId = that.getEntityId(); 203 204 boolean objectsEqual = thisEntityId.equals(thatEntityId); 205 if(objectsEqual) 206 objectsEqual = isIdentical(that); 207 208 return objectsEqual; 209 } else { 210 return false; 211 } 212 } 213 214 public boolean isIdentical(Object other) { 215 if(other instanceof VendorItemDetailValue that) { 216 boolean objectsEqual = true; 217 218 219 if(objectsEqual) { 220 VendorItemPK thisVendorItemPK = getVendorItemPK(); 221 VendorItemPK thatVendorItemPK = that.getVendorItemPK(); 222 223 if(thisVendorItemPK == null) { 224 objectsEqual = objectsEqual && (thatVendorItemPK == null); 225 } else { 226 objectsEqual = objectsEqual && thisVendorItemPK.equals(thatVendorItemPK); 227 } 228 } 229 230 if(objectsEqual) { 231 ItemPK thisItemPK = getItemPK(); 232 ItemPK thatItemPK = that.getItemPK(); 233 234 if(thisItemPK == null) { 235 objectsEqual = objectsEqual && (thatItemPK == null); 236 } else { 237 objectsEqual = objectsEqual && thisItemPK.equals(thatItemPK); 238 } 239 } 240 241 if(objectsEqual) { 242 PartyPK thisVendorPartyPK = getVendorPartyPK(); 243 PartyPK thatVendorPartyPK = that.getVendorPartyPK(); 244 245 if(thisVendorPartyPK == null) { 246 objectsEqual = objectsEqual && (thatVendorPartyPK == null); 247 } else { 248 objectsEqual = objectsEqual && thisVendorPartyPK.equals(thatVendorPartyPK); 249 } 250 } 251 252 if(objectsEqual) { 253 String thisVendorItemName = getVendorItemName(); 254 String thatVendorItemName = that.getVendorItemName(); 255 256 if(thisVendorItemName == null) { 257 objectsEqual = objectsEqual && (thatVendorItemName == null); 258 } else { 259 objectsEqual = objectsEqual && thisVendorItemName.equals(thatVendorItemName); 260 } 261 } 262 263 if(objectsEqual) { 264 String thisDescription = getDescription(); 265 String thatDescription = that.getDescription(); 266 267 if(thisDescription == null) { 268 objectsEqual = objectsEqual && (thatDescription == null); 269 } else { 270 objectsEqual = objectsEqual && thisDescription.equals(thatDescription); 271 } 272 } 273 274 if(objectsEqual) { 275 Integer thisPriority = getPriority(); 276 Integer thatPriority = that.getPriority(); 277 278 if(thisPriority == null) { 279 objectsEqual = objectsEqual && (thatPriority == null); 280 } else { 281 objectsEqual = objectsEqual && thisPriority.equals(thatPriority); 282 } 283 } 284 285 if(objectsEqual) { 286 CancellationPolicyPK thisCancellationPolicyPK = getCancellationPolicyPK(); 287 CancellationPolicyPK thatCancellationPolicyPK = that.getCancellationPolicyPK(); 288 289 if(thisCancellationPolicyPK == null) { 290 objectsEqual = objectsEqual && (thatCancellationPolicyPK == null); 291 } else { 292 objectsEqual = objectsEqual && thisCancellationPolicyPK.equals(thatCancellationPolicyPK); 293 } 294 } 295 296 if(objectsEqual) { 297 ReturnPolicyPK thisReturnPolicyPK = getReturnPolicyPK(); 298 ReturnPolicyPK thatReturnPolicyPK = that.getReturnPolicyPK(); 299 300 if(thisReturnPolicyPK == null) { 301 objectsEqual = objectsEqual && (thatReturnPolicyPK == null); 302 } else { 303 objectsEqual = objectsEqual && thisReturnPolicyPK.equals(thatReturnPolicyPK); 304 } 305 } 306 307 if(objectsEqual) { 308 Long thisFromTime = getFromTime(); 309 Long thatFromTime = that.getFromTime(); 310 311 if(thisFromTime == null) { 312 objectsEqual = objectsEqual && (thatFromTime == null); 313 } else { 314 objectsEqual = objectsEqual && thisFromTime.equals(thatFromTime); 315 } 316 } 317 318 if(objectsEqual) { 319 Long thisThruTime = getThruTime(); 320 Long thatThruTime = that.getThruTime(); 321 322 if(thisThruTime == null) { 323 objectsEqual = objectsEqual && (thatThruTime == null); 324 } else { 325 objectsEqual = objectsEqual && thisThruTime.equals(thatThruTime); 326 } 327 } 328 329 return objectsEqual; 330 } else { 331 return false; 332 } 333 } 334 335 @Override 336 public boolean hasBeenModified() { 337 return vendorItemPKHasBeenModified || itemPKHasBeenModified || vendorPartyPKHasBeenModified || vendorItemNameHasBeenModified || descriptionHasBeenModified || priorityHasBeenModified || cancellationPolicyPKHasBeenModified || returnPolicyPKHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified; 338 } 339 340 @Override 341 public void clearHasBeenModified() { 342 vendorItemPKHasBeenModified = false; 343 itemPKHasBeenModified = false; 344 vendorPartyPKHasBeenModified = false; 345 vendorItemNameHasBeenModified = false; 346 descriptionHasBeenModified = false; 347 priorityHasBeenModified = false; 348 cancellationPolicyPKHasBeenModified = false; 349 returnPolicyPKHasBeenModified = false; 350 fromTimeHasBeenModified = false; 351 thruTimeHasBeenModified = false; 352 } 353 354 @Nonnull 355 public VendorItemPK getVendorItemPK() { 356 return vendorItemPK; 357 } 358 359 public void setVendorItemPK(@Nonnull VendorItemPK vendorItemPK) 360 throws PersistenceNotNullException { 361 checkForNull(vendorItemPK); 362 363 boolean update = true; 364 365 if(this.vendorItemPK != null) { 366 if(this.vendorItemPK.equals(vendorItemPK)) { 367 update = false; 368 } 369 } else if(vendorItemPK == null) { 370 update = false; 371 } 372 373 if(update) { 374 this.vendorItemPK = vendorItemPK; 375 vendorItemPKHasBeenModified = true; 376 clearHashAndString(); 377 } 378 } 379 380 public boolean getVendorItemPKHasBeenModified() { 381 return vendorItemPKHasBeenModified; 382 } 383 384 @Nonnull 385 public ItemPK getItemPK() { 386 return itemPK; 387 } 388 389 public void setItemPK(@Nonnull ItemPK itemPK) 390 throws PersistenceNotNullException { 391 checkForNull(itemPK); 392 393 boolean update = true; 394 395 if(this.itemPK != null) { 396 if(this.itemPK.equals(itemPK)) { 397 update = false; 398 } 399 } else if(itemPK == null) { 400 update = false; 401 } 402 403 if(update) { 404 this.itemPK = itemPK; 405 itemPKHasBeenModified = true; 406 clearHashAndString(); 407 } 408 } 409 410 public boolean getItemPKHasBeenModified() { 411 return itemPKHasBeenModified; 412 } 413 414 @Nonnull 415 public PartyPK getVendorPartyPK() { 416 return vendorPartyPK; 417 } 418 419 public void setVendorPartyPK(@Nonnull PartyPK vendorPartyPK) 420 throws PersistenceNotNullException { 421 checkForNull(vendorPartyPK); 422 423 boolean update = true; 424 425 if(this.vendorPartyPK != null) { 426 if(this.vendorPartyPK.equals(vendorPartyPK)) { 427 update = false; 428 } 429 } else if(vendorPartyPK == null) { 430 update = false; 431 } 432 433 if(update) { 434 this.vendorPartyPK = vendorPartyPK; 435 vendorPartyPKHasBeenModified = true; 436 clearHashAndString(); 437 } 438 } 439 440 public boolean getVendorPartyPKHasBeenModified() { 441 return vendorPartyPKHasBeenModified; 442 } 443 444 @Nonnull 445 public String getVendorItemName() { 446 return vendorItemName; 447 } 448 449 public void setVendorItemName(@Nonnull String vendorItemName) 450 throws PersistenceNotNullException { 451 checkForNull(vendorItemName); 452 453 boolean update = true; 454 455 if(this.vendorItemName != null) { 456 if(this.vendorItemName.equals(vendorItemName)) { 457 update = false; 458 } 459 } else if(vendorItemName == null) { 460 update = false; 461 } 462 463 if(update) { 464 this.vendorItemName = vendorItemName; 465 vendorItemNameHasBeenModified = true; 466 clearHashAndString(); 467 } 468 } 469 470 public boolean getVendorItemNameHasBeenModified() { 471 return vendorItemNameHasBeenModified; 472 } 473 474 @Nullable 475 public String getDescription() { 476 return description; 477 } 478 479 public void setDescription(@Nullable String description) { 480 boolean update = true; 481 482 if(this.description != null) { 483 if(this.description.equals(description)) { 484 update = false; 485 } 486 } else if(description == null) { 487 update = false; 488 } 489 490 if(update) { 491 this.description = description; 492 descriptionHasBeenModified = true; 493 clearHashAndString(); 494 } 495 } 496 497 public boolean getDescriptionHasBeenModified() { 498 return descriptionHasBeenModified; 499 } 500 501 @Nonnull 502 public Integer getPriority() { 503 return priority; 504 } 505 506 public void setPriority(@Nonnull Integer priority) 507 throws PersistenceNotNullException { 508 checkForNull(priority); 509 510 boolean update = true; 511 512 if(this.priority != null) { 513 if(this.priority.equals(priority)) { 514 update = false; 515 } 516 } else if(priority == null) { 517 update = false; 518 } 519 520 if(update) { 521 this.priority = priority; 522 priorityHasBeenModified = true; 523 clearHashAndString(); 524 } 525 } 526 527 public boolean getPriorityHasBeenModified() { 528 return priorityHasBeenModified; 529 } 530 531 @Nullable 532 public CancellationPolicyPK getCancellationPolicyPK() { 533 return cancellationPolicyPK; 534 } 535 536 public void setCancellationPolicyPK(@Nullable CancellationPolicyPK cancellationPolicyPK) { 537 boolean update = true; 538 539 if(this.cancellationPolicyPK != null) { 540 if(this.cancellationPolicyPK.equals(cancellationPolicyPK)) { 541 update = false; 542 } 543 } else if(cancellationPolicyPK == null) { 544 update = false; 545 } 546 547 if(update) { 548 this.cancellationPolicyPK = cancellationPolicyPK; 549 cancellationPolicyPKHasBeenModified = true; 550 clearHashAndString(); 551 } 552 } 553 554 public boolean getCancellationPolicyPKHasBeenModified() { 555 return cancellationPolicyPKHasBeenModified; 556 } 557 558 @Nullable 559 public ReturnPolicyPK getReturnPolicyPK() { 560 return returnPolicyPK; 561 } 562 563 public void setReturnPolicyPK(@Nullable ReturnPolicyPK returnPolicyPK) { 564 boolean update = true; 565 566 if(this.returnPolicyPK != null) { 567 if(this.returnPolicyPK.equals(returnPolicyPK)) { 568 update = false; 569 } 570 } else if(returnPolicyPK == null) { 571 update = false; 572 } 573 574 if(update) { 575 this.returnPolicyPK = returnPolicyPK; 576 returnPolicyPKHasBeenModified = true; 577 clearHashAndString(); 578 } 579 } 580 581 public boolean getReturnPolicyPKHasBeenModified() { 582 return returnPolicyPKHasBeenModified; 583 } 584 585 @Nonnull 586 public Long getFromTime() { 587 return fromTime; 588 } 589 590 public void setFromTime(@Nonnull Long fromTime) 591 throws PersistenceNotNullException { 592 checkForNull(fromTime); 593 594 boolean update = true; 595 596 if(this.fromTime != null) { 597 if(this.fromTime.equals(fromTime)) { 598 update = false; 599 } 600 } else if(fromTime == null) { 601 update = false; 602 } 603 604 if(update) { 605 this.fromTime = fromTime; 606 fromTimeHasBeenModified = true; 607 clearHashAndString(); 608 } 609 } 610 611 public boolean getFromTimeHasBeenModified() { 612 return fromTimeHasBeenModified; 613 } 614 615 @Nonnull 616 public Long getThruTime() { 617 return thruTime; 618 } 619 620 public void setThruTime(@Nonnull Long thruTime) 621 throws PersistenceNotNullException { 622 checkForNull(thruTime); 623 624 boolean update = true; 625 626 if(this.thruTime != null) { 627 if(this.thruTime.equals(thruTime)) { 628 update = false; 629 } 630 } else if(thruTime == null) { 631 update = false; 632 } 633 634 if(update) { 635 this.thruTime = thruTime; 636 thruTimeHasBeenModified = true; 637 clearHashAndString(); 638 } 639 } 640 641 public boolean getThruTimeHasBeenModified() { 642 return thruTimeHasBeenModified; 643 } 644 645}