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 * 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 StringBuilder stringValue = new StringBuilder("{"); 164 165 stringValue.append("entityId=").append(getEntityId()); 166 167 stringValue.append(", postalAddressLinePK=").append(getPostalAddressLinePK()); 168 stringValue.append(", postalAddressFormatPK=").append(getPostalAddressFormatPK()); 169 stringValue.append(", postalAddressLineSortOrder=").append(getPostalAddressLineSortOrder()); 170 stringValue.append(", prefix=").append(getPrefix()); 171 stringValue.append(", alwaysIncludePrefix=").append(getAlwaysIncludePrefix()); 172 stringValue.append(", suffix=").append(getSuffix()); 173 stringValue.append(", alwaysIncludeSuffix=").append(getAlwaysIncludeSuffix()); 174 stringValue.append(", collapseIfEmpty=").append(getCollapseIfEmpty()); 175 stringValue.append(", fromTime=").append(getFromTime()); 176 stringValue.append(", thruTime=").append(getThruTime()); 177 178 stringValue.append('}'); 179 180 _stringValue = stringValue.toString(); 181 } 182 return _stringValue; 183 } 184 185 @Override 186 public boolean equals(Object other) { 187 if(this == other) 188 return true; 189 190 if(!hasIdentity()) 191 return false; 192 193 if(other instanceof PostalAddressLineDetailValue) { 194 PostalAddressLineDetailValue that = (PostalAddressLineDetailValue)other; 195 196 if(!that.hasIdentity()) 197 return false; 198 199 Long thisEntityId = getEntityId(); 200 Long thatEntityId = that.getEntityId(); 201 202 boolean objectsEqual = thisEntityId.equals(thatEntityId); 203 if(objectsEqual) 204 objectsEqual = objectsEqual && isIdentical(that); 205 206 return objectsEqual; 207 } else { 208 return false; 209 } 210 } 211 212 public boolean isIdentical(Object other) { 213 if(other instanceof PostalAddressLineDetailValue) { 214 PostalAddressLineDetailValue that = (PostalAddressLineDetailValue)other; 215 boolean objectsEqual = true; 216 217 218 if(objectsEqual) { 219 PostalAddressLinePK thisPostalAddressLinePK = getPostalAddressLinePK(); 220 PostalAddressLinePK thatPostalAddressLinePK = that.getPostalAddressLinePK(); 221 222 if(thisPostalAddressLinePK == null) { 223 objectsEqual = objectsEqual && (thatPostalAddressLinePK == null); 224 } else { 225 objectsEqual = objectsEqual && thisPostalAddressLinePK.equals(thatPostalAddressLinePK); 226 } 227 } 228 229 if(objectsEqual) { 230 PostalAddressFormatPK thisPostalAddressFormatPK = getPostalAddressFormatPK(); 231 PostalAddressFormatPK thatPostalAddressFormatPK = that.getPostalAddressFormatPK(); 232 233 if(thisPostalAddressFormatPK == null) { 234 objectsEqual = objectsEqual && (thatPostalAddressFormatPK == null); 235 } else { 236 objectsEqual = objectsEqual && thisPostalAddressFormatPK.equals(thatPostalAddressFormatPK); 237 } 238 } 239 240 if(objectsEqual) { 241 Integer thisPostalAddressLineSortOrder = getPostalAddressLineSortOrder(); 242 Integer thatPostalAddressLineSortOrder = that.getPostalAddressLineSortOrder(); 243 244 if(thisPostalAddressLineSortOrder == null) { 245 objectsEqual = objectsEqual && (thatPostalAddressLineSortOrder == null); 246 } else { 247 objectsEqual = objectsEqual && thisPostalAddressLineSortOrder.equals(thatPostalAddressLineSortOrder); 248 } 249 } 250 251 if(objectsEqual) { 252 String thisPrefix = getPrefix(); 253 String thatPrefix = that.getPrefix(); 254 255 if(thisPrefix == null) { 256 objectsEqual = objectsEqual && (thatPrefix == null); 257 } else { 258 objectsEqual = objectsEqual && thisPrefix.equals(thatPrefix); 259 } 260 } 261 262 if(objectsEqual) { 263 Boolean thisAlwaysIncludePrefix = getAlwaysIncludePrefix(); 264 Boolean thatAlwaysIncludePrefix = that.getAlwaysIncludePrefix(); 265 266 if(thisAlwaysIncludePrefix == null) { 267 objectsEqual = objectsEqual && (thatAlwaysIncludePrefix == null); 268 } else { 269 objectsEqual = objectsEqual && thisAlwaysIncludePrefix.equals(thatAlwaysIncludePrefix); 270 } 271 } 272 273 if(objectsEqual) { 274 String thisSuffix = getSuffix(); 275 String thatSuffix = that.getSuffix(); 276 277 if(thisSuffix == null) { 278 objectsEqual = objectsEqual && (thatSuffix == null); 279 } else { 280 objectsEqual = objectsEqual && thisSuffix.equals(thatSuffix); 281 } 282 } 283 284 if(objectsEqual) { 285 Boolean thisAlwaysIncludeSuffix = getAlwaysIncludeSuffix(); 286 Boolean thatAlwaysIncludeSuffix = that.getAlwaysIncludeSuffix(); 287 288 if(thisAlwaysIncludeSuffix == null) { 289 objectsEqual = objectsEqual && (thatAlwaysIncludeSuffix == null); 290 } else { 291 objectsEqual = objectsEqual && thisAlwaysIncludeSuffix.equals(thatAlwaysIncludeSuffix); 292 } 293 } 294 295 if(objectsEqual) { 296 Boolean thisCollapseIfEmpty = getCollapseIfEmpty(); 297 Boolean thatCollapseIfEmpty = that.getCollapseIfEmpty(); 298 299 if(thisCollapseIfEmpty == null) { 300 objectsEqual = objectsEqual && (thatCollapseIfEmpty == null); 301 } else { 302 objectsEqual = objectsEqual && thisCollapseIfEmpty.equals(thatCollapseIfEmpty); 303 } 304 } 305 306 if(objectsEqual) { 307 Long thisFromTime = getFromTime(); 308 Long thatFromTime = that.getFromTime(); 309 310 if(thisFromTime == null) { 311 objectsEqual = objectsEqual && (thatFromTime == null); 312 } else { 313 objectsEqual = objectsEqual && thisFromTime.equals(thatFromTime); 314 } 315 } 316 317 if(objectsEqual) { 318 Long thisThruTime = getThruTime(); 319 Long thatThruTime = that.getThruTime(); 320 321 if(thisThruTime == null) { 322 objectsEqual = objectsEqual && (thatThruTime == null); 323 } else { 324 objectsEqual = objectsEqual && thisThruTime.equals(thatThruTime); 325 } 326 } 327 328 return objectsEqual; 329 } else { 330 return false; 331 } 332 } 333 334 @Override 335 public boolean hasBeenModified() { 336 return postalAddressLinePKHasBeenModified || postalAddressFormatPKHasBeenModified || postalAddressLineSortOrderHasBeenModified || prefixHasBeenModified || alwaysIncludePrefixHasBeenModified || suffixHasBeenModified || alwaysIncludeSuffixHasBeenModified || collapseIfEmptyHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified; 337 } 338 339 @Override 340 public void clearHasBeenModified() { 341 postalAddressLinePKHasBeenModified = false; 342 postalAddressFormatPKHasBeenModified = false; 343 postalAddressLineSortOrderHasBeenModified = false; 344 prefixHasBeenModified = false; 345 alwaysIncludePrefixHasBeenModified = false; 346 suffixHasBeenModified = false; 347 alwaysIncludeSuffixHasBeenModified = false; 348 collapseIfEmptyHasBeenModified = false; 349 fromTimeHasBeenModified = false; 350 thruTimeHasBeenModified = false; 351 } 352 353 public PostalAddressLinePK getPostalAddressLinePK() { 354 return postalAddressLinePK; 355 } 356 357 public void setPostalAddressLinePK(PostalAddressLinePK postalAddressLinePK) 358 throws PersistenceNotNullException { 359 checkForNull(postalAddressLinePK); 360 361 boolean update = true; 362 363 if(this.postalAddressLinePK != null) { 364 if(this.postalAddressLinePK.equals(postalAddressLinePK)) { 365 update = false; 366 } 367 } else if(postalAddressLinePK == null) { 368 update = false; 369 } 370 371 if(update) { 372 this.postalAddressLinePK = postalAddressLinePK; 373 postalAddressLinePKHasBeenModified = true; 374 clearHashAndString(); 375 } 376 } 377 378 public boolean getPostalAddressLinePKHasBeenModified() { 379 return postalAddressLinePKHasBeenModified; 380 } 381 382 public PostalAddressFormatPK getPostalAddressFormatPK() { 383 return postalAddressFormatPK; 384 } 385 386 public void setPostalAddressFormatPK(PostalAddressFormatPK postalAddressFormatPK) 387 throws PersistenceNotNullException { 388 checkForNull(postalAddressFormatPK); 389 390 boolean update = true; 391 392 if(this.postalAddressFormatPK != null) { 393 if(this.postalAddressFormatPK.equals(postalAddressFormatPK)) { 394 update = false; 395 } 396 } else if(postalAddressFormatPK == null) { 397 update = false; 398 } 399 400 if(update) { 401 this.postalAddressFormatPK = postalAddressFormatPK; 402 postalAddressFormatPKHasBeenModified = true; 403 clearHashAndString(); 404 } 405 } 406 407 public boolean getPostalAddressFormatPKHasBeenModified() { 408 return postalAddressFormatPKHasBeenModified; 409 } 410 411 public Integer getPostalAddressLineSortOrder() { 412 return postalAddressLineSortOrder; 413 } 414 415 public void setPostalAddressLineSortOrder(Integer postalAddressLineSortOrder) 416 throws PersistenceNotNullException { 417 checkForNull(postalAddressLineSortOrder); 418 419 boolean update = true; 420 421 if(this.postalAddressLineSortOrder != null) { 422 if(this.postalAddressLineSortOrder.equals(postalAddressLineSortOrder)) { 423 update = false; 424 } 425 } else if(postalAddressLineSortOrder == null) { 426 update = false; 427 } 428 429 if(update) { 430 this.postalAddressLineSortOrder = postalAddressLineSortOrder; 431 postalAddressLineSortOrderHasBeenModified = true; 432 clearHashAndString(); 433 } 434 } 435 436 public boolean getPostalAddressLineSortOrderHasBeenModified() { 437 return postalAddressLineSortOrderHasBeenModified; 438 } 439 440 public String getPrefix() { 441 return prefix; 442 } 443 444 public void setPrefix(String prefix) { 445 boolean update = true; 446 447 if(this.prefix != null) { 448 if(this.prefix.equals(prefix)) { 449 update = false; 450 } 451 } else if(prefix == null) { 452 update = false; 453 } 454 455 if(update) { 456 this.prefix = prefix; 457 prefixHasBeenModified = true; 458 clearHashAndString(); 459 } 460 } 461 462 public boolean getPrefixHasBeenModified() { 463 return prefixHasBeenModified; 464 } 465 466 public Boolean getAlwaysIncludePrefix() { 467 return alwaysIncludePrefix; 468 } 469 470 public void setAlwaysIncludePrefix(Boolean alwaysIncludePrefix) 471 throws PersistenceNotNullException { 472 checkForNull(alwaysIncludePrefix); 473 474 boolean update = true; 475 476 if(this.alwaysIncludePrefix != null) { 477 if(this.alwaysIncludePrefix.equals(alwaysIncludePrefix)) { 478 update = false; 479 } 480 } else if(alwaysIncludePrefix == null) { 481 update = false; 482 } 483 484 if(update) { 485 this.alwaysIncludePrefix = alwaysIncludePrefix; 486 alwaysIncludePrefixHasBeenModified = true; 487 clearHashAndString(); 488 } 489 } 490 491 public boolean getAlwaysIncludePrefixHasBeenModified() { 492 return alwaysIncludePrefixHasBeenModified; 493 } 494 495 public String getSuffix() { 496 return suffix; 497 } 498 499 public void setSuffix(String suffix) { 500 boolean update = true; 501 502 if(this.suffix != null) { 503 if(this.suffix.equals(suffix)) { 504 update = false; 505 } 506 } else if(suffix == null) { 507 update = false; 508 } 509 510 if(update) { 511 this.suffix = suffix; 512 suffixHasBeenModified = true; 513 clearHashAndString(); 514 } 515 } 516 517 public boolean getSuffixHasBeenModified() { 518 return suffixHasBeenModified; 519 } 520 521 public Boolean getAlwaysIncludeSuffix() { 522 return alwaysIncludeSuffix; 523 } 524 525 public void setAlwaysIncludeSuffix(Boolean alwaysIncludeSuffix) 526 throws PersistenceNotNullException { 527 checkForNull(alwaysIncludeSuffix); 528 529 boolean update = true; 530 531 if(this.alwaysIncludeSuffix != null) { 532 if(this.alwaysIncludeSuffix.equals(alwaysIncludeSuffix)) { 533 update = false; 534 } 535 } else if(alwaysIncludeSuffix == null) { 536 update = false; 537 } 538 539 if(update) { 540 this.alwaysIncludeSuffix = alwaysIncludeSuffix; 541 alwaysIncludeSuffixHasBeenModified = true; 542 clearHashAndString(); 543 } 544 } 545 546 public boolean getAlwaysIncludeSuffixHasBeenModified() { 547 return alwaysIncludeSuffixHasBeenModified; 548 } 549 550 public Boolean getCollapseIfEmpty() { 551 return collapseIfEmpty; 552 } 553 554 public void setCollapseIfEmpty(Boolean collapseIfEmpty) 555 throws PersistenceNotNullException { 556 checkForNull(collapseIfEmpty); 557 558 boolean update = true; 559 560 if(this.collapseIfEmpty != null) { 561 if(this.collapseIfEmpty.equals(collapseIfEmpty)) { 562 update = false; 563 } 564 } else if(collapseIfEmpty == null) { 565 update = false; 566 } 567 568 if(update) { 569 this.collapseIfEmpty = collapseIfEmpty; 570 collapseIfEmptyHasBeenModified = true; 571 clearHashAndString(); 572 } 573 } 574 575 public boolean getCollapseIfEmptyHasBeenModified() { 576 return collapseIfEmptyHasBeenModified; 577 } 578 579 public Long getFromTime() { 580 return fromTime; 581 } 582 583 public void setFromTime(Long fromTime) 584 throws PersistenceNotNullException { 585 checkForNull(fromTime); 586 587 boolean update = true; 588 589 if(this.fromTime != null) { 590 if(this.fromTime.equals(fromTime)) { 591 update = false; 592 } 593 } else if(fromTime == null) { 594 update = false; 595 } 596 597 if(update) { 598 this.fromTime = fromTime; 599 fromTimeHasBeenModified = true; 600 clearHashAndString(); 601 } 602 } 603 604 public boolean getFromTimeHasBeenModified() { 605 return fromTimeHasBeenModified; 606 } 607 608 public Long getThruTime() { 609 return thruTime; 610 } 611 612 public void setThruTime(Long thruTime) 613 throws PersistenceNotNullException { 614 checkForNull(thruTime); 615 616 boolean update = true; 617 618 if(this.thruTime != null) { 619 if(this.thruTime.equals(thruTime)) { 620 update = false; 621 } 622 } else if(thruTime == null) { 623 update = false; 624 } 625 626 if(update) { 627 this.thruTime = thruTime; 628 thruTimeHasBeenModified = true; 629 clearHashAndString(); 630 } 631 } 632 633 public boolean getThruTimeHasBeenModified() { 634 return thruTimeHasBeenModified; 635 } 636 637}