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 * 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 StringBuilder stringValue = new StringBuilder("{"); 164 165 stringValue.append("entityId=").append(getEntityId()); 166 167 stringValue.append(", partyPK=").append(getPartyPK()); 168 stringValue.append(", personalTitlePK=").append(getPersonalTitlePK()); 169 stringValue.append(", firstName=").append(getFirstName()); 170 stringValue.append(", firstNameSdx=").append(getFirstNameSdx()); 171 stringValue.append(", middleName=").append(getMiddleName()); 172 stringValue.append(", middleNameSdx=").append(getMiddleNameSdx()); 173 stringValue.append(", lastName=").append(getLastName()); 174 stringValue.append(", lastNameSdx=").append(getLastNameSdx()); 175 stringValue.append(", nameSuffixPK=").append(getNameSuffixPK()); 176 stringValue.append(", fromTime=").append(getFromTime()); 177 stringValue.append(", thruTime=").append(getThruTime()); 178 179 stringValue.append('}'); 180 181 _stringValue = stringValue.toString(); 182 } 183 return _stringValue; 184 } 185 186 @Override 187 public boolean equals(Object other) { 188 if(this == other) 189 return true; 190 191 if(!hasIdentity()) 192 return false; 193 194 if(other instanceof PersonValue) { 195 PersonValue that = (PersonValue)other; 196 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 = 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) { 215 PersonValue that = (PersonValue)other; 216 boolean objectsEqual = true; 217 218 219 if(objectsEqual) { 220 PartyPK thisPartyPK = getPartyPK(); 221 PartyPK thatPartyPK = that.getPartyPK(); 222 223 if(thisPartyPK == null) { 224 objectsEqual = objectsEqual && (thatPartyPK == null); 225 } else { 226 objectsEqual = objectsEqual && thisPartyPK.equals(thatPartyPK); 227 } 228 } 229 230 if(objectsEqual) { 231 PersonalTitlePK thisPersonalTitlePK = getPersonalTitlePK(); 232 PersonalTitlePK thatPersonalTitlePK = that.getPersonalTitlePK(); 233 234 if(thisPersonalTitlePK == null) { 235 objectsEqual = objectsEqual && (thatPersonalTitlePK == null); 236 } else { 237 objectsEqual = objectsEqual && thisPersonalTitlePK.equals(thatPersonalTitlePK); 238 } 239 } 240 241 if(objectsEqual) { 242 String thisFirstName = getFirstName(); 243 String thatFirstName = that.getFirstName(); 244 245 if(thisFirstName == null) { 246 objectsEqual = objectsEqual && (thatFirstName == null); 247 } else { 248 objectsEqual = objectsEqual && thisFirstName.equals(thatFirstName); 249 } 250 } 251 252 if(objectsEqual) { 253 String thisFirstNameSdx = getFirstNameSdx(); 254 String thatFirstNameSdx = that.getFirstNameSdx(); 255 256 if(thisFirstNameSdx == null) { 257 objectsEqual = objectsEqual && (thatFirstNameSdx == null); 258 } else { 259 objectsEqual = objectsEqual && thisFirstNameSdx.equals(thatFirstNameSdx); 260 } 261 } 262 263 if(objectsEqual) { 264 String thisMiddleName = getMiddleName(); 265 String thatMiddleName = that.getMiddleName(); 266 267 if(thisMiddleName == null) { 268 objectsEqual = objectsEqual && (thatMiddleName == null); 269 } else { 270 objectsEqual = objectsEqual && thisMiddleName.equals(thatMiddleName); 271 } 272 } 273 274 if(objectsEqual) { 275 String thisMiddleNameSdx = getMiddleNameSdx(); 276 String thatMiddleNameSdx = that.getMiddleNameSdx(); 277 278 if(thisMiddleNameSdx == null) { 279 objectsEqual = objectsEqual && (thatMiddleNameSdx == null); 280 } else { 281 objectsEqual = objectsEqual && thisMiddleNameSdx.equals(thatMiddleNameSdx); 282 } 283 } 284 285 if(objectsEqual) { 286 String thisLastName = getLastName(); 287 String thatLastName = that.getLastName(); 288 289 if(thisLastName == null) { 290 objectsEqual = objectsEqual && (thatLastName == null); 291 } else { 292 objectsEqual = objectsEqual && thisLastName.equals(thatLastName); 293 } 294 } 295 296 if(objectsEqual) { 297 String thisLastNameSdx = getLastNameSdx(); 298 String thatLastNameSdx = that.getLastNameSdx(); 299 300 if(thisLastNameSdx == null) { 301 objectsEqual = objectsEqual && (thatLastNameSdx == null); 302 } else { 303 objectsEqual = objectsEqual && thisLastNameSdx.equals(thatLastNameSdx); 304 } 305 } 306 307 if(objectsEqual) { 308 NameSuffixPK thisNameSuffixPK = getNameSuffixPK(); 309 NameSuffixPK thatNameSuffixPK = that.getNameSuffixPK(); 310 311 if(thisNameSuffixPK == null) { 312 objectsEqual = objectsEqual && (thatNameSuffixPK == null); 313 } else { 314 objectsEqual = objectsEqual && thisNameSuffixPK.equals(thatNameSuffixPK); 315 } 316 } 317 318 if(objectsEqual) { 319 Long thisFromTime = getFromTime(); 320 Long thatFromTime = that.getFromTime(); 321 322 if(thisFromTime == null) { 323 objectsEqual = objectsEqual && (thatFromTime == null); 324 } else { 325 objectsEqual = objectsEqual && thisFromTime.equals(thatFromTime); 326 } 327 } 328 329 if(objectsEqual) { 330 Long thisThruTime = getThruTime(); 331 Long thatThruTime = that.getThruTime(); 332 333 if(thisThruTime == null) { 334 objectsEqual = objectsEqual && (thatThruTime == null); 335 } else { 336 objectsEqual = objectsEqual && thisThruTime.equals(thatThruTime); 337 } 338 } 339 340 return objectsEqual; 341 } else { 342 return false; 343 } 344 } 345 346 @Override 347 public boolean hasBeenModified() { 348 return partyPKHasBeenModified || personalTitlePKHasBeenModified || firstNameHasBeenModified || firstNameSdxHasBeenModified || middleNameHasBeenModified || middleNameSdxHasBeenModified || lastNameHasBeenModified || lastNameSdxHasBeenModified || nameSuffixPKHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified; 349 } 350 351 @Override 352 public void clearHasBeenModified() { 353 partyPKHasBeenModified = false; 354 personalTitlePKHasBeenModified = false; 355 firstNameHasBeenModified = false; 356 firstNameSdxHasBeenModified = false; 357 middleNameHasBeenModified = false; 358 middleNameSdxHasBeenModified = false; 359 lastNameHasBeenModified = false; 360 lastNameSdxHasBeenModified = false; 361 nameSuffixPKHasBeenModified = false; 362 fromTimeHasBeenModified = false; 363 thruTimeHasBeenModified = false; 364 } 365 366 public PartyPK getPartyPK() { 367 return partyPK; 368 } 369 370 public void setPartyPK(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 public PersonalTitlePK getPersonalTitlePK() { 396 return personalTitlePK; 397 } 398 399 public void setPersonalTitlePK(PersonalTitlePK personalTitlePK) { 400 boolean update = true; 401 402 if(this.personalTitlePK != null) { 403 if(this.personalTitlePK.equals(personalTitlePK)) { 404 update = false; 405 } 406 } else if(personalTitlePK == null) { 407 update = false; 408 } 409 410 if(update) { 411 this.personalTitlePK = personalTitlePK; 412 personalTitlePKHasBeenModified = true; 413 clearHashAndString(); 414 } 415 } 416 417 public boolean getPersonalTitlePKHasBeenModified() { 418 return personalTitlePKHasBeenModified; 419 } 420 421 public String getFirstName() { 422 return firstName; 423 } 424 425 public void setFirstName(String firstName) { 426 boolean update = true; 427 428 if(this.firstName != null) { 429 if(this.firstName.equals(firstName)) { 430 update = false; 431 } 432 } else if(firstName == null) { 433 update = false; 434 } 435 436 if(update) { 437 this.firstName = firstName; 438 firstNameHasBeenModified = true; 439 clearHashAndString(); 440 } 441 } 442 443 public boolean getFirstNameHasBeenModified() { 444 return firstNameHasBeenModified; 445 } 446 447 public String getFirstNameSdx() { 448 return firstNameSdx; 449 } 450 451 public void setFirstNameSdx(String firstNameSdx) { 452 boolean update = true; 453 454 if(this.firstNameSdx != null) { 455 if(this.firstNameSdx.equals(firstNameSdx)) { 456 update = false; 457 } 458 } else if(firstNameSdx == null) { 459 update = false; 460 } 461 462 if(update) { 463 this.firstNameSdx = firstNameSdx; 464 firstNameSdxHasBeenModified = true; 465 clearHashAndString(); 466 } 467 } 468 469 public boolean getFirstNameSdxHasBeenModified() { 470 return firstNameSdxHasBeenModified; 471 } 472 473 public String getMiddleName() { 474 return middleName; 475 } 476 477 public void setMiddleName(String middleName) { 478 boolean update = true; 479 480 if(this.middleName != null) { 481 if(this.middleName.equals(middleName)) { 482 update = false; 483 } 484 } else if(middleName == null) { 485 update = false; 486 } 487 488 if(update) { 489 this.middleName = middleName; 490 middleNameHasBeenModified = true; 491 clearHashAndString(); 492 } 493 } 494 495 public boolean getMiddleNameHasBeenModified() { 496 return middleNameHasBeenModified; 497 } 498 499 public String getMiddleNameSdx() { 500 return middleNameSdx; 501 } 502 503 public void setMiddleNameSdx(String middleNameSdx) { 504 boolean update = true; 505 506 if(this.middleNameSdx != null) { 507 if(this.middleNameSdx.equals(middleNameSdx)) { 508 update = false; 509 } 510 } else if(middleNameSdx == null) { 511 update = false; 512 } 513 514 if(update) { 515 this.middleNameSdx = middleNameSdx; 516 middleNameSdxHasBeenModified = true; 517 clearHashAndString(); 518 } 519 } 520 521 public boolean getMiddleNameSdxHasBeenModified() { 522 return middleNameSdxHasBeenModified; 523 } 524 525 public String getLastName() { 526 return lastName; 527 } 528 529 public void setLastName(String lastName) { 530 boolean update = true; 531 532 if(this.lastName != null) { 533 if(this.lastName.equals(lastName)) { 534 update = false; 535 } 536 } else if(lastName == null) { 537 update = false; 538 } 539 540 if(update) { 541 this.lastName = lastName; 542 lastNameHasBeenModified = true; 543 clearHashAndString(); 544 } 545 } 546 547 public boolean getLastNameHasBeenModified() { 548 return lastNameHasBeenModified; 549 } 550 551 public String getLastNameSdx() { 552 return lastNameSdx; 553 } 554 555 public void setLastNameSdx(String lastNameSdx) { 556 boolean update = true; 557 558 if(this.lastNameSdx != null) { 559 if(this.lastNameSdx.equals(lastNameSdx)) { 560 update = false; 561 } 562 } else if(lastNameSdx == null) { 563 update = false; 564 } 565 566 if(update) { 567 this.lastNameSdx = lastNameSdx; 568 lastNameSdxHasBeenModified = true; 569 clearHashAndString(); 570 } 571 } 572 573 public boolean getLastNameSdxHasBeenModified() { 574 return lastNameSdxHasBeenModified; 575 } 576 577 public NameSuffixPK getNameSuffixPK() { 578 return nameSuffixPK; 579 } 580 581 public void setNameSuffixPK(NameSuffixPK nameSuffixPK) { 582 boolean update = true; 583 584 if(this.nameSuffixPK != null) { 585 if(this.nameSuffixPK.equals(nameSuffixPK)) { 586 update = false; 587 } 588 } else if(nameSuffixPK == null) { 589 update = false; 590 } 591 592 if(update) { 593 this.nameSuffixPK = nameSuffixPK; 594 nameSuffixPKHasBeenModified = true; 595 clearHashAndString(); 596 } 597 } 598 599 public boolean getNameSuffixPKHasBeenModified() { 600 return nameSuffixPKHasBeenModified; 601 } 602 603 public Long getFromTime() { 604 return fromTime; 605 } 606 607 public void setFromTime(Long fromTime) 608 throws PersistenceNotNullException { 609 checkForNull(fromTime); 610 611 boolean update = true; 612 613 if(this.fromTime != null) { 614 if(this.fromTime.equals(fromTime)) { 615 update = false; 616 } 617 } else if(fromTime == null) { 618 update = false; 619 } 620 621 if(update) { 622 this.fromTime = fromTime; 623 fromTimeHasBeenModified = true; 624 clearHashAndString(); 625 } 626 } 627 628 public boolean getFromTimeHasBeenModified() { 629 return fromTimeHasBeenModified; 630 } 631 632 public Long getThruTime() { 633 return thruTime; 634 } 635 636 public void setThruTime(Long thruTime) 637 throws PersistenceNotNullException { 638 checkForNull(thruTime); 639 640 boolean update = true; 641 642 if(this.thruTime != null) { 643 if(this.thruTime.equals(thruTime)) { 644 update = false; 645 } 646 } else if(thruTime == null) { 647 update = false; 648 } 649 650 if(update) { 651 this.thruTime = thruTime; 652 thruTimeHasBeenModified = true; 653 clearHashAndString(); 654 } 655 } 656 657 public boolean getThruTimeHasBeenModified() { 658 return thruTimeHasBeenModified; 659 } 660 661}