001// -------------------------------------------------------------------------------- 002// Copyright 2002-2024 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 * InvoiceDetailValue.java 021 */ 022 023package com.echothree.model.data.invoice.server.value; 024 025import com.echothree.model.data.invoice.common.pk.InvoiceDetailPK; 026 027import com.echothree.model.data.invoice.server.factory.InvoiceDetailFactory; 028 029import com.echothree.model.data.invoice.common.pk.InvoicePK; 030import com.echothree.model.data.invoice.common.pk.InvoiceTypePK; 031import com.echothree.model.data.payment.common.pk.BillingAccountPK; 032import com.echothree.model.data.accounting.common.pk.GlAccountPK; 033import com.echothree.model.data.term.common.pk.TermPK; 034import com.echothree.model.data.shipment.common.pk.FreeOnBoardPK; 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 043public class InvoiceDetailValue 044 extends BaseValue<InvoiceDetailPK> 045 implements Cloneable, Serializable { 046 047 private InvoicePK invoicePK; 048 private boolean invoicePKHasBeenModified = false; 049 private InvoiceTypePK invoiceTypePK; 050 private boolean invoiceTypePKHasBeenModified = false; 051 private String invoiceName; 052 private boolean invoiceNameHasBeenModified = false; 053 private BillingAccountPK billingAccountPK; 054 private boolean billingAccountPKHasBeenModified = false; 055 private GlAccountPK glAccountPK; 056 private boolean glAccountPKHasBeenModified = false; 057 private TermPK termPK; 058 private boolean termPKHasBeenModified = false; 059 private FreeOnBoardPK freeOnBoardPK; 060 private boolean freeOnBoardPKHasBeenModified = false; 061 private String reference; 062 private boolean referenceHasBeenModified = false; 063 private String description; 064 private boolean descriptionHasBeenModified = false; 065 private Long fromTime; 066 private boolean fromTimeHasBeenModified = false; 067 private Long thruTime; 068 private boolean thruTimeHasBeenModified = false; 069 070 private transient Integer _hashCode = null; 071 private transient String _stringValue = null; 072 073 private void constructFields(InvoicePK invoicePK, InvoiceTypePK invoiceTypePK, String invoiceName, BillingAccountPK billingAccountPK, GlAccountPK glAccountPK, TermPK termPK, FreeOnBoardPK freeOnBoardPK, String reference, String description, Long fromTime, Long thruTime) 074 throws PersistenceNotNullException { 075 checkForNull(invoicePK); 076 this.invoicePK = invoicePK; 077 checkForNull(invoiceTypePK); 078 this.invoiceTypePK = invoiceTypePK; 079 checkForNull(invoiceName); 080 this.invoiceName = invoiceName; 081 checkForNull(billingAccountPK); 082 this.billingAccountPK = billingAccountPK; 083 checkForNull(glAccountPK); 084 this.glAccountPK = glAccountPK; 085 checkForNull(termPK); 086 this.termPK = termPK; 087 this.freeOnBoardPK = freeOnBoardPK; 088 this.reference = reference; 089 this.description = description; 090 checkForNull(fromTime); 091 this.fromTime = fromTime; 092 checkForNull(thruTime); 093 this.thruTime = thruTime; 094 } 095 096 /** Creates a new instance of InvoiceDetailValue */ 097 public InvoiceDetailValue(InvoiceDetailPK invoiceDetailPK, InvoicePK invoicePK, InvoiceTypePK invoiceTypePK, String invoiceName, BillingAccountPK billingAccountPK, GlAccountPK glAccountPK, TermPK termPK, FreeOnBoardPK freeOnBoardPK, String reference, String description, Long fromTime, Long thruTime) 098 throws PersistenceNotNullException { 099 super(invoiceDetailPK); 100 constructFields(invoicePK, invoiceTypePK, invoiceName, billingAccountPK, glAccountPK, termPK, freeOnBoardPK, reference, description, fromTime, thruTime); 101 } 102 103 /** Creates a new instance of InvoiceDetailValue */ 104 public InvoiceDetailValue(InvoicePK invoicePK, InvoiceTypePK invoiceTypePK, String invoiceName, BillingAccountPK billingAccountPK, GlAccountPK glAccountPK, TermPK termPK, FreeOnBoardPK freeOnBoardPK, String reference, String description, Long fromTime, Long thruTime) 105 throws PersistenceNotNullException { 106 super(); 107 constructFields(invoicePK, invoiceTypePK, invoiceName, billingAccountPK, glAccountPK, termPK, freeOnBoardPK, reference, description, fromTime, thruTime); 108 } 109 110 @Override 111 public InvoiceDetailFactory getBaseFactoryInstance() { 112 return InvoiceDetailFactory.getInstance(); 113 } 114 115 @Override 116 public InvoiceDetailValue 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 (InvoiceDetailValue)result; 127 } 128 129 @Override 130 public InvoiceDetailPK getPrimaryKey() { 131 if(_primaryKey == null) { 132 _primaryKey = new InvoiceDetailPK(entityId); 133 } 134 135 return _primaryKey; 136 } 137 138 private void clearHashAndString() { 139 _hashCode = null; 140 _stringValue = null; 141 } 142 143 @Override 144 public int hashCode() { 145 if(_hashCode == null) { 146 int hashCode = 17; 147 148 hashCode = 37 * hashCode + ((entityId != null) ? entityId.hashCode() : 0); 149 150 hashCode = 37 * hashCode + ((invoicePK != null) ? invoicePK.hashCode() : 0); 151 hashCode = 37 * hashCode + ((invoiceTypePK != null) ? invoiceTypePK.hashCode() : 0); 152 hashCode = 37 * hashCode + ((invoiceName != null) ? invoiceName.hashCode() : 0); 153 hashCode = 37 * hashCode + ((billingAccountPK != null) ? billingAccountPK.hashCode() : 0); 154 hashCode = 37 * hashCode + ((glAccountPK != null) ? glAccountPK.hashCode() : 0); 155 hashCode = 37 * hashCode + ((termPK != null) ? termPK.hashCode() : 0); 156 hashCode = 37 * hashCode + ((freeOnBoardPK != null) ? freeOnBoardPK.hashCode() : 0); 157 hashCode = 37 * hashCode + ((reference != null) ? reference.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 public String toString() { 170 if(_stringValue == null) { 171 StringBuilder stringValue = new StringBuilder("{"); 172 173 stringValue.append("entityId=").append(getEntityId()); 174 175 stringValue.append(", invoicePK=").append(getInvoicePK()); 176 stringValue.append(", invoiceTypePK=").append(getInvoiceTypePK()); 177 stringValue.append(", invoiceName=").append(getInvoiceName()); 178 stringValue.append(", billingAccountPK=").append(getBillingAccountPK()); 179 stringValue.append(", glAccountPK=").append(getGlAccountPK()); 180 stringValue.append(", termPK=").append(getTermPK()); 181 stringValue.append(", freeOnBoardPK=").append(getFreeOnBoardPK()); 182 stringValue.append(", reference=").append(getReference()); 183 stringValue.append(", description=").append(getDescription()); 184 stringValue.append(", fromTime=").append(getFromTime()); 185 stringValue.append(", thruTime=").append(getThruTime()); 186 187 stringValue.append('}'); 188 189 _stringValue = stringValue.toString(); 190 } 191 return _stringValue; 192 } 193 194 @Override 195 public boolean equals(Object other) { 196 if(this == other) 197 return true; 198 199 if(!hasIdentity()) 200 return false; 201 202 if(other instanceof InvoiceDetailValue) { 203 InvoiceDetailValue that = (InvoiceDetailValue)other; 204 205 if(!that.hasIdentity()) 206 return false; 207 208 Long thisEntityId = getEntityId(); 209 Long thatEntityId = that.getEntityId(); 210 211 boolean objectsEqual = thisEntityId.equals(thatEntityId); 212 if(objectsEqual) 213 objectsEqual = objectsEqual && isIdentical(that); 214 215 return objectsEqual; 216 } else { 217 return false; 218 } 219 } 220 221 public boolean isIdentical(Object other) { 222 if(other instanceof InvoiceDetailValue) { 223 InvoiceDetailValue that = (InvoiceDetailValue)other; 224 boolean objectsEqual = true; 225 226 227 if(objectsEqual) { 228 InvoicePK thisInvoicePK = getInvoicePK(); 229 InvoicePK thatInvoicePK = that.getInvoicePK(); 230 231 if(thisInvoicePK == null) { 232 objectsEqual = objectsEqual && (thatInvoicePK == null); 233 } else { 234 objectsEqual = objectsEqual && thisInvoicePK.equals(thatInvoicePK); 235 } 236 } 237 238 if(objectsEqual) { 239 InvoiceTypePK thisInvoiceTypePK = getInvoiceTypePK(); 240 InvoiceTypePK thatInvoiceTypePK = that.getInvoiceTypePK(); 241 242 if(thisInvoiceTypePK == null) { 243 objectsEqual = objectsEqual && (thatInvoiceTypePK == null); 244 } else { 245 objectsEqual = objectsEqual && thisInvoiceTypePK.equals(thatInvoiceTypePK); 246 } 247 } 248 249 if(objectsEqual) { 250 String thisInvoiceName = getInvoiceName(); 251 String thatInvoiceName = that.getInvoiceName(); 252 253 if(thisInvoiceName == null) { 254 objectsEqual = objectsEqual && (thatInvoiceName == null); 255 } else { 256 objectsEqual = objectsEqual && thisInvoiceName.equals(thatInvoiceName); 257 } 258 } 259 260 if(objectsEqual) { 261 BillingAccountPK thisBillingAccountPK = getBillingAccountPK(); 262 BillingAccountPK thatBillingAccountPK = that.getBillingAccountPK(); 263 264 if(thisBillingAccountPK == null) { 265 objectsEqual = objectsEqual && (thatBillingAccountPK == null); 266 } else { 267 objectsEqual = objectsEqual && thisBillingAccountPK.equals(thatBillingAccountPK); 268 } 269 } 270 271 if(objectsEqual) { 272 GlAccountPK thisGlAccountPK = getGlAccountPK(); 273 GlAccountPK thatGlAccountPK = that.getGlAccountPK(); 274 275 if(thisGlAccountPK == null) { 276 objectsEqual = objectsEqual && (thatGlAccountPK == null); 277 } else { 278 objectsEqual = objectsEqual && thisGlAccountPK.equals(thatGlAccountPK); 279 } 280 } 281 282 if(objectsEqual) { 283 TermPK thisTermPK = getTermPK(); 284 TermPK thatTermPK = that.getTermPK(); 285 286 if(thisTermPK == null) { 287 objectsEqual = objectsEqual && (thatTermPK == null); 288 } else { 289 objectsEqual = objectsEqual && thisTermPK.equals(thatTermPK); 290 } 291 } 292 293 if(objectsEqual) { 294 FreeOnBoardPK thisFreeOnBoardPK = getFreeOnBoardPK(); 295 FreeOnBoardPK thatFreeOnBoardPK = that.getFreeOnBoardPK(); 296 297 if(thisFreeOnBoardPK == null) { 298 objectsEqual = objectsEqual && (thatFreeOnBoardPK == null); 299 } else { 300 objectsEqual = objectsEqual && thisFreeOnBoardPK.equals(thatFreeOnBoardPK); 301 } 302 } 303 304 if(objectsEqual) { 305 String thisReference = getReference(); 306 String thatReference = that.getReference(); 307 308 if(thisReference == null) { 309 objectsEqual = objectsEqual && (thatReference == null); 310 } else { 311 objectsEqual = objectsEqual && thisReference.equals(thatReference); 312 } 313 } 314 315 if(objectsEqual) { 316 String thisDescription = getDescription(); 317 String thatDescription = that.getDescription(); 318 319 if(thisDescription == null) { 320 objectsEqual = objectsEqual && (thatDescription == null); 321 } else { 322 objectsEqual = objectsEqual && thisDescription.equals(thatDescription); 323 } 324 } 325 326 if(objectsEqual) { 327 Long thisFromTime = getFromTime(); 328 Long thatFromTime = that.getFromTime(); 329 330 if(thisFromTime == null) { 331 objectsEqual = objectsEqual && (thatFromTime == null); 332 } else { 333 objectsEqual = objectsEqual && thisFromTime.equals(thatFromTime); 334 } 335 } 336 337 if(objectsEqual) { 338 Long thisThruTime = getThruTime(); 339 Long thatThruTime = that.getThruTime(); 340 341 if(thisThruTime == null) { 342 objectsEqual = objectsEqual && (thatThruTime == null); 343 } else { 344 objectsEqual = objectsEqual && thisThruTime.equals(thatThruTime); 345 } 346 } 347 348 return objectsEqual; 349 } else { 350 return false; 351 } 352 } 353 354 @Override 355 public boolean hasBeenModified() { 356 return invoicePKHasBeenModified || invoiceTypePKHasBeenModified || invoiceNameHasBeenModified || billingAccountPKHasBeenModified || glAccountPKHasBeenModified || termPKHasBeenModified || freeOnBoardPKHasBeenModified || referenceHasBeenModified || descriptionHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified; 357 } 358 359 @Override 360 public void clearHasBeenModified() { 361 invoicePKHasBeenModified = false; 362 invoiceTypePKHasBeenModified = false; 363 invoiceNameHasBeenModified = false; 364 billingAccountPKHasBeenModified = false; 365 glAccountPKHasBeenModified = false; 366 termPKHasBeenModified = false; 367 freeOnBoardPKHasBeenModified = false; 368 referenceHasBeenModified = false; 369 descriptionHasBeenModified = false; 370 fromTimeHasBeenModified = false; 371 thruTimeHasBeenModified = false; 372 } 373 374 public InvoicePK getInvoicePK() { 375 return invoicePK; 376 } 377 378 public void setInvoicePK(InvoicePK invoicePK) 379 throws PersistenceNotNullException { 380 checkForNull(invoicePK); 381 382 boolean update = true; 383 384 if(this.invoicePK != null) { 385 if(this.invoicePK.equals(invoicePK)) { 386 update = false; 387 } 388 } else if(invoicePK == null) { 389 update = false; 390 } 391 392 if(update) { 393 this.invoicePK = invoicePK; 394 invoicePKHasBeenModified = true; 395 clearHashAndString(); 396 } 397 } 398 399 public boolean getInvoicePKHasBeenModified() { 400 return invoicePKHasBeenModified; 401 } 402 403 public InvoiceTypePK getInvoiceTypePK() { 404 return invoiceTypePK; 405 } 406 407 public void setInvoiceTypePK(InvoiceTypePK invoiceTypePK) 408 throws PersistenceNotNullException { 409 checkForNull(invoiceTypePK); 410 411 boolean update = true; 412 413 if(this.invoiceTypePK != null) { 414 if(this.invoiceTypePK.equals(invoiceTypePK)) { 415 update = false; 416 } 417 } else if(invoiceTypePK == null) { 418 update = false; 419 } 420 421 if(update) { 422 this.invoiceTypePK = invoiceTypePK; 423 invoiceTypePKHasBeenModified = true; 424 clearHashAndString(); 425 } 426 } 427 428 public boolean getInvoiceTypePKHasBeenModified() { 429 return invoiceTypePKHasBeenModified; 430 } 431 432 public String getInvoiceName() { 433 return invoiceName; 434 } 435 436 public void setInvoiceName(String invoiceName) 437 throws PersistenceNotNullException { 438 checkForNull(invoiceName); 439 440 boolean update = true; 441 442 if(this.invoiceName != null) { 443 if(this.invoiceName.equals(invoiceName)) { 444 update = false; 445 } 446 } else if(invoiceName == null) { 447 update = false; 448 } 449 450 if(update) { 451 this.invoiceName = invoiceName; 452 invoiceNameHasBeenModified = true; 453 clearHashAndString(); 454 } 455 } 456 457 public boolean getInvoiceNameHasBeenModified() { 458 return invoiceNameHasBeenModified; 459 } 460 461 public BillingAccountPK getBillingAccountPK() { 462 return billingAccountPK; 463 } 464 465 public void setBillingAccountPK(BillingAccountPK billingAccountPK) 466 throws PersistenceNotNullException { 467 checkForNull(billingAccountPK); 468 469 boolean update = true; 470 471 if(this.billingAccountPK != null) { 472 if(this.billingAccountPK.equals(billingAccountPK)) { 473 update = false; 474 } 475 } else if(billingAccountPK == null) { 476 update = false; 477 } 478 479 if(update) { 480 this.billingAccountPK = billingAccountPK; 481 billingAccountPKHasBeenModified = true; 482 clearHashAndString(); 483 } 484 } 485 486 public boolean getBillingAccountPKHasBeenModified() { 487 return billingAccountPKHasBeenModified; 488 } 489 490 public GlAccountPK getGlAccountPK() { 491 return glAccountPK; 492 } 493 494 public void setGlAccountPK(GlAccountPK glAccountPK) 495 throws PersistenceNotNullException { 496 checkForNull(glAccountPK); 497 498 boolean update = true; 499 500 if(this.glAccountPK != null) { 501 if(this.glAccountPK.equals(glAccountPK)) { 502 update = false; 503 } 504 } else if(glAccountPK == null) { 505 update = false; 506 } 507 508 if(update) { 509 this.glAccountPK = glAccountPK; 510 glAccountPKHasBeenModified = true; 511 clearHashAndString(); 512 } 513 } 514 515 public boolean getGlAccountPKHasBeenModified() { 516 return glAccountPKHasBeenModified; 517 } 518 519 public TermPK getTermPK() { 520 return termPK; 521 } 522 523 public void setTermPK(TermPK termPK) 524 throws PersistenceNotNullException { 525 checkForNull(termPK); 526 527 boolean update = true; 528 529 if(this.termPK != null) { 530 if(this.termPK.equals(termPK)) { 531 update = false; 532 } 533 } else if(termPK == null) { 534 update = false; 535 } 536 537 if(update) { 538 this.termPK = termPK; 539 termPKHasBeenModified = true; 540 clearHashAndString(); 541 } 542 } 543 544 public boolean getTermPKHasBeenModified() { 545 return termPKHasBeenModified; 546 } 547 548 public FreeOnBoardPK getFreeOnBoardPK() { 549 return freeOnBoardPK; 550 } 551 552 public void setFreeOnBoardPK(FreeOnBoardPK freeOnBoardPK) { 553 boolean update = true; 554 555 if(this.freeOnBoardPK != null) { 556 if(this.freeOnBoardPK.equals(freeOnBoardPK)) { 557 update = false; 558 } 559 } else if(freeOnBoardPK == null) { 560 update = false; 561 } 562 563 if(update) { 564 this.freeOnBoardPK = freeOnBoardPK; 565 freeOnBoardPKHasBeenModified = true; 566 clearHashAndString(); 567 } 568 } 569 570 public boolean getFreeOnBoardPKHasBeenModified() { 571 return freeOnBoardPKHasBeenModified; 572 } 573 574 public String getReference() { 575 return reference; 576 } 577 578 public void setReference(String reference) { 579 boolean update = true; 580 581 if(this.reference != null) { 582 if(this.reference.equals(reference)) { 583 update = false; 584 } 585 } else if(reference == null) { 586 update = false; 587 } 588 589 if(update) { 590 this.reference = reference; 591 referenceHasBeenModified = true; 592 clearHashAndString(); 593 } 594 } 595 596 public boolean getReferenceHasBeenModified() { 597 return referenceHasBeenModified; 598 } 599 600 public String getDescription() { 601 return description; 602 } 603 604 public void setDescription(String description) { 605 boolean update = true; 606 607 if(this.description != null) { 608 if(this.description.equals(description)) { 609 update = false; 610 } 611 } else if(description == null) { 612 update = false; 613 } 614 615 if(update) { 616 this.description = description; 617 descriptionHasBeenModified = true; 618 clearHashAndString(); 619 } 620 } 621 622 public boolean getDescriptionHasBeenModified() { 623 return descriptionHasBeenModified; 624 } 625 626 public Long getFromTime() { 627 return fromTime; 628 } 629 630 public void setFromTime(Long fromTime) 631 throws PersistenceNotNullException { 632 checkForNull(fromTime); 633 634 boolean update = true; 635 636 if(this.fromTime != null) { 637 if(this.fromTime.equals(fromTime)) { 638 update = false; 639 } 640 } else if(fromTime == null) { 641 update = false; 642 } 643 644 if(update) { 645 this.fromTime = fromTime; 646 fromTimeHasBeenModified = true; 647 clearHashAndString(); 648 } 649 } 650 651 public boolean getFromTimeHasBeenModified() { 652 return fromTimeHasBeenModified; 653 } 654 655 public Long getThruTime() { 656 return thruTime; 657 } 658 659 public void setThruTime(Long thruTime) 660 throws PersistenceNotNullException { 661 checkForNull(thruTime); 662 663 boolean update = true; 664 665 if(this.thruTime != null) { 666 if(this.thruTime.equals(thruTime)) { 667 update = false; 668 } 669 } else if(thruTime == null) { 670 update = false; 671 } 672 673 if(update) { 674 this.thruTime = thruTime; 675 thruTimeHasBeenModified = true; 676 clearHashAndString(); 677 } 678 } 679 680 public boolean getThruTimeHasBeenModified() { 681 return thruTimeHasBeenModified; 682 } 683 684}