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