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 * AssociateProgramDetailValue.java 021 */ 022 023package com.echothree.model.data.associate.server.value; 024 025import com.echothree.model.data.associate.common.pk.AssociateProgramDetailPK; 026 027import com.echothree.model.data.associate.server.factory.AssociateProgramDetailFactory; 028 029import com.echothree.model.data.associate.common.pk.AssociateProgramPK; 030import com.echothree.model.data.sequence.common.pk.SequencePK; 031 032import com.echothree.util.common.exception.PersistenceCloneException; 033import com.echothree.util.common.exception.PersistenceNotNullException; 034 035import com.echothree.util.server.persistence.BaseValue; 036 037import java.io.Serializable; 038 039public class AssociateProgramDetailValue 040 extends BaseValue<AssociateProgramDetailPK> 041 implements Cloneable, Serializable { 042 043 private AssociateProgramPK associateProgramPK; 044 private boolean associateProgramPKHasBeenModified = false; 045 private String associateProgramName; 046 private boolean associateProgramNameHasBeenModified = false; 047 private SequencePK associateSequencePK; 048 private boolean associateSequencePKHasBeenModified = false; 049 private SequencePK associatePartyContactMechanismSequencePK; 050 private boolean associatePartyContactMechanismSequencePKHasBeenModified = false; 051 private SequencePK associateReferralSequencePK; 052 private boolean associateReferralSequencePKHasBeenModified = false; 053 private Integer itemIndirectSalePercent; 054 private boolean itemIndirectSalePercentHasBeenModified = false; 055 private Integer itemDirectSalePercent; 056 private boolean itemDirectSalePercentHasBeenModified = false; 057 private Boolean isDefault; 058 private boolean isDefaultHasBeenModified = false; 059 private Integer sortOrder; 060 private boolean sortOrderHasBeenModified = false; 061 private Long fromTime; 062 private boolean fromTimeHasBeenModified = false; 063 private Long thruTime; 064 private boolean thruTimeHasBeenModified = false; 065 066 private transient Integer _hashCode = null; 067 private transient String _stringValue = null; 068 069 private void constructFields(AssociateProgramPK associateProgramPK, String associateProgramName, SequencePK associateSequencePK, SequencePK associatePartyContactMechanismSequencePK, SequencePK associateReferralSequencePK, Integer itemIndirectSalePercent, Integer itemDirectSalePercent, Boolean isDefault, Integer sortOrder, Long fromTime, Long thruTime) 070 throws PersistenceNotNullException { 071 this.associateProgramPK = associateProgramPK; 072 checkForNull(associateProgramName); 073 this.associateProgramName = associateProgramName; 074 this.associateSequencePK = associateSequencePK; 075 this.associatePartyContactMechanismSequencePK = associatePartyContactMechanismSequencePK; 076 this.associateReferralSequencePK = associateReferralSequencePK; 077 this.itemIndirectSalePercent = itemIndirectSalePercent; 078 this.itemDirectSalePercent = itemDirectSalePercent; 079 checkForNull(isDefault); 080 this.isDefault = isDefault; 081 checkForNull(sortOrder); 082 this.sortOrder = sortOrder; 083 checkForNull(fromTime); 084 this.fromTime = fromTime; 085 checkForNull(thruTime); 086 this.thruTime = thruTime; 087 } 088 089 /** Creates a new instance of AssociateProgramDetailValue */ 090 public AssociateProgramDetailValue(AssociateProgramDetailPK associateProgramDetailPK, AssociateProgramPK associateProgramPK, String associateProgramName, SequencePK associateSequencePK, SequencePK associatePartyContactMechanismSequencePK, SequencePK associateReferralSequencePK, Integer itemIndirectSalePercent, Integer itemDirectSalePercent, Boolean isDefault, Integer sortOrder, Long fromTime, Long thruTime) 091 throws PersistenceNotNullException { 092 super(associateProgramDetailPK); 093 constructFields(associateProgramPK, associateProgramName, associateSequencePK, associatePartyContactMechanismSequencePK, associateReferralSequencePK, itemIndirectSalePercent, itemDirectSalePercent, isDefault, sortOrder, fromTime, thruTime); 094 } 095 096 /** Creates a new instance of AssociateProgramDetailValue */ 097 public AssociateProgramDetailValue(AssociateProgramPK associateProgramPK, String associateProgramName, SequencePK associateSequencePK, SequencePK associatePartyContactMechanismSequencePK, SequencePK associateReferralSequencePK, Integer itemIndirectSalePercent, Integer itemDirectSalePercent, Boolean isDefault, Integer sortOrder, Long fromTime, Long thruTime) 098 throws PersistenceNotNullException { 099 super(); 100 constructFields(associateProgramPK, associateProgramName, associateSequencePK, associatePartyContactMechanismSequencePK, associateReferralSequencePK, itemIndirectSalePercent, itemDirectSalePercent, isDefault, sortOrder, fromTime, thruTime); 101 } 102 103 @Override 104 public AssociateProgramDetailFactory getBaseFactoryInstance() { 105 return AssociateProgramDetailFactory.getInstance(); 106 } 107 108 @Override 109 public AssociateProgramDetailValue 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 (AssociateProgramDetailValue)result; 120 } 121 122 @Override 123 public AssociateProgramDetailPK getPrimaryKey() { 124 if(_primaryKey == null) { 125 _primaryKey = new AssociateProgramDetailPK(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 + ((associateProgramPK != null) ? associateProgramPK.hashCode() : 0); 144 hashCode = 37 * hashCode + ((associateProgramName != null) ? associateProgramName.hashCode() : 0); 145 hashCode = 37 * hashCode + ((associateSequencePK != null) ? associateSequencePK.hashCode() : 0); 146 hashCode = 37 * hashCode + ((associatePartyContactMechanismSequencePK != null) ? associatePartyContactMechanismSequencePK.hashCode() : 0); 147 hashCode = 37 * hashCode + ((associateReferralSequencePK != null) ? associateReferralSequencePK.hashCode() : 0); 148 hashCode = 37 * hashCode + ((itemIndirectSalePercent != null) ? itemIndirectSalePercent.hashCode() : 0); 149 hashCode = 37 * hashCode + ((itemDirectSalePercent != null) ? itemDirectSalePercent.hashCode() : 0); 150 hashCode = 37 * hashCode + ((isDefault != null) ? isDefault.hashCode() : 0); 151 hashCode = 37 * hashCode + ((sortOrder != null) ? sortOrder.hashCode() : 0); 152 hashCode = 37 * hashCode + ((fromTime != null) ? fromTime.hashCode() : 0); 153 hashCode = 37 * hashCode + ((thruTime != null) ? thruTime.hashCode() : 0); 154 155 _hashCode = hashCode; 156 } 157 158 return _hashCode; 159 } 160 161 @Override 162 public String toString() { 163 if(_stringValue == null) { 164 StringBuilder stringValue = new StringBuilder("{"); 165 166 stringValue.append("entityId=").append(getEntityId()); 167 168 stringValue.append(", associateProgramPK=").append(getAssociateProgramPK()); 169 stringValue.append(", associateProgramName=").append(getAssociateProgramName()); 170 stringValue.append(", associateSequencePK=").append(getAssociateSequencePK()); 171 stringValue.append(", associatePartyContactMechanismSequencePK=").append(getAssociatePartyContactMechanismSequencePK()); 172 stringValue.append(", associateReferralSequencePK=").append(getAssociateReferralSequencePK()); 173 stringValue.append(", itemIndirectSalePercent=").append(getItemIndirectSalePercent()); 174 stringValue.append(", itemDirectSalePercent=").append(getItemDirectSalePercent()); 175 stringValue.append(", isDefault=").append(getIsDefault()); 176 stringValue.append(", sortOrder=").append(getSortOrder()); 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 AssociateProgramDetailValue) { 196 AssociateProgramDetailValue that = (AssociateProgramDetailValue)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 AssociateProgramDetailValue) { 216 AssociateProgramDetailValue that = (AssociateProgramDetailValue)other; 217 boolean objectsEqual = true; 218 219 220 if(objectsEqual) { 221 AssociateProgramPK thisAssociateProgramPK = getAssociateProgramPK(); 222 AssociateProgramPK thatAssociateProgramPK = that.getAssociateProgramPK(); 223 224 if(thisAssociateProgramPK == null) { 225 objectsEqual = objectsEqual && (thatAssociateProgramPK == null); 226 } else { 227 objectsEqual = objectsEqual && thisAssociateProgramPK.equals(thatAssociateProgramPK); 228 } 229 } 230 231 if(objectsEqual) { 232 String thisAssociateProgramName = getAssociateProgramName(); 233 String thatAssociateProgramName = that.getAssociateProgramName(); 234 235 if(thisAssociateProgramName == null) { 236 objectsEqual = objectsEqual && (thatAssociateProgramName == null); 237 } else { 238 objectsEqual = objectsEqual && thisAssociateProgramName.equals(thatAssociateProgramName); 239 } 240 } 241 242 if(objectsEqual) { 243 SequencePK thisAssociateSequencePK = getAssociateSequencePK(); 244 SequencePK thatAssociateSequencePK = that.getAssociateSequencePK(); 245 246 if(thisAssociateSequencePK == null) { 247 objectsEqual = objectsEqual && (thatAssociateSequencePK == null); 248 } else { 249 objectsEqual = objectsEqual && thisAssociateSequencePK.equals(thatAssociateSequencePK); 250 } 251 } 252 253 if(objectsEqual) { 254 SequencePK thisAssociatePartyContactMechanismSequencePK = getAssociatePartyContactMechanismSequencePK(); 255 SequencePK thatAssociatePartyContactMechanismSequencePK = that.getAssociatePartyContactMechanismSequencePK(); 256 257 if(thisAssociatePartyContactMechanismSequencePK == null) { 258 objectsEqual = objectsEqual && (thatAssociatePartyContactMechanismSequencePK == null); 259 } else { 260 objectsEqual = objectsEqual && thisAssociatePartyContactMechanismSequencePK.equals(thatAssociatePartyContactMechanismSequencePK); 261 } 262 } 263 264 if(objectsEqual) { 265 SequencePK thisAssociateReferralSequencePK = getAssociateReferralSequencePK(); 266 SequencePK thatAssociateReferralSequencePK = that.getAssociateReferralSequencePK(); 267 268 if(thisAssociateReferralSequencePK == null) { 269 objectsEqual = objectsEqual && (thatAssociateReferralSequencePK == null); 270 } else { 271 objectsEqual = objectsEqual && thisAssociateReferralSequencePK.equals(thatAssociateReferralSequencePK); 272 } 273 } 274 275 if(objectsEqual) { 276 Integer thisItemIndirectSalePercent = getItemIndirectSalePercent(); 277 Integer thatItemIndirectSalePercent = that.getItemIndirectSalePercent(); 278 279 if(thisItemIndirectSalePercent == null) { 280 objectsEqual = objectsEqual && (thatItemIndirectSalePercent == null); 281 } else { 282 objectsEqual = objectsEqual && thisItemIndirectSalePercent.equals(thatItemIndirectSalePercent); 283 } 284 } 285 286 if(objectsEqual) { 287 Integer thisItemDirectSalePercent = getItemDirectSalePercent(); 288 Integer thatItemDirectSalePercent = that.getItemDirectSalePercent(); 289 290 if(thisItemDirectSalePercent == null) { 291 objectsEqual = objectsEqual && (thatItemDirectSalePercent == null); 292 } else { 293 objectsEqual = objectsEqual && thisItemDirectSalePercent.equals(thatItemDirectSalePercent); 294 } 295 } 296 297 if(objectsEqual) { 298 Boolean thisIsDefault = getIsDefault(); 299 Boolean thatIsDefault = that.getIsDefault(); 300 301 if(thisIsDefault == null) { 302 objectsEqual = objectsEqual && (thatIsDefault == null); 303 } else { 304 objectsEqual = objectsEqual && thisIsDefault.equals(thatIsDefault); 305 } 306 } 307 308 if(objectsEqual) { 309 Integer thisSortOrder = getSortOrder(); 310 Integer thatSortOrder = that.getSortOrder(); 311 312 if(thisSortOrder == null) { 313 objectsEqual = objectsEqual && (thatSortOrder == null); 314 } else { 315 objectsEqual = objectsEqual && thisSortOrder.equals(thatSortOrder); 316 } 317 } 318 319 if(objectsEqual) { 320 Long thisFromTime = getFromTime(); 321 Long thatFromTime = that.getFromTime(); 322 323 if(thisFromTime == null) { 324 objectsEqual = objectsEqual && (thatFromTime == null); 325 } else { 326 objectsEqual = objectsEqual && thisFromTime.equals(thatFromTime); 327 } 328 } 329 330 if(objectsEqual) { 331 Long thisThruTime = getThruTime(); 332 Long thatThruTime = that.getThruTime(); 333 334 if(thisThruTime == null) { 335 objectsEqual = objectsEqual && (thatThruTime == null); 336 } else { 337 objectsEqual = objectsEqual && thisThruTime.equals(thatThruTime); 338 } 339 } 340 341 return objectsEqual; 342 } else { 343 return false; 344 } 345 } 346 347 @Override 348 public boolean hasBeenModified() { 349 return associateProgramPKHasBeenModified || associateProgramNameHasBeenModified || associateSequencePKHasBeenModified || associatePartyContactMechanismSequencePKHasBeenModified || associateReferralSequencePKHasBeenModified || itemIndirectSalePercentHasBeenModified || itemDirectSalePercentHasBeenModified || isDefaultHasBeenModified || sortOrderHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified; 350 } 351 352 @Override 353 public void clearHasBeenModified() { 354 associateProgramPKHasBeenModified = false; 355 associateProgramNameHasBeenModified = false; 356 associateSequencePKHasBeenModified = false; 357 associatePartyContactMechanismSequencePKHasBeenModified = false; 358 associateReferralSequencePKHasBeenModified = false; 359 itemIndirectSalePercentHasBeenModified = false; 360 itemDirectSalePercentHasBeenModified = false; 361 isDefaultHasBeenModified = false; 362 sortOrderHasBeenModified = false; 363 fromTimeHasBeenModified = false; 364 thruTimeHasBeenModified = false; 365 } 366 367 public AssociateProgramPK getAssociateProgramPK() { 368 return associateProgramPK; 369 } 370 371 public void setAssociateProgramPK(AssociateProgramPK associateProgramPK) { 372 boolean update = true; 373 374 if(this.associateProgramPK != null) { 375 if(this.associateProgramPK.equals(associateProgramPK)) { 376 update = false; 377 } 378 } else if(associateProgramPK == null) { 379 update = false; 380 } 381 382 if(update) { 383 this.associateProgramPK = associateProgramPK; 384 associateProgramPKHasBeenModified = true; 385 clearHashAndString(); 386 } 387 } 388 389 public boolean getAssociateProgramPKHasBeenModified() { 390 return associateProgramPKHasBeenModified; 391 } 392 393 public String getAssociateProgramName() { 394 return associateProgramName; 395 } 396 397 public void setAssociateProgramName(String associateProgramName) 398 throws PersistenceNotNullException { 399 checkForNull(associateProgramName); 400 401 boolean update = true; 402 403 if(this.associateProgramName != null) { 404 if(this.associateProgramName.equals(associateProgramName)) { 405 update = false; 406 } 407 } else if(associateProgramName == null) { 408 update = false; 409 } 410 411 if(update) { 412 this.associateProgramName = associateProgramName; 413 associateProgramNameHasBeenModified = true; 414 clearHashAndString(); 415 } 416 } 417 418 public boolean getAssociateProgramNameHasBeenModified() { 419 return associateProgramNameHasBeenModified; 420 } 421 422 public SequencePK getAssociateSequencePK() { 423 return associateSequencePK; 424 } 425 426 public void setAssociateSequencePK(SequencePK associateSequencePK) { 427 boolean update = true; 428 429 if(this.associateSequencePK != null) { 430 if(this.associateSequencePK.equals(associateSequencePK)) { 431 update = false; 432 } 433 } else if(associateSequencePK == null) { 434 update = false; 435 } 436 437 if(update) { 438 this.associateSequencePK = associateSequencePK; 439 associateSequencePKHasBeenModified = true; 440 clearHashAndString(); 441 } 442 } 443 444 public boolean getAssociateSequencePKHasBeenModified() { 445 return associateSequencePKHasBeenModified; 446 } 447 448 public SequencePK getAssociatePartyContactMechanismSequencePK() { 449 return associatePartyContactMechanismSequencePK; 450 } 451 452 public void setAssociatePartyContactMechanismSequencePK(SequencePK associatePartyContactMechanismSequencePK) { 453 boolean update = true; 454 455 if(this.associatePartyContactMechanismSequencePK != null) { 456 if(this.associatePartyContactMechanismSequencePK.equals(associatePartyContactMechanismSequencePK)) { 457 update = false; 458 } 459 } else if(associatePartyContactMechanismSequencePK == null) { 460 update = false; 461 } 462 463 if(update) { 464 this.associatePartyContactMechanismSequencePK = associatePartyContactMechanismSequencePK; 465 associatePartyContactMechanismSequencePKHasBeenModified = true; 466 clearHashAndString(); 467 } 468 } 469 470 public boolean getAssociatePartyContactMechanismSequencePKHasBeenModified() { 471 return associatePartyContactMechanismSequencePKHasBeenModified; 472 } 473 474 public SequencePK getAssociateReferralSequencePK() { 475 return associateReferralSequencePK; 476 } 477 478 public void setAssociateReferralSequencePK(SequencePK associateReferralSequencePK) { 479 boolean update = true; 480 481 if(this.associateReferralSequencePK != null) { 482 if(this.associateReferralSequencePK.equals(associateReferralSequencePK)) { 483 update = false; 484 } 485 } else if(associateReferralSequencePK == null) { 486 update = false; 487 } 488 489 if(update) { 490 this.associateReferralSequencePK = associateReferralSequencePK; 491 associateReferralSequencePKHasBeenModified = true; 492 clearHashAndString(); 493 } 494 } 495 496 public boolean getAssociateReferralSequencePKHasBeenModified() { 497 return associateReferralSequencePKHasBeenModified; 498 } 499 500 public Integer getItemIndirectSalePercent() { 501 return itemIndirectSalePercent; 502 } 503 504 public void setItemIndirectSalePercent(Integer itemIndirectSalePercent) { 505 boolean update = true; 506 507 if(this.itemIndirectSalePercent != null) { 508 if(this.itemIndirectSalePercent.equals(itemIndirectSalePercent)) { 509 update = false; 510 } 511 } else if(itemIndirectSalePercent == null) { 512 update = false; 513 } 514 515 if(update) { 516 this.itemIndirectSalePercent = itemIndirectSalePercent; 517 itemIndirectSalePercentHasBeenModified = true; 518 clearHashAndString(); 519 } 520 } 521 522 public boolean getItemIndirectSalePercentHasBeenModified() { 523 return itemIndirectSalePercentHasBeenModified; 524 } 525 526 public Integer getItemDirectSalePercent() { 527 return itemDirectSalePercent; 528 } 529 530 public void setItemDirectSalePercent(Integer itemDirectSalePercent) { 531 boolean update = true; 532 533 if(this.itemDirectSalePercent != null) { 534 if(this.itemDirectSalePercent.equals(itemDirectSalePercent)) { 535 update = false; 536 } 537 } else if(itemDirectSalePercent == null) { 538 update = false; 539 } 540 541 if(update) { 542 this.itemDirectSalePercent = itemDirectSalePercent; 543 itemDirectSalePercentHasBeenModified = true; 544 clearHashAndString(); 545 } 546 } 547 548 public boolean getItemDirectSalePercentHasBeenModified() { 549 return itemDirectSalePercentHasBeenModified; 550 } 551 552 public Boolean getIsDefault() { 553 return isDefault; 554 } 555 556 public void setIsDefault(Boolean isDefault) 557 throws PersistenceNotNullException { 558 checkForNull(isDefault); 559 560 boolean update = true; 561 562 if(this.isDefault != null) { 563 if(this.isDefault.equals(isDefault)) { 564 update = false; 565 } 566 } else if(isDefault == null) { 567 update = false; 568 } 569 570 if(update) { 571 this.isDefault = isDefault; 572 isDefaultHasBeenModified = true; 573 clearHashAndString(); 574 } 575 } 576 577 public boolean getIsDefaultHasBeenModified() { 578 return isDefaultHasBeenModified; 579 } 580 581 public Integer getSortOrder() { 582 return sortOrder; 583 } 584 585 public void setSortOrder(Integer sortOrder) 586 throws PersistenceNotNullException { 587 checkForNull(sortOrder); 588 589 boolean update = true; 590 591 if(this.sortOrder != null) { 592 if(this.sortOrder.equals(sortOrder)) { 593 update = false; 594 } 595 } else if(sortOrder == null) { 596 update = false; 597 } 598 599 if(update) { 600 this.sortOrder = sortOrder; 601 sortOrderHasBeenModified = true; 602 clearHashAndString(); 603 } 604 } 605 606 public boolean getSortOrderHasBeenModified() { 607 return sortOrderHasBeenModified; 608 } 609 610 public Long getFromTime() { 611 return fromTime; 612 } 613 614 public void setFromTime(Long fromTime) 615 throws PersistenceNotNullException { 616 checkForNull(fromTime); 617 618 boolean update = true; 619 620 if(this.fromTime != null) { 621 if(this.fromTime.equals(fromTime)) { 622 update = false; 623 } 624 } else if(fromTime == null) { 625 update = false; 626 } 627 628 if(update) { 629 this.fromTime = fromTime; 630 fromTimeHasBeenModified = true; 631 clearHashAndString(); 632 } 633 } 634 635 public boolean getFromTimeHasBeenModified() { 636 return fromTimeHasBeenModified; 637 } 638 639 public Long getThruTime() { 640 return thruTime; 641 } 642 643 public void setThruTime(Long thruTime) 644 throws PersistenceNotNullException { 645 checkForNull(thruTime); 646 647 boolean update = true; 648 649 if(this.thruTime != null) { 650 if(this.thruTime.equals(thruTime)) { 651 update = false; 652 } 653 } else if(thruTime == null) { 654 update = false; 655 } 656 657 if(update) { 658 this.thruTime = thruTime; 659 thruTimeHasBeenModified = true; 660 clearHashAndString(); 661 } 662 } 663 664 public boolean getThruTimeHasBeenModified() { 665 return thruTimeHasBeenModified; 666 } 667 668}