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