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