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 * 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 StringBuilder stringValue = new StringBuilder("{"); 166 167 stringValue.append("entityId=").append(getEntityId()); 168 169 stringValue.append(", vendorItemPK=").append(getVendorItemPK()); 170 stringValue.append(", itemPK=").append(getItemPK()); 171 stringValue.append(", vendorPartyPK=").append(getVendorPartyPK()); 172 stringValue.append(", vendorItemName=").append(getVendorItemName()); 173 stringValue.append(", description=").append(getDescription()); 174 stringValue.append(", priority=").append(getPriority()); 175 stringValue.append(", cancellationPolicyPK=").append(getCancellationPolicyPK()); 176 stringValue.append(", returnPolicyPK=").append(getReturnPolicyPK()); 177 stringValue.append(", fromTime=").append(getFromTime()); 178 stringValue.append(", thruTime=").append(getThruTime()); 179 180 stringValue.append('}'); 181 182 _stringValue = stringValue.toString(); 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 VendorItemDetailValue) { 196 VendorItemDetailValue that = (VendorItemDetailValue)other; 197 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 = 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) { 216 VendorItemDetailValue that = (VendorItemDetailValue)other; 217 boolean objectsEqual = true; 218 219 220 if(objectsEqual) { 221 VendorItemPK thisVendorItemPK = getVendorItemPK(); 222 VendorItemPK thatVendorItemPK = that.getVendorItemPK(); 223 224 if(thisVendorItemPK == null) { 225 objectsEqual = objectsEqual && (thatVendorItemPK == null); 226 } else { 227 objectsEqual = objectsEqual && thisVendorItemPK.equals(thatVendorItemPK); 228 } 229 } 230 231 if(objectsEqual) { 232 ItemPK thisItemPK = getItemPK(); 233 ItemPK thatItemPK = that.getItemPK(); 234 235 if(thisItemPK == null) { 236 objectsEqual = objectsEqual && (thatItemPK == null); 237 } else { 238 objectsEqual = objectsEqual && thisItemPK.equals(thatItemPK); 239 } 240 } 241 242 if(objectsEqual) { 243 PartyPK thisVendorPartyPK = getVendorPartyPK(); 244 PartyPK thatVendorPartyPK = that.getVendorPartyPK(); 245 246 if(thisVendorPartyPK == null) { 247 objectsEqual = objectsEqual && (thatVendorPartyPK == null); 248 } else { 249 objectsEqual = objectsEqual && thisVendorPartyPK.equals(thatVendorPartyPK); 250 } 251 } 252 253 if(objectsEqual) { 254 String thisVendorItemName = getVendorItemName(); 255 String thatVendorItemName = that.getVendorItemName(); 256 257 if(thisVendorItemName == null) { 258 objectsEqual = objectsEqual && (thatVendorItemName == null); 259 } else { 260 objectsEqual = objectsEqual && thisVendorItemName.equals(thatVendorItemName); 261 } 262 } 263 264 if(objectsEqual) { 265 String thisDescription = getDescription(); 266 String thatDescription = that.getDescription(); 267 268 if(thisDescription == null) { 269 objectsEqual = objectsEqual && (thatDescription == null); 270 } else { 271 objectsEqual = objectsEqual && thisDescription.equals(thatDescription); 272 } 273 } 274 275 if(objectsEqual) { 276 Integer thisPriority = getPriority(); 277 Integer thatPriority = that.getPriority(); 278 279 if(thisPriority == null) { 280 objectsEqual = objectsEqual && (thatPriority == null); 281 } else { 282 objectsEqual = objectsEqual && thisPriority.equals(thatPriority); 283 } 284 } 285 286 if(objectsEqual) { 287 CancellationPolicyPK thisCancellationPolicyPK = getCancellationPolicyPK(); 288 CancellationPolicyPK thatCancellationPolicyPK = that.getCancellationPolicyPK(); 289 290 if(thisCancellationPolicyPK == null) { 291 objectsEqual = objectsEqual && (thatCancellationPolicyPK == null); 292 } else { 293 objectsEqual = objectsEqual && thisCancellationPolicyPK.equals(thatCancellationPolicyPK); 294 } 295 } 296 297 if(objectsEqual) { 298 ReturnPolicyPK thisReturnPolicyPK = getReturnPolicyPK(); 299 ReturnPolicyPK thatReturnPolicyPK = that.getReturnPolicyPK(); 300 301 if(thisReturnPolicyPK == null) { 302 objectsEqual = objectsEqual && (thatReturnPolicyPK == null); 303 } else { 304 objectsEqual = objectsEqual && thisReturnPolicyPK.equals(thatReturnPolicyPK); 305 } 306 } 307 308 if(objectsEqual) { 309 Long thisFromTime = getFromTime(); 310 Long thatFromTime = that.getFromTime(); 311 312 if(thisFromTime == null) { 313 objectsEqual = objectsEqual && (thatFromTime == null); 314 } else { 315 objectsEqual = objectsEqual && thisFromTime.equals(thatFromTime); 316 } 317 } 318 319 if(objectsEqual) { 320 Long thisThruTime = getThruTime(); 321 Long thatThruTime = that.getThruTime(); 322 323 if(thisThruTime == null) { 324 objectsEqual = objectsEqual && (thatThruTime == null); 325 } else { 326 objectsEqual = objectsEqual && thisThruTime.equals(thatThruTime); 327 } 328 } 329 330 return objectsEqual; 331 } else { 332 return false; 333 } 334 } 335 336 @Override 337 public boolean hasBeenModified() { 338 return vendorItemPKHasBeenModified || itemPKHasBeenModified || vendorPartyPKHasBeenModified || vendorItemNameHasBeenModified || descriptionHasBeenModified || priorityHasBeenModified || cancellationPolicyPKHasBeenModified || returnPolicyPKHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified; 339 } 340 341 @Override 342 public void clearHasBeenModified() { 343 vendorItemPKHasBeenModified = false; 344 itemPKHasBeenModified = false; 345 vendorPartyPKHasBeenModified = false; 346 vendorItemNameHasBeenModified = false; 347 descriptionHasBeenModified = false; 348 priorityHasBeenModified = false; 349 cancellationPolicyPKHasBeenModified = false; 350 returnPolicyPKHasBeenModified = false; 351 fromTimeHasBeenModified = false; 352 thruTimeHasBeenModified = false; 353 } 354 355 public VendorItemPK getVendorItemPK() { 356 return vendorItemPK; 357 } 358 359 public void setVendorItemPK(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 public ItemPK getItemPK() { 385 return itemPK; 386 } 387 388 public void setItemPK(ItemPK itemPK) 389 throws PersistenceNotNullException { 390 checkForNull(itemPK); 391 392 boolean update = true; 393 394 if(this.itemPK != null) { 395 if(this.itemPK.equals(itemPK)) { 396 update = false; 397 } 398 } else if(itemPK == null) { 399 update = false; 400 } 401 402 if(update) { 403 this.itemPK = itemPK; 404 itemPKHasBeenModified = true; 405 clearHashAndString(); 406 } 407 } 408 409 public boolean getItemPKHasBeenModified() { 410 return itemPKHasBeenModified; 411 } 412 413 public PartyPK getVendorPartyPK() { 414 return vendorPartyPK; 415 } 416 417 public void setVendorPartyPK(PartyPK vendorPartyPK) 418 throws PersistenceNotNullException { 419 checkForNull(vendorPartyPK); 420 421 boolean update = true; 422 423 if(this.vendorPartyPK != null) { 424 if(this.vendorPartyPK.equals(vendorPartyPK)) { 425 update = false; 426 } 427 } else if(vendorPartyPK == null) { 428 update = false; 429 } 430 431 if(update) { 432 this.vendorPartyPK = vendorPartyPK; 433 vendorPartyPKHasBeenModified = true; 434 clearHashAndString(); 435 } 436 } 437 438 public boolean getVendorPartyPKHasBeenModified() { 439 return vendorPartyPKHasBeenModified; 440 } 441 442 public String getVendorItemName() { 443 return vendorItemName; 444 } 445 446 public void setVendorItemName(String vendorItemName) 447 throws PersistenceNotNullException { 448 checkForNull(vendorItemName); 449 450 boolean update = true; 451 452 if(this.vendorItemName != null) { 453 if(this.vendorItemName.equals(vendorItemName)) { 454 update = false; 455 } 456 } else if(vendorItemName == null) { 457 update = false; 458 } 459 460 if(update) { 461 this.vendorItemName = vendorItemName; 462 vendorItemNameHasBeenModified = true; 463 clearHashAndString(); 464 } 465 } 466 467 public boolean getVendorItemNameHasBeenModified() { 468 return vendorItemNameHasBeenModified; 469 } 470 471 public String getDescription() { 472 return description; 473 } 474 475 public void setDescription(String description) { 476 boolean update = true; 477 478 if(this.description != null) { 479 if(this.description.equals(description)) { 480 update = false; 481 } 482 } else if(description == null) { 483 update = false; 484 } 485 486 if(update) { 487 this.description = description; 488 descriptionHasBeenModified = true; 489 clearHashAndString(); 490 } 491 } 492 493 public boolean getDescriptionHasBeenModified() { 494 return descriptionHasBeenModified; 495 } 496 497 public Integer getPriority() { 498 return priority; 499 } 500 501 public void setPriority(Integer priority) 502 throws PersistenceNotNullException { 503 checkForNull(priority); 504 505 boolean update = true; 506 507 if(this.priority != null) { 508 if(this.priority.equals(priority)) { 509 update = false; 510 } 511 } else if(priority == null) { 512 update = false; 513 } 514 515 if(update) { 516 this.priority = priority; 517 priorityHasBeenModified = true; 518 clearHashAndString(); 519 } 520 } 521 522 public boolean getPriorityHasBeenModified() { 523 return priorityHasBeenModified; 524 } 525 526 public CancellationPolicyPK getCancellationPolicyPK() { 527 return cancellationPolicyPK; 528 } 529 530 public void setCancellationPolicyPK(CancellationPolicyPK cancellationPolicyPK) { 531 boolean update = true; 532 533 if(this.cancellationPolicyPK != null) { 534 if(this.cancellationPolicyPK.equals(cancellationPolicyPK)) { 535 update = false; 536 } 537 } else if(cancellationPolicyPK == null) { 538 update = false; 539 } 540 541 if(update) { 542 this.cancellationPolicyPK = cancellationPolicyPK; 543 cancellationPolicyPKHasBeenModified = true; 544 clearHashAndString(); 545 } 546 } 547 548 public boolean getCancellationPolicyPKHasBeenModified() { 549 return cancellationPolicyPKHasBeenModified; 550 } 551 552 public ReturnPolicyPK getReturnPolicyPK() { 553 return returnPolicyPK; 554 } 555 556 public void setReturnPolicyPK(ReturnPolicyPK returnPolicyPK) { 557 boolean update = true; 558 559 if(this.returnPolicyPK != null) { 560 if(this.returnPolicyPK.equals(returnPolicyPK)) { 561 update = false; 562 } 563 } else if(returnPolicyPK == null) { 564 update = false; 565 } 566 567 if(update) { 568 this.returnPolicyPK = returnPolicyPK; 569 returnPolicyPKHasBeenModified = true; 570 clearHashAndString(); 571 } 572 } 573 574 public boolean getReturnPolicyPKHasBeenModified() { 575 return returnPolicyPKHasBeenModified; 576 } 577 578 public Long getFromTime() { 579 return fromTime; 580 } 581 582 public void setFromTime(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 public Long getThruTime() { 608 return thruTime; 609 } 610 611 public void setThruTime(Long thruTime) 612 throws PersistenceNotNullException { 613 checkForNull(thruTime); 614 615 boolean update = true; 616 617 if(this.thruTime != null) { 618 if(this.thruTime.equals(thruTime)) { 619 update = false; 620 } 621 } else if(thruTime == null) { 622 update = false; 623 } 624 625 if(update) { 626 this.thruTime = thruTime; 627 thruTimeHasBeenModified = true; 628 clearHashAndString(); 629 } 630 } 631 632 public boolean getThruTimeHasBeenModified() { 633 return thruTimeHasBeenModified; 634 } 635 636}