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