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