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 * PersonValue.java 021 */ 022 023package com.echothree.model.data.party.server.value; 024 025import com.echothree.model.data.party.common.pk.PersonPK; 026 027import com.echothree.model.data.party.server.factory.PersonFactory; 028 029import com.echothree.model.data.party.common.pk.PartyPK; 030import com.echothree.model.data.party.common.pk.PersonalTitlePK; 031import com.echothree.model.data.party.common.pk.NameSuffixPK; 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 PersonValue 044 extends BaseValue<PersonPK> 045 implements Cloneable, Serializable { 046 047 private PartyPK partyPK; 048 private boolean partyPKHasBeenModified = false; 049 private PersonalTitlePK personalTitlePK; 050 private boolean personalTitlePKHasBeenModified = false; 051 private String firstName; 052 private boolean firstNameHasBeenModified = false; 053 private String firstNameSdx; 054 private boolean firstNameSdxHasBeenModified = false; 055 private String middleName; 056 private boolean middleNameHasBeenModified = false; 057 private String middleNameSdx; 058 private boolean middleNameSdxHasBeenModified = false; 059 private String lastName; 060 private boolean lastNameHasBeenModified = false; 061 private String lastNameSdx; 062 private boolean lastNameSdxHasBeenModified = false; 063 private NameSuffixPK nameSuffixPK; 064 private boolean nameSuffixPKHasBeenModified = 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(PartyPK partyPK, PersonalTitlePK personalTitlePK, String firstName, String firstNameSdx, String middleName, String middleNameSdx, String lastName, String lastNameSdx, NameSuffixPK nameSuffixPK, Long fromTime, Long thruTime) 074 throws PersistenceNotNullException { 075 checkForNull(partyPK); 076 this.partyPK = partyPK; 077 this.personalTitlePK = personalTitlePK; 078 this.firstName = firstName; 079 this.firstNameSdx = firstNameSdx; 080 this.middleName = middleName; 081 this.middleNameSdx = middleNameSdx; 082 this.lastName = lastName; 083 this.lastNameSdx = lastNameSdx; 084 this.nameSuffixPK = nameSuffixPK; 085 checkForNull(fromTime); 086 this.fromTime = fromTime; 087 checkForNull(thruTime); 088 this.thruTime = thruTime; 089 } 090 091 /** Creates a new instance of PersonValue */ 092 public PersonValue(PersonPK personPK, PartyPK partyPK, PersonalTitlePK personalTitlePK, String firstName, String firstNameSdx, String middleName, String middleNameSdx, String lastName, String lastNameSdx, NameSuffixPK nameSuffixPK, Long fromTime, Long thruTime) 093 throws PersistenceNotNullException { 094 super(personPK); 095 constructFields(partyPK, personalTitlePK, firstName, firstNameSdx, middleName, middleNameSdx, lastName, lastNameSdx, nameSuffixPK, fromTime, thruTime); 096 } 097 098 /** Creates a new instance of PersonValue */ 099 public PersonValue(PartyPK partyPK, PersonalTitlePK personalTitlePK, String firstName, String firstNameSdx, String middleName, String middleNameSdx, String lastName, String lastNameSdx, NameSuffixPK nameSuffixPK, Long fromTime, Long thruTime) 100 throws PersistenceNotNullException { 101 super(); 102 constructFields(partyPK, personalTitlePK, firstName, firstNameSdx, middleName, middleNameSdx, lastName, lastNameSdx, nameSuffixPK, fromTime, thruTime); 103 } 104 105 @Override 106 @Nonnull 107 public PersonFactory getBaseFactoryInstance() { 108 return PersonFactory.getInstance(); 109 } 110 111 @Override 112 @Nonnull 113 public PersonValue clone() { 114 Object result; 115 116 try { 117 result = super.clone(); 118 } catch (CloneNotSupportedException cnse) { 119 // This shouldn't happen, fail when it does. 120 throw new PersistenceCloneException(cnse); 121 } 122 123 return (PersonValue)result; 124 } 125 126 @Override 127 @Nonnull 128 public PersonPK getPrimaryKey() { 129 if(_primaryKey == null) { 130 _primaryKey = new PersonPK(entityId); 131 } 132 133 return _primaryKey; 134 } 135 136 private void clearHashAndString() { 137 _hashCode = null; 138 _stringValue = null; 139 } 140 141 @Override 142 public int hashCode() { 143 if(_hashCode == null) { 144 int hashCode = 17; 145 146 hashCode = 37 * hashCode + ((entityId != null) ? entityId.hashCode() : 0); 147 148 hashCode = 37 * hashCode + ((partyPK != null) ? partyPK.hashCode() : 0); 149 hashCode = 37 * hashCode + ((personalTitlePK != null) ? personalTitlePK.hashCode() : 0); 150 hashCode = 37 * hashCode + ((firstName != null) ? firstName.hashCode() : 0); 151 hashCode = 37 * hashCode + ((firstNameSdx != null) ? firstNameSdx.hashCode() : 0); 152 hashCode = 37 * hashCode + ((middleName != null) ? middleName.hashCode() : 0); 153 hashCode = 37 * hashCode + ((middleNameSdx != null) ? middleNameSdx.hashCode() : 0); 154 hashCode = 37 * hashCode + ((lastName != null) ? lastName.hashCode() : 0); 155 hashCode = 37 * hashCode + ((lastNameSdx != null) ? lastNameSdx.hashCode() : 0); 156 hashCode = 37 * hashCode + ((nameSuffixPK != null) ? nameSuffixPK.hashCode() : 0); 157 hashCode = 37 * hashCode + ((fromTime != null) ? fromTime.hashCode() : 0); 158 hashCode = 37 * hashCode + ((thruTime != null) ? thruTime.hashCode() : 0); 159 160 _hashCode = hashCode; 161 } 162 163 return _hashCode; 164 } 165 166 @Override 167 @Nonnull 168 public String toString() { 169 if(_stringValue == null) { 170 _stringValue = "{" + 171 "entityId=" + getEntityId() + 172 ", partyPK=" + getPartyPK() + 173 ", personalTitlePK=" + getPersonalTitlePK() + 174 ", firstName=" + getFirstName() + 175 ", firstNameSdx=" + getFirstNameSdx() + 176 ", middleName=" + getMiddleName() + 177 ", middleNameSdx=" + getMiddleNameSdx() + 178 ", lastName=" + getLastName() + 179 ", lastNameSdx=" + getLastNameSdx() + 180 ", nameSuffixPK=" + getNameSuffixPK() + 181 ", fromTime=" + getFromTime() + 182 ", thruTime=" + getThruTime() + 183 "}"; 184 } 185 return _stringValue; 186 } 187 188 @Override 189 public boolean equals(Object other) { 190 if(this == other) 191 return true; 192 193 if(!hasIdentity()) 194 return false; 195 196 if(other instanceof PersonValue that) { 197 if(!that.hasIdentity()) 198 return false; 199 200 Long thisEntityId = getEntityId(); 201 Long thatEntityId = that.getEntityId(); 202 203 boolean objectsEqual = thisEntityId.equals(thatEntityId); 204 if(objectsEqual) 205 objectsEqual = isIdentical(that); 206 207 return objectsEqual; 208 } else { 209 return false; 210 } 211 } 212 213 public boolean isIdentical(Object other) { 214 if(other instanceof PersonValue that) { 215 boolean objectsEqual = true; 216 217 218 if(objectsEqual) { 219 PartyPK thisPartyPK = getPartyPK(); 220 PartyPK thatPartyPK = that.getPartyPK(); 221 222 if(thisPartyPK == null) { 223 objectsEqual = objectsEqual && (thatPartyPK == null); 224 } else { 225 objectsEqual = objectsEqual && thisPartyPK.equals(thatPartyPK); 226 } 227 } 228 229 if(objectsEqual) { 230 PersonalTitlePK thisPersonalTitlePK = getPersonalTitlePK(); 231 PersonalTitlePK thatPersonalTitlePK = that.getPersonalTitlePK(); 232 233 if(thisPersonalTitlePK == null) { 234 objectsEqual = objectsEqual && (thatPersonalTitlePK == null); 235 } else { 236 objectsEqual = objectsEqual && thisPersonalTitlePK.equals(thatPersonalTitlePK); 237 } 238 } 239 240 if(objectsEqual) { 241 String thisFirstName = getFirstName(); 242 String thatFirstName = that.getFirstName(); 243 244 if(thisFirstName == null) { 245 objectsEqual = objectsEqual && (thatFirstName == null); 246 } else { 247 objectsEqual = objectsEqual && thisFirstName.equals(thatFirstName); 248 } 249 } 250 251 if(objectsEqual) { 252 String thisFirstNameSdx = getFirstNameSdx(); 253 String thatFirstNameSdx = that.getFirstNameSdx(); 254 255 if(thisFirstNameSdx == null) { 256 objectsEqual = objectsEqual && (thatFirstNameSdx == null); 257 } else { 258 objectsEqual = objectsEqual && thisFirstNameSdx.equals(thatFirstNameSdx); 259 } 260 } 261 262 if(objectsEqual) { 263 String thisMiddleName = getMiddleName(); 264 String thatMiddleName = that.getMiddleName(); 265 266 if(thisMiddleName == null) { 267 objectsEqual = objectsEqual && (thatMiddleName == null); 268 } else { 269 objectsEqual = objectsEqual && thisMiddleName.equals(thatMiddleName); 270 } 271 } 272 273 if(objectsEqual) { 274 String thisMiddleNameSdx = getMiddleNameSdx(); 275 String thatMiddleNameSdx = that.getMiddleNameSdx(); 276 277 if(thisMiddleNameSdx == null) { 278 objectsEqual = objectsEqual && (thatMiddleNameSdx == null); 279 } else { 280 objectsEqual = objectsEqual && thisMiddleNameSdx.equals(thatMiddleNameSdx); 281 } 282 } 283 284 if(objectsEqual) { 285 String thisLastName = getLastName(); 286 String thatLastName = that.getLastName(); 287 288 if(thisLastName == null) { 289 objectsEqual = objectsEqual && (thatLastName == null); 290 } else { 291 objectsEqual = objectsEqual && thisLastName.equals(thatLastName); 292 } 293 } 294 295 if(objectsEqual) { 296 String thisLastNameSdx = getLastNameSdx(); 297 String thatLastNameSdx = that.getLastNameSdx(); 298 299 if(thisLastNameSdx == null) { 300 objectsEqual = objectsEqual && (thatLastNameSdx == null); 301 } else { 302 objectsEqual = objectsEqual && thisLastNameSdx.equals(thatLastNameSdx); 303 } 304 } 305 306 if(objectsEqual) { 307 NameSuffixPK thisNameSuffixPK = getNameSuffixPK(); 308 NameSuffixPK thatNameSuffixPK = that.getNameSuffixPK(); 309 310 if(thisNameSuffixPK == null) { 311 objectsEqual = objectsEqual && (thatNameSuffixPK == null); 312 } else { 313 objectsEqual = objectsEqual && thisNameSuffixPK.equals(thatNameSuffixPK); 314 } 315 } 316 317 if(objectsEqual) { 318 Long thisFromTime = getFromTime(); 319 Long thatFromTime = that.getFromTime(); 320 321 if(thisFromTime == null) { 322 objectsEqual = objectsEqual && (thatFromTime == null); 323 } else { 324 objectsEqual = objectsEqual && thisFromTime.equals(thatFromTime); 325 } 326 } 327 328 if(objectsEqual) { 329 Long thisThruTime = getThruTime(); 330 Long thatThruTime = that.getThruTime(); 331 332 if(thisThruTime == null) { 333 objectsEqual = objectsEqual && (thatThruTime == null); 334 } else { 335 objectsEqual = objectsEqual && thisThruTime.equals(thatThruTime); 336 } 337 } 338 339 return objectsEqual; 340 } else { 341 return false; 342 } 343 } 344 345 @Override 346 public boolean hasBeenModified() { 347 return partyPKHasBeenModified || personalTitlePKHasBeenModified || firstNameHasBeenModified || firstNameSdxHasBeenModified || middleNameHasBeenModified || middleNameSdxHasBeenModified || lastNameHasBeenModified || lastNameSdxHasBeenModified || nameSuffixPKHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified; 348 } 349 350 @Override 351 public void clearHasBeenModified() { 352 partyPKHasBeenModified = false; 353 personalTitlePKHasBeenModified = false; 354 firstNameHasBeenModified = false; 355 firstNameSdxHasBeenModified = false; 356 middleNameHasBeenModified = false; 357 middleNameSdxHasBeenModified = false; 358 lastNameHasBeenModified = false; 359 lastNameSdxHasBeenModified = false; 360 nameSuffixPKHasBeenModified = false; 361 fromTimeHasBeenModified = false; 362 thruTimeHasBeenModified = false; 363 } 364 365 @Nonnull 366 public PartyPK getPartyPK() { 367 return partyPK; 368 } 369 370 public void setPartyPK(@Nonnull PartyPK partyPK) 371 throws PersistenceNotNullException { 372 checkForNull(partyPK); 373 374 boolean update = true; 375 376 if(this.partyPK != null) { 377 if(this.partyPK.equals(partyPK)) { 378 update = false; 379 } 380 } else if(partyPK == null) { 381 update = false; 382 } 383 384 if(update) { 385 this.partyPK = partyPK; 386 partyPKHasBeenModified = true; 387 clearHashAndString(); 388 } 389 } 390 391 public boolean getPartyPKHasBeenModified() { 392 return partyPKHasBeenModified; 393 } 394 395 @Nullable 396 public PersonalTitlePK getPersonalTitlePK() { 397 return personalTitlePK; 398 } 399 400 public void setPersonalTitlePK(@Nullable PersonalTitlePK personalTitlePK) { 401 boolean update = true; 402 403 if(this.personalTitlePK != null) { 404 if(this.personalTitlePK.equals(personalTitlePK)) { 405 update = false; 406 } 407 } else if(personalTitlePK == null) { 408 update = false; 409 } 410 411 if(update) { 412 this.personalTitlePK = personalTitlePK; 413 personalTitlePKHasBeenModified = true; 414 clearHashAndString(); 415 } 416 } 417 418 public boolean getPersonalTitlePKHasBeenModified() { 419 return personalTitlePKHasBeenModified; 420 } 421 422 @Nullable 423 public String getFirstName() { 424 return firstName; 425 } 426 427 public void setFirstName(@Nullable String firstName) { 428 boolean update = true; 429 430 if(this.firstName != null) { 431 if(this.firstName.equals(firstName)) { 432 update = false; 433 } 434 } else if(firstName == null) { 435 update = false; 436 } 437 438 if(update) { 439 this.firstName = firstName; 440 firstNameHasBeenModified = true; 441 clearHashAndString(); 442 } 443 } 444 445 public boolean getFirstNameHasBeenModified() { 446 return firstNameHasBeenModified; 447 } 448 449 @Nullable 450 public String getFirstNameSdx() { 451 return firstNameSdx; 452 } 453 454 public void setFirstNameSdx(@Nullable String firstNameSdx) { 455 boolean update = true; 456 457 if(this.firstNameSdx != null) { 458 if(this.firstNameSdx.equals(firstNameSdx)) { 459 update = false; 460 } 461 } else if(firstNameSdx == null) { 462 update = false; 463 } 464 465 if(update) { 466 this.firstNameSdx = firstNameSdx; 467 firstNameSdxHasBeenModified = true; 468 clearHashAndString(); 469 } 470 } 471 472 public boolean getFirstNameSdxHasBeenModified() { 473 return firstNameSdxHasBeenModified; 474 } 475 476 @Nullable 477 public String getMiddleName() { 478 return middleName; 479 } 480 481 public void setMiddleName(@Nullable String middleName) { 482 boolean update = true; 483 484 if(this.middleName != null) { 485 if(this.middleName.equals(middleName)) { 486 update = false; 487 } 488 } else if(middleName == null) { 489 update = false; 490 } 491 492 if(update) { 493 this.middleName = middleName; 494 middleNameHasBeenModified = true; 495 clearHashAndString(); 496 } 497 } 498 499 public boolean getMiddleNameHasBeenModified() { 500 return middleNameHasBeenModified; 501 } 502 503 @Nullable 504 public String getMiddleNameSdx() { 505 return middleNameSdx; 506 } 507 508 public void setMiddleNameSdx(@Nullable String middleNameSdx) { 509 boolean update = true; 510 511 if(this.middleNameSdx != null) { 512 if(this.middleNameSdx.equals(middleNameSdx)) { 513 update = false; 514 } 515 } else if(middleNameSdx == null) { 516 update = false; 517 } 518 519 if(update) { 520 this.middleNameSdx = middleNameSdx; 521 middleNameSdxHasBeenModified = true; 522 clearHashAndString(); 523 } 524 } 525 526 public boolean getMiddleNameSdxHasBeenModified() { 527 return middleNameSdxHasBeenModified; 528 } 529 530 @Nullable 531 public String getLastName() { 532 return lastName; 533 } 534 535 public void setLastName(@Nullable String lastName) { 536 boolean update = true; 537 538 if(this.lastName != null) { 539 if(this.lastName.equals(lastName)) { 540 update = false; 541 } 542 } else if(lastName == null) { 543 update = false; 544 } 545 546 if(update) { 547 this.lastName = lastName; 548 lastNameHasBeenModified = true; 549 clearHashAndString(); 550 } 551 } 552 553 public boolean getLastNameHasBeenModified() { 554 return lastNameHasBeenModified; 555 } 556 557 @Nullable 558 public String getLastNameSdx() { 559 return lastNameSdx; 560 } 561 562 public void setLastNameSdx(@Nullable String lastNameSdx) { 563 boolean update = true; 564 565 if(this.lastNameSdx != null) { 566 if(this.lastNameSdx.equals(lastNameSdx)) { 567 update = false; 568 } 569 } else if(lastNameSdx == null) { 570 update = false; 571 } 572 573 if(update) { 574 this.lastNameSdx = lastNameSdx; 575 lastNameSdxHasBeenModified = true; 576 clearHashAndString(); 577 } 578 } 579 580 public boolean getLastNameSdxHasBeenModified() { 581 return lastNameSdxHasBeenModified; 582 } 583 584 @Nullable 585 public NameSuffixPK getNameSuffixPK() { 586 return nameSuffixPK; 587 } 588 589 public void setNameSuffixPK(@Nullable NameSuffixPK nameSuffixPK) { 590 boolean update = true; 591 592 if(this.nameSuffixPK != null) { 593 if(this.nameSuffixPK.equals(nameSuffixPK)) { 594 update = false; 595 } 596 } else if(nameSuffixPK == null) { 597 update = false; 598 } 599 600 if(update) { 601 this.nameSuffixPK = nameSuffixPK; 602 nameSuffixPKHasBeenModified = true; 603 clearHashAndString(); 604 } 605 } 606 607 public boolean getNameSuffixPKHasBeenModified() { 608 return nameSuffixPKHasBeenModified; 609 } 610 611 @Nonnull 612 public Long getFromTime() { 613 return fromTime; 614 } 615 616 public void setFromTime(@Nonnull Long fromTime) 617 throws PersistenceNotNullException { 618 checkForNull(fromTime); 619 620 boolean update = true; 621 622 if(this.fromTime != null) { 623 if(this.fromTime.equals(fromTime)) { 624 update = false; 625 } 626 } else if(fromTime == null) { 627 update = false; 628 } 629 630 if(update) { 631 this.fromTime = fromTime; 632 fromTimeHasBeenModified = true; 633 clearHashAndString(); 634 } 635 } 636 637 public boolean getFromTimeHasBeenModified() { 638 return fromTimeHasBeenModified; 639 } 640 641 @Nonnull 642 public Long getThruTime() { 643 return thruTime; 644 } 645 646 public void setThruTime(@Nonnull Long thruTime) 647 throws PersistenceNotNullException { 648 checkForNull(thruTime); 649 650 boolean update = true; 651 652 if(this.thruTime != null) { 653 if(this.thruTime.equals(thruTime)) { 654 update = false; 655 } 656 } else if(thruTime == null) { 657 update = false; 658 } 659 660 if(update) { 661 this.thruTime = thruTime; 662 thruTimeHasBeenModified = true; 663 clearHashAndString(); 664 } 665 } 666 667 public boolean getThruTimeHasBeenModified() { 668 return thruTimeHasBeenModified; 669 } 670 671}