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