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