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