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