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 * PostalAddressLineDetailValue.java 021 */ 022 023package com.echothree.model.data.contact.server.value; 024 025import com.echothree.model.data.contact.common.pk.PostalAddressLineDetailPK; 026 027import com.echothree.model.data.contact.server.factory.PostalAddressLineDetailFactory; 028 029import com.echothree.model.data.contact.common.pk.PostalAddressLinePK; 030import com.echothree.model.data.contact.common.pk.PostalAddressFormatPK; 031 032import com.echothree.util.common.exception.PersistenceCloneException; 033import com.echothree.util.common.exception.PersistenceNotNullException; 034 035import com.echothree.util.server.persistence.BaseValue; 036 037import java.io.Serializable; 038 039public class PostalAddressLineDetailValue 040 extends BaseValue<PostalAddressLineDetailPK> 041 implements Cloneable, Serializable { 042 043 private PostalAddressLinePK postalAddressLinePK; 044 private boolean postalAddressLinePKHasBeenModified = false; 045 private PostalAddressFormatPK postalAddressFormatPK; 046 private boolean postalAddressFormatPKHasBeenModified = false; 047 private Integer postalAddressLineSortOrder; 048 private boolean postalAddressLineSortOrderHasBeenModified = false; 049 private String prefix; 050 private boolean prefixHasBeenModified = false; 051 private Boolean alwaysIncludePrefix; 052 private boolean alwaysIncludePrefixHasBeenModified = false; 053 private String suffix; 054 private boolean suffixHasBeenModified = false; 055 private Boolean alwaysIncludeSuffix; 056 private boolean alwaysIncludeSuffixHasBeenModified = false; 057 private Boolean collapseIfEmpty; 058 private boolean collapseIfEmptyHasBeenModified = 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(PostalAddressLinePK postalAddressLinePK, PostalAddressFormatPK postalAddressFormatPK, Integer postalAddressLineSortOrder, String prefix, Boolean alwaysIncludePrefix, String suffix, Boolean alwaysIncludeSuffix, Boolean collapseIfEmpty, Long fromTime, Long thruTime) 068 throws PersistenceNotNullException { 069 checkForNull(postalAddressLinePK); 070 this.postalAddressLinePK = postalAddressLinePK; 071 checkForNull(postalAddressFormatPK); 072 this.postalAddressFormatPK = postalAddressFormatPK; 073 checkForNull(postalAddressLineSortOrder); 074 this.postalAddressLineSortOrder = postalAddressLineSortOrder; 075 this.prefix = prefix; 076 checkForNull(alwaysIncludePrefix); 077 this.alwaysIncludePrefix = alwaysIncludePrefix; 078 this.suffix = suffix; 079 checkForNull(alwaysIncludeSuffix); 080 this.alwaysIncludeSuffix = alwaysIncludeSuffix; 081 checkForNull(collapseIfEmpty); 082 this.collapseIfEmpty = collapseIfEmpty; 083 checkForNull(fromTime); 084 this.fromTime = fromTime; 085 checkForNull(thruTime); 086 this.thruTime = thruTime; 087 } 088 089 /** Creates a new instance of PostalAddressLineDetailValue */ 090 public PostalAddressLineDetailValue(PostalAddressLineDetailPK postalAddressLineDetailPK, PostalAddressLinePK postalAddressLinePK, PostalAddressFormatPK postalAddressFormatPK, Integer postalAddressLineSortOrder, String prefix, Boolean alwaysIncludePrefix, String suffix, Boolean alwaysIncludeSuffix, Boolean collapseIfEmpty, Long fromTime, Long thruTime) 091 throws PersistenceNotNullException { 092 super(postalAddressLineDetailPK); 093 constructFields(postalAddressLinePK, postalAddressFormatPK, postalAddressLineSortOrder, prefix, alwaysIncludePrefix, suffix, alwaysIncludeSuffix, collapseIfEmpty, fromTime, thruTime); 094 } 095 096 /** Creates a new instance of PostalAddressLineDetailValue */ 097 public PostalAddressLineDetailValue(PostalAddressLinePK postalAddressLinePK, PostalAddressFormatPK postalAddressFormatPK, Integer postalAddressLineSortOrder, String prefix, Boolean alwaysIncludePrefix, String suffix, Boolean alwaysIncludeSuffix, Boolean collapseIfEmpty, Long fromTime, Long thruTime) 098 throws PersistenceNotNullException { 099 super(); 100 constructFields(postalAddressLinePK, postalAddressFormatPK, postalAddressLineSortOrder, prefix, alwaysIncludePrefix, suffix, alwaysIncludeSuffix, collapseIfEmpty, fromTime, thruTime); 101 } 102 103 @Override 104 public PostalAddressLineDetailFactory getBaseFactoryInstance() { 105 return PostalAddressLineDetailFactory.getInstance(); 106 } 107 108 @Override 109 public PostalAddressLineDetailValue clone() { 110 Object result; 111 112 try { 113 result = super.clone(); 114 } catch (CloneNotSupportedException cnse) { 115 // This shouldn't happen, fail when it does. 116 throw new PersistenceCloneException(cnse); 117 } 118 119 return (PostalAddressLineDetailValue)result; 120 } 121 122 @Override 123 public PostalAddressLineDetailPK getPrimaryKey() { 124 if(_primaryKey == null) { 125 _primaryKey = new PostalAddressLineDetailPK(entityId); 126 } 127 128 return _primaryKey; 129 } 130 131 private void clearHashAndString() { 132 _hashCode = null; 133 _stringValue = null; 134 } 135 136 @Override 137 public int hashCode() { 138 if(_hashCode == null) { 139 int hashCode = 17; 140 141 hashCode = 37 * hashCode + ((entityId != null) ? entityId.hashCode() : 0); 142 143 hashCode = 37 * hashCode + ((postalAddressLinePK != null) ? postalAddressLinePK.hashCode() : 0); 144 hashCode = 37 * hashCode + ((postalAddressFormatPK != null) ? postalAddressFormatPK.hashCode() : 0); 145 hashCode = 37 * hashCode + ((postalAddressLineSortOrder != null) ? postalAddressLineSortOrder.hashCode() : 0); 146 hashCode = 37 * hashCode + ((prefix != null) ? prefix.hashCode() : 0); 147 hashCode = 37 * hashCode + ((alwaysIncludePrefix != null) ? alwaysIncludePrefix.hashCode() : 0); 148 hashCode = 37 * hashCode + ((suffix != null) ? suffix.hashCode() : 0); 149 hashCode = 37 * hashCode + ((alwaysIncludeSuffix != null) ? alwaysIncludeSuffix.hashCode() : 0); 150 hashCode = 37 * hashCode + ((collapseIfEmpty != null) ? collapseIfEmpty.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 _stringValue = "{" + 164 "entityId=" + getEntityId() + 165 ", postalAddressLinePK=" + getPostalAddressLinePK() + 166 ", postalAddressFormatPK=" + getPostalAddressFormatPK() + 167 ", postalAddressLineSortOrder=" + getPostalAddressLineSortOrder() + 168 ", prefix=" + getPrefix() + 169 ", alwaysIncludePrefix=" + getAlwaysIncludePrefix() + 170 ", suffix=" + getSuffix() + 171 ", alwaysIncludeSuffix=" + getAlwaysIncludeSuffix() + 172 ", collapseIfEmpty=" + getCollapseIfEmpty() + 173 ", fromTime=" + getFromTime() + 174 ", thruTime=" + getThruTime() + 175 "}"; 176 } 177 return _stringValue; 178 } 179 180 @Override 181 public boolean equals(Object other) { 182 if(this == other) 183 return true; 184 185 if(!hasIdentity()) 186 return false; 187 188 if(other instanceof PostalAddressLineDetailValue that) { 189 if(!that.hasIdentity()) 190 return false; 191 192 Long thisEntityId = getEntityId(); 193 Long thatEntityId = that.getEntityId(); 194 195 boolean objectsEqual = thisEntityId.equals(thatEntityId); 196 if(objectsEqual) 197 objectsEqual = isIdentical(that); 198 199 return objectsEqual; 200 } else { 201 return false; 202 } 203 } 204 205 public boolean isIdentical(Object other) { 206 if(other instanceof PostalAddressLineDetailValue that) { 207 boolean objectsEqual = true; 208 209 210 if(objectsEqual) { 211 PostalAddressLinePK thisPostalAddressLinePK = getPostalAddressLinePK(); 212 PostalAddressLinePK thatPostalAddressLinePK = that.getPostalAddressLinePK(); 213 214 if(thisPostalAddressLinePK == null) { 215 objectsEqual = objectsEqual && (thatPostalAddressLinePK == null); 216 } else { 217 objectsEqual = objectsEqual && thisPostalAddressLinePK.equals(thatPostalAddressLinePK); 218 } 219 } 220 221 if(objectsEqual) { 222 PostalAddressFormatPK thisPostalAddressFormatPK = getPostalAddressFormatPK(); 223 PostalAddressFormatPK thatPostalAddressFormatPK = that.getPostalAddressFormatPK(); 224 225 if(thisPostalAddressFormatPK == null) { 226 objectsEqual = objectsEqual && (thatPostalAddressFormatPK == null); 227 } else { 228 objectsEqual = objectsEqual && thisPostalAddressFormatPK.equals(thatPostalAddressFormatPK); 229 } 230 } 231 232 if(objectsEqual) { 233 Integer thisPostalAddressLineSortOrder = getPostalAddressLineSortOrder(); 234 Integer thatPostalAddressLineSortOrder = that.getPostalAddressLineSortOrder(); 235 236 if(thisPostalAddressLineSortOrder == null) { 237 objectsEqual = objectsEqual && (thatPostalAddressLineSortOrder == null); 238 } else { 239 objectsEqual = objectsEqual && thisPostalAddressLineSortOrder.equals(thatPostalAddressLineSortOrder); 240 } 241 } 242 243 if(objectsEqual) { 244 String thisPrefix = getPrefix(); 245 String thatPrefix = that.getPrefix(); 246 247 if(thisPrefix == null) { 248 objectsEqual = objectsEqual && (thatPrefix == null); 249 } else { 250 objectsEqual = objectsEqual && thisPrefix.equals(thatPrefix); 251 } 252 } 253 254 if(objectsEqual) { 255 Boolean thisAlwaysIncludePrefix = getAlwaysIncludePrefix(); 256 Boolean thatAlwaysIncludePrefix = that.getAlwaysIncludePrefix(); 257 258 if(thisAlwaysIncludePrefix == null) { 259 objectsEqual = objectsEqual && (thatAlwaysIncludePrefix == null); 260 } else { 261 objectsEqual = objectsEqual && thisAlwaysIncludePrefix.equals(thatAlwaysIncludePrefix); 262 } 263 } 264 265 if(objectsEqual) { 266 String thisSuffix = getSuffix(); 267 String thatSuffix = that.getSuffix(); 268 269 if(thisSuffix == null) { 270 objectsEqual = objectsEqual && (thatSuffix == null); 271 } else { 272 objectsEqual = objectsEqual && thisSuffix.equals(thatSuffix); 273 } 274 } 275 276 if(objectsEqual) { 277 Boolean thisAlwaysIncludeSuffix = getAlwaysIncludeSuffix(); 278 Boolean thatAlwaysIncludeSuffix = that.getAlwaysIncludeSuffix(); 279 280 if(thisAlwaysIncludeSuffix == null) { 281 objectsEqual = objectsEqual && (thatAlwaysIncludeSuffix == null); 282 } else { 283 objectsEqual = objectsEqual && thisAlwaysIncludeSuffix.equals(thatAlwaysIncludeSuffix); 284 } 285 } 286 287 if(objectsEqual) { 288 Boolean thisCollapseIfEmpty = getCollapseIfEmpty(); 289 Boolean thatCollapseIfEmpty = that.getCollapseIfEmpty(); 290 291 if(thisCollapseIfEmpty == null) { 292 objectsEqual = objectsEqual && (thatCollapseIfEmpty == null); 293 } else { 294 objectsEqual = objectsEqual && thisCollapseIfEmpty.equals(thatCollapseIfEmpty); 295 } 296 } 297 298 if(objectsEqual) { 299 Long thisFromTime = getFromTime(); 300 Long thatFromTime = that.getFromTime(); 301 302 if(thisFromTime == null) { 303 objectsEqual = objectsEqual && (thatFromTime == null); 304 } else { 305 objectsEqual = objectsEqual && thisFromTime.equals(thatFromTime); 306 } 307 } 308 309 if(objectsEqual) { 310 Long thisThruTime = getThruTime(); 311 Long thatThruTime = that.getThruTime(); 312 313 if(thisThruTime == null) { 314 objectsEqual = objectsEqual && (thatThruTime == null); 315 } else { 316 objectsEqual = objectsEqual && thisThruTime.equals(thatThruTime); 317 } 318 } 319 320 return objectsEqual; 321 } else { 322 return false; 323 } 324 } 325 326 @Override 327 public boolean hasBeenModified() { 328 return postalAddressLinePKHasBeenModified || postalAddressFormatPKHasBeenModified || postalAddressLineSortOrderHasBeenModified || prefixHasBeenModified || alwaysIncludePrefixHasBeenModified || suffixHasBeenModified || alwaysIncludeSuffixHasBeenModified || collapseIfEmptyHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified; 329 } 330 331 @Override 332 public void clearHasBeenModified() { 333 postalAddressLinePKHasBeenModified = false; 334 postalAddressFormatPKHasBeenModified = false; 335 postalAddressLineSortOrderHasBeenModified = false; 336 prefixHasBeenModified = false; 337 alwaysIncludePrefixHasBeenModified = false; 338 suffixHasBeenModified = false; 339 alwaysIncludeSuffixHasBeenModified = false; 340 collapseIfEmptyHasBeenModified = false; 341 fromTimeHasBeenModified = false; 342 thruTimeHasBeenModified = false; 343 } 344 345 public PostalAddressLinePK getPostalAddressLinePK() { 346 return postalAddressLinePK; 347 } 348 349 public void setPostalAddressLinePK(PostalAddressLinePK postalAddressLinePK) 350 throws PersistenceNotNullException { 351 checkForNull(postalAddressLinePK); 352 353 boolean update = true; 354 355 if(this.postalAddressLinePK != null) { 356 if(this.postalAddressLinePK.equals(postalAddressLinePK)) { 357 update = false; 358 } 359 } else if(postalAddressLinePK == null) { 360 update = false; 361 } 362 363 if(update) { 364 this.postalAddressLinePK = postalAddressLinePK; 365 postalAddressLinePKHasBeenModified = true; 366 clearHashAndString(); 367 } 368 } 369 370 public boolean getPostalAddressLinePKHasBeenModified() { 371 return postalAddressLinePKHasBeenModified; 372 } 373 374 public PostalAddressFormatPK getPostalAddressFormatPK() { 375 return postalAddressFormatPK; 376 } 377 378 public void setPostalAddressFormatPK(PostalAddressFormatPK postalAddressFormatPK) 379 throws PersistenceNotNullException { 380 checkForNull(postalAddressFormatPK); 381 382 boolean update = true; 383 384 if(this.postalAddressFormatPK != null) { 385 if(this.postalAddressFormatPK.equals(postalAddressFormatPK)) { 386 update = false; 387 } 388 } else if(postalAddressFormatPK == null) { 389 update = false; 390 } 391 392 if(update) { 393 this.postalAddressFormatPK = postalAddressFormatPK; 394 postalAddressFormatPKHasBeenModified = true; 395 clearHashAndString(); 396 } 397 } 398 399 public boolean getPostalAddressFormatPKHasBeenModified() { 400 return postalAddressFormatPKHasBeenModified; 401 } 402 403 public Integer getPostalAddressLineSortOrder() { 404 return postalAddressLineSortOrder; 405 } 406 407 public void setPostalAddressLineSortOrder(Integer postalAddressLineSortOrder) 408 throws PersistenceNotNullException { 409 checkForNull(postalAddressLineSortOrder); 410 411 boolean update = true; 412 413 if(this.postalAddressLineSortOrder != null) { 414 if(this.postalAddressLineSortOrder.equals(postalAddressLineSortOrder)) { 415 update = false; 416 } 417 } else if(postalAddressLineSortOrder == null) { 418 update = false; 419 } 420 421 if(update) { 422 this.postalAddressLineSortOrder = postalAddressLineSortOrder; 423 postalAddressLineSortOrderHasBeenModified = true; 424 clearHashAndString(); 425 } 426 } 427 428 public boolean getPostalAddressLineSortOrderHasBeenModified() { 429 return postalAddressLineSortOrderHasBeenModified; 430 } 431 432 public String getPrefix() { 433 return prefix; 434 } 435 436 public void setPrefix(String prefix) { 437 boolean update = true; 438 439 if(this.prefix != null) { 440 if(this.prefix.equals(prefix)) { 441 update = false; 442 } 443 } else if(prefix == null) { 444 update = false; 445 } 446 447 if(update) { 448 this.prefix = prefix; 449 prefixHasBeenModified = true; 450 clearHashAndString(); 451 } 452 } 453 454 public boolean getPrefixHasBeenModified() { 455 return prefixHasBeenModified; 456 } 457 458 public Boolean getAlwaysIncludePrefix() { 459 return alwaysIncludePrefix; 460 } 461 462 public void setAlwaysIncludePrefix(Boolean alwaysIncludePrefix) 463 throws PersistenceNotNullException { 464 checkForNull(alwaysIncludePrefix); 465 466 boolean update = true; 467 468 if(this.alwaysIncludePrefix != null) { 469 if(this.alwaysIncludePrefix.equals(alwaysIncludePrefix)) { 470 update = false; 471 } 472 } else if(alwaysIncludePrefix == null) { 473 update = false; 474 } 475 476 if(update) { 477 this.alwaysIncludePrefix = alwaysIncludePrefix; 478 alwaysIncludePrefixHasBeenModified = true; 479 clearHashAndString(); 480 } 481 } 482 483 public boolean getAlwaysIncludePrefixHasBeenModified() { 484 return alwaysIncludePrefixHasBeenModified; 485 } 486 487 public String getSuffix() { 488 return suffix; 489 } 490 491 public void setSuffix(String suffix) { 492 boolean update = true; 493 494 if(this.suffix != null) { 495 if(this.suffix.equals(suffix)) { 496 update = false; 497 } 498 } else if(suffix == null) { 499 update = false; 500 } 501 502 if(update) { 503 this.suffix = suffix; 504 suffixHasBeenModified = true; 505 clearHashAndString(); 506 } 507 } 508 509 public boolean getSuffixHasBeenModified() { 510 return suffixHasBeenModified; 511 } 512 513 public Boolean getAlwaysIncludeSuffix() { 514 return alwaysIncludeSuffix; 515 } 516 517 public void setAlwaysIncludeSuffix(Boolean alwaysIncludeSuffix) 518 throws PersistenceNotNullException { 519 checkForNull(alwaysIncludeSuffix); 520 521 boolean update = true; 522 523 if(this.alwaysIncludeSuffix != null) { 524 if(this.alwaysIncludeSuffix.equals(alwaysIncludeSuffix)) { 525 update = false; 526 } 527 } else if(alwaysIncludeSuffix == null) { 528 update = false; 529 } 530 531 if(update) { 532 this.alwaysIncludeSuffix = alwaysIncludeSuffix; 533 alwaysIncludeSuffixHasBeenModified = true; 534 clearHashAndString(); 535 } 536 } 537 538 public boolean getAlwaysIncludeSuffixHasBeenModified() { 539 return alwaysIncludeSuffixHasBeenModified; 540 } 541 542 public Boolean getCollapseIfEmpty() { 543 return collapseIfEmpty; 544 } 545 546 public void setCollapseIfEmpty(Boolean collapseIfEmpty) 547 throws PersistenceNotNullException { 548 checkForNull(collapseIfEmpty); 549 550 boolean update = true; 551 552 if(this.collapseIfEmpty != null) { 553 if(this.collapseIfEmpty.equals(collapseIfEmpty)) { 554 update = false; 555 } 556 } else if(collapseIfEmpty == null) { 557 update = false; 558 } 559 560 if(update) { 561 this.collapseIfEmpty = collapseIfEmpty; 562 collapseIfEmptyHasBeenModified = true; 563 clearHashAndString(); 564 } 565 } 566 567 public boolean getCollapseIfEmptyHasBeenModified() { 568 return collapseIfEmptyHasBeenModified; 569 } 570 571 public Long getFromTime() { 572 return fromTime; 573 } 574 575 public void setFromTime(Long fromTime) 576 throws PersistenceNotNullException { 577 checkForNull(fromTime); 578 579 boolean update = true; 580 581 if(this.fromTime != null) { 582 if(this.fromTime.equals(fromTime)) { 583 update = false; 584 } 585 } else if(fromTime == null) { 586 update = false; 587 } 588 589 if(update) { 590 this.fromTime = fromTime; 591 fromTimeHasBeenModified = true; 592 clearHashAndString(); 593 } 594 } 595 596 public boolean getFromTimeHasBeenModified() { 597 return fromTimeHasBeenModified; 598 } 599 600 public Long getThruTime() { 601 return thruTime; 602 } 603 604 public void setThruTime(Long thruTime) 605 throws PersistenceNotNullException { 606 checkForNull(thruTime); 607 608 boolean update = true; 609 610 if(this.thruTime != null) { 611 if(this.thruTime.equals(thruTime)) { 612 update = false; 613 } 614 } else if(thruTime == null) { 615 update = false; 616 } 617 618 if(update) { 619 this.thruTime = thruTime; 620 thruTimeHasBeenModified = true; 621 clearHashAndString(); 622 } 623 } 624 625 public boolean getThruTimeHasBeenModified() { 626 return thruTimeHasBeenModified; 627 } 628 629}