001// -------------------------------------------------------------------------------- 002// Copyright 2002-2026 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 * CarrierValue.java 021 */ 022 023package com.echothree.model.data.carrier.server.value; 024 025import com.echothree.model.data.carrier.common.pk.CarrierPK; 026 027import com.echothree.model.data.carrier.server.factory.CarrierFactory; 028 029import com.echothree.model.data.party.common.pk.PartyPK; 030import com.echothree.model.data.carrier.common.pk.CarrierTypePK; 031import com.echothree.model.data.selector.common.pk.SelectorPK; 032 033import com.echothree.util.common.exception.PersistenceCloneException; 034import com.echothree.util.common.exception.PersistenceNotNullException; 035 036import com.echothree.util.server.persistence.BaseValue; 037 038import java.io.Serializable; 039 040import javax.annotation.Nonnull; 041import javax.annotation.Nullable; 042 043public class CarrierValue 044 extends BaseValue<CarrierPK> 045 implements Cloneable, Serializable { 046 047 private PartyPK partyPK; 048 private boolean partyPKHasBeenModified = false; 049 private String carrierName; 050 private boolean carrierNameHasBeenModified = false; 051 private CarrierTypePK carrierTypePK; 052 private boolean carrierTypePKHasBeenModified = false; 053 private SelectorPK geoCodeSelectorPK; 054 private boolean geoCodeSelectorPKHasBeenModified = false; 055 private SelectorPK itemSelectorPK; 056 private boolean itemSelectorPKHasBeenModified = false; 057 private String accountValidationPattern; 058 private boolean accountValidationPatternHasBeenModified = false; 059 private Boolean isDefault; 060 private boolean isDefaultHasBeenModified = false; 061 private Integer sortOrder; 062 private boolean sortOrderHasBeenModified = false; 063 private Long fromTime; 064 private boolean fromTimeHasBeenModified = false; 065 private Long thruTime; 066 private boolean thruTimeHasBeenModified = false; 067 068 private transient Integer _hashCode = null; 069 private transient String _stringValue = null; 070 071 private void constructFields(PartyPK partyPK, String carrierName, CarrierTypePK carrierTypePK, SelectorPK geoCodeSelectorPK, SelectorPK itemSelectorPK, String accountValidationPattern, Boolean isDefault, Integer sortOrder, Long fromTime, Long thruTime) 072 throws PersistenceNotNullException { 073 checkForNull(partyPK); 074 this.partyPK = partyPK; 075 checkForNull(carrierName); 076 this.carrierName = carrierName; 077 checkForNull(carrierTypePK); 078 this.carrierTypePK = carrierTypePK; 079 this.geoCodeSelectorPK = geoCodeSelectorPK; 080 this.itemSelectorPK = itemSelectorPK; 081 this.accountValidationPattern = accountValidationPattern; 082 checkForNull(isDefault); 083 this.isDefault = isDefault; 084 checkForNull(sortOrder); 085 this.sortOrder = sortOrder; 086 checkForNull(fromTime); 087 this.fromTime = fromTime; 088 checkForNull(thruTime); 089 this.thruTime = thruTime; 090 } 091 092 /** Creates a new instance of CarrierValue */ 093 public CarrierValue(CarrierPK carrierPK, PartyPK partyPK, String carrierName, CarrierTypePK carrierTypePK, SelectorPK geoCodeSelectorPK, SelectorPK itemSelectorPK, String accountValidationPattern, Boolean isDefault, Integer sortOrder, Long fromTime, Long thruTime) 094 throws PersistenceNotNullException { 095 super(carrierPK); 096 constructFields(partyPK, carrierName, carrierTypePK, geoCodeSelectorPK, itemSelectorPK, accountValidationPattern, isDefault, sortOrder, fromTime, thruTime); 097 } 098 099 /** Creates a new instance of CarrierValue */ 100 public CarrierValue(PartyPK partyPK, String carrierName, CarrierTypePK carrierTypePK, SelectorPK geoCodeSelectorPK, SelectorPK itemSelectorPK, String accountValidationPattern, Boolean isDefault, Integer sortOrder, Long fromTime, Long thruTime) 101 throws PersistenceNotNullException { 102 super(); 103 constructFields(partyPK, carrierName, carrierTypePK, geoCodeSelectorPK, itemSelectorPK, accountValidationPattern, isDefault, sortOrder, fromTime, thruTime); 104 } 105 106 @Override 107 @Nonnull 108 public CarrierFactory getBaseFactoryInstance() { 109 return CarrierFactory.getInstance(); 110 } 111 112 @Override 113 @Nonnull 114 public CarrierValue clone() { 115 Object result; 116 117 try { 118 result = super.clone(); 119 } catch (CloneNotSupportedException cnse) { 120 // This shouldn't happen, fail when it does. 121 throw new PersistenceCloneException(cnse); 122 } 123 124 return (CarrierValue)result; 125 } 126 127 @Override 128 @Nonnull 129 public CarrierPK getPrimaryKey() { 130 if(_primaryKey == null) { 131 _primaryKey = new CarrierPK(entityId); 132 } 133 134 return _primaryKey; 135 } 136 137 private void clearHashAndString() { 138 _hashCode = null; 139 _stringValue = null; 140 } 141 142 @Override 143 public int hashCode() { 144 if(_hashCode == null) { 145 int hashCode = 17; 146 147 hashCode = 37 * hashCode + ((entityId != null) ? entityId.hashCode() : 0); 148 149 hashCode = 37 * hashCode + ((partyPK != null) ? partyPK.hashCode() : 0); 150 hashCode = 37 * hashCode + ((carrierName != null) ? carrierName.hashCode() : 0); 151 hashCode = 37 * hashCode + ((carrierTypePK != null) ? carrierTypePK.hashCode() : 0); 152 hashCode = 37 * hashCode + ((geoCodeSelectorPK != null) ? geoCodeSelectorPK.hashCode() : 0); 153 hashCode = 37 * hashCode + ((itemSelectorPK != null) ? itemSelectorPK.hashCode() : 0); 154 hashCode = 37 * hashCode + ((accountValidationPattern != null) ? accountValidationPattern.hashCode() : 0); 155 hashCode = 37 * hashCode + ((isDefault != null) ? isDefault.hashCode() : 0); 156 hashCode = 37 * hashCode + ((sortOrder != null) ? sortOrder.hashCode() : 0); 157 hashCode = 37 * hashCode + ((fromTime != null) ? fromTime.hashCode() : 0); 158 hashCode = 37 * hashCode + ((thruTime != null) ? thruTime.hashCode() : 0); 159 160 _hashCode = hashCode; 161 } 162 163 return _hashCode; 164 } 165 166 @Override 167 @Nonnull 168 public String toString() { 169 if(_stringValue == null) { 170 _stringValue = "{" + 171 "entityId=" + getEntityId() + 172 ", partyPK=" + getPartyPK() + 173 ", carrierName=" + getCarrierName() + 174 ", carrierTypePK=" + getCarrierTypePK() + 175 ", geoCodeSelectorPK=" + getGeoCodeSelectorPK() + 176 ", itemSelectorPK=" + getItemSelectorPK() + 177 ", accountValidationPattern=" + getAccountValidationPattern() + 178 ", isDefault=" + getIsDefault() + 179 ", sortOrder=" + getSortOrder() + 180 ", fromTime=" + getFromTime() + 181 ", thruTime=" + getThruTime() + 182 "}"; 183 } 184 return _stringValue; 185 } 186 187 @Override 188 public boolean equals(Object other) { 189 if(this == other) 190 return true; 191 192 if(!hasIdentity()) 193 return false; 194 195 if(other instanceof CarrierValue that) { 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 = isIdentical(that); 205 206 return objectsEqual; 207 } else { 208 return false; 209 } 210 } 211 212 public boolean isIdentical(Object other) { 213 if(other instanceof CarrierValue that) { 214 boolean objectsEqual = true; 215 216 217 if(objectsEqual) { 218 PartyPK thisPartyPK = getPartyPK(); 219 PartyPK thatPartyPK = that.getPartyPK(); 220 221 if(thisPartyPK == null) { 222 objectsEqual = objectsEqual && (thatPartyPK == null); 223 } else { 224 objectsEqual = objectsEqual && thisPartyPK.equals(thatPartyPK); 225 } 226 } 227 228 if(objectsEqual) { 229 String thisCarrierName = getCarrierName(); 230 String thatCarrierName = that.getCarrierName(); 231 232 if(thisCarrierName == null) { 233 objectsEqual = objectsEqual && (thatCarrierName == null); 234 } else { 235 objectsEqual = objectsEqual && thisCarrierName.equals(thatCarrierName); 236 } 237 } 238 239 if(objectsEqual) { 240 CarrierTypePK thisCarrierTypePK = getCarrierTypePK(); 241 CarrierTypePK thatCarrierTypePK = that.getCarrierTypePK(); 242 243 if(thisCarrierTypePK == null) { 244 objectsEqual = objectsEqual && (thatCarrierTypePK == null); 245 } else { 246 objectsEqual = objectsEqual && thisCarrierTypePK.equals(thatCarrierTypePK); 247 } 248 } 249 250 if(objectsEqual) { 251 SelectorPK thisGeoCodeSelectorPK = getGeoCodeSelectorPK(); 252 SelectorPK thatGeoCodeSelectorPK = that.getGeoCodeSelectorPK(); 253 254 if(thisGeoCodeSelectorPK == null) { 255 objectsEqual = objectsEqual && (thatGeoCodeSelectorPK == null); 256 } else { 257 objectsEqual = objectsEqual && thisGeoCodeSelectorPK.equals(thatGeoCodeSelectorPK); 258 } 259 } 260 261 if(objectsEqual) { 262 SelectorPK thisItemSelectorPK = getItemSelectorPK(); 263 SelectorPK thatItemSelectorPK = that.getItemSelectorPK(); 264 265 if(thisItemSelectorPK == null) { 266 objectsEqual = objectsEqual && (thatItemSelectorPK == null); 267 } else { 268 objectsEqual = objectsEqual && thisItemSelectorPK.equals(thatItemSelectorPK); 269 } 270 } 271 272 if(objectsEqual) { 273 String thisAccountValidationPattern = getAccountValidationPattern(); 274 String thatAccountValidationPattern = that.getAccountValidationPattern(); 275 276 if(thisAccountValidationPattern == null) { 277 objectsEqual = objectsEqual && (thatAccountValidationPattern == null); 278 } else { 279 objectsEqual = objectsEqual && thisAccountValidationPattern.equals(thatAccountValidationPattern); 280 } 281 } 282 283 if(objectsEqual) { 284 Boolean thisIsDefault = getIsDefault(); 285 Boolean thatIsDefault = that.getIsDefault(); 286 287 if(thisIsDefault == null) { 288 objectsEqual = objectsEqual && (thatIsDefault == null); 289 } else { 290 objectsEqual = objectsEqual && thisIsDefault.equals(thatIsDefault); 291 } 292 } 293 294 if(objectsEqual) { 295 Integer thisSortOrder = getSortOrder(); 296 Integer thatSortOrder = that.getSortOrder(); 297 298 if(thisSortOrder == null) { 299 objectsEqual = objectsEqual && (thatSortOrder == null); 300 } else { 301 objectsEqual = objectsEqual && thisSortOrder.equals(thatSortOrder); 302 } 303 } 304 305 if(objectsEqual) { 306 Long thisFromTime = getFromTime(); 307 Long thatFromTime = that.getFromTime(); 308 309 if(thisFromTime == null) { 310 objectsEqual = objectsEqual && (thatFromTime == null); 311 } else { 312 objectsEqual = objectsEqual && thisFromTime.equals(thatFromTime); 313 } 314 } 315 316 if(objectsEqual) { 317 Long thisThruTime = getThruTime(); 318 Long thatThruTime = that.getThruTime(); 319 320 if(thisThruTime == null) { 321 objectsEqual = objectsEqual && (thatThruTime == null); 322 } else { 323 objectsEqual = objectsEqual && thisThruTime.equals(thatThruTime); 324 } 325 } 326 327 return objectsEqual; 328 } else { 329 return false; 330 } 331 } 332 333 @Override 334 public boolean hasBeenModified() { 335 return partyPKHasBeenModified || carrierNameHasBeenModified || carrierTypePKHasBeenModified || geoCodeSelectorPKHasBeenModified || itemSelectorPKHasBeenModified || accountValidationPatternHasBeenModified || isDefaultHasBeenModified || sortOrderHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified; 336 } 337 338 @Override 339 public void clearHasBeenModified() { 340 partyPKHasBeenModified = false; 341 carrierNameHasBeenModified = false; 342 carrierTypePKHasBeenModified = false; 343 geoCodeSelectorPKHasBeenModified = false; 344 itemSelectorPKHasBeenModified = false; 345 accountValidationPatternHasBeenModified = false; 346 isDefaultHasBeenModified = false; 347 sortOrderHasBeenModified = false; 348 fromTimeHasBeenModified = false; 349 thruTimeHasBeenModified = false; 350 } 351 352 @Nonnull 353 public PartyPK getPartyPK() { 354 return partyPK; 355 } 356 357 public void setPartyPK(@Nonnull PartyPK partyPK) 358 throws PersistenceNotNullException { 359 checkForNull(partyPK); 360 361 boolean update = true; 362 363 if(this.partyPK != null) { 364 if(this.partyPK.equals(partyPK)) { 365 update = false; 366 } 367 } else if(partyPK == null) { 368 update = false; 369 } 370 371 if(update) { 372 this.partyPK = partyPK; 373 partyPKHasBeenModified = true; 374 clearHashAndString(); 375 } 376 } 377 378 public boolean getPartyPKHasBeenModified() { 379 return partyPKHasBeenModified; 380 } 381 382 @Nonnull 383 public String getCarrierName() { 384 return carrierName; 385 } 386 387 public void setCarrierName(@Nonnull String carrierName) 388 throws PersistenceNotNullException { 389 checkForNull(carrierName); 390 391 boolean update = true; 392 393 if(this.carrierName != null) { 394 if(this.carrierName.equals(carrierName)) { 395 update = false; 396 } 397 } else if(carrierName == null) { 398 update = false; 399 } 400 401 if(update) { 402 this.carrierName = carrierName; 403 carrierNameHasBeenModified = true; 404 clearHashAndString(); 405 } 406 } 407 408 public boolean getCarrierNameHasBeenModified() { 409 return carrierNameHasBeenModified; 410 } 411 412 @Nonnull 413 public CarrierTypePK getCarrierTypePK() { 414 return carrierTypePK; 415 } 416 417 public void setCarrierTypePK(@Nonnull CarrierTypePK carrierTypePK) 418 throws PersistenceNotNullException { 419 checkForNull(carrierTypePK); 420 421 boolean update = true; 422 423 if(this.carrierTypePK != null) { 424 if(this.carrierTypePK.equals(carrierTypePK)) { 425 update = false; 426 } 427 } else if(carrierTypePK == null) { 428 update = false; 429 } 430 431 if(update) { 432 this.carrierTypePK = carrierTypePK; 433 carrierTypePKHasBeenModified = true; 434 clearHashAndString(); 435 } 436 } 437 438 public boolean getCarrierTypePKHasBeenModified() { 439 return carrierTypePKHasBeenModified; 440 } 441 442 @Nullable 443 public SelectorPK getGeoCodeSelectorPK() { 444 return geoCodeSelectorPK; 445 } 446 447 public void setGeoCodeSelectorPK(@Nullable SelectorPK geoCodeSelectorPK) { 448 boolean update = true; 449 450 if(this.geoCodeSelectorPK != null) { 451 if(this.geoCodeSelectorPK.equals(geoCodeSelectorPK)) { 452 update = false; 453 } 454 } else if(geoCodeSelectorPK == null) { 455 update = false; 456 } 457 458 if(update) { 459 this.geoCodeSelectorPK = geoCodeSelectorPK; 460 geoCodeSelectorPKHasBeenModified = true; 461 clearHashAndString(); 462 } 463 } 464 465 public boolean getGeoCodeSelectorPKHasBeenModified() { 466 return geoCodeSelectorPKHasBeenModified; 467 } 468 469 @Nullable 470 public SelectorPK getItemSelectorPK() { 471 return itemSelectorPK; 472 } 473 474 public void setItemSelectorPK(@Nullable SelectorPK itemSelectorPK) { 475 boolean update = true; 476 477 if(this.itemSelectorPK != null) { 478 if(this.itemSelectorPK.equals(itemSelectorPK)) { 479 update = false; 480 } 481 } else if(itemSelectorPK == null) { 482 update = false; 483 } 484 485 if(update) { 486 this.itemSelectorPK = itemSelectorPK; 487 itemSelectorPKHasBeenModified = true; 488 clearHashAndString(); 489 } 490 } 491 492 public boolean getItemSelectorPKHasBeenModified() { 493 return itemSelectorPKHasBeenModified; 494 } 495 496 @Nullable 497 public String getAccountValidationPattern() { 498 return accountValidationPattern; 499 } 500 501 public void setAccountValidationPattern(@Nullable String accountValidationPattern) { 502 boolean update = true; 503 504 if(this.accountValidationPattern != null) { 505 if(this.accountValidationPattern.equals(accountValidationPattern)) { 506 update = false; 507 } 508 } else if(accountValidationPattern == null) { 509 update = false; 510 } 511 512 if(update) { 513 this.accountValidationPattern = accountValidationPattern; 514 accountValidationPatternHasBeenModified = true; 515 clearHashAndString(); 516 } 517 } 518 519 public boolean getAccountValidationPatternHasBeenModified() { 520 return accountValidationPatternHasBeenModified; 521 } 522 523 @Nonnull 524 public Boolean getIsDefault() { 525 return isDefault; 526 } 527 528 public void setIsDefault(@Nonnull Boolean isDefault) 529 throws PersistenceNotNullException { 530 checkForNull(isDefault); 531 532 boolean update = true; 533 534 if(this.isDefault != null) { 535 if(this.isDefault.equals(isDefault)) { 536 update = false; 537 } 538 } else if(isDefault == null) { 539 update = false; 540 } 541 542 if(update) { 543 this.isDefault = isDefault; 544 isDefaultHasBeenModified = true; 545 clearHashAndString(); 546 } 547 } 548 549 public boolean getIsDefaultHasBeenModified() { 550 return isDefaultHasBeenModified; 551 } 552 553 @Nonnull 554 public Integer getSortOrder() { 555 return sortOrder; 556 } 557 558 public void setSortOrder(@Nonnull Integer sortOrder) 559 throws PersistenceNotNullException { 560 checkForNull(sortOrder); 561 562 boolean update = true; 563 564 if(this.sortOrder != null) { 565 if(this.sortOrder.equals(sortOrder)) { 566 update = false; 567 } 568 } else if(sortOrder == null) { 569 update = false; 570 } 571 572 if(update) { 573 this.sortOrder = sortOrder; 574 sortOrderHasBeenModified = true; 575 clearHashAndString(); 576 } 577 } 578 579 public boolean getSortOrderHasBeenModified() { 580 return sortOrderHasBeenModified; 581 } 582 583 @Nonnull 584 public Long getFromTime() { 585 return fromTime; 586 } 587 588 public void setFromTime(@Nonnull Long fromTime) 589 throws PersistenceNotNullException { 590 checkForNull(fromTime); 591 592 boolean update = true; 593 594 if(this.fromTime != null) { 595 if(this.fromTime.equals(fromTime)) { 596 update = false; 597 } 598 } else if(fromTime == null) { 599 update = false; 600 } 601 602 if(update) { 603 this.fromTime = fromTime; 604 fromTimeHasBeenModified = true; 605 clearHashAndString(); 606 } 607 } 608 609 public boolean getFromTimeHasBeenModified() { 610 return fromTimeHasBeenModified; 611 } 612 613 @Nonnull 614 public Long getThruTime() { 615 return thruTime; 616 } 617 618 public void setThruTime(@Nonnull Long thruTime) 619 throws PersistenceNotNullException { 620 checkForNull(thruTime); 621 622 boolean update = true; 623 624 if(this.thruTime != null) { 625 if(this.thruTime.equals(thruTime)) { 626 update = false; 627 } 628 } else if(thruTime == null) { 629 update = false; 630 } 631 632 if(update) { 633 this.thruTime = thruTime; 634 thruTimeHasBeenModified = true; 635 clearHashAndString(); 636 } 637 } 638 639 public boolean getThruTimeHasBeenModified() { 640 return thruTimeHasBeenModified; 641 } 642 643}