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 * InventoryConditionGlAccountValue.java 021 */ 022 023package com.echothree.model.data.inventory.server.value; 024 025import com.echothree.model.data.inventory.common.pk.InventoryConditionGlAccountPK; 026 027import com.echothree.model.data.inventory.server.factory.InventoryConditionGlAccountFactory; 028 029import com.echothree.model.data.inventory.common.pk.InventoryConditionPK; 030import com.echothree.model.data.accounting.common.pk.ItemAccountingCategoryPK; 031import com.echothree.model.data.accounting.common.pk.GlAccountPK; 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 InventoryConditionGlAccountValue 041 extends BaseValue<InventoryConditionGlAccountPK> 042 implements Cloneable, Serializable { 043 044 private InventoryConditionPK inventoryConditionPK; 045 private boolean inventoryConditionPKHasBeenModified = false; 046 private ItemAccountingCategoryPK itemAccountingCategoryPK; 047 private boolean itemAccountingCategoryPKHasBeenModified = false; 048 private GlAccountPK inventoryGlAccountPK; 049 private boolean inventoryGlAccountPKHasBeenModified = false; 050 private GlAccountPK salesGlAccountPK; 051 private boolean salesGlAccountPKHasBeenModified = false; 052 private GlAccountPK returnsGlAccountPK; 053 private boolean returnsGlAccountPKHasBeenModified = false; 054 private GlAccountPK cogsGlAccountPK; 055 private boolean cogsGlAccountPKHasBeenModified = false; 056 private GlAccountPK returnsCogsGlAccountPK; 057 private boolean returnsCogsGlAccountPKHasBeenModified = 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(InventoryConditionPK inventoryConditionPK, ItemAccountingCategoryPK itemAccountingCategoryPK, GlAccountPK inventoryGlAccountPK, GlAccountPK salesGlAccountPK, GlAccountPK returnsGlAccountPK, GlAccountPK cogsGlAccountPK, GlAccountPK returnsCogsGlAccountPK, Long fromTime, Long thruTime) 067 throws PersistenceNotNullException { 068 checkForNull(inventoryConditionPK); 069 this.inventoryConditionPK = inventoryConditionPK; 070 checkForNull(itemAccountingCategoryPK); 071 this.itemAccountingCategoryPK = itemAccountingCategoryPK; 072 this.inventoryGlAccountPK = inventoryGlAccountPK; 073 this.salesGlAccountPK = salesGlAccountPK; 074 this.returnsGlAccountPK = returnsGlAccountPK; 075 this.cogsGlAccountPK = cogsGlAccountPK; 076 this.returnsCogsGlAccountPK = returnsCogsGlAccountPK; 077 checkForNull(fromTime); 078 this.fromTime = fromTime; 079 checkForNull(thruTime); 080 this.thruTime = thruTime; 081 } 082 083 /** Creates a new instance of InventoryConditionGlAccountValue */ 084 public InventoryConditionGlAccountValue(InventoryConditionGlAccountPK inventoryConditionGlAccountPK, InventoryConditionPK inventoryConditionPK, ItemAccountingCategoryPK itemAccountingCategoryPK, GlAccountPK inventoryGlAccountPK, GlAccountPK salesGlAccountPK, GlAccountPK returnsGlAccountPK, GlAccountPK cogsGlAccountPK, GlAccountPK returnsCogsGlAccountPK, Long fromTime, Long thruTime) 085 throws PersistenceNotNullException { 086 super(inventoryConditionGlAccountPK); 087 constructFields(inventoryConditionPK, itemAccountingCategoryPK, inventoryGlAccountPK, salesGlAccountPK, returnsGlAccountPK, cogsGlAccountPK, returnsCogsGlAccountPK, fromTime, thruTime); 088 } 089 090 /** Creates a new instance of InventoryConditionGlAccountValue */ 091 public InventoryConditionGlAccountValue(InventoryConditionPK inventoryConditionPK, ItemAccountingCategoryPK itemAccountingCategoryPK, GlAccountPK inventoryGlAccountPK, GlAccountPK salesGlAccountPK, GlAccountPK returnsGlAccountPK, GlAccountPK cogsGlAccountPK, GlAccountPK returnsCogsGlAccountPK, Long fromTime, Long thruTime) 092 throws PersistenceNotNullException { 093 super(); 094 constructFields(inventoryConditionPK, itemAccountingCategoryPK, inventoryGlAccountPK, salesGlAccountPK, returnsGlAccountPK, cogsGlAccountPK, returnsCogsGlAccountPK, fromTime, thruTime); 095 } 096 097 @Override 098 public InventoryConditionGlAccountFactory getBaseFactoryInstance() { 099 return InventoryConditionGlAccountFactory.getInstance(); 100 } 101 102 @Override 103 public InventoryConditionGlAccountValue clone() { 104 Object result; 105 106 try { 107 result = super.clone(); 108 } catch (CloneNotSupportedException cnse) { 109 // This shouldn't happen, fail when it does. 110 throw new PersistenceCloneException(cnse); 111 } 112 113 return (InventoryConditionGlAccountValue)result; 114 } 115 116 @Override 117 public InventoryConditionGlAccountPK getPrimaryKey() { 118 if(_primaryKey == null) { 119 _primaryKey = new InventoryConditionGlAccountPK(entityId); 120 } 121 122 return _primaryKey; 123 } 124 125 private void clearHashAndString() { 126 _hashCode = null; 127 _stringValue = null; 128 } 129 130 @Override 131 public int hashCode() { 132 if(_hashCode == null) { 133 int hashCode = 17; 134 135 hashCode = 37 * hashCode + ((entityId != null) ? entityId.hashCode() : 0); 136 137 hashCode = 37 * hashCode + ((inventoryConditionPK != null) ? inventoryConditionPK.hashCode() : 0); 138 hashCode = 37 * hashCode + ((itemAccountingCategoryPK != null) ? itemAccountingCategoryPK.hashCode() : 0); 139 hashCode = 37 * hashCode + ((inventoryGlAccountPK != null) ? inventoryGlAccountPK.hashCode() : 0); 140 hashCode = 37 * hashCode + ((salesGlAccountPK != null) ? salesGlAccountPK.hashCode() : 0); 141 hashCode = 37 * hashCode + ((returnsGlAccountPK != null) ? returnsGlAccountPK.hashCode() : 0); 142 hashCode = 37 * hashCode + ((cogsGlAccountPK != null) ? cogsGlAccountPK.hashCode() : 0); 143 hashCode = 37 * hashCode + ((returnsCogsGlAccountPK != null) ? returnsCogsGlAccountPK.hashCode() : 0); 144 hashCode = 37 * hashCode + ((fromTime != null) ? fromTime.hashCode() : 0); 145 hashCode = 37 * hashCode + ((thruTime != null) ? thruTime.hashCode() : 0); 146 147 _hashCode = hashCode; 148 } 149 150 return _hashCode; 151 } 152 153 @Override 154 public String toString() { 155 if(_stringValue == null) { 156 _stringValue = "{" + 157 "entityId=" + getEntityId() + 158 ", inventoryConditionPK=" + getInventoryConditionPK() + 159 ", itemAccountingCategoryPK=" + getItemAccountingCategoryPK() + 160 ", inventoryGlAccountPK=" + getInventoryGlAccountPK() + 161 ", salesGlAccountPK=" + getSalesGlAccountPK() + 162 ", returnsGlAccountPK=" + getReturnsGlAccountPK() + 163 ", cogsGlAccountPK=" + getCogsGlAccountPK() + 164 ", returnsCogsGlAccountPK=" + getReturnsCogsGlAccountPK() + 165 ", fromTime=" + getFromTime() + 166 ", thruTime=" + getThruTime() + 167 "}"; 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 InventoryConditionGlAccountValue that) { 181 if(!that.hasIdentity()) 182 return false; 183 184 Long thisEntityId = getEntityId(); 185 Long thatEntityId = that.getEntityId(); 186 187 boolean objectsEqual = thisEntityId.equals(thatEntityId); 188 if(objectsEqual) 189 objectsEqual = isIdentical(that); 190 191 return objectsEqual; 192 } else { 193 return false; 194 } 195 } 196 197 public boolean isIdentical(Object other) { 198 if(other instanceof InventoryConditionGlAccountValue that) { 199 boolean objectsEqual = true; 200 201 202 if(objectsEqual) { 203 InventoryConditionPK thisInventoryConditionPK = getInventoryConditionPK(); 204 InventoryConditionPK thatInventoryConditionPK = that.getInventoryConditionPK(); 205 206 if(thisInventoryConditionPK == null) { 207 objectsEqual = objectsEqual && (thatInventoryConditionPK == null); 208 } else { 209 objectsEqual = objectsEqual && thisInventoryConditionPK.equals(thatInventoryConditionPK); 210 } 211 } 212 213 if(objectsEqual) { 214 ItemAccountingCategoryPK thisItemAccountingCategoryPK = getItemAccountingCategoryPK(); 215 ItemAccountingCategoryPK thatItemAccountingCategoryPK = that.getItemAccountingCategoryPK(); 216 217 if(thisItemAccountingCategoryPK == null) { 218 objectsEqual = objectsEqual && (thatItemAccountingCategoryPK == null); 219 } else { 220 objectsEqual = objectsEqual && thisItemAccountingCategoryPK.equals(thatItemAccountingCategoryPK); 221 } 222 } 223 224 if(objectsEqual) { 225 GlAccountPK thisInventoryGlAccountPK = getInventoryGlAccountPK(); 226 GlAccountPK thatInventoryGlAccountPK = that.getInventoryGlAccountPK(); 227 228 if(thisInventoryGlAccountPK == null) { 229 objectsEqual = objectsEqual && (thatInventoryGlAccountPK == null); 230 } else { 231 objectsEqual = objectsEqual && thisInventoryGlAccountPK.equals(thatInventoryGlAccountPK); 232 } 233 } 234 235 if(objectsEqual) { 236 GlAccountPK thisSalesGlAccountPK = getSalesGlAccountPK(); 237 GlAccountPK thatSalesGlAccountPK = that.getSalesGlAccountPK(); 238 239 if(thisSalesGlAccountPK == null) { 240 objectsEqual = objectsEqual && (thatSalesGlAccountPK == null); 241 } else { 242 objectsEqual = objectsEqual && thisSalesGlAccountPK.equals(thatSalesGlAccountPK); 243 } 244 } 245 246 if(objectsEqual) { 247 GlAccountPK thisReturnsGlAccountPK = getReturnsGlAccountPK(); 248 GlAccountPK thatReturnsGlAccountPK = that.getReturnsGlAccountPK(); 249 250 if(thisReturnsGlAccountPK == null) { 251 objectsEqual = objectsEqual && (thatReturnsGlAccountPK == null); 252 } else { 253 objectsEqual = objectsEqual && thisReturnsGlAccountPK.equals(thatReturnsGlAccountPK); 254 } 255 } 256 257 if(objectsEqual) { 258 GlAccountPK thisCogsGlAccountPK = getCogsGlAccountPK(); 259 GlAccountPK thatCogsGlAccountPK = that.getCogsGlAccountPK(); 260 261 if(thisCogsGlAccountPK == null) { 262 objectsEqual = objectsEqual && (thatCogsGlAccountPK == null); 263 } else { 264 objectsEqual = objectsEqual && thisCogsGlAccountPK.equals(thatCogsGlAccountPK); 265 } 266 } 267 268 if(objectsEqual) { 269 GlAccountPK thisReturnsCogsGlAccountPK = getReturnsCogsGlAccountPK(); 270 GlAccountPK thatReturnsCogsGlAccountPK = that.getReturnsCogsGlAccountPK(); 271 272 if(thisReturnsCogsGlAccountPK == null) { 273 objectsEqual = objectsEqual && (thatReturnsCogsGlAccountPK == null); 274 } else { 275 objectsEqual = objectsEqual && thisReturnsCogsGlAccountPK.equals(thatReturnsCogsGlAccountPK); 276 } 277 } 278 279 if(objectsEqual) { 280 Long thisFromTime = getFromTime(); 281 Long thatFromTime = that.getFromTime(); 282 283 if(thisFromTime == null) { 284 objectsEqual = objectsEqual && (thatFromTime == null); 285 } else { 286 objectsEqual = objectsEqual && thisFromTime.equals(thatFromTime); 287 } 288 } 289 290 if(objectsEqual) { 291 Long thisThruTime = getThruTime(); 292 Long thatThruTime = that.getThruTime(); 293 294 if(thisThruTime == null) { 295 objectsEqual = objectsEqual && (thatThruTime == null); 296 } else { 297 objectsEqual = objectsEqual && thisThruTime.equals(thatThruTime); 298 } 299 } 300 301 return objectsEqual; 302 } else { 303 return false; 304 } 305 } 306 307 @Override 308 public boolean hasBeenModified() { 309 return inventoryConditionPKHasBeenModified || itemAccountingCategoryPKHasBeenModified || inventoryGlAccountPKHasBeenModified || salesGlAccountPKHasBeenModified || returnsGlAccountPKHasBeenModified || cogsGlAccountPKHasBeenModified || returnsCogsGlAccountPKHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified; 310 } 311 312 @Override 313 public void clearHasBeenModified() { 314 inventoryConditionPKHasBeenModified = false; 315 itemAccountingCategoryPKHasBeenModified = false; 316 inventoryGlAccountPKHasBeenModified = false; 317 salesGlAccountPKHasBeenModified = false; 318 returnsGlAccountPKHasBeenModified = false; 319 cogsGlAccountPKHasBeenModified = false; 320 returnsCogsGlAccountPKHasBeenModified = false; 321 fromTimeHasBeenModified = false; 322 thruTimeHasBeenModified = false; 323 } 324 325 public InventoryConditionPK getInventoryConditionPK() { 326 return inventoryConditionPK; 327 } 328 329 public void setInventoryConditionPK(InventoryConditionPK inventoryConditionPK) 330 throws PersistenceNotNullException { 331 checkForNull(inventoryConditionPK); 332 333 boolean update = true; 334 335 if(this.inventoryConditionPK != null) { 336 if(this.inventoryConditionPK.equals(inventoryConditionPK)) { 337 update = false; 338 } 339 } else if(inventoryConditionPK == null) { 340 update = false; 341 } 342 343 if(update) { 344 this.inventoryConditionPK = inventoryConditionPK; 345 inventoryConditionPKHasBeenModified = true; 346 clearHashAndString(); 347 } 348 } 349 350 public boolean getInventoryConditionPKHasBeenModified() { 351 return inventoryConditionPKHasBeenModified; 352 } 353 354 public ItemAccountingCategoryPK getItemAccountingCategoryPK() { 355 return itemAccountingCategoryPK; 356 } 357 358 public void setItemAccountingCategoryPK(ItemAccountingCategoryPK itemAccountingCategoryPK) 359 throws PersistenceNotNullException { 360 checkForNull(itemAccountingCategoryPK); 361 362 boolean update = true; 363 364 if(this.itemAccountingCategoryPK != null) { 365 if(this.itemAccountingCategoryPK.equals(itemAccountingCategoryPK)) { 366 update = false; 367 } 368 } else if(itemAccountingCategoryPK == null) { 369 update = false; 370 } 371 372 if(update) { 373 this.itemAccountingCategoryPK = itemAccountingCategoryPK; 374 itemAccountingCategoryPKHasBeenModified = true; 375 clearHashAndString(); 376 } 377 } 378 379 public boolean getItemAccountingCategoryPKHasBeenModified() { 380 return itemAccountingCategoryPKHasBeenModified; 381 } 382 383 public GlAccountPK getInventoryGlAccountPK() { 384 return inventoryGlAccountPK; 385 } 386 387 public void setInventoryGlAccountPK(GlAccountPK inventoryGlAccountPK) { 388 boolean update = true; 389 390 if(this.inventoryGlAccountPK != null) { 391 if(this.inventoryGlAccountPK.equals(inventoryGlAccountPK)) { 392 update = false; 393 } 394 } else if(inventoryGlAccountPK == null) { 395 update = false; 396 } 397 398 if(update) { 399 this.inventoryGlAccountPK = inventoryGlAccountPK; 400 inventoryGlAccountPKHasBeenModified = true; 401 clearHashAndString(); 402 } 403 } 404 405 public boolean getInventoryGlAccountPKHasBeenModified() { 406 return inventoryGlAccountPKHasBeenModified; 407 } 408 409 public GlAccountPK getSalesGlAccountPK() { 410 return salesGlAccountPK; 411 } 412 413 public void setSalesGlAccountPK(GlAccountPK salesGlAccountPK) { 414 boolean update = true; 415 416 if(this.salesGlAccountPK != null) { 417 if(this.salesGlAccountPK.equals(salesGlAccountPK)) { 418 update = false; 419 } 420 } else if(salesGlAccountPK == null) { 421 update = false; 422 } 423 424 if(update) { 425 this.salesGlAccountPK = salesGlAccountPK; 426 salesGlAccountPKHasBeenModified = true; 427 clearHashAndString(); 428 } 429 } 430 431 public boolean getSalesGlAccountPKHasBeenModified() { 432 return salesGlAccountPKHasBeenModified; 433 } 434 435 public GlAccountPK getReturnsGlAccountPK() { 436 return returnsGlAccountPK; 437 } 438 439 public void setReturnsGlAccountPK(GlAccountPK returnsGlAccountPK) { 440 boolean update = true; 441 442 if(this.returnsGlAccountPK != null) { 443 if(this.returnsGlAccountPK.equals(returnsGlAccountPK)) { 444 update = false; 445 } 446 } else if(returnsGlAccountPK == null) { 447 update = false; 448 } 449 450 if(update) { 451 this.returnsGlAccountPK = returnsGlAccountPK; 452 returnsGlAccountPKHasBeenModified = true; 453 clearHashAndString(); 454 } 455 } 456 457 public boolean getReturnsGlAccountPKHasBeenModified() { 458 return returnsGlAccountPKHasBeenModified; 459 } 460 461 public GlAccountPK getCogsGlAccountPK() { 462 return cogsGlAccountPK; 463 } 464 465 public void setCogsGlAccountPK(GlAccountPK cogsGlAccountPK) { 466 boolean update = true; 467 468 if(this.cogsGlAccountPK != null) { 469 if(this.cogsGlAccountPK.equals(cogsGlAccountPK)) { 470 update = false; 471 } 472 } else if(cogsGlAccountPK == null) { 473 update = false; 474 } 475 476 if(update) { 477 this.cogsGlAccountPK = cogsGlAccountPK; 478 cogsGlAccountPKHasBeenModified = true; 479 clearHashAndString(); 480 } 481 } 482 483 public boolean getCogsGlAccountPKHasBeenModified() { 484 return cogsGlAccountPKHasBeenModified; 485 } 486 487 public GlAccountPK getReturnsCogsGlAccountPK() { 488 return returnsCogsGlAccountPK; 489 } 490 491 public void setReturnsCogsGlAccountPK(GlAccountPK returnsCogsGlAccountPK) { 492 boolean update = true; 493 494 if(this.returnsCogsGlAccountPK != null) { 495 if(this.returnsCogsGlAccountPK.equals(returnsCogsGlAccountPK)) { 496 update = false; 497 } 498 } else if(returnsCogsGlAccountPK == null) { 499 update = false; 500 } 501 502 if(update) { 503 this.returnsCogsGlAccountPK = returnsCogsGlAccountPK; 504 returnsCogsGlAccountPKHasBeenModified = true; 505 clearHashAndString(); 506 } 507 } 508 509 public boolean getReturnsCogsGlAccountPKHasBeenModified() { 510 return returnsCogsGlAccountPKHasBeenModified; 511 } 512 513 public Long getFromTime() { 514 return fromTime; 515 } 516 517 public void setFromTime(Long fromTime) 518 throws PersistenceNotNullException { 519 checkForNull(fromTime); 520 521 boolean update = true; 522 523 if(this.fromTime != null) { 524 if(this.fromTime.equals(fromTime)) { 525 update = false; 526 } 527 } else if(fromTime == null) { 528 update = false; 529 } 530 531 if(update) { 532 this.fromTime = fromTime; 533 fromTimeHasBeenModified = true; 534 clearHashAndString(); 535 } 536 } 537 538 public boolean getFromTimeHasBeenModified() { 539 return fromTimeHasBeenModified; 540 } 541 542 public Long getThruTime() { 543 return thruTime; 544 } 545 546 public void setThruTime(Long thruTime) 547 throws PersistenceNotNullException { 548 checkForNull(thruTime); 549 550 boolean update = true; 551 552 if(this.thruTime != null) { 553 if(this.thruTime.equals(thruTime)) { 554 update = false; 555 } 556 } else if(thruTime == null) { 557 update = false; 558 } 559 560 if(update) { 561 this.thruTime = thruTime; 562 thruTimeHasBeenModified = true; 563 clearHashAndString(); 564 } 565 } 566 567 public boolean getThruTimeHasBeenModified() { 568 return thruTimeHasBeenModified; 569 } 570 571}