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