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 * 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 040public class CarrierValue 041 extends BaseValue<CarrierPK> 042 implements Cloneable, Serializable { 043 044 private PartyPK partyPK; 045 private boolean partyPKHasBeenModified = false; 046 private String carrierName; 047 private boolean carrierNameHasBeenModified = false; 048 private CarrierTypePK carrierTypePK; 049 private boolean carrierTypePKHasBeenModified = false; 050 private SelectorPK geoCodeSelectorPK; 051 private boolean geoCodeSelectorPKHasBeenModified = false; 052 private SelectorPK itemSelectorPK; 053 private boolean itemSelectorPKHasBeenModified = false; 054 private String accountValidationPattern; 055 private boolean accountValidationPatternHasBeenModified = false; 056 private Boolean isDefault; 057 private boolean isDefaultHasBeenModified = false; 058 private Integer sortOrder; 059 private boolean sortOrderHasBeenModified = false; 060 private Long fromTime; 061 private boolean fromTimeHasBeenModified = false; 062 private Long thruTime; 063 private boolean thruTimeHasBeenModified = false; 064 065 private transient Integer _hashCode = null; 066 private transient String _stringValue = null; 067 068 private void constructFields(PartyPK partyPK, String carrierName, CarrierTypePK carrierTypePK, SelectorPK geoCodeSelectorPK, SelectorPK itemSelectorPK, String accountValidationPattern, Boolean isDefault, Integer sortOrder, Long fromTime, Long thruTime) 069 throws PersistenceNotNullException { 070 checkForNull(partyPK); 071 this.partyPK = partyPK; 072 checkForNull(carrierName); 073 this.carrierName = carrierName; 074 checkForNull(carrierTypePK); 075 this.carrierTypePK = carrierTypePK; 076 this.geoCodeSelectorPK = geoCodeSelectorPK; 077 this.itemSelectorPK = itemSelectorPK; 078 this.accountValidationPattern = accountValidationPattern; 079 checkForNull(isDefault); 080 this.isDefault = isDefault; 081 checkForNull(sortOrder); 082 this.sortOrder = sortOrder; 083 checkForNull(fromTime); 084 this.fromTime = fromTime; 085 checkForNull(thruTime); 086 this.thruTime = thruTime; 087 } 088 089 /** Creates a new instance of CarrierValue */ 090 public CarrierValue(CarrierPK carrierPK, PartyPK partyPK, String carrierName, CarrierTypePK carrierTypePK, SelectorPK geoCodeSelectorPK, SelectorPK itemSelectorPK, String accountValidationPattern, Boolean isDefault, Integer sortOrder, Long fromTime, Long thruTime) 091 throws PersistenceNotNullException { 092 super(carrierPK); 093 constructFields(partyPK, carrierName, carrierTypePK, geoCodeSelectorPK, itemSelectorPK, accountValidationPattern, isDefault, sortOrder, fromTime, thruTime); 094 } 095 096 /** Creates a new instance of CarrierValue */ 097 public CarrierValue(PartyPK partyPK, String carrierName, CarrierTypePK carrierTypePK, SelectorPK geoCodeSelectorPK, SelectorPK itemSelectorPK, String accountValidationPattern, Boolean isDefault, Integer sortOrder, Long fromTime, Long thruTime) 098 throws PersistenceNotNullException { 099 super(); 100 constructFields(partyPK, carrierName, carrierTypePK, geoCodeSelectorPK, itemSelectorPK, accountValidationPattern, isDefault, sortOrder, fromTime, thruTime); 101 } 102 103 @Override 104 public CarrierFactory getBaseFactoryInstance() { 105 return CarrierFactory.getInstance(); 106 } 107 108 @Override 109 public CarrierValue 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 (CarrierValue)result; 120 } 121 122 @Override 123 public CarrierPK getPrimaryKey() { 124 if(_primaryKey == null) { 125 _primaryKey = new CarrierPK(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 + ((partyPK != null) ? partyPK.hashCode() : 0); 144 hashCode = 37 * hashCode + ((carrierName != null) ? carrierName.hashCode() : 0); 145 hashCode = 37 * hashCode + ((carrierTypePK != null) ? carrierTypePK.hashCode() : 0); 146 hashCode = 37 * hashCode + ((geoCodeSelectorPK != null) ? geoCodeSelectorPK.hashCode() : 0); 147 hashCode = 37 * hashCode + ((itemSelectorPK != null) ? itemSelectorPK.hashCode() : 0); 148 hashCode = 37 * hashCode + ((accountValidationPattern != null) ? accountValidationPattern.hashCode() : 0); 149 hashCode = 37 * hashCode + ((isDefault != null) ? isDefault.hashCode() : 0); 150 hashCode = 37 * hashCode + ((sortOrder != null) ? sortOrder.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 ", partyPK=" + getPartyPK() + 166 ", carrierName=" + getCarrierName() + 167 ", carrierTypePK=" + getCarrierTypePK() + 168 ", geoCodeSelectorPK=" + getGeoCodeSelectorPK() + 169 ", itemSelectorPK=" + getItemSelectorPK() + 170 ", accountValidationPattern=" + getAccountValidationPattern() + 171 ", isDefault=" + getIsDefault() + 172 ", sortOrder=" + getSortOrder() + 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 CarrierValue 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 CarrierValue that) { 207 boolean objectsEqual = true; 208 209 210 if(objectsEqual) { 211 PartyPK thisPartyPK = getPartyPK(); 212 PartyPK thatPartyPK = that.getPartyPK(); 213 214 if(thisPartyPK == null) { 215 objectsEqual = objectsEqual && (thatPartyPK == null); 216 } else { 217 objectsEqual = objectsEqual && thisPartyPK.equals(thatPartyPK); 218 } 219 } 220 221 if(objectsEqual) { 222 String thisCarrierName = getCarrierName(); 223 String thatCarrierName = that.getCarrierName(); 224 225 if(thisCarrierName == null) { 226 objectsEqual = objectsEqual && (thatCarrierName == null); 227 } else { 228 objectsEqual = objectsEqual && thisCarrierName.equals(thatCarrierName); 229 } 230 } 231 232 if(objectsEqual) { 233 CarrierTypePK thisCarrierTypePK = getCarrierTypePK(); 234 CarrierTypePK thatCarrierTypePK = that.getCarrierTypePK(); 235 236 if(thisCarrierTypePK == null) { 237 objectsEqual = objectsEqual && (thatCarrierTypePK == null); 238 } else { 239 objectsEqual = objectsEqual && thisCarrierTypePK.equals(thatCarrierTypePK); 240 } 241 } 242 243 if(objectsEqual) { 244 SelectorPK thisGeoCodeSelectorPK = getGeoCodeSelectorPK(); 245 SelectorPK thatGeoCodeSelectorPK = that.getGeoCodeSelectorPK(); 246 247 if(thisGeoCodeSelectorPK == null) { 248 objectsEqual = objectsEqual && (thatGeoCodeSelectorPK == null); 249 } else { 250 objectsEqual = objectsEqual && thisGeoCodeSelectorPK.equals(thatGeoCodeSelectorPK); 251 } 252 } 253 254 if(objectsEqual) { 255 SelectorPK thisItemSelectorPK = getItemSelectorPK(); 256 SelectorPK thatItemSelectorPK = that.getItemSelectorPK(); 257 258 if(thisItemSelectorPK == null) { 259 objectsEqual = objectsEqual && (thatItemSelectorPK == null); 260 } else { 261 objectsEqual = objectsEqual && thisItemSelectorPK.equals(thatItemSelectorPK); 262 } 263 } 264 265 if(objectsEqual) { 266 String thisAccountValidationPattern = getAccountValidationPattern(); 267 String thatAccountValidationPattern = that.getAccountValidationPattern(); 268 269 if(thisAccountValidationPattern == null) { 270 objectsEqual = objectsEqual && (thatAccountValidationPattern == null); 271 } else { 272 objectsEqual = objectsEqual && thisAccountValidationPattern.equals(thatAccountValidationPattern); 273 } 274 } 275 276 if(objectsEqual) { 277 Boolean thisIsDefault = getIsDefault(); 278 Boolean thatIsDefault = that.getIsDefault(); 279 280 if(thisIsDefault == null) { 281 objectsEqual = objectsEqual && (thatIsDefault == null); 282 } else { 283 objectsEqual = objectsEqual && thisIsDefault.equals(thatIsDefault); 284 } 285 } 286 287 if(objectsEqual) { 288 Integer thisSortOrder = getSortOrder(); 289 Integer thatSortOrder = that.getSortOrder(); 290 291 if(thisSortOrder == null) { 292 objectsEqual = objectsEqual && (thatSortOrder == null); 293 } else { 294 objectsEqual = objectsEqual && thisSortOrder.equals(thatSortOrder); 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 partyPKHasBeenModified || carrierNameHasBeenModified || carrierTypePKHasBeenModified || geoCodeSelectorPKHasBeenModified || itemSelectorPKHasBeenModified || accountValidationPatternHasBeenModified || isDefaultHasBeenModified || sortOrderHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified; 329 } 330 331 @Override 332 public void clearHasBeenModified() { 333 partyPKHasBeenModified = false; 334 carrierNameHasBeenModified = false; 335 carrierTypePKHasBeenModified = false; 336 geoCodeSelectorPKHasBeenModified = false; 337 itemSelectorPKHasBeenModified = false; 338 accountValidationPatternHasBeenModified = false; 339 isDefaultHasBeenModified = false; 340 sortOrderHasBeenModified = false; 341 fromTimeHasBeenModified = false; 342 thruTimeHasBeenModified = false; 343 } 344 345 public PartyPK getPartyPK() { 346 return partyPK; 347 } 348 349 public void setPartyPK(PartyPK partyPK) 350 throws PersistenceNotNullException { 351 checkForNull(partyPK); 352 353 boolean update = true; 354 355 if(this.partyPK != null) { 356 if(this.partyPK.equals(partyPK)) { 357 update = false; 358 } 359 } else if(partyPK == null) { 360 update = false; 361 } 362 363 if(update) { 364 this.partyPK = partyPK; 365 partyPKHasBeenModified = true; 366 clearHashAndString(); 367 } 368 } 369 370 public boolean getPartyPKHasBeenModified() { 371 return partyPKHasBeenModified; 372 } 373 374 public String getCarrierName() { 375 return carrierName; 376 } 377 378 public void setCarrierName(String carrierName) 379 throws PersistenceNotNullException { 380 checkForNull(carrierName); 381 382 boolean update = true; 383 384 if(this.carrierName != null) { 385 if(this.carrierName.equals(carrierName)) { 386 update = false; 387 } 388 } else if(carrierName == null) { 389 update = false; 390 } 391 392 if(update) { 393 this.carrierName = carrierName; 394 carrierNameHasBeenModified = true; 395 clearHashAndString(); 396 } 397 } 398 399 public boolean getCarrierNameHasBeenModified() { 400 return carrierNameHasBeenModified; 401 } 402 403 public CarrierTypePK getCarrierTypePK() { 404 return carrierTypePK; 405 } 406 407 public void setCarrierTypePK(CarrierTypePK carrierTypePK) 408 throws PersistenceNotNullException { 409 checkForNull(carrierTypePK); 410 411 boolean update = true; 412 413 if(this.carrierTypePK != null) { 414 if(this.carrierTypePK.equals(carrierTypePK)) { 415 update = false; 416 } 417 } else if(carrierTypePK == null) { 418 update = false; 419 } 420 421 if(update) { 422 this.carrierTypePK = carrierTypePK; 423 carrierTypePKHasBeenModified = true; 424 clearHashAndString(); 425 } 426 } 427 428 public boolean getCarrierTypePKHasBeenModified() { 429 return carrierTypePKHasBeenModified; 430 } 431 432 public SelectorPK getGeoCodeSelectorPK() { 433 return geoCodeSelectorPK; 434 } 435 436 public void setGeoCodeSelectorPK(SelectorPK geoCodeSelectorPK) { 437 boolean update = true; 438 439 if(this.geoCodeSelectorPK != null) { 440 if(this.geoCodeSelectorPK.equals(geoCodeSelectorPK)) { 441 update = false; 442 } 443 } else if(geoCodeSelectorPK == null) { 444 update = false; 445 } 446 447 if(update) { 448 this.geoCodeSelectorPK = geoCodeSelectorPK; 449 geoCodeSelectorPKHasBeenModified = true; 450 clearHashAndString(); 451 } 452 } 453 454 public boolean getGeoCodeSelectorPKHasBeenModified() { 455 return geoCodeSelectorPKHasBeenModified; 456 } 457 458 public SelectorPK getItemSelectorPK() { 459 return itemSelectorPK; 460 } 461 462 public void setItemSelectorPK(SelectorPK itemSelectorPK) { 463 boolean update = true; 464 465 if(this.itemSelectorPK != null) { 466 if(this.itemSelectorPK.equals(itemSelectorPK)) { 467 update = false; 468 } 469 } else if(itemSelectorPK == null) { 470 update = false; 471 } 472 473 if(update) { 474 this.itemSelectorPK = itemSelectorPK; 475 itemSelectorPKHasBeenModified = true; 476 clearHashAndString(); 477 } 478 } 479 480 public boolean getItemSelectorPKHasBeenModified() { 481 return itemSelectorPKHasBeenModified; 482 } 483 484 public String getAccountValidationPattern() { 485 return accountValidationPattern; 486 } 487 488 public void setAccountValidationPattern(String accountValidationPattern) { 489 boolean update = true; 490 491 if(this.accountValidationPattern != null) { 492 if(this.accountValidationPattern.equals(accountValidationPattern)) { 493 update = false; 494 } 495 } else if(accountValidationPattern == null) { 496 update = false; 497 } 498 499 if(update) { 500 this.accountValidationPattern = accountValidationPattern; 501 accountValidationPatternHasBeenModified = true; 502 clearHashAndString(); 503 } 504 } 505 506 public boolean getAccountValidationPatternHasBeenModified() { 507 return accountValidationPatternHasBeenModified; 508 } 509 510 public Boolean getIsDefault() { 511 return isDefault; 512 } 513 514 public void setIsDefault(Boolean isDefault) 515 throws PersistenceNotNullException { 516 checkForNull(isDefault); 517 518 boolean update = true; 519 520 if(this.isDefault != null) { 521 if(this.isDefault.equals(isDefault)) { 522 update = false; 523 } 524 } else if(isDefault == null) { 525 update = false; 526 } 527 528 if(update) { 529 this.isDefault = isDefault; 530 isDefaultHasBeenModified = true; 531 clearHashAndString(); 532 } 533 } 534 535 public boolean getIsDefaultHasBeenModified() { 536 return isDefaultHasBeenModified; 537 } 538 539 public Integer getSortOrder() { 540 return sortOrder; 541 } 542 543 public void setSortOrder(Integer sortOrder) 544 throws PersistenceNotNullException { 545 checkForNull(sortOrder); 546 547 boolean update = true; 548 549 if(this.sortOrder != null) { 550 if(this.sortOrder.equals(sortOrder)) { 551 update = false; 552 } 553 } else if(sortOrder == null) { 554 update = false; 555 } 556 557 if(update) { 558 this.sortOrder = sortOrder; 559 sortOrderHasBeenModified = true; 560 clearHashAndString(); 561 } 562 } 563 564 public boolean getSortOrderHasBeenModified() { 565 return sortOrderHasBeenModified; 566 } 567 568 public Long getFromTime() { 569 return fromTime; 570 } 571 572 public void setFromTime(Long fromTime) 573 throws PersistenceNotNullException { 574 checkForNull(fromTime); 575 576 boolean update = true; 577 578 if(this.fromTime != null) { 579 if(this.fromTime.equals(fromTime)) { 580 update = false; 581 } 582 } else if(fromTime == null) { 583 update = false; 584 } 585 586 if(update) { 587 this.fromTime = fromTime; 588 fromTimeHasBeenModified = true; 589 clearHashAndString(); 590 } 591 } 592 593 public boolean getFromTimeHasBeenModified() { 594 return fromTimeHasBeenModified; 595 } 596 597 public Long getThruTime() { 598 return thruTime; 599 } 600 601 public void setThruTime(Long thruTime) 602 throws PersistenceNotNullException { 603 checkForNull(thruTime); 604 605 boolean update = true; 606 607 if(this.thruTime != null) { 608 if(this.thruTime.equals(thruTime)) { 609 update = false; 610 } 611 } else if(thruTime == null) { 612 update = false; 613 } 614 615 if(update) { 616 this.thruTime = thruTime; 617 thruTimeHasBeenModified = true; 618 clearHashAndString(); 619 } 620 } 621 622 public boolean getThruTimeHasBeenModified() { 623 return thruTimeHasBeenModified; 624 } 625 626}