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