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 * OfferDetailValue.java 021 */ 022 023package com.echothree.model.data.offer.server.value; 024 025import com.echothree.model.data.offer.common.pk.OfferDetailPK; 026 027import com.echothree.model.data.offer.server.factory.OfferDetailFactory; 028 029import com.echothree.model.data.offer.common.pk.OfferPK; 030import com.echothree.model.data.sequence.common.pk.SequencePK; 031import com.echothree.model.data.party.common.pk.PartyPK; 032import com.echothree.model.data.selector.common.pk.SelectorPK; 033import com.echothree.model.data.filter.common.pk.FilterPK; 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 OfferDetailValue 046 extends BaseValue<OfferDetailPK> 047 implements Cloneable, Serializable { 048 049 private OfferPK offerPK; 050 private boolean offerPKHasBeenModified = false; 051 private String offerName; 052 private boolean offerNameHasBeenModified = false; 053 private SequencePK salesOrderSequencePK; 054 private boolean salesOrderSequencePKHasBeenModified = false; 055 private PartyPK departmentPartyPK; 056 private boolean departmentPartyPKHasBeenModified = false; 057 private SelectorPK offerItemSelectorPK; 058 private boolean offerItemSelectorPKHasBeenModified = false; 059 private FilterPK offerItemPriceFilterPK; 060 private boolean offerItemPriceFilterPKHasBeenModified = false; 061 private Boolean isDefault; 062 private boolean isDefaultHasBeenModified = false; 063 private Integer sortOrder; 064 private boolean sortOrderHasBeenModified = 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(OfferPK offerPK, String offerName, SequencePK salesOrderSequencePK, PartyPK departmentPartyPK, SelectorPK offerItemSelectorPK, FilterPK offerItemPriceFilterPK, Boolean isDefault, Integer sortOrder, Long fromTime, Long thruTime) 074 throws PersistenceNotNullException { 075 checkForNull(offerPK); 076 this.offerPK = offerPK; 077 checkForNull(offerName); 078 this.offerName = offerName; 079 this.salesOrderSequencePK = salesOrderSequencePK; 080 checkForNull(departmentPartyPK); 081 this.departmentPartyPK = departmentPartyPK; 082 this.offerItemSelectorPK = offerItemSelectorPK; 083 this.offerItemPriceFilterPK = offerItemPriceFilterPK; 084 checkForNull(isDefault); 085 this.isDefault = isDefault; 086 checkForNull(sortOrder); 087 this.sortOrder = sortOrder; 088 checkForNull(fromTime); 089 this.fromTime = fromTime; 090 checkForNull(thruTime); 091 this.thruTime = thruTime; 092 } 093 094 /** Creates a new instance of OfferDetailValue */ 095 public OfferDetailValue(OfferDetailPK offerDetailPK, OfferPK offerPK, String offerName, SequencePK salesOrderSequencePK, PartyPK departmentPartyPK, SelectorPK offerItemSelectorPK, FilterPK offerItemPriceFilterPK, Boolean isDefault, Integer sortOrder, Long fromTime, Long thruTime) 096 throws PersistenceNotNullException { 097 super(offerDetailPK); 098 constructFields(offerPK, offerName, salesOrderSequencePK, departmentPartyPK, offerItemSelectorPK, offerItemPriceFilterPK, isDefault, sortOrder, fromTime, thruTime); 099 } 100 101 /** Creates a new instance of OfferDetailValue */ 102 public OfferDetailValue(OfferPK offerPK, String offerName, SequencePK salesOrderSequencePK, PartyPK departmentPartyPK, SelectorPK offerItemSelectorPK, FilterPK offerItemPriceFilterPK, Boolean isDefault, Integer sortOrder, Long fromTime, Long thruTime) 103 throws PersistenceNotNullException { 104 super(); 105 constructFields(offerPK, offerName, salesOrderSequencePK, departmentPartyPK, offerItemSelectorPK, offerItemPriceFilterPK, isDefault, sortOrder, fromTime, thruTime); 106 } 107 108 @Override 109 @Nonnull 110 public OfferDetailFactory getBaseFactoryInstance() { 111 return OfferDetailFactory.getInstance(); 112 } 113 114 @Override 115 @Nonnull 116 public OfferDetailValue 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 (OfferDetailValue)result; 127 } 128 129 @Override 130 @Nonnull 131 public OfferDetailPK getPrimaryKey() { 132 if(_primaryKey == null) { 133 _primaryKey = new OfferDetailPK(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 + ((offerPK != null) ? offerPK.hashCode() : 0); 152 hashCode = 37 * hashCode + ((offerName != null) ? offerName.hashCode() : 0); 153 hashCode = 37 * hashCode + ((salesOrderSequencePK != null) ? salesOrderSequencePK.hashCode() : 0); 154 hashCode = 37 * hashCode + ((departmentPartyPK != null) ? departmentPartyPK.hashCode() : 0); 155 hashCode = 37 * hashCode + ((offerItemSelectorPK != null) ? offerItemSelectorPK.hashCode() : 0); 156 hashCode = 37 * hashCode + ((offerItemPriceFilterPK != null) ? offerItemPriceFilterPK.hashCode() : 0); 157 hashCode = 37 * hashCode + ((isDefault != null) ? isDefault.hashCode() : 0); 158 hashCode = 37 * hashCode + ((sortOrder != null) ? sortOrder.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 ", offerPK=" + getOfferPK() + 175 ", offerName=" + getOfferName() + 176 ", salesOrderSequencePK=" + getSalesOrderSequencePK() + 177 ", departmentPartyPK=" + getDepartmentPartyPK() + 178 ", offerItemSelectorPK=" + getOfferItemSelectorPK() + 179 ", offerItemPriceFilterPK=" + getOfferItemPriceFilterPK() + 180 ", isDefault=" + getIsDefault() + 181 ", sortOrder=" + getSortOrder() + 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 OfferDetailValue 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 OfferDetailValue that) { 216 boolean objectsEqual = true; 217 218 219 if(objectsEqual) { 220 OfferPK thisOfferPK = getOfferPK(); 221 OfferPK thatOfferPK = that.getOfferPK(); 222 223 if(thisOfferPK == null) { 224 objectsEqual = objectsEqual && (thatOfferPK == null); 225 } else { 226 objectsEqual = objectsEqual && thisOfferPK.equals(thatOfferPK); 227 } 228 } 229 230 if(objectsEqual) { 231 String thisOfferName = getOfferName(); 232 String thatOfferName = that.getOfferName(); 233 234 if(thisOfferName == null) { 235 objectsEqual = objectsEqual && (thatOfferName == null); 236 } else { 237 objectsEqual = objectsEqual && thisOfferName.equals(thatOfferName); 238 } 239 } 240 241 if(objectsEqual) { 242 SequencePK thisSalesOrderSequencePK = getSalesOrderSequencePK(); 243 SequencePK thatSalesOrderSequencePK = that.getSalesOrderSequencePK(); 244 245 if(thisSalesOrderSequencePK == null) { 246 objectsEqual = objectsEqual && (thatSalesOrderSequencePK == null); 247 } else { 248 objectsEqual = objectsEqual && thisSalesOrderSequencePK.equals(thatSalesOrderSequencePK); 249 } 250 } 251 252 if(objectsEqual) { 253 PartyPK thisDepartmentPartyPK = getDepartmentPartyPK(); 254 PartyPK thatDepartmentPartyPK = that.getDepartmentPartyPK(); 255 256 if(thisDepartmentPartyPK == null) { 257 objectsEqual = objectsEqual && (thatDepartmentPartyPK == null); 258 } else { 259 objectsEqual = objectsEqual && thisDepartmentPartyPK.equals(thatDepartmentPartyPK); 260 } 261 } 262 263 if(objectsEqual) { 264 SelectorPK thisOfferItemSelectorPK = getOfferItemSelectorPK(); 265 SelectorPK thatOfferItemSelectorPK = that.getOfferItemSelectorPK(); 266 267 if(thisOfferItemSelectorPK == null) { 268 objectsEqual = objectsEqual && (thatOfferItemSelectorPK == null); 269 } else { 270 objectsEqual = objectsEqual && thisOfferItemSelectorPK.equals(thatOfferItemSelectorPK); 271 } 272 } 273 274 if(objectsEqual) { 275 FilterPK thisOfferItemPriceFilterPK = getOfferItemPriceFilterPK(); 276 FilterPK thatOfferItemPriceFilterPK = that.getOfferItemPriceFilterPK(); 277 278 if(thisOfferItemPriceFilterPK == null) { 279 objectsEqual = objectsEqual && (thatOfferItemPriceFilterPK == null); 280 } else { 281 objectsEqual = objectsEqual && thisOfferItemPriceFilterPK.equals(thatOfferItemPriceFilterPK); 282 } 283 } 284 285 if(objectsEqual) { 286 Boolean thisIsDefault = getIsDefault(); 287 Boolean thatIsDefault = that.getIsDefault(); 288 289 if(thisIsDefault == null) { 290 objectsEqual = objectsEqual && (thatIsDefault == null); 291 } else { 292 objectsEqual = objectsEqual && thisIsDefault.equals(thatIsDefault); 293 } 294 } 295 296 if(objectsEqual) { 297 Integer thisSortOrder = getSortOrder(); 298 Integer thatSortOrder = that.getSortOrder(); 299 300 if(thisSortOrder == null) { 301 objectsEqual = objectsEqual && (thatSortOrder == null); 302 } else { 303 objectsEqual = objectsEqual && thisSortOrder.equals(thatSortOrder); 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 offerPKHasBeenModified || offerNameHasBeenModified || salesOrderSequencePKHasBeenModified || departmentPartyPKHasBeenModified || offerItemSelectorPKHasBeenModified || offerItemPriceFilterPKHasBeenModified || isDefaultHasBeenModified || sortOrderHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified; 338 } 339 340 @Override 341 public void clearHasBeenModified() { 342 offerPKHasBeenModified = false; 343 offerNameHasBeenModified = false; 344 salesOrderSequencePKHasBeenModified = false; 345 departmentPartyPKHasBeenModified = false; 346 offerItemSelectorPKHasBeenModified = false; 347 offerItemPriceFilterPKHasBeenModified = false; 348 isDefaultHasBeenModified = false; 349 sortOrderHasBeenModified = false; 350 fromTimeHasBeenModified = false; 351 thruTimeHasBeenModified = false; 352 } 353 354 @Nonnull 355 public OfferPK getOfferPK() { 356 return offerPK; 357 } 358 359 public void setOfferPK(@Nonnull OfferPK offerPK) 360 throws PersistenceNotNullException { 361 checkForNull(offerPK); 362 363 boolean update = true; 364 365 if(this.offerPK != null) { 366 if(this.offerPK.equals(offerPK)) { 367 update = false; 368 } 369 } else if(offerPK == null) { 370 update = false; 371 } 372 373 if(update) { 374 this.offerPK = offerPK; 375 offerPKHasBeenModified = true; 376 clearHashAndString(); 377 } 378 } 379 380 public boolean getOfferPKHasBeenModified() { 381 return offerPKHasBeenModified; 382 } 383 384 @Nonnull 385 public String getOfferName() { 386 return offerName; 387 } 388 389 public void setOfferName(@Nonnull String offerName) 390 throws PersistenceNotNullException { 391 checkForNull(offerName); 392 393 boolean update = true; 394 395 if(this.offerName != null) { 396 if(this.offerName.equals(offerName)) { 397 update = false; 398 } 399 } else if(offerName == null) { 400 update = false; 401 } 402 403 if(update) { 404 this.offerName = offerName; 405 offerNameHasBeenModified = true; 406 clearHashAndString(); 407 } 408 } 409 410 public boolean getOfferNameHasBeenModified() { 411 return offerNameHasBeenModified; 412 } 413 414 @Nullable 415 public SequencePK getSalesOrderSequencePK() { 416 return salesOrderSequencePK; 417 } 418 419 public void setSalesOrderSequencePK(@Nullable SequencePK salesOrderSequencePK) { 420 boolean update = true; 421 422 if(this.salesOrderSequencePK != null) { 423 if(this.salesOrderSequencePK.equals(salesOrderSequencePK)) { 424 update = false; 425 } 426 } else if(salesOrderSequencePK == null) { 427 update = false; 428 } 429 430 if(update) { 431 this.salesOrderSequencePK = salesOrderSequencePK; 432 salesOrderSequencePKHasBeenModified = true; 433 clearHashAndString(); 434 } 435 } 436 437 public boolean getSalesOrderSequencePKHasBeenModified() { 438 return salesOrderSequencePKHasBeenModified; 439 } 440 441 @Nonnull 442 public PartyPK getDepartmentPartyPK() { 443 return departmentPartyPK; 444 } 445 446 public void setDepartmentPartyPK(@Nonnull PartyPK departmentPartyPK) 447 throws PersistenceNotNullException { 448 checkForNull(departmentPartyPK); 449 450 boolean update = true; 451 452 if(this.departmentPartyPK != null) { 453 if(this.departmentPartyPK.equals(departmentPartyPK)) { 454 update = false; 455 } 456 } else if(departmentPartyPK == null) { 457 update = false; 458 } 459 460 if(update) { 461 this.departmentPartyPK = departmentPartyPK; 462 departmentPartyPKHasBeenModified = true; 463 clearHashAndString(); 464 } 465 } 466 467 public boolean getDepartmentPartyPKHasBeenModified() { 468 return departmentPartyPKHasBeenModified; 469 } 470 471 @Nullable 472 public SelectorPK getOfferItemSelectorPK() { 473 return offerItemSelectorPK; 474 } 475 476 public void setOfferItemSelectorPK(@Nullable SelectorPK offerItemSelectorPK) { 477 boolean update = true; 478 479 if(this.offerItemSelectorPK != null) { 480 if(this.offerItemSelectorPK.equals(offerItemSelectorPK)) { 481 update = false; 482 } 483 } else if(offerItemSelectorPK == null) { 484 update = false; 485 } 486 487 if(update) { 488 this.offerItemSelectorPK = offerItemSelectorPK; 489 offerItemSelectorPKHasBeenModified = true; 490 clearHashAndString(); 491 } 492 } 493 494 public boolean getOfferItemSelectorPKHasBeenModified() { 495 return offerItemSelectorPKHasBeenModified; 496 } 497 498 @Nullable 499 public FilterPK getOfferItemPriceFilterPK() { 500 return offerItemPriceFilterPK; 501 } 502 503 public void setOfferItemPriceFilterPK(@Nullable FilterPK offerItemPriceFilterPK) { 504 boolean update = true; 505 506 if(this.offerItemPriceFilterPK != null) { 507 if(this.offerItemPriceFilterPK.equals(offerItemPriceFilterPK)) { 508 update = false; 509 } 510 } else if(offerItemPriceFilterPK == null) { 511 update = false; 512 } 513 514 if(update) { 515 this.offerItemPriceFilterPK = offerItemPriceFilterPK; 516 offerItemPriceFilterPKHasBeenModified = true; 517 clearHashAndString(); 518 } 519 } 520 521 public boolean getOfferItemPriceFilterPKHasBeenModified() { 522 return offerItemPriceFilterPKHasBeenModified; 523 } 524 525 @Nonnull 526 public Boolean getIsDefault() { 527 return isDefault; 528 } 529 530 public void setIsDefault(@Nonnull Boolean isDefault) 531 throws PersistenceNotNullException { 532 checkForNull(isDefault); 533 534 boolean update = true; 535 536 if(this.isDefault != null) { 537 if(this.isDefault.equals(isDefault)) { 538 update = false; 539 } 540 } else if(isDefault == null) { 541 update = false; 542 } 543 544 if(update) { 545 this.isDefault = isDefault; 546 isDefaultHasBeenModified = true; 547 clearHashAndString(); 548 } 549 } 550 551 public boolean getIsDefaultHasBeenModified() { 552 return isDefaultHasBeenModified; 553 } 554 555 @Nonnull 556 public Integer getSortOrder() { 557 return sortOrder; 558 } 559 560 public void setSortOrder(@Nonnull Integer sortOrder) 561 throws PersistenceNotNullException { 562 checkForNull(sortOrder); 563 564 boolean update = true; 565 566 if(this.sortOrder != null) { 567 if(this.sortOrder.equals(sortOrder)) { 568 update = false; 569 } 570 } else if(sortOrder == null) { 571 update = false; 572 } 573 574 if(update) { 575 this.sortOrder = sortOrder; 576 sortOrderHasBeenModified = true; 577 clearHashAndString(); 578 } 579 } 580 581 public boolean getSortOrderHasBeenModified() { 582 return sortOrderHasBeenModified; 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}