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 * LetterSourceDetailValue.java 021 */ 022 023package com.echothree.model.data.letter.server.value; 024 025import com.echothree.model.data.letter.common.pk.LetterSourceDetailPK; 026 027import com.echothree.model.data.letter.server.factory.LetterSourceDetailFactory; 028 029import com.echothree.model.data.letter.common.pk.LetterSourcePK; 030import com.echothree.model.data.party.common.pk.PartyPK; 031import com.echothree.model.data.contact.common.pk.PartyContactMechanismPK; 032 033import com.echothree.util.common.exception.PersistenceCloneException; 034import com.echothree.util.common.exception.PersistenceNotNullException; 035 036import com.echothree.util.server.persistence.BaseValue; 037 038import java.io.Serializable; 039 040import javax.annotation.Nonnull; 041import javax.annotation.Nullable; 042 043public class LetterSourceDetailValue 044 extends BaseValue<LetterSourceDetailPK> 045 implements Cloneable, Serializable { 046 047 private LetterSourcePK letterSourcePK; 048 private boolean letterSourcePKHasBeenModified = false; 049 private String letterSourceName; 050 private boolean letterSourceNameHasBeenModified = false; 051 private PartyPK companyPartyPK; 052 private boolean companyPartyPKHasBeenModified = false; 053 private PartyContactMechanismPK emailAddressPartyContactMechanismPK; 054 private boolean emailAddressPartyContactMechanismPKHasBeenModified = false; 055 private PartyContactMechanismPK postalAddressPartyContactMechanismPK; 056 private boolean postalAddressPartyContactMechanismPKHasBeenModified = false; 057 private PartyContactMechanismPK letterSourcePartyContactMechanismPK; 058 private boolean letterSourcePartyContactMechanismPKHasBeenModified = false; 059 private Boolean isDefault; 060 private boolean isDefaultHasBeenModified = false; 061 private Integer sortOrder; 062 private boolean sortOrderHasBeenModified = false; 063 private Long fromTime; 064 private boolean fromTimeHasBeenModified = false; 065 private Long thruTime; 066 private boolean thruTimeHasBeenModified = false; 067 068 private transient Integer _hashCode = null; 069 private transient String _stringValue = null; 070 071 private void constructFields(LetterSourcePK letterSourcePK, String letterSourceName, PartyPK companyPartyPK, PartyContactMechanismPK emailAddressPartyContactMechanismPK, PartyContactMechanismPK postalAddressPartyContactMechanismPK, PartyContactMechanismPK letterSourcePartyContactMechanismPK, Boolean isDefault, Integer sortOrder, Long fromTime, Long thruTime) 072 throws PersistenceNotNullException { 073 checkForNull(letterSourcePK); 074 this.letterSourcePK = letterSourcePK; 075 checkForNull(letterSourceName); 076 this.letterSourceName = letterSourceName; 077 checkForNull(companyPartyPK); 078 this.companyPartyPK = companyPartyPK; 079 checkForNull(emailAddressPartyContactMechanismPK); 080 this.emailAddressPartyContactMechanismPK = emailAddressPartyContactMechanismPK; 081 checkForNull(postalAddressPartyContactMechanismPK); 082 this.postalAddressPartyContactMechanismPK = postalAddressPartyContactMechanismPK; 083 checkForNull(letterSourcePartyContactMechanismPK); 084 this.letterSourcePartyContactMechanismPK = letterSourcePartyContactMechanismPK; 085 checkForNull(isDefault); 086 this.isDefault = isDefault; 087 checkForNull(sortOrder); 088 this.sortOrder = sortOrder; 089 checkForNull(fromTime); 090 this.fromTime = fromTime; 091 checkForNull(thruTime); 092 this.thruTime = thruTime; 093 } 094 095 /** Creates a new instance of LetterSourceDetailValue */ 096 public LetterSourceDetailValue(LetterSourceDetailPK letterSourceDetailPK, LetterSourcePK letterSourcePK, String letterSourceName, PartyPK companyPartyPK, PartyContactMechanismPK emailAddressPartyContactMechanismPK, PartyContactMechanismPK postalAddressPartyContactMechanismPK, PartyContactMechanismPK letterSourcePartyContactMechanismPK, Boolean isDefault, Integer sortOrder, Long fromTime, Long thruTime) 097 throws PersistenceNotNullException { 098 super(letterSourceDetailPK); 099 constructFields(letterSourcePK, letterSourceName, companyPartyPK, emailAddressPartyContactMechanismPK, postalAddressPartyContactMechanismPK, letterSourcePartyContactMechanismPK, isDefault, sortOrder, fromTime, thruTime); 100 } 101 102 /** Creates a new instance of LetterSourceDetailValue */ 103 public LetterSourceDetailValue(LetterSourcePK letterSourcePK, String letterSourceName, PartyPK companyPartyPK, PartyContactMechanismPK emailAddressPartyContactMechanismPK, PartyContactMechanismPK postalAddressPartyContactMechanismPK, PartyContactMechanismPK letterSourcePartyContactMechanismPK, Boolean isDefault, Integer sortOrder, Long fromTime, Long thruTime) 104 throws PersistenceNotNullException { 105 super(); 106 constructFields(letterSourcePK, letterSourceName, companyPartyPK, emailAddressPartyContactMechanismPK, postalAddressPartyContactMechanismPK, letterSourcePartyContactMechanismPK, isDefault, sortOrder, fromTime, thruTime); 107 } 108 109 @Override 110 @Nonnull 111 public LetterSourceDetailFactory getBaseFactoryInstance() { 112 return LetterSourceDetailFactory.getInstance(); 113 } 114 115 @Override 116 @Nonnull 117 public LetterSourceDetailValue clone() { 118 Object result; 119 120 try { 121 result = super.clone(); 122 } catch (CloneNotSupportedException cnse) { 123 // This shouldn't happen, fail when it does. 124 throw new PersistenceCloneException(cnse); 125 } 126 127 return (LetterSourceDetailValue)result; 128 } 129 130 @Override 131 @Nonnull 132 public LetterSourceDetailPK getPrimaryKey() { 133 if(_primaryKey == null) { 134 _primaryKey = new LetterSourceDetailPK(entityId); 135 } 136 137 return _primaryKey; 138 } 139 140 private void clearHashAndString() { 141 _hashCode = null; 142 _stringValue = null; 143 } 144 145 @Override 146 public int hashCode() { 147 if(_hashCode == null) { 148 int hashCode = 17; 149 150 hashCode = 37 * hashCode + ((entityId != null) ? entityId.hashCode() : 0); 151 152 hashCode = 37 * hashCode + ((letterSourcePK != null) ? letterSourcePK.hashCode() : 0); 153 hashCode = 37 * hashCode + ((letterSourceName != null) ? letterSourceName.hashCode() : 0); 154 hashCode = 37 * hashCode + ((companyPartyPK != null) ? companyPartyPK.hashCode() : 0); 155 hashCode = 37 * hashCode + ((emailAddressPartyContactMechanismPK != null) ? emailAddressPartyContactMechanismPK.hashCode() : 0); 156 hashCode = 37 * hashCode + ((postalAddressPartyContactMechanismPK != null) ? postalAddressPartyContactMechanismPK.hashCode() : 0); 157 hashCode = 37 * hashCode + ((letterSourcePartyContactMechanismPK != null) ? letterSourcePartyContactMechanismPK.hashCode() : 0); 158 hashCode = 37 * hashCode + ((isDefault != null) ? isDefault.hashCode() : 0); 159 hashCode = 37 * hashCode + ((sortOrder != null) ? sortOrder.hashCode() : 0); 160 hashCode = 37 * hashCode + ((fromTime != null) ? fromTime.hashCode() : 0); 161 hashCode = 37 * hashCode + ((thruTime != null) ? thruTime.hashCode() : 0); 162 163 _hashCode = hashCode; 164 } 165 166 return _hashCode; 167 } 168 169 @Override 170 @Nonnull 171 public String toString() { 172 if(_stringValue == null) { 173 _stringValue = "{" + 174 "entityId=" + getEntityId() + 175 ", letterSourcePK=" + getLetterSourcePK() + 176 ", letterSourceName=" + getLetterSourceName() + 177 ", companyPartyPK=" + getCompanyPartyPK() + 178 ", emailAddressPartyContactMechanismPK=" + getEmailAddressPartyContactMechanismPK() + 179 ", postalAddressPartyContactMechanismPK=" + getPostalAddressPartyContactMechanismPK() + 180 ", letterSourcePartyContactMechanismPK=" + getLetterSourcePartyContactMechanismPK() + 181 ", isDefault=" + getIsDefault() + 182 ", sortOrder=" + getSortOrder() + 183 ", fromTime=" + getFromTime() + 184 ", thruTime=" + getThruTime() + 185 "}"; 186 } 187 return _stringValue; 188 } 189 190 @Override 191 public boolean equals(Object other) { 192 if(this == other) 193 return true; 194 195 if(!hasIdentity()) 196 return false; 197 198 if(other instanceof LetterSourceDetailValue that) { 199 if(!that.hasIdentity()) 200 return false; 201 202 Long thisEntityId = getEntityId(); 203 Long thatEntityId = that.getEntityId(); 204 205 boolean objectsEqual = thisEntityId.equals(thatEntityId); 206 if(objectsEqual) 207 objectsEqual = isIdentical(that); 208 209 return objectsEqual; 210 } else { 211 return false; 212 } 213 } 214 215 public boolean isIdentical(Object other) { 216 if(other instanceof LetterSourceDetailValue that) { 217 boolean objectsEqual = true; 218 219 220 if(objectsEqual) { 221 LetterSourcePK thisLetterSourcePK = getLetterSourcePK(); 222 LetterSourcePK thatLetterSourcePK = that.getLetterSourcePK(); 223 224 if(thisLetterSourcePK == null) { 225 objectsEqual = objectsEqual && (thatLetterSourcePK == null); 226 } else { 227 objectsEqual = objectsEqual && thisLetterSourcePK.equals(thatLetterSourcePK); 228 } 229 } 230 231 if(objectsEqual) { 232 String thisLetterSourceName = getLetterSourceName(); 233 String thatLetterSourceName = that.getLetterSourceName(); 234 235 if(thisLetterSourceName == null) { 236 objectsEqual = objectsEqual && (thatLetterSourceName == null); 237 } else { 238 objectsEqual = objectsEqual && thisLetterSourceName.equals(thatLetterSourceName); 239 } 240 } 241 242 if(objectsEqual) { 243 PartyPK thisCompanyPartyPK = getCompanyPartyPK(); 244 PartyPK thatCompanyPartyPK = that.getCompanyPartyPK(); 245 246 if(thisCompanyPartyPK == null) { 247 objectsEqual = objectsEqual && (thatCompanyPartyPK == null); 248 } else { 249 objectsEqual = objectsEqual && thisCompanyPartyPK.equals(thatCompanyPartyPK); 250 } 251 } 252 253 if(objectsEqual) { 254 PartyContactMechanismPK thisEmailAddressPartyContactMechanismPK = getEmailAddressPartyContactMechanismPK(); 255 PartyContactMechanismPK thatEmailAddressPartyContactMechanismPK = that.getEmailAddressPartyContactMechanismPK(); 256 257 if(thisEmailAddressPartyContactMechanismPK == null) { 258 objectsEqual = objectsEqual && (thatEmailAddressPartyContactMechanismPK == null); 259 } else { 260 objectsEqual = objectsEqual && thisEmailAddressPartyContactMechanismPK.equals(thatEmailAddressPartyContactMechanismPK); 261 } 262 } 263 264 if(objectsEqual) { 265 PartyContactMechanismPK thisPostalAddressPartyContactMechanismPK = getPostalAddressPartyContactMechanismPK(); 266 PartyContactMechanismPK thatPostalAddressPartyContactMechanismPK = that.getPostalAddressPartyContactMechanismPK(); 267 268 if(thisPostalAddressPartyContactMechanismPK == null) { 269 objectsEqual = objectsEqual && (thatPostalAddressPartyContactMechanismPK == null); 270 } else { 271 objectsEqual = objectsEqual && thisPostalAddressPartyContactMechanismPK.equals(thatPostalAddressPartyContactMechanismPK); 272 } 273 } 274 275 if(objectsEqual) { 276 PartyContactMechanismPK thisLetterSourcePartyContactMechanismPK = getLetterSourcePartyContactMechanismPK(); 277 PartyContactMechanismPK thatLetterSourcePartyContactMechanismPK = that.getLetterSourcePartyContactMechanismPK(); 278 279 if(thisLetterSourcePartyContactMechanismPK == null) { 280 objectsEqual = objectsEqual && (thatLetterSourcePartyContactMechanismPK == null); 281 } else { 282 objectsEqual = objectsEqual && thisLetterSourcePartyContactMechanismPK.equals(thatLetterSourcePartyContactMechanismPK); 283 } 284 } 285 286 if(objectsEqual) { 287 Boolean thisIsDefault = getIsDefault(); 288 Boolean thatIsDefault = that.getIsDefault(); 289 290 if(thisIsDefault == null) { 291 objectsEqual = objectsEqual && (thatIsDefault == null); 292 } else { 293 objectsEqual = objectsEqual && thisIsDefault.equals(thatIsDefault); 294 } 295 } 296 297 if(objectsEqual) { 298 Integer thisSortOrder = getSortOrder(); 299 Integer thatSortOrder = that.getSortOrder(); 300 301 if(thisSortOrder == null) { 302 objectsEqual = objectsEqual && (thatSortOrder == null); 303 } else { 304 objectsEqual = objectsEqual && thisSortOrder.equals(thatSortOrder); 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 letterSourcePKHasBeenModified || letterSourceNameHasBeenModified || companyPartyPKHasBeenModified || emailAddressPartyContactMechanismPKHasBeenModified || postalAddressPartyContactMechanismPKHasBeenModified || letterSourcePartyContactMechanismPKHasBeenModified || isDefaultHasBeenModified || sortOrderHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified; 339 } 340 341 @Override 342 public void clearHasBeenModified() { 343 letterSourcePKHasBeenModified = false; 344 letterSourceNameHasBeenModified = false; 345 companyPartyPKHasBeenModified = false; 346 emailAddressPartyContactMechanismPKHasBeenModified = false; 347 postalAddressPartyContactMechanismPKHasBeenModified = false; 348 letterSourcePartyContactMechanismPKHasBeenModified = false; 349 isDefaultHasBeenModified = false; 350 sortOrderHasBeenModified = false; 351 fromTimeHasBeenModified = false; 352 thruTimeHasBeenModified = false; 353 } 354 355 @Nonnull 356 public LetterSourcePK getLetterSourcePK() { 357 return letterSourcePK; 358 } 359 360 public void setLetterSourcePK(@Nonnull LetterSourcePK letterSourcePK) 361 throws PersistenceNotNullException { 362 checkForNull(letterSourcePK); 363 364 boolean update = true; 365 366 if(this.letterSourcePK != null) { 367 if(this.letterSourcePK.equals(letterSourcePK)) { 368 update = false; 369 } 370 } else if(letterSourcePK == null) { 371 update = false; 372 } 373 374 if(update) { 375 this.letterSourcePK = letterSourcePK; 376 letterSourcePKHasBeenModified = true; 377 clearHashAndString(); 378 } 379 } 380 381 public boolean getLetterSourcePKHasBeenModified() { 382 return letterSourcePKHasBeenModified; 383 } 384 385 @Nonnull 386 public String getLetterSourceName() { 387 return letterSourceName; 388 } 389 390 public void setLetterSourceName(@Nonnull String letterSourceName) 391 throws PersistenceNotNullException { 392 checkForNull(letterSourceName); 393 394 boolean update = true; 395 396 if(this.letterSourceName != null) { 397 if(this.letterSourceName.equals(letterSourceName)) { 398 update = false; 399 } 400 } else if(letterSourceName == null) { 401 update = false; 402 } 403 404 if(update) { 405 this.letterSourceName = letterSourceName; 406 letterSourceNameHasBeenModified = true; 407 clearHashAndString(); 408 } 409 } 410 411 public boolean getLetterSourceNameHasBeenModified() { 412 return letterSourceNameHasBeenModified; 413 } 414 415 @Nonnull 416 public PartyPK getCompanyPartyPK() { 417 return companyPartyPK; 418 } 419 420 public void setCompanyPartyPK(@Nonnull PartyPK companyPartyPK) 421 throws PersistenceNotNullException { 422 checkForNull(companyPartyPK); 423 424 boolean update = true; 425 426 if(this.companyPartyPK != null) { 427 if(this.companyPartyPK.equals(companyPartyPK)) { 428 update = false; 429 } 430 } else if(companyPartyPK == null) { 431 update = false; 432 } 433 434 if(update) { 435 this.companyPartyPK = companyPartyPK; 436 companyPartyPKHasBeenModified = true; 437 clearHashAndString(); 438 } 439 } 440 441 public boolean getCompanyPartyPKHasBeenModified() { 442 return companyPartyPKHasBeenModified; 443 } 444 445 @Nonnull 446 public PartyContactMechanismPK getEmailAddressPartyContactMechanismPK() { 447 return emailAddressPartyContactMechanismPK; 448 } 449 450 public void setEmailAddressPartyContactMechanismPK(@Nonnull PartyContactMechanismPK emailAddressPartyContactMechanismPK) 451 throws PersistenceNotNullException { 452 checkForNull(emailAddressPartyContactMechanismPK); 453 454 boolean update = true; 455 456 if(this.emailAddressPartyContactMechanismPK != null) { 457 if(this.emailAddressPartyContactMechanismPK.equals(emailAddressPartyContactMechanismPK)) { 458 update = false; 459 } 460 } else if(emailAddressPartyContactMechanismPK == null) { 461 update = false; 462 } 463 464 if(update) { 465 this.emailAddressPartyContactMechanismPK = emailAddressPartyContactMechanismPK; 466 emailAddressPartyContactMechanismPKHasBeenModified = true; 467 clearHashAndString(); 468 } 469 } 470 471 public boolean getEmailAddressPartyContactMechanismPKHasBeenModified() { 472 return emailAddressPartyContactMechanismPKHasBeenModified; 473 } 474 475 @Nonnull 476 public PartyContactMechanismPK getPostalAddressPartyContactMechanismPK() { 477 return postalAddressPartyContactMechanismPK; 478 } 479 480 public void setPostalAddressPartyContactMechanismPK(@Nonnull PartyContactMechanismPK postalAddressPartyContactMechanismPK) 481 throws PersistenceNotNullException { 482 checkForNull(postalAddressPartyContactMechanismPK); 483 484 boolean update = true; 485 486 if(this.postalAddressPartyContactMechanismPK != null) { 487 if(this.postalAddressPartyContactMechanismPK.equals(postalAddressPartyContactMechanismPK)) { 488 update = false; 489 } 490 } else if(postalAddressPartyContactMechanismPK == null) { 491 update = false; 492 } 493 494 if(update) { 495 this.postalAddressPartyContactMechanismPK = postalAddressPartyContactMechanismPK; 496 postalAddressPartyContactMechanismPKHasBeenModified = true; 497 clearHashAndString(); 498 } 499 } 500 501 public boolean getPostalAddressPartyContactMechanismPKHasBeenModified() { 502 return postalAddressPartyContactMechanismPKHasBeenModified; 503 } 504 505 @Nonnull 506 public PartyContactMechanismPK getLetterSourcePartyContactMechanismPK() { 507 return letterSourcePartyContactMechanismPK; 508 } 509 510 public void setLetterSourcePartyContactMechanismPK(@Nonnull PartyContactMechanismPK letterSourcePartyContactMechanismPK) 511 throws PersistenceNotNullException { 512 checkForNull(letterSourcePartyContactMechanismPK); 513 514 boolean update = true; 515 516 if(this.letterSourcePartyContactMechanismPK != null) { 517 if(this.letterSourcePartyContactMechanismPK.equals(letterSourcePartyContactMechanismPK)) { 518 update = false; 519 } 520 } else if(letterSourcePartyContactMechanismPK == null) { 521 update = false; 522 } 523 524 if(update) { 525 this.letterSourcePartyContactMechanismPK = letterSourcePartyContactMechanismPK; 526 letterSourcePartyContactMechanismPKHasBeenModified = true; 527 clearHashAndString(); 528 } 529 } 530 531 public boolean getLetterSourcePartyContactMechanismPKHasBeenModified() { 532 return letterSourcePartyContactMechanismPKHasBeenModified; 533 } 534 535 @Nonnull 536 public Boolean getIsDefault() { 537 return isDefault; 538 } 539 540 public void setIsDefault(@Nonnull Boolean isDefault) 541 throws PersistenceNotNullException { 542 checkForNull(isDefault); 543 544 boolean update = true; 545 546 if(this.isDefault != null) { 547 if(this.isDefault.equals(isDefault)) { 548 update = false; 549 } 550 } else if(isDefault == null) { 551 update = false; 552 } 553 554 if(update) { 555 this.isDefault = isDefault; 556 isDefaultHasBeenModified = true; 557 clearHashAndString(); 558 } 559 } 560 561 public boolean getIsDefaultHasBeenModified() { 562 return isDefaultHasBeenModified; 563 } 564 565 @Nonnull 566 public Integer getSortOrder() { 567 return sortOrder; 568 } 569 570 public void setSortOrder(@Nonnull Integer sortOrder) 571 throws PersistenceNotNullException { 572 checkForNull(sortOrder); 573 574 boolean update = true; 575 576 if(this.sortOrder != null) { 577 if(this.sortOrder.equals(sortOrder)) { 578 update = false; 579 } 580 } else if(sortOrder == null) { 581 update = false; 582 } 583 584 if(update) { 585 this.sortOrder = sortOrder; 586 sortOrderHasBeenModified = true; 587 clearHashAndString(); 588 } 589 } 590 591 public boolean getSortOrderHasBeenModified() { 592 return sortOrderHasBeenModified; 593 } 594 595 @Nonnull 596 public Long getFromTime() { 597 return fromTime; 598 } 599 600 public void setFromTime(@Nonnull Long fromTime) 601 throws PersistenceNotNullException { 602 checkForNull(fromTime); 603 604 boolean update = true; 605 606 if(this.fromTime != null) { 607 if(this.fromTime.equals(fromTime)) { 608 update = false; 609 } 610 } else if(fromTime == null) { 611 update = false; 612 } 613 614 if(update) { 615 this.fromTime = fromTime; 616 fromTimeHasBeenModified = true; 617 clearHashAndString(); 618 } 619 } 620 621 public boolean getFromTimeHasBeenModified() { 622 return fromTimeHasBeenModified; 623 } 624 625 @Nonnull 626 public Long getThruTime() { 627 return thruTime; 628 } 629 630 public void setThruTime(@Nonnull Long thruTime) 631 throws PersistenceNotNullException { 632 checkForNull(thruTime); 633 634 boolean update = true; 635 636 if(this.thruTime != null) { 637 if(this.thruTime.equals(thruTime)) { 638 update = false; 639 } 640 } else if(thruTime == null) { 641 update = false; 642 } 643 644 if(update) { 645 this.thruTime = thruTime; 646 thruTimeHasBeenModified = true; 647 clearHashAndString(); 648 } 649 } 650 651 public boolean getThruTimeHasBeenModified() { 652 return thruTimeHasBeenModified; 653 } 654 655}