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 * 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 StringBuilder stringValue = new StringBuilder("{"); 160 161 stringValue.append("entityId=").append(getEntityId()); 162 163 stringValue.append(", itemPK=").append(getItemPK()); 164 stringValue.append(", itemAdditionalChargeTypePK=").append(getItemAdditionalChargeTypePK()); 165 stringValue.append(", unitOfMeasureTypePK=").append(getUnitOfMeasureTypePK()); 166 stringValue.append(", minimumQuantity=").append(getMinimumQuantity()); 167 stringValue.append(", maximumQuantity=").append(getMaximumQuantity()); 168 stringValue.append(", currencyPK=").append(getCurrencyPK()); 169 stringValue.append(", unitPrice=").append(getUnitPrice()); 170 stringValue.append(", fromTime=").append(getFromTime()); 171 stringValue.append(", thruTime=").append(getThruTime()); 172 173 stringValue.append('}'); 174 175 _stringValue = stringValue.toString(); 176 } 177 return _stringValue; 178 } 179 180 @Override 181 public boolean equals(Object other) { 182 if(this == other) 183 return true; 184 185 if(!hasIdentity()) 186 return false; 187 188 if(other instanceof ItemAdditionalChargeValue) { 189 ItemAdditionalChargeValue that = (ItemAdditionalChargeValue)other; 190 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 = 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 ItemAdditionalChargeValue) { 209 ItemAdditionalChargeValue that = (ItemAdditionalChargeValue)other; 210 boolean objectsEqual = true; 211 212 213 if(objectsEqual) { 214 ItemPK thisItemPK = getItemPK(); 215 ItemPK thatItemPK = that.getItemPK(); 216 217 if(thisItemPK == null) { 218 objectsEqual = objectsEqual && (thatItemPK == null); 219 } else { 220 objectsEqual = objectsEqual && thisItemPK.equals(thatItemPK); 221 } 222 } 223 224 if(objectsEqual) { 225 ItemAdditionalChargeTypePK thisItemAdditionalChargeTypePK = getItemAdditionalChargeTypePK(); 226 ItemAdditionalChargeTypePK thatItemAdditionalChargeTypePK = that.getItemAdditionalChargeTypePK(); 227 228 if(thisItemAdditionalChargeTypePK == null) { 229 objectsEqual = objectsEqual && (thatItemAdditionalChargeTypePK == null); 230 } else { 231 objectsEqual = objectsEqual && thisItemAdditionalChargeTypePK.equals(thatItemAdditionalChargeTypePK); 232 } 233 } 234 235 if(objectsEqual) { 236 UnitOfMeasureTypePK thisUnitOfMeasureTypePK = getUnitOfMeasureTypePK(); 237 UnitOfMeasureTypePK thatUnitOfMeasureTypePK = that.getUnitOfMeasureTypePK(); 238 239 if(thisUnitOfMeasureTypePK == null) { 240 objectsEqual = objectsEqual && (thatUnitOfMeasureTypePK == null); 241 } else { 242 objectsEqual = objectsEqual && thisUnitOfMeasureTypePK.equals(thatUnitOfMeasureTypePK); 243 } 244 } 245 246 if(objectsEqual) { 247 Long thisMinimumQuantity = getMinimumQuantity(); 248 Long thatMinimumQuantity = that.getMinimumQuantity(); 249 250 if(thisMinimumQuantity == null) { 251 objectsEqual = objectsEqual && (thatMinimumQuantity == null); 252 } else { 253 objectsEqual = objectsEqual && thisMinimumQuantity.equals(thatMinimumQuantity); 254 } 255 } 256 257 if(objectsEqual) { 258 Long thisMaximumQuantity = getMaximumQuantity(); 259 Long thatMaximumQuantity = that.getMaximumQuantity(); 260 261 if(thisMaximumQuantity == null) { 262 objectsEqual = objectsEqual && (thatMaximumQuantity == null); 263 } else { 264 objectsEqual = objectsEqual && thisMaximumQuantity.equals(thatMaximumQuantity); 265 } 266 } 267 268 if(objectsEqual) { 269 CurrencyPK thisCurrencyPK = getCurrencyPK(); 270 CurrencyPK thatCurrencyPK = that.getCurrencyPK(); 271 272 if(thisCurrencyPK == null) { 273 objectsEqual = objectsEqual && (thatCurrencyPK == null); 274 } else { 275 objectsEqual = objectsEqual && thisCurrencyPK.equals(thatCurrencyPK); 276 } 277 } 278 279 if(objectsEqual) { 280 Long thisUnitPrice = getUnitPrice(); 281 Long thatUnitPrice = that.getUnitPrice(); 282 283 if(thisUnitPrice == null) { 284 objectsEqual = objectsEqual && (thatUnitPrice == null); 285 } else { 286 objectsEqual = objectsEqual && thisUnitPrice.equals(thatUnitPrice); 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 itemPKHasBeenModified || itemAdditionalChargeTypePKHasBeenModified || unitOfMeasureTypePKHasBeenModified || minimumQuantityHasBeenModified || maximumQuantityHasBeenModified || currencyPKHasBeenModified || unitPriceHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified; 321 } 322 323 @Override 324 public void clearHasBeenModified() { 325 itemPKHasBeenModified = false; 326 itemAdditionalChargeTypePKHasBeenModified = false; 327 unitOfMeasureTypePKHasBeenModified = false; 328 minimumQuantityHasBeenModified = false; 329 maximumQuantityHasBeenModified = false; 330 currencyPKHasBeenModified = false; 331 unitPriceHasBeenModified = false; 332 fromTimeHasBeenModified = false; 333 thruTimeHasBeenModified = false; 334 } 335 336 public ItemPK getItemPK() { 337 return itemPK; 338 } 339 340 public void setItemPK(ItemPK itemPK) 341 throws PersistenceNotNullException { 342 checkForNull(itemPK); 343 344 boolean update = true; 345 346 if(this.itemPK != null) { 347 if(this.itemPK.equals(itemPK)) { 348 update = false; 349 } 350 } else if(itemPK == null) { 351 update = false; 352 } 353 354 if(update) { 355 this.itemPK = itemPK; 356 itemPKHasBeenModified = true; 357 clearHashAndString(); 358 } 359 } 360 361 public boolean getItemPKHasBeenModified() { 362 return itemPKHasBeenModified; 363 } 364 365 public ItemAdditionalChargeTypePK getItemAdditionalChargeTypePK() { 366 return itemAdditionalChargeTypePK; 367 } 368 369 public void setItemAdditionalChargeTypePK(ItemAdditionalChargeTypePK itemAdditionalChargeTypePK) 370 throws PersistenceNotNullException { 371 checkForNull(itemAdditionalChargeTypePK); 372 373 boolean update = true; 374 375 if(this.itemAdditionalChargeTypePK != null) { 376 if(this.itemAdditionalChargeTypePK.equals(itemAdditionalChargeTypePK)) { 377 update = false; 378 } 379 } else if(itemAdditionalChargeTypePK == null) { 380 update = false; 381 } 382 383 if(update) { 384 this.itemAdditionalChargeTypePK = itemAdditionalChargeTypePK; 385 itemAdditionalChargeTypePKHasBeenModified = true; 386 clearHashAndString(); 387 } 388 } 389 390 public boolean getItemAdditionalChargeTypePKHasBeenModified() { 391 return itemAdditionalChargeTypePKHasBeenModified; 392 } 393 394 public UnitOfMeasureTypePK getUnitOfMeasureTypePK() { 395 return unitOfMeasureTypePK; 396 } 397 398 public void setUnitOfMeasureTypePK(UnitOfMeasureTypePK unitOfMeasureTypePK) { 399 boolean update = true; 400 401 if(this.unitOfMeasureTypePK != null) { 402 if(this.unitOfMeasureTypePK.equals(unitOfMeasureTypePK)) { 403 update = false; 404 } 405 } else if(unitOfMeasureTypePK == null) { 406 update = false; 407 } 408 409 if(update) { 410 this.unitOfMeasureTypePK = unitOfMeasureTypePK; 411 unitOfMeasureTypePKHasBeenModified = true; 412 clearHashAndString(); 413 } 414 } 415 416 public boolean getUnitOfMeasureTypePKHasBeenModified() { 417 return unitOfMeasureTypePKHasBeenModified; 418 } 419 420 public Long getMinimumQuantity() { 421 return minimumQuantity; 422 } 423 424 public void setMinimumQuantity(Long minimumQuantity) { 425 boolean update = true; 426 427 if(this.minimumQuantity != null) { 428 if(this.minimumQuantity.equals(minimumQuantity)) { 429 update = false; 430 } 431 } else if(minimumQuantity == null) { 432 update = false; 433 } 434 435 if(update) { 436 this.minimumQuantity = minimumQuantity; 437 minimumQuantityHasBeenModified = true; 438 clearHashAndString(); 439 } 440 } 441 442 public boolean getMinimumQuantityHasBeenModified() { 443 return minimumQuantityHasBeenModified; 444 } 445 446 public Long getMaximumQuantity() { 447 return maximumQuantity; 448 } 449 450 public void setMaximumQuantity(Long maximumQuantity) { 451 boolean update = true; 452 453 if(this.maximumQuantity != null) { 454 if(this.maximumQuantity.equals(maximumQuantity)) { 455 update = false; 456 } 457 } else if(maximumQuantity == null) { 458 update = false; 459 } 460 461 if(update) { 462 this.maximumQuantity = maximumQuantity; 463 maximumQuantityHasBeenModified = true; 464 clearHashAndString(); 465 } 466 } 467 468 public boolean getMaximumQuantityHasBeenModified() { 469 return maximumQuantityHasBeenModified; 470 } 471 472 public CurrencyPK getCurrencyPK() { 473 return currencyPK; 474 } 475 476 public void setCurrencyPK(CurrencyPK currencyPK) 477 throws PersistenceNotNullException { 478 checkForNull(currencyPK); 479 480 boolean update = true; 481 482 if(this.currencyPK != null) { 483 if(this.currencyPK.equals(currencyPK)) { 484 update = false; 485 } 486 } else if(currencyPK == null) { 487 update = false; 488 } 489 490 if(update) { 491 this.currencyPK = currencyPK; 492 currencyPKHasBeenModified = true; 493 clearHashAndString(); 494 } 495 } 496 497 public boolean getCurrencyPKHasBeenModified() { 498 return currencyPKHasBeenModified; 499 } 500 501 public Long getUnitPrice() { 502 return unitPrice; 503 } 504 505 public void setUnitPrice(Long unitPrice) 506 throws PersistenceNotNullException { 507 checkForNull(unitPrice); 508 509 boolean update = true; 510 511 if(this.unitPrice != null) { 512 if(this.unitPrice.equals(unitPrice)) { 513 update = false; 514 } 515 } else if(unitPrice == null) { 516 update = false; 517 } 518 519 if(update) { 520 this.unitPrice = unitPrice; 521 unitPriceHasBeenModified = true; 522 clearHashAndString(); 523 } 524 } 525 526 public boolean getUnitPriceHasBeenModified() { 527 return unitPriceHasBeenModified; 528 } 529 530 public Long getFromTime() { 531 return fromTime; 532 } 533 534 public void setFromTime(Long fromTime) 535 throws PersistenceNotNullException { 536 checkForNull(fromTime); 537 538 boolean update = true; 539 540 if(this.fromTime != null) { 541 if(this.fromTime.equals(fromTime)) { 542 update = false; 543 } 544 } else if(fromTime == null) { 545 update = false; 546 } 547 548 if(update) { 549 this.fromTime = fromTime; 550 fromTimeHasBeenModified = true; 551 clearHashAndString(); 552 } 553 } 554 555 public boolean getFromTimeHasBeenModified() { 556 return fromTimeHasBeenModified; 557 } 558 559 public Long getThruTime() { 560 return thruTime; 561 } 562 563 public void setThruTime(Long thruTime) 564 throws PersistenceNotNullException { 565 checkForNull(thruTime); 566 567 boolean update = true; 568 569 if(this.thruTime != null) { 570 if(this.thruTime.equals(thruTime)) { 571 update = false; 572 } 573 } else if(thruTime == null) { 574 update = false; 575 } 576 577 if(update) { 578 this.thruTime = thruTime; 579 thruTimeHasBeenModified = true; 580 clearHashAndString(); 581 } 582 } 583 584 public boolean getThruTimeHasBeenModified() { 585 return thruTimeHasBeenModified; 586 } 587 588}