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