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 * 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 StringBuilder stringValue = new StringBuilder("{"); 162 163 stringValue.append("entityId=").append(getEntityId()); 164 165 stringValue.append(", letterPK=").append(getLetterPK()); 166 stringValue.append(", chainTypePK=").append(getChainTypePK()); 167 stringValue.append(", letterName=").append(getLetterName()); 168 stringValue.append(", letterSourcePK=").append(getLetterSourcePK()); 169 stringValue.append(", contactListPK=").append(getContactListPK()); 170 stringValue.append(", isDefault=").append(getIsDefault()); 171 stringValue.append(", sortOrder=").append(getSortOrder()); 172 stringValue.append(", fromTime=").append(getFromTime()); 173 stringValue.append(", thruTime=").append(getThruTime()); 174 175 stringValue.append('}'); 176 177 _stringValue = stringValue.toString(); 178 } 179 return _stringValue; 180 } 181 182 @Override 183 public boolean equals(Object other) { 184 if(this == other) 185 return true; 186 187 if(!hasIdentity()) 188 return false; 189 190 if(other instanceof LetterDetailValue) { 191 LetterDetailValue that = (LetterDetailValue)other; 192 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 = 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) { 211 LetterDetailValue that = (LetterDetailValue)other; 212 boolean objectsEqual = true; 213 214 215 if(objectsEqual) { 216 LetterPK thisLetterPK = getLetterPK(); 217 LetterPK thatLetterPK = that.getLetterPK(); 218 219 if(thisLetterPK == null) { 220 objectsEqual = objectsEqual && (thatLetterPK == null); 221 } else { 222 objectsEqual = objectsEqual && thisLetterPK.equals(thatLetterPK); 223 } 224 } 225 226 if(objectsEqual) { 227 ChainTypePK thisChainTypePK = getChainTypePK(); 228 ChainTypePK thatChainTypePK = that.getChainTypePK(); 229 230 if(thisChainTypePK == null) { 231 objectsEqual = objectsEqual && (thatChainTypePK == null); 232 } else { 233 objectsEqual = objectsEqual && thisChainTypePK.equals(thatChainTypePK); 234 } 235 } 236 237 if(objectsEqual) { 238 String thisLetterName = getLetterName(); 239 String thatLetterName = that.getLetterName(); 240 241 if(thisLetterName == null) { 242 objectsEqual = objectsEqual && (thatLetterName == null); 243 } else { 244 objectsEqual = objectsEqual && thisLetterName.equals(thatLetterName); 245 } 246 } 247 248 if(objectsEqual) { 249 LetterSourcePK thisLetterSourcePK = getLetterSourcePK(); 250 LetterSourcePK thatLetterSourcePK = that.getLetterSourcePK(); 251 252 if(thisLetterSourcePK == null) { 253 objectsEqual = objectsEqual && (thatLetterSourcePK == null); 254 } else { 255 objectsEqual = objectsEqual && thisLetterSourcePK.equals(thatLetterSourcePK); 256 } 257 } 258 259 if(objectsEqual) { 260 ContactListPK thisContactListPK = getContactListPK(); 261 ContactListPK thatContactListPK = that.getContactListPK(); 262 263 if(thisContactListPK == null) { 264 objectsEqual = objectsEqual && (thatContactListPK == null); 265 } else { 266 objectsEqual = objectsEqual && thisContactListPK.equals(thatContactListPK); 267 } 268 } 269 270 if(objectsEqual) { 271 Boolean thisIsDefault = getIsDefault(); 272 Boolean thatIsDefault = that.getIsDefault(); 273 274 if(thisIsDefault == null) { 275 objectsEqual = objectsEqual && (thatIsDefault == null); 276 } else { 277 objectsEqual = objectsEqual && thisIsDefault.equals(thatIsDefault); 278 } 279 } 280 281 if(objectsEqual) { 282 Integer thisSortOrder = getSortOrder(); 283 Integer thatSortOrder = that.getSortOrder(); 284 285 if(thisSortOrder == null) { 286 objectsEqual = objectsEqual && (thatSortOrder == null); 287 } else { 288 objectsEqual = objectsEqual && thisSortOrder.equals(thatSortOrder); 289 } 290 } 291 292 if(objectsEqual) { 293 Long thisFromTime = getFromTime(); 294 Long thatFromTime = that.getFromTime(); 295 296 if(thisFromTime == null) { 297 objectsEqual = objectsEqual && (thatFromTime == null); 298 } else { 299 objectsEqual = objectsEqual && thisFromTime.equals(thatFromTime); 300 } 301 } 302 303 if(objectsEqual) { 304 Long thisThruTime = getThruTime(); 305 Long thatThruTime = that.getThruTime(); 306 307 if(thisThruTime == null) { 308 objectsEqual = objectsEqual && (thatThruTime == null); 309 } else { 310 objectsEqual = objectsEqual && thisThruTime.equals(thatThruTime); 311 } 312 } 313 314 return objectsEqual; 315 } else { 316 return false; 317 } 318 } 319 320 @Override 321 public boolean hasBeenModified() { 322 return letterPKHasBeenModified || chainTypePKHasBeenModified || letterNameHasBeenModified || letterSourcePKHasBeenModified || contactListPKHasBeenModified || isDefaultHasBeenModified || sortOrderHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified; 323 } 324 325 @Override 326 public void clearHasBeenModified() { 327 letterPKHasBeenModified = false; 328 chainTypePKHasBeenModified = false; 329 letterNameHasBeenModified = false; 330 letterSourcePKHasBeenModified = false; 331 contactListPKHasBeenModified = false; 332 isDefaultHasBeenModified = false; 333 sortOrderHasBeenModified = false; 334 fromTimeHasBeenModified = false; 335 thruTimeHasBeenModified = false; 336 } 337 338 public LetterPK getLetterPK() { 339 return letterPK; 340 } 341 342 public void setLetterPK(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 public ChainTypePK getChainTypePK() { 368 return chainTypePK; 369 } 370 371 public void setChainTypePK(ChainTypePK chainTypePK) 372 throws PersistenceNotNullException { 373 checkForNull(chainTypePK); 374 375 boolean update = true; 376 377 if(this.chainTypePK != null) { 378 if(this.chainTypePK.equals(chainTypePK)) { 379 update = false; 380 } 381 } else if(chainTypePK == null) { 382 update = false; 383 } 384 385 if(update) { 386 this.chainTypePK = chainTypePK; 387 chainTypePKHasBeenModified = true; 388 clearHashAndString(); 389 } 390 } 391 392 public boolean getChainTypePKHasBeenModified() { 393 return chainTypePKHasBeenModified; 394 } 395 396 public String getLetterName() { 397 return letterName; 398 } 399 400 public void setLetterName(String letterName) 401 throws PersistenceNotNullException { 402 checkForNull(letterName); 403 404 boolean update = true; 405 406 if(this.letterName != null) { 407 if(this.letterName.equals(letterName)) { 408 update = false; 409 } 410 } else if(letterName == null) { 411 update = false; 412 } 413 414 if(update) { 415 this.letterName = letterName; 416 letterNameHasBeenModified = true; 417 clearHashAndString(); 418 } 419 } 420 421 public boolean getLetterNameHasBeenModified() { 422 return letterNameHasBeenModified; 423 } 424 425 public LetterSourcePK getLetterSourcePK() { 426 return letterSourcePK; 427 } 428 429 public void setLetterSourcePK(LetterSourcePK letterSourcePK) 430 throws PersistenceNotNullException { 431 checkForNull(letterSourcePK); 432 433 boolean update = true; 434 435 if(this.letterSourcePK != null) { 436 if(this.letterSourcePK.equals(letterSourcePK)) { 437 update = false; 438 } 439 } else if(letterSourcePK == null) { 440 update = false; 441 } 442 443 if(update) { 444 this.letterSourcePK = letterSourcePK; 445 letterSourcePKHasBeenModified = true; 446 clearHashAndString(); 447 } 448 } 449 450 public boolean getLetterSourcePKHasBeenModified() { 451 return letterSourcePKHasBeenModified; 452 } 453 454 public ContactListPK getContactListPK() { 455 return contactListPK; 456 } 457 458 public void setContactListPK(ContactListPK contactListPK) { 459 boolean update = true; 460 461 if(this.contactListPK != null) { 462 if(this.contactListPK.equals(contactListPK)) { 463 update = false; 464 } 465 } else if(contactListPK == null) { 466 update = false; 467 } 468 469 if(update) { 470 this.contactListPK = contactListPK; 471 contactListPKHasBeenModified = true; 472 clearHashAndString(); 473 } 474 } 475 476 public boolean getContactListPKHasBeenModified() { 477 return contactListPKHasBeenModified; 478 } 479 480 public Boolean getIsDefault() { 481 return isDefault; 482 } 483 484 public void setIsDefault(Boolean isDefault) 485 throws PersistenceNotNullException { 486 checkForNull(isDefault); 487 488 boolean update = true; 489 490 if(this.isDefault != null) { 491 if(this.isDefault.equals(isDefault)) { 492 update = false; 493 } 494 } else if(isDefault == null) { 495 update = false; 496 } 497 498 if(update) { 499 this.isDefault = isDefault; 500 isDefaultHasBeenModified = true; 501 clearHashAndString(); 502 } 503 } 504 505 public boolean getIsDefaultHasBeenModified() { 506 return isDefaultHasBeenModified; 507 } 508 509 public Integer getSortOrder() { 510 return sortOrder; 511 } 512 513 public void setSortOrder(Integer sortOrder) 514 throws PersistenceNotNullException { 515 checkForNull(sortOrder); 516 517 boolean update = true; 518 519 if(this.sortOrder != null) { 520 if(this.sortOrder.equals(sortOrder)) { 521 update = false; 522 } 523 } else if(sortOrder == null) { 524 update = false; 525 } 526 527 if(update) { 528 this.sortOrder = sortOrder; 529 sortOrderHasBeenModified = true; 530 clearHashAndString(); 531 } 532 } 533 534 public boolean getSortOrderHasBeenModified() { 535 return sortOrderHasBeenModified; 536 } 537 538 public Long getFromTime() { 539 return fromTime; 540 } 541 542 public void setFromTime(Long fromTime) 543 throws PersistenceNotNullException { 544 checkForNull(fromTime); 545 546 boolean update = true; 547 548 if(this.fromTime != null) { 549 if(this.fromTime.equals(fromTime)) { 550 update = false; 551 } 552 } else if(fromTime == null) { 553 update = false; 554 } 555 556 if(update) { 557 this.fromTime = fromTime; 558 fromTimeHasBeenModified = true; 559 clearHashAndString(); 560 } 561 } 562 563 public boolean getFromTimeHasBeenModified() { 564 return fromTimeHasBeenModified; 565 } 566 567 public Long getThruTime() { 568 return thruTime; 569 } 570 571 public void setThruTime(Long thruTime) 572 throws PersistenceNotNullException { 573 checkForNull(thruTime); 574 575 boolean update = true; 576 577 if(this.thruTime != null) { 578 if(this.thruTime.equals(thruTime)) { 579 update = false; 580 } 581 } else if(thruTime == null) { 582 update = false; 583 } 584 585 if(update) { 586 this.thruTime = thruTime; 587 thruTimeHasBeenModified = true; 588 clearHashAndString(); 589 } 590 } 591 592 public boolean getThruTimeHasBeenModified() { 593 return thruTimeHasBeenModified; 594 } 595 596}