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 * InventoryLocationAssignmentValue.java 021 */ 022 023package com.echothree.model.data.inventory.server.value; 024 025import com.echothree.model.data.inventory.common.pk.InventoryLocationAssignmentPK; 026 027import com.echothree.model.data.inventory.server.factory.InventoryLocationAssignmentFactory; 028 029import com.echothree.model.data.warehouse.common.pk.LocationPK; 030import com.echothree.model.data.party.common.pk.PartyPK; 031import com.echothree.model.data.item.common.pk.ItemPK; 032import com.echothree.model.data.uom.common.pk.UnitOfMeasureTypePK; 033import com.echothree.model.data.inventory.common.pk.InventoryConditionPK; 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 InventoryLocationAssignmentValue 043 extends BaseValue<InventoryLocationAssignmentPK> 044 implements Cloneable, Serializable { 045 046 private LocationPK locationPK; 047 private boolean locationPKHasBeenModified = false; 048 private PartyPK ownerPartyPK; 049 private boolean ownerPartyPKHasBeenModified = false; 050 private ItemPK itemPK; 051 private boolean itemPKHasBeenModified = false; 052 private UnitOfMeasureTypePK unitOfMeasureTypePK; 053 private boolean unitOfMeasureTypePKHasBeenModified = false; 054 private InventoryConditionPK inventoryConditionPK; 055 private boolean inventoryConditionPKHasBeenModified = 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(LocationPK locationPK, PartyPK ownerPartyPK, ItemPK itemPK, UnitOfMeasureTypePK unitOfMeasureTypePK, InventoryConditionPK inventoryConditionPK, Long fromTime, Long thruTime) 065 throws PersistenceNotNullException { 066 checkForNull(locationPK); 067 this.locationPK = locationPK; 068 checkForNull(ownerPartyPK); 069 this.ownerPartyPK = ownerPartyPK; 070 checkForNull(itemPK); 071 this.itemPK = itemPK; 072 checkForNull(unitOfMeasureTypePK); 073 this.unitOfMeasureTypePK = unitOfMeasureTypePK; 074 checkForNull(inventoryConditionPK); 075 this.inventoryConditionPK = inventoryConditionPK; 076 checkForNull(fromTime); 077 this.fromTime = fromTime; 078 checkForNull(thruTime); 079 this.thruTime = thruTime; 080 } 081 082 /** Creates a new instance of InventoryLocationAssignmentValue */ 083 public InventoryLocationAssignmentValue(InventoryLocationAssignmentPK inventoryLocationAssignmentPK, LocationPK locationPK, PartyPK ownerPartyPK, ItemPK itemPK, UnitOfMeasureTypePK unitOfMeasureTypePK, InventoryConditionPK inventoryConditionPK, Long fromTime, Long thruTime) 084 throws PersistenceNotNullException { 085 super(inventoryLocationAssignmentPK); 086 constructFields(locationPK, ownerPartyPK, itemPK, unitOfMeasureTypePK, inventoryConditionPK, fromTime, thruTime); 087 } 088 089 /** Creates a new instance of InventoryLocationAssignmentValue */ 090 public InventoryLocationAssignmentValue(LocationPK locationPK, PartyPK ownerPartyPK, ItemPK itemPK, UnitOfMeasureTypePK unitOfMeasureTypePK, InventoryConditionPK inventoryConditionPK, Long fromTime, Long thruTime) 091 throws PersistenceNotNullException { 092 super(); 093 constructFields(locationPK, ownerPartyPK, itemPK, unitOfMeasureTypePK, inventoryConditionPK, fromTime, thruTime); 094 } 095 096 @Override 097 public InventoryLocationAssignmentFactory getBaseFactoryInstance() { 098 return InventoryLocationAssignmentFactory.getInstance(); 099 } 100 101 @Override 102 public InventoryLocationAssignmentValue 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 (InventoryLocationAssignmentValue)result; 113 } 114 115 @Override 116 public InventoryLocationAssignmentPK getPrimaryKey() { 117 if(_primaryKey == null) { 118 _primaryKey = new InventoryLocationAssignmentPK(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 + ((locationPK != null) ? locationPK.hashCode() : 0); 137 hashCode = 37 * hashCode + ((ownerPartyPK != null) ? ownerPartyPK.hashCode() : 0); 138 hashCode = 37 * hashCode + ((itemPK != null) ? itemPK.hashCode() : 0); 139 hashCode = 37 * hashCode + ((unitOfMeasureTypePK != null) ? unitOfMeasureTypePK.hashCode() : 0); 140 hashCode = 37 * hashCode + ((inventoryConditionPK != null) ? inventoryConditionPK.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 _stringValue = "{" + 154 "entityId=" + getEntityId() + 155 ", locationPK=" + getLocationPK() + 156 ", ownerPartyPK=" + getOwnerPartyPK() + 157 ", itemPK=" + getItemPK() + 158 ", unitOfMeasureTypePK=" + getUnitOfMeasureTypePK() + 159 ", inventoryConditionPK=" + getInventoryConditionPK() + 160 ", fromTime=" + getFromTime() + 161 ", thruTime=" + getThruTime() + 162 "}"; 163 } 164 return _stringValue; 165 } 166 167 @Override 168 public boolean equals(Object other) { 169 if(this == other) 170 return true; 171 172 if(!hasIdentity()) 173 return false; 174 175 if(other instanceof InventoryLocationAssignmentValue that) { 176 if(!that.hasIdentity()) 177 return false; 178 179 Long thisEntityId = getEntityId(); 180 Long thatEntityId = that.getEntityId(); 181 182 boolean objectsEqual = thisEntityId.equals(thatEntityId); 183 if(objectsEqual) 184 objectsEqual = isIdentical(that); 185 186 return objectsEqual; 187 } else { 188 return false; 189 } 190 } 191 192 public boolean isIdentical(Object other) { 193 if(other instanceof InventoryLocationAssignmentValue that) { 194 boolean objectsEqual = true; 195 196 197 if(objectsEqual) { 198 LocationPK thisLocationPK = getLocationPK(); 199 LocationPK thatLocationPK = that.getLocationPK(); 200 201 if(thisLocationPK == null) { 202 objectsEqual = objectsEqual && (thatLocationPK == null); 203 } else { 204 objectsEqual = objectsEqual && thisLocationPK.equals(thatLocationPK); 205 } 206 } 207 208 if(objectsEqual) { 209 PartyPK thisOwnerPartyPK = getOwnerPartyPK(); 210 PartyPK thatOwnerPartyPK = that.getOwnerPartyPK(); 211 212 if(thisOwnerPartyPK == null) { 213 objectsEqual = objectsEqual && (thatOwnerPartyPK == null); 214 } else { 215 objectsEqual = objectsEqual && thisOwnerPartyPK.equals(thatOwnerPartyPK); 216 } 217 } 218 219 if(objectsEqual) { 220 ItemPK thisItemPK = getItemPK(); 221 ItemPK thatItemPK = that.getItemPK(); 222 223 if(thisItemPK == null) { 224 objectsEqual = objectsEqual && (thatItemPK == null); 225 } else { 226 objectsEqual = objectsEqual && thisItemPK.equals(thatItemPK); 227 } 228 } 229 230 if(objectsEqual) { 231 UnitOfMeasureTypePK thisUnitOfMeasureTypePK = getUnitOfMeasureTypePK(); 232 UnitOfMeasureTypePK thatUnitOfMeasureTypePK = that.getUnitOfMeasureTypePK(); 233 234 if(thisUnitOfMeasureTypePK == null) { 235 objectsEqual = objectsEqual && (thatUnitOfMeasureTypePK == null); 236 } else { 237 objectsEqual = objectsEqual && thisUnitOfMeasureTypePK.equals(thatUnitOfMeasureTypePK); 238 } 239 } 240 241 if(objectsEqual) { 242 InventoryConditionPK thisInventoryConditionPK = getInventoryConditionPK(); 243 InventoryConditionPK thatInventoryConditionPK = that.getInventoryConditionPK(); 244 245 if(thisInventoryConditionPK == null) { 246 objectsEqual = objectsEqual && (thatInventoryConditionPK == null); 247 } else { 248 objectsEqual = objectsEqual && thisInventoryConditionPK.equals(thatInventoryConditionPK); 249 } 250 } 251 252 if(objectsEqual) { 253 Long thisFromTime = getFromTime(); 254 Long thatFromTime = that.getFromTime(); 255 256 if(thisFromTime == null) { 257 objectsEqual = objectsEqual && (thatFromTime == null); 258 } else { 259 objectsEqual = objectsEqual && thisFromTime.equals(thatFromTime); 260 } 261 } 262 263 if(objectsEqual) { 264 Long thisThruTime = getThruTime(); 265 Long thatThruTime = that.getThruTime(); 266 267 if(thisThruTime == null) { 268 objectsEqual = objectsEqual && (thatThruTime == null); 269 } else { 270 objectsEqual = objectsEqual && thisThruTime.equals(thatThruTime); 271 } 272 } 273 274 return objectsEqual; 275 } else { 276 return false; 277 } 278 } 279 280 @Override 281 public boolean hasBeenModified() { 282 return locationPKHasBeenModified || ownerPartyPKHasBeenModified || itemPKHasBeenModified || unitOfMeasureTypePKHasBeenModified || inventoryConditionPKHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified; 283 } 284 285 @Override 286 public void clearHasBeenModified() { 287 locationPKHasBeenModified = false; 288 ownerPartyPKHasBeenModified = false; 289 itemPKHasBeenModified = false; 290 unitOfMeasureTypePKHasBeenModified = false; 291 inventoryConditionPKHasBeenModified = false; 292 fromTimeHasBeenModified = false; 293 thruTimeHasBeenModified = false; 294 } 295 296 public LocationPK getLocationPK() { 297 return locationPK; 298 } 299 300 public void setLocationPK(LocationPK locationPK) 301 throws PersistenceNotNullException { 302 checkForNull(locationPK); 303 304 boolean update = true; 305 306 if(this.locationPK != null) { 307 if(this.locationPK.equals(locationPK)) { 308 update = false; 309 } 310 } else if(locationPK == null) { 311 update = false; 312 } 313 314 if(update) { 315 this.locationPK = locationPK; 316 locationPKHasBeenModified = true; 317 clearHashAndString(); 318 } 319 } 320 321 public boolean getLocationPKHasBeenModified() { 322 return locationPKHasBeenModified; 323 } 324 325 public PartyPK getOwnerPartyPK() { 326 return ownerPartyPK; 327 } 328 329 public void setOwnerPartyPK(PartyPK ownerPartyPK) 330 throws PersistenceNotNullException { 331 checkForNull(ownerPartyPK); 332 333 boolean update = true; 334 335 if(this.ownerPartyPK != null) { 336 if(this.ownerPartyPK.equals(ownerPartyPK)) { 337 update = false; 338 } 339 } else if(ownerPartyPK == null) { 340 update = false; 341 } 342 343 if(update) { 344 this.ownerPartyPK = ownerPartyPK; 345 ownerPartyPKHasBeenModified = true; 346 clearHashAndString(); 347 } 348 } 349 350 public boolean getOwnerPartyPKHasBeenModified() { 351 return ownerPartyPKHasBeenModified; 352 } 353 354 public ItemPK getItemPK() { 355 return itemPK; 356 } 357 358 public void setItemPK(ItemPK itemPK) 359 throws PersistenceNotNullException { 360 checkForNull(itemPK); 361 362 boolean update = true; 363 364 if(this.itemPK != null) { 365 if(this.itemPK.equals(itemPK)) { 366 update = false; 367 } 368 } else if(itemPK == null) { 369 update = false; 370 } 371 372 if(update) { 373 this.itemPK = itemPK; 374 itemPKHasBeenModified = true; 375 clearHashAndString(); 376 } 377 } 378 379 public boolean getItemPKHasBeenModified() { 380 return itemPKHasBeenModified; 381 } 382 383 public UnitOfMeasureTypePK getUnitOfMeasureTypePK() { 384 return unitOfMeasureTypePK; 385 } 386 387 public void setUnitOfMeasureTypePK(UnitOfMeasureTypePK unitOfMeasureTypePK) 388 throws PersistenceNotNullException { 389 checkForNull(unitOfMeasureTypePK); 390 391 boolean update = true; 392 393 if(this.unitOfMeasureTypePK != null) { 394 if(this.unitOfMeasureTypePK.equals(unitOfMeasureTypePK)) { 395 update = false; 396 } 397 } else if(unitOfMeasureTypePK == null) { 398 update = false; 399 } 400 401 if(update) { 402 this.unitOfMeasureTypePK = unitOfMeasureTypePK; 403 unitOfMeasureTypePKHasBeenModified = true; 404 clearHashAndString(); 405 } 406 } 407 408 public boolean getUnitOfMeasureTypePKHasBeenModified() { 409 return unitOfMeasureTypePKHasBeenModified; 410 } 411 412 public InventoryConditionPK getInventoryConditionPK() { 413 return inventoryConditionPK; 414 } 415 416 public void setInventoryConditionPK(InventoryConditionPK inventoryConditionPK) 417 throws PersistenceNotNullException { 418 checkForNull(inventoryConditionPK); 419 420 boolean update = true; 421 422 if(this.inventoryConditionPK != null) { 423 if(this.inventoryConditionPK.equals(inventoryConditionPK)) { 424 update = false; 425 } 426 } else if(inventoryConditionPK == null) { 427 update = false; 428 } 429 430 if(update) { 431 this.inventoryConditionPK = inventoryConditionPK; 432 inventoryConditionPKHasBeenModified = true; 433 clearHashAndString(); 434 } 435 } 436 437 public boolean getInventoryConditionPKHasBeenModified() { 438 return inventoryConditionPKHasBeenModified; 439 } 440 441 public Long getFromTime() { 442 return fromTime; 443 } 444 445 public void setFromTime(Long fromTime) 446 throws PersistenceNotNullException { 447 checkForNull(fromTime); 448 449 boolean update = true; 450 451 if(this.fromTime != null) { 452 if(this.fromTime.equals(fromTime)) { 453 update = false; 454 } 455 } else if(fromTime == null) { 456 update = false; 457 } 458 459 if(update) { 460 this.fromTime = fromTime; 461 fromTimeHasBeenModified = true; 462 clearHashAndString(); 463 } 464 } 465 466 public boolean getFromTimeHasBeenModified() { 467 return fromTimeHasBeenModified; 468 } 469 470 public Long getThruTime() { 471 return thruTime; 472 } 473 474 public void setThruTime(Long thruTime) 475 throws PersistenceNotNullException { 476 checkForNull(thruTime); 477 478 boolean update = true; 479 480 if(this.thruTime != null) { 481 if(this.thruTime.equals(thruTime)) { 482 update = false; 483 } 484 } else if(thruTime == null) { 485 update = false; 486 } 487 488 if(update) { 489 this.thruTime = thruTime; 490 thruTimeHasBeenModified = true; 491 clearHashAndString(); 492 } 493 } 494 495 public boolean getThruTimeHasBeenModified() { 496 return thruTimeHasBeenModified; 497 } 498 499}