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 * LetterDetailValue.java 021 */ 022 023package com.echothree.model.data.letter.server.value; 024 025import com.echothree.model.data.letter.common.pk.LetterDetailPK; 026 027import com.echothree.model.data.letter.server.factory.LetterDetailFactory; 028 029import com.echothree.model.data.letter.common.pk.LetterPK; 030import com.echothree.model.data.chain.common.pk.ChainTypePK; 031import com.echothree.model.data.letter.common.pk.LetterSourcePK; 032import com.echothree.model.data.contactlist.common.pk.ContactListPK; 033 034import com.echothree.util.common.exception.PersistenceCloneException; 035import com.echothree.util.common.exception.PersistenceNotNullException; 036 037import com.echothree.util.server.persistence.BaseValue; 038 039import java.io.Serializable; 040 041import javax.annotation.Nonnull; 042import javax.annotation.Nullable; 043 044public class LetterDetailValue 045 extends BaseValue<LetterDetailPK> 046 implements Cloneable, Serializable { 047 048 private LetterPK letterPK; 049 private boolean letterPKHasBeenModified = false; 050 private ChainTypePK chainTypePK; 051 private boolean chainTypePKHasBeenModified = false; 052 private String letterName; 053 private boolean letterNameHasBeenModified = false; 054 private LetterSourcePK letterSourcePK; 055 private boolean letterSourcePKHasBeenModified = false; 056 private ContactListPK contactListPK; 057 private boolean contactListPKHasBeenModified = false; 058 private Boolean isDefault; 059 private boolean isDefaultHasBeenModified = false; 060 private Integer sortOrder; 061 private boolean sortOrderHasBeenModified = 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(LetterPK letterPK, ChainTypePK chainTypePK, String letterName, LetterSourcePK letterSourcePK, ContactListPK contactListPK, Boolean isDefault, Integer sortOrder, Long fromTime, Long thruTime) 071 throws PersistenceNotNullException { 072 checkForNull(letterPK); 073 this.letterPK = letterPK; 074 checkForNull(chainTypePK); 075 this.chainTypePK = chainTypePK; 076 checkForNull(letterName); 077 this.letterName = letterName; 078 checkForNull(letterSourcePK); 079 this.letterSourcePK = letterSourcePK; 080 this.contactListPK = contactListPK; 081 checkForNull(isDefault); 082 this.isDefault = isDefault; 083 checkForNull(sortOrder); 084 this.sortOrder = sortOrder; 085 checkForNull(fromTime); 086 this.fromTime = fromTime; 087 checkForNull(thruTime); 088 this.thruTime = thruTime; 089 } 090 091 /** Creates a new instance of LetterDetailValue */ 092 public LetterDetailValue(LetterDetailPK letterDetailPK, LetterPK letterPK, ChainTypePK chainTypePK, String letterName, LetterSourcePK letterSourcePK, ContactListPK contactListPK, Boolean isDefault, Integer sortOrder, Long fromTime, Long thruTime) 093 throws PersistenceNotNullException { 094 super(letterDetailPK); 095 constructFields(letterPK, chainTypePK, letterName, letterSourcePK, contactListPK, isDefault, sortOrder, fromTime, thruTime); 096 } 097 098 /** Creates a new instance of LetterDetailValue */ 099 public LetterDetailValue(LetterPK letterPK, ChainTypePK chainTypePK, String letterName, LetterSourcePK letterSourcePK, ContactListPK contactListPK, Boolean isDefault, Integer sortOrder, Long fromTime, Long thruTime) 100 throws PersistenceNotNullException { 101 super(); 102 constructFields(letterPK, chainTypePK, letterName, letterSourcePK, contactListPK, isDefault, sortOrder, fromTime, thruTime); 103 } 104 105 @Override 106 @Nonnull 107 public LetterDetailFactory getBaseFactoryInstance() { 108 return LetterDetailFactory.getInstance(); 109 } 110 111 @Override 112 @Nonnull 113 public LetterDetailValue 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 (LetterDetailValue)result; 124 } 125 126 @Override 127 @Nonnull 128 public LetterDetailPK getPrimaryKey() { 129 if(_primaryKey == null) { 130 _primaryKey = new LetterDetailPK(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 + ((letterPK != null) ? letterPK.hashCode() : 0); 149 hashCode = 37 * hashCode + ((chainTypePK != null) ? chainTypePK.hashCode() : 0); 150 hashCode = 37 * hashCode + ((letterName != null) ? letterName.hashCode() : 0); 151 hashCode = 37 * hashCode + ((letterSourcePK != null) ? letterSourcePK.hashCode() : 0); 152 hashCode = 37 * hashCode + ((contactListPK != null) ? contactListPK.hashCode() : 0); 153 hashCode = 37 * hashCode + ((isDefault != null) ? isDefault.hashCode() : 0); 154 hashCode = 37 * hashCode + ((sortOrder != null) ? sortOrder.hashCode() : 0); 155 hashCode = 37 * hashCode + ((fromTime != null) ? fromTime.hashCode() : 0); 156 hashCode = 37 * hashCode + ((thruTime != null) ? thruTime.hashCode() : 0); 157 158 _hashCode = hashCode; 159 } 160 161 return _hashCode; 162 } 163 164 @Override 165 @Nonnull 166 public String toString() { 167 if(_stringValue == null) { 168 _stringValue = "{" + 169 "entityId=" + getEntityId() + 170 ", letterPK=" + getLetterPK() + 171 ", chainTypePK=" + getChainTypePK() + 172 ", letterName=" + getLetterName() + 173 ", letterSourcePK=" + getLetterSourcePK() + 174 ", contactListPK=" + getContactListPK() + 175 ", isDefault=" + getIsDefault() + 176 ", sortOrder=" + getSortOrder() + 177 ", fromTime=" + getFromTime() + 178 ", thruTime=" + getThruTime() + 179 "}"; 180 } 181 return _stringValue; 182 } 183 184 @Override 185 public boolean equals(Object other) { 186 if(this == other) 187 return true; 188 189 if(!hasIdentity()) 190 return false; 191 192 if(other instanceof LetterDetailValue that) { 193 if(!that.hasIdentity()) 194 return false; 195 196 Long thisEntityId = getEntityId(); 197 Long thatEntityId = that.getEntityId(); 198 199 boolean objectsEqual = thisEntityId.equals(thatEntityId); 200 if(objectsEqual) 201 objectsEqual = isIdentical(that); 202 203 return objectsEqual; 204 } else { 205 return false; 206 } 207 } 208 209 public boolean isIdentical(Object other) { 210 if(other instanceof LetterDetailValue that) { 211 boolean objectsEqual = true; 212 213 214 if(objectsEqual) { 215 LetterPK thisLetterPK = getLetterPK(); 216 LetterPK thatLetterPK = that.getLetterPK(); 217 218 if(thisLetterPK == null) { 219 objectsEqual = objectsEqual && (thatLetterPK == null); 220 } else { 221 objectsEqual = objectsEqual && thisLetterPK.equals(thatLetterPK); 222 } 223 } 224 225 if(objectsEqual) { 226 ChainTypePK thisChainTypePK = getChainTypePK(); 227 ChainTypePK thatChainTypePK = that.getChainTypePK(); 228 229 if(thisChainTypePK == null) { 230 objectsEqual = objectsEqual && (thatChainTypePK == null); 231 } else { 232 objectsEqual = objectsEqual && thisChainTypePK.equals(thatChainTypePK); 233 } 234 } 235 236 if(objectsEqual) { 237 String thisLetterName = getLetterName(); 238 String thatLetterName = that.getLetterName(); 239 240 if(thisLetterName == null) { 241 objectsEqual = objectsEqual && (thatLetterName == null); 242 } else { 243 objectsEqual = objectsEqual && thisLetterName.equals(thatLetterName); 244 } 245 } 246 247 if(objectsEqual) { 248 LetterSourcePK thisLetterSourcePK = getLetterSourcePK(); 249 LetterSourcePK thatLetterSourcePK = that.getLetterSourcePK(); 250 251 if(thisLetterSourcePK == null) { 252 objectsEqual = objectsEqual && (thatLetterSourcePK == null); 253 } else { 254 objectsEqual = objectsEqual && thisLetterSourcePK.equals(thatLetterSourcePK); 255 } 256 } 257 258 if(objectsEqual) { 259 ContactListPK thisContactListPK = getContactListPK(); 260 ContactListPK thatContactListPK = that.getContactListPK(); 261 262 if(thisContactListPK == null) { 263 objectsEqual = objectsEqual && (thatContactListPK == null); 264 } else { 265 objectsEqual = objectsEqual && thisContactListPK.equals(thatContactListPK); 266 } 267 } 268 269 if(objectsEqual) { 270 Boolean thisIsDefault = getIsDefault(); 271 Boolean thatIsDefault = that.getIsDefault(); 272 273 if(thisIsDefault == null) { 274 objectsEqual = objectsEqual && (thatIsDefault == null); 275 } else { 276 objectsEqual = objectsEqual && thisIsDefault.equals(thatIsDefault); 277 } 278 } 279 280 if(objectsEqual) { 281 Integer thisSortOrder = getSortOrder(); 282 Integer thatSortOrder = that.getSortOrder(); 283 284 if(thisSortOrder == null) { 285 objectsEqual = objectsEqual && (thatSortOrder == null); 286 } else { 287 objectsEqual = objectsEqual && thisSortOrder.equals(thatSortOrder); 288 } 289 } 290 291 if(objectsEqual) { 292 Long thisFromTime = getFromTime(); 293 Long thatFromTime = that.getFromTime(); 294 295 if(thisFromTime == null) { 296 objectsEqual = objectsEqual && (thatFromTime == null); 297 } else { 298 objectsEqual = objectsEqual && thisFromTime.equals(thatFromTime); 299 } 300 } 301 302 if(objectsEqual) { 303 Long thisThruTime = getThruTime(); 304 Long thatThruTime = that.getThruTime(); 305 306 if(thisThruTime == null) { 307 objectsEqual = objectsEqual && (thatThruTime == null); 308 } else { 309 objectsEqual = objectsEqual && thisThruTime.equals(thatThruTime); 310 } 311 } 312 313 return objectsEqual; 314 } else { 315 return false; 316 } 317 } 318 319 @Override 320 public boolean hasBeenModified() { 321 return letterPKHasBeenModified || chainTypePKHasBeenModified || letterNameHasBeenModified || letterSourcePKHasBeenModified || contactListPKHasBeenModified || isDefaultHasBeenModified || sortOrderHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified; 322 } 323 324 @Override 325 public void clearHasBeenModified() { 326 letterPKHasBeenModified = false; 327 chainTypePKHasBeenModified = false; 328 letterNameHasBeenModified = false; 329 letterSourcePKHasBeenModified = false; 330 contactListPKHasBeenModified = false; 331 isDefaultHasBeenModified = false; 332 sortOrderHasBeenModified = false; 333 fromTimeHasBeenModified = false; 334 thruTimeHasBeenModified = false; 335 } 336 337 @Nonnull 338 public LetterPK getLetterPK() { 339 return letterPK; 340 } 341 342 public void setLetterPK(@Nonnull LetterPK letterPK) 343 throws PersistenceNotNullException { 344 checkForNull(letterPK); 345 346 boolean update = true; 347 348 if(this.letterPK != null) { 349 if(this.letterPK.equals(letterPK)) { 350 update = false; 351 } 352 } else if(letterPK == null) { 353 update = false; 354 } 355 356 if(update) { 357 this.letterPK = letterPK; 358 letterPKHasBeenModified = true; 359 clearHashAndString(); 360 } 361 } 362 363 public boolean getLetterPKHasBeenModified() { 364 return letterPKHasBeenModified; 365 } 366 367 @Nonnull 368 public ChainTypePK getChainTypePK() { 369 return chainTypePK; 370 } 371 372 public void setChainTypePK(@Nonnull ChainTypePK chainTypePK) 373 throws PersistenceNotNullException { 374 checkForNull(chainTypePK); 375 376 boolean update = true; 377 378 if(this.chainTypePK != null) { 379 if(this.chainTypePK.equals(chainTypePK)) { 380 update = false; 381 } 382 } else if(chainTypePK == null) { 383 update = false; 384 } 385 386 if(update) { 387 this.chainTypePK = chainTypePK; 388 chainTypePKHasBeenModified = true; 389 clearHashAndString(); 390 } 391 } 392 393 public boolean getChainTypePKHasBeenModified() { 394 return chainTypePKHasBeenModified; 395 } 396 397 @Nonnull 398 public String getLetterName() { 399 return letterName; 400 } 401 402 public void setLetterName(@Nonnull String letterName) 403 throws PersistenceNotNullException { 404 checkForNull(letterName); 405 406 boolean update = true; 407 408 if(this.letterName != null) { 409 if(this.letterName.equals(letterName)) { 410 update = false; 411 } 412 } else if(letterName == null) { 413 update = false; 414 } 415 416 if(update) { 417 this.letterName = letterName; 418 letterNameHasBeenModified = true; 419 clearHashAndString(); 420 } 421 } 422 423 public boolean getLetterNameHasBeenModified() { 424 return letterNameHasBeenModified; 425 } 426 427 @Nonnull 428 public LetterSourcePK getLetterSourcePK() { 429 return letterSourcePK; 430 } 431 432 public void setLetterSourcePK(@Nonnull LetterSourcePK letterSourcePK) 433 throws PersistenceNotNullException { 434 checkForNull(letterSourcePK); 435 436 boolean update = true; 437 438 if(this.letterSourcePK != null) { 439 if(this.letterSourcePK.equals(letterSourcePK)) { 440 update = false; 441 } 442 } else if(letterSourcePK == null) { 443 update = false; 444 } 445 446 if(update) { 447 this.letterSourcePK = letterSourcePK; 448 letterSourcePKHasBeenModified = true; 449 clearHashAndString(); 450 } 451 } 452 453 public boolean getLetterSourcePKHasBeenModified() { 454 return letterSourcePKHasBeenModified; 455 } 456 457 @Nullable 458 public ContactListPK getContactListPK() { 459 return contactListPK; 460 } 461 462 public void setContactListPK(@Nullable ContactListPK contactListPK) { 463 boolean update = true; 464 465 if(this.contactListPK != null) { 466 if(this.contactListPK.equals(contactListPK)) { 467 update = false; 468 } 469 } else if(contactListPK == null) { 470 update = false; 471 } 472 473 if(update) { 474 this.contactListPK = contactListPK; 475 contactListPKHasBeenModified = true; 476 clearHashAndString(); 477 } 478 } 479 480 public boolean getContactListPKHasBeenModified() { 481 return contactListPKHasBeenModified; 482 } 483 484 @Nonnull 485 public Boolean getIsDefault() { 486 return isDefault; 487 } 488 489 public void setIsDefault(@Nonnull Boolean isDefault) 490 throws PersistenceNotNullException { 491 checkForNull(isDefault); 492 493 boolean update = true; 494 495 if(this.isDefault != null) { 496 if(this.isDefault.equals(isDefault)) { 497 update = false; 498 } 499 } else if(isDefault == null) { 500 update = false; 501 } 502 503 if(update) { 504 this.isDefault = isDefault; 505 isDefaultHasBeenModified = true; 506 clearHashAndString(); 507 } 508 } 509 510 public boolean getIsDefaultHasBeenModified() { 511 return isDefaultHasBeenModified; 512 } 513 514 @Nonnull 515 public Integer getSortOrder() { 516 return sortOrder; 517 } 518 519 public void setSortOrder(@Nonnull Integer sortOrder) 520 throws PersistenceNotNullException { 521 checkForNull(sortOrder); 522 523 boolean update = true; 524 525 if(this.sortOrder != null) { 526 if(this.sortOrder.equals(sortOrder)) { 527 update = false; 528 } 529 } else if(sortOrder == null) { 530 update = false; 531 } 532 533 if(update) { 534 this.sortOrder = sortOrder; 535 sortOrderHasBeenModified = true; 536 clearHashAndString(); 537 } 538 } 539 540 public boolean getSortOrderHasBeenModified() { 541 return sortOrderHasBeenModified; 542 } 543 544 @Nonnull 545 public Long getFromTime() { 546 return fromTime; 547 } 548 549 public void setFromTime(@Nonnull Long fromTime) 550 throws PersistenceNotNullException { 551 checkForNull(fromTime); 552 553 boolean update = true; 554 555 if(this.fromTime != null) { 556 if(this.fromTime.equals(fromTime)) { 557 update = false; 558 } 559 } else if(fromTime == null) { 560 update = false; 561 } 562 563 if(update) { 564 this.fromTime = fromTime; 565 fromTimeHasBeenModified = true; 566 clearHashAndString(); 567 } 568 } 569 570 public boolean getFromTimeHasBeenModified() { 571 return fromTimeHasBeenModified; 572 } 573 574 @Nonnull 575 public Long getThruTime() { 576 return thruTime; 577 } 578 579 public void setThruTime(@Nonnull Long thruTime) 580 throws PersistenceNotNullException { 581 checkForNull(thruTime); 582 583 boolean update = true; 584 585 if(this.thruTime != null) { 586 if(this.thruTime.equals(thruTime)) { 587 update = false; 588 } 589 } else if(thruTime == null) { 590 update = false; 591 } 592 593 if(update) { 594 this.thruTime = thruTime; 595 thruTimeHasBeenModified = true; 596 clearHashAndString(); 597 } 598 } 599 600 public boolean getThruTimeHasBeenModified() { 601 return thruTimeHasBeenModified; 602 } 603 604}