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 * 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 042public class ContentCatalogItemValue 043 extends BaseValue<ContentCatalogItemPK> 044 implements Cloneable, Serializable { 045 046 private ContentCatalogPK contentCatalogPK; 047 private boolean contentCatalogPKHasBeenModified = false; 048 private ItemPK itemPK; 049 private boolean itemPKHasBeenModified = false; 050 private InventoryConditionPK inventoryConditionPK; 051 private boolean inventoryConditionPKHasBeenModified = false; 052 private UnitOfMeasureTypePK unitOfMeasureTypePK; 053 private boolean unitOfMeasureTypePKHasBeenModified = false; 054 private CurrencyPK currencyPK; 055 private boolean currencyPKHasBeenModified = false; 056 private Long fromTime; 057 private boolean fromTimeHasBeenModified = false; 058 private Long thruTime; 059 private boolean thruTimeHasBeenModified = false; 060 061 private transient Integer _hashCode = null; 062 private transient String _stringValue = null; 063 064 private void constructFields(ContentCatalogPK contentCatalogPK, ItemPK itemPK, InventoryConditionPK inventoryConditionPK, UnitOfMeasureTypePK unitOfMeasureTypePK, CurrencyPK currencyPK, Long fromTime, Long thruTime) 065 throws PersistenceNotNullException { 066 checkForNull(contentCatalogPK); 067 this.contentCatalogPK = contentCatalogPK; 068 checkForNull(itemPK); 069 this.itemPK = itemPK; 070 checkForNull(inventoryConditionPK); 071 this.inventoryConditionPK = inventoryConditionPK; 072 checkForNull(unitOfMeasureTypePK); 073 this.unitOfMeasureTypePK = unitOfMeasureTypePK; 074 checkForNull(currencyPK); 075 this.currencyPK = currencyPK; 076 checkForNull(fromTime); 077 this.fromTime = fromTime; 078 checkForNull(thruTime); 079 this.thruTime = thruTime; 080 } 081 082 /** Creates a new instance of ContentCatalogItemValue */ 083 public ContentCatalogItemValue(ContentCatalogItemPK contentCatalogItemPK, ContentCatalogPK contentCatalogPK, ItemPK itemPK, InventoryConditionPK inventoryConditionPK, UnitOfMeasureTypePK unitOfMeasureTypePK, CurrencyPK currencyPK, Long fromTime, Long thruTime) 084 throws PersistenceNotNullException { 085 super(contentCatalogItemPK); 086 constructFields(contentCatalogPK, itemPK, inventoryConditionPK, unitOfMeasureTypePK, currencyPK, fromTime, thruTime); 087 } 088 089 /** Creates a new instance of ContentCatalogItemValue */ 090 public ContentCatalogItemValue(ContentCatalogPK contentCatalogPK, ItemPK itemPK, InventoryConditionPK inventoryConditionPK, UnitOfMeasureTypePK unitOfMeasureTypePK, CurrencyPK currencyPK, Long fromTime, Long thruTime) 091 throws PersistenceNotNullException { 092 super(); 093 constructFields(contentCatalogPK, itemPK, inventoryConditionPK, unitOfMeasureTypePK, currencyPK, fromTime, thruTime); 094 } 095 096 @Override 097 public ContentCatalogItemFactory getBaseFactoryInstance() { 098 return ContentCatalogItemFactory.getInstance(); 099 } 100 101 @Override 102 public ContentCatalogItemValue clone() { 103 Object result; 104 105 try { 106 result = super.clone(); 107 } catch (CloneNotSupportedException cnse) { 108 // This shouldn't happen, fail when it does. 109 throw new PersistenceCloneException(cnse); 110 } 111 112 return (ContentCatalogItemValue)result; 113 } 114 115 @Override 116 public ContentCatalogItemPK getPrimaryKey() { 117 if(_primaryKey == null) { 118 _primaryKey = new ContentCatalogItemPK(entityId); 119 } 120 121 return _primaryKey; 122 } 123 124 private void clearHashAndString() { 125 _hashCode = null; 126 _stringValue = null; 127 } 128 129 @Override 130 public int hashCode() { 131 if(_hashCode == null) { 132 int hashCode = 17; 133 134 hashCode = 37 * hashCode + ((entityId != null) ? entityId.hashCode() : 0); 135 136 hashCode = 37 * hashCode + ((contentCatalogPK != null) ? contentCatalogPK.hashCode() : 0); 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 + ((fromTime != null) ? fromTime.hashCode() : 0); 142 hashCode = 37 * hashCode + ((thruTime != null) ? thruTime.hashCode() : 0); 143 144 _hashCode = hashCode; 145 } 146 147 return _hashCode; 148 } 149 150 @Override 151 public String toString() { 152 if(_stringValue == null) { 153 StringBuilder stringValue = new StringBuilder("{"); 154 155 stringValue.append("entityId=").append(getEntityId()); 156 157 stringValue.append(", contentCatalogPK=").append(getContentCatalogPK()); 158 stringValue.append(", itemPK=").append(getItemPK()); 159 stringValue.append(", inventoryConditionPK=").append(getInventoryConditionPK()); 160 stringValue.append(", unitOfMeasureTypePK=").append(getUnitOfMeasureTypePK()); 161 stringValue.append(", currencyPK=").append(getCurrencyPK()); 162 stringValue.append(", fromTime=").append(getFromTime()); 163 stringValue.append(", thruTime=").append(getThruTime()); 164 165 stringValue.append('}'); 166 167 _stringValue = stringValue.toString(); 168 } 169 return _stringValue; 170 } 171 172 @Override 173 public boolean equals(Object other) { 174 if(this == other) 175 return true; 176 177 if(!hasIdentity()) 178 return false; 179 180 if(other instanceof ContentCatalogItemValue) { 181 ContentCatalogItemValue that = (ContentCatalogItemValue)other; 182 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 = 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) { 201 ContentCatalogItemValue that = (ContentCatalogItemValue)other; 202 boolean objectsEqual = true; 203 204 205 if(objectsEqual) { 206 ContentCatalogPK thisContentCatalogPK = getContentCatalogPK(); 207 ContentCatalogPK thatContentCatalogPK = that.getContentCatalogPK(); 208 209 if(thisContentCatalogPK == null) { 210 objectsEqual = objectsEqual && (thatContentCatalogPK == null); 211 } else { 212 objectsEqual = objectsEqual && thisContentCatalogPK.equals(thatContentCatalogPK); 213 } 214 } 215 216 if(objectsEqual) { 217 ItemPK thisItemPK = getItemPK(); 218 ItemPK thatItemPK = that.getItemPK(); 219 220 if(thisItemPK == null) { 221 objectsEqual = objectsEqual && (thatItemPK == null); 222 } else { 223 objectsEqual = objectsEqual && thisItemPK.equals(thatItemPK); 224 } 225 } 226 227 if(objectsEqual) { 228 InventoryConditionPK thisInventoryConditionPK = getInventoryConditionPK(); 229 InventoryConditionPK thatInventoryConditionPK = that.getInventoryConditionPK(); 230 231 if(thisInventoryConditionPK == null) { 232 objectsEqual = objectsEqual && (thatInventoryConditionPK == null); 233 } else { 234 objectsEqual = objectsEqual && thisInventoryConditionPK.equals(thatInventoryConditionPK); 235 } 236 } 237 238 if(objectsEqual) { 239 UnitOfMeasureTypePK thisUnitOfMeasureTypePK = getUnitOfMeasureTypePK(); 240 UnitOfMeasureTypePK thatUnitOfMeasureTypePK = that.getUnitOfMeasureTypePK(); 241 242 if(thisUnitOfMeasureTypePK == null) { 243 objectsEqual = objectsEqual && (thatUnitOfMeasureTypePK == null); 244 } else { 245 objectsEqual = objectsEqual && thisUnitOfMeasureTypePK.equals(thatUnitOfMeasureTypePK); 246 } 247 } 248 249 if(objectsEqual) { 250 CurrencyPK thisCurrencyPK = getCurrencyPK(); 251 CurrencyPK thatCurrencyPK = that.getCurrencyPK(); 252 253 if(thisCurrencyPK == null) { 254 objectsEqual = objectsEqual && (thatCurrencyPK == null); 255 } else { 256 objectsEqual = objectsEqual && thisCurrencyPK.equals(thatCurrencyPK); 257 } 258 } 259 260 if(objectsEqual) { 261 Long thisFromTime = getFromTime(); 262 Long thatFromTime = that.getFromTime(); 263 264 if(thisFromTime == null) { 265 objectsEqual = objectsEqual && (thatFromTime == null); 266 } else { 267 objectsEqual = objectsEqual && thisFromTime.equals(thatFromTime); 268 } 269 } 270 271 if(objectsEqual) { 272 Long thisThruTime = getThruTime(); 273 Long thatThruTime = that.getThruTime(); 274 275 if(thisThruTime == null) { 276 objectsEqual = objectsEqual && (thatThruTime == null); 277 } else { 278 objectsEqual = objectsEqual && thisThruTime.equals(thatThruTime); 279 } 280 } 281 282 return objectsEqual; 283 } else { 284 return false; 285 } 286 } 287 288 @Override 289 public boolean hasBeenModified() { 290 return contentCatalogPKHasBeenModified || itemPKHasBeenModified || inventoryConditionPKHasBeenModified || unitOfMeasureTypePKHasBeenModified || currencyPKHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified; 291 } 292 293 @Override 294 public void clearHasBeenModified() { 295 contentCatalogPKHasBeenModified = false; 296 itemPKHasBeenModified = false; 297 inventoryConditionPKHasBeenModified = false; 298 unitOfMeasureTypePKHasBeenModified = false; 299 currencyPKHasBeenModified = false; 300 fromTimeHasBeenModified = false; 301 thruTimeHasBeenModified = false; 302 } 303 304 public ContentCatalogPK getContentCatalogPK() { 305 return contentCatalogPK; 306 } 307 308 public void setContentCatalogPK(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 public ItemPK getItemPK() { 334 return itemPK; 335 } 336 337 public void setItemPK(ItemPK itemPK) 338 throws PersistenceNotNullException { 339 checkForNull(itemPK); 340 341 boolean update = true; 342 343 if(this.itemPK != null) { 344 if(this.itemPK.equals(itemPK)) { 345 update = false; 346 } 347 } else if(itemPK == null) { 348 update = false; 349 } 350 351 if(update) { 352 this.itemPK = itemPK; 353 itemPKHasBeenModified = true; 354 clearHashAndString(); 355 } 356 } 357 358 public boolean getItemPKHasBeenModified() { 359 return itemPKHasBeenModified; 360 } 361 362 public InventoryConditionPK getInventoryConditionPK() { 363 return inventoryConditionPK; 364 } 365 366 public void setInventoryConditionPK(InventoryConditionPK inventoryConditionPK) 367 throws PersistenceNotNullException { 368 checkForNull(inventoryConditionPK); 369 370 boolean update = true; 371 372 if(this.inventoryConditionPK != null) { 373 if(this.inventoryConditionPK.equals(inventoryConditionPK)) { 374 update = false; 375 } 376 } else if(inventoryConditionPK == null) { 377 update = false; 378 } 379 380 if(update) { 381 this.inventoryConditionPK = inventoryConditionPK; 382 inventoryConditionPKHasBeenModified = true; 383 clearHashAndString(); 384 } 385 } 386 387 public boolean getInventoryConditionPKHasBeenModified() { 388 return inventoryConditionPKHasBeenModified; 389 } 390 391 public UnitOfMeasureTypePK getUnitOfMeasureTypePK() { 392 return unitOfMeasureTypePK; 393 } 394 395 public void setUnitOfMeasureTypePK(UnitOfMeasureTypePK unitOfMeasureTypePK) 396 throws PersistenceNotNullException { 397 checkForNull(unitOfMeasureTypePK); 398 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 CurrencyPK getCurrencyPK() { 421 return currencyPK; 422 } 423 424 public void setCurrencyPK(CurrencyPK currencyPK) 425 throws PersistenceNotNullException { 426 checkForNull(currencyPK); 427 428 boolean update = true; 429 430 if(this.currencyPK != null) { 431 if(this.currencyPK.equals(currencyPK)) { 432 update = false; 433 } 434 } else if(currencyPK == null) { 435 update = false; 436 } 437 438 if(update) { 439 this.currencyPK = currencyPK; 440 currencyPKHasBeenModified = true; 441 clearHashAndString(); 442 } 443 } 444 445 public boolean getCurrencyPKHasBeenModified() { 446 return currencyPKHasBeenModified; 447 } 448 449 public Long getFromTime() { 450 return fromTime; 451 } 452 453 public void setFromTime(Long fromTime) 454 throws PersistenceNotNullException { 455 checkForNull(fromTime); 456 457 boolean update = true; 458 459 if(this.fromTime != null) { 460 if(this.fromTime.equals(fromTime)) { 461 update = false; 462 } 463 } else if(fromTime == null) { 464 update = false; 465 } 466 467 if(update) { 468 this.fromTime = fromTime; 469 fromTimeHasBeenModified = true; 470 clearHashAndString(); 471 } 472 } 473 474 public boolean getFromTimeHasBeenModified() { 475 return fromTimeHasBeenModified; 476 } 477 478 public Long getThruTime() { 479 return thruTime; 480 } 481 482 public void setThruTime(Long thruTime) 483 throws PersistenceNotNullException { 484 checkForNull(thruTime); 485 486 boolean update = true; 487 488 if(this.thruTime != null) { 489 if(this.thruTime.equals(thruTime)) { 490 update = false; 491 } 492 } else if(thruTime == null) { 493 update = false; 494 } 495 496 if(update) { 497 this.thruTime = thruTime; 498 thruTimeHasBeenModified = true; 499 clearHashAndString(); 500 } 501 } 502 503 public boolean getThruTimeHasBeenModified() { 504 return thruTimeHasBeenModified; 505 } 506 507}