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