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