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 * 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 StringBuilder stringValue = new StringBuilder("{"); 157 158 stringValue.append("entityId=").append(getEntityId()); 159 160 stringValue.append(", inventoryConditionPK=").append(getInventoryConditionPK()); 161 stringValue.append(", itemAccountingCategoryPK=").append(getItemAccountingCategoryPK()); 162 stringValue.append(", inventoryGlAccountPK=").append(getInventoryGlAccountPK()); 163 stringValue.append(", salesGlAccountPK=").append(getSalesGlAccountPK()); 164 stringValue.append(", returnsGlAccountPK=").append(getReturnsGlAccountPK()); 165 stringValue.append(", cogsGlAccountPK=").append(getCogsGlAccountPK()); 166 stringValue.append(", returnsCogsGlAccountPK=").append(getReturnsCogsGlAccountPK()); 167 stringValue.append(", fromTime=").append(getFromTime()); 168 stringValue.append(", thruTime=").append(getThruTime()); 169 170 stringValue.append('}'); 171 172 _stringValue = stringValue.toString(); 173 } 174 return _stringValue; 175 } 176 177 @Override 178 public boolean equals(Object other) { 179 if(this == other) 180 return true; 181 182 if(!hasIdentity()) 183 return false; 184 185 if(other instanceof InventoryConditionGlAccountValue) { 186 InventoryConditionGlAccountValue that = (InventoryConditionGlAccountValue)other; 187 188 if(!that.hasIdentity()) 189 return false; 190 191 Long thisEntityId = getEntityId(); 192 Long thatEntityId = that.getEntityId(); 193 194 boolean objectsEqual = thisEntityId.equals(thatEntityId); 195 if(objectsEqual) 196 objectsEqual = objectsEqual && isIdentical(that); 197 198 return objectsEqual; 199 } else { 200 return false; 201 } 202 } 203 204 public boolean isIdentical(Object other) { 205 if(other instanceof InventoryConditionGlAccountValue) { 206 InventoryConditionGlAccountValue that = (InventoryConditionGlAccountValue)other; 207 boolean objectsEqual = true; 208 209 210 if(objectsEqual) { 211 InventoryConditionPK thisInventoryConditionPK = getInventoryConditionPK(); 212 InventoryConditionPK thatInventoryConditionPK = that.getInventoryConditionPK(); 213 214 if(thisInventoryConditionPK == null) { 215 objectsEqual = objectsEqual && (thatInventoryConditionPK == null); 216 } else { 217 objectsEqual = objectsEqual && thisInventoryConditionPK.equals(thatInventoryConditionPK); 218 } 219 } 220 221 if(objectsEqual) { 222 ItemAccountingCategoryPK thisItemAccountingCategoryPK = getItemAccountingCategoryPK(); 223 ItemAccountingCategoryPK thatItemAccountingCategoryPK = that.getItemAccountingCategoryPK(); 224 225 if(thisItemAccountingCategoryPK == null) { 226 objectsEqual = objectsEqual && (thatItemAccountingCategoryPK == null); 227 } else { 228 objectsEqual = objectsEqual && thisItemAccountingCategoryPK.equals(thatItemAccountingCategoryPK); 229 } 230 } 231 232 if(objectsEqual) { 233 GlAccountPK thisInventoryGlAccountPK = getInventoryGlAccountPK(); 234 GlAccountPK thatInventoryGlAccountPK = that.getInventoryGlAccountPK(); 235 236 if(thisInventoryGlAccountPK == null) { 237 objectsEqual = objectsEqual && (thatInventoryGlAccountPK == null); 238 } else { 239 objectsEqual = objectsEqual && thisInventoryGlAccountPK.equals(thatInventoryGlAccountPK); 240 } 241 } 242 243 if(objectsEqual) { 244 GlAccountPK thisSalesGlAccountPK = getSalesGlAccountPK(); 245 GlAccountPK thatSalesGlAccountPK = that.getSalesGlAccountPK(); 246 247 if(thisSalesGlAccountPK == null) { 248 objectsEqual = objectsEqual && (thatSalesGlAccountPK == null); 249 } else { 250 objectsEqual = objectsEqual && thisSalesGlAccountPK.equals(thatSalesGlAccountPK); 251 } 252 } 253 254 if(objectsEqual) { 255 GlAccountPK thisReturnsGlAccountPK = getReturnsGlAccountPK(); 256 GlAccountPK thatReturnsGlAccountPK = that.getReturnsGlAccountPK(); 257 258 if(thisReturnsGlAccountPK == null) { 259 objectsEqual = objectsEqual && (thatReturnsGlAccountPK == null); 260 } else { 261 objectsEqual = objectsEqual && thisReturnsGlAccountPK.equals(thatReturnsGlAccountPK); 262 } 263 } 264 265 if(objectsEqual) { 266 GlAccountPK thisCogsGlAccountPK = getCogsGlAccountPK(); 267 GlAccountPK thatCogsGlAccountPK = that.getCogsGlAccountPK(); 268 269 if(thisCogsGlAccountPK == null) { 270 objectsEqual = objectsEqual && (thatCogsGlAccountPK == null); 271 } else { 272 objectsEqual = objectsEqual && thisCogsGlAccountPK.equals(thatCogsGlAccountPK); 273 } 274 } 275 276 if(objectsEqual) { 277 GlAccountPK thisReturnsCogsGlAccountPK = getReturnsCogsGlAccountPK(); 278 GlAccountPK thatReturnsCogsGlAccountPK = that.getReturnsCogsGlAccountPK(); 279 280 if(thisReturnsCogsGlAccountPK == null) { 281 objectsEqual = objectsEqual && (thatReturnsCogsGlAccountPK == null); 282 } else { 283 objectsEqual = objectsEqual && thisReturnsCogsGlAccountPK.equals(thatReturnsCogsGlAccountPK); 284 } 285 } 286 287 if(objectsEqual) { 288 Long thisFromTime = getFromTime(); 289 Long thatFromTime = that.getFromTime(); 290 291 if(thisFromTime == null) { 292 objectsEqual = objectsEqual && (thatFromTime == null); 293 } else { 294 objectsEqual = objectsEqual && thisFromTime.equals(thatFromTime); 295 } 296 } 297 298 if(objectsEqual) { 299 Long thisThruTime = getThruTime(); 300 Long thatThruTime = that.getThruTime(); 301 302 if(thisThruTime == null) { 303 objectsEqual = objectsEqual && (thatThruTime == null); 304 } else { 305 objectsEqual = objectsEqual && thisThruTime.equals(thatThruTime); 306 } 307 } 308 309 return objectsEqual; 310 } else { 311 return false; 312 } 313 } 314 315 @Override 316 public boolean hasBeenModified() { 317 return inventoryConditionPKHasBeenModified || itemAccountingCategoryPKHasBeenModified || inventoryGlAccountPKHasBeenModified || salesGlAccountPKHasBeenModified || returnsGlAccountPKHasBeenModified || cogsGlAccountPKHasBeenModified || returnsCogsGlAccountPKHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified; 318 } 319 320 @Override 321 public void clearHasBeenModified() { 322 inventoryConditionPKHasBeenModified = false; 323 itemAccountingCategoryPKHasBeenModified = false; 324 inventoryGlAccountPKHasBeenModified = false; 325 salesGlAccountPKHasBeenModified = false; 326 returnsGlAccountPKHasBeenModified = false; 327 cogsGlAccountPKHasBeenModified = false; 328 returnsCogsGlAccountPKHasBeenModified = false; 329 fromTimeHasBeenModified = false; 330 thruTimeHasBeenModified = false; 331 } 332 333 public InventoryConditionPK getInventoryConditionPK() { 334 return inventoryConditionPK; 335 } 336 337 public void setInventoryConditionPK(InventoryConditionPK inventoryConditionPK) 338 throws PersistenceNotNullException { 339 checkForNull(inventoryConditionPK); 340 341 boolean update = true; 342 343 if(this.inventoryConditionPK != null) { 344 if(this.inventoryConditionPK.equals(inventoryConditionPK)) { 345 update = false; 346 } 347 } else if(inventoryConditionPK == null) { 348 update = false; 349 } 350 351 if(update) { 352 this.inventoryConditionPK = inventoryConditionPK; 353 inventoryConditionPKHasBeenModified = true; 354 clearHashAndString(); 355 } 356 } 357 358 public boolean getInventoryConditionPKHasBeenModified() { 359 return inventoryConditionPKHasBeenModified; 360 } 361 362 public ItemAccountingCategoryPK getItemAccountingCategoryPK() { 363 return itemAccountingCategoryPK; 364 } 365 366 public void setItemAccountingCategoryPK(ItemAccountingCategoryPK itemAccountingCategoryPK) 367 throws PersistenceNotNullException { 368 checkForNull(itemAccountingCategoryPK); 369 370 boolean update = true; 371 372 if(this.itemAccountingCategoryPK != null) { 373 if(this.itemAccountingCategoryPK.equals(itemAccountingCategoryPK)) { 374 update = false; 375 } 376 } else if(itemAccountingCategoryPK == null) { 377 update = false; 378 } 379 380 if(update) { 381 this.itemAccountingCategoryPK = itemAccountingCategoryPK; 382 itemAccountingCategoryPKHasBeenModified = true; 383 clearHashAndString(); 384 } 385 } 386 387 public boolean getItemAccountingCategoryPKHasBeenModified() { 388 return itemAccountingCategoryPKHasBeenModified; 389 } 390 391 public GlAccountPK getInventoryGlAccountPK() { 392 return inventoryGlAccountPK; 393 } 394 395 public void setInventoryGlAccountPK(GlAccountPK inventoryGlAccountPK) { 396 boolean update = true; 397 398 if(this.inventoryGlAccountPK != null) { 399 if(this.inventoryGlAccountPK.equals(inventoryGlAccountPK)) { 400 update = false; 401 } 402 } else if(inventoryGlAccountPK == null) { 403 update = false; 404 } 405 406 if(update) { 407 this.inventoryGlAccountPK = inventoryGlAccountPK; 408 inventoryGlAccountPKHasBeenModified = true; 409 clearHashAndString(); 410 } 411 } 412 413 public boolean getInventoryGlAccountPKHasBeenModified() { 414 return inventoryGlAccountPKHasBeenModified; 415 } 416 417 public GlAccountPK getSalesGlAccountPK() { 418 return salesGlAccountPK; 419 } 420 421 public void setSalesGlAccountPK(GlAccountPK salesGlAccountPK) { 422 boolean update = true; 423 424 if(this.salesGlAccountPK != null) { 425 if(this.salesGlAccountPK.equals(salesGlAccountPK)) { 426 update = false; 427 } 428 } else if(salesGlAccountPK == null) { 429 update = false; 430 } 431 432 if(update) { 433 this.salesGlAccountPK = salesGlAccountPK; 434 salesGlAccountPKHasBeenModified = true; 435 clearHashAndString(); 436 } 437 } 438 439 public boolean getSalesGlAccountPKHasBeenModified() { 440 return salesGlAccountPKHasBeenModified; 441 } 442 443 public GlAccountPK getReturnsGlAccountPK() { 444 return returnsGlAccountPK; 445 } 446 447 public void setReturnsGlAccountPK(GlAccountPK returnsGlAccountPK) { 448 boolean update = true; 449 450 if(this.returnsGlAccountPK != null) { 451 if(this.returnsGlAccountPK.equals(returnsGlAccountPK)) { 452 update = false; 453 } 454 } else if(returnsGlAccountPK == null) { 455 update = false; 456 } 457 458 if(update) { 459 this.returnsGlAccountPK = returnsGlAccountPK; 460 returnsGlAccountPKHasBeenModified = true; 461 clearHashAndString(); 462 } 463 } 464 465 public boolean getReturnsGlAccountPKHasBeenModified() { 466 return returnsGlAccountPKHasBeenModified; 467 } 468 469 public GlAccountPK getCogsGlAccountPK() { 470 return cogsGlAccountPK; 471 } 472 473 public void setCogsGlAccountPK(GlAccountPK cogsGlAccountPK) { 474 boolean update = true; 475 476 if(this.cogsGlAccountPK != null) { 477 if(this.cogsGlAccountPK.equals(cogsGlAccountPK)) { 478 update = false; 479 } 480 } else if(cogsGlAccountPK == null) { 481 update = false; 482 } 483 484 if(update) { 485 this.cogsGlAccountPK = cogsGlAccountPK; 486 cogsGlAccountPKHasBeenModified = true; 487 clearHashAndString(); 488 } 489 } 490 491 public boolean getCogsGlAccountPKHasBeenModified() { 492 return cogsGlAccountPKHasBeenModified; 493 } 494 495 public GlAccountPK getReturnsCogsGlAccountPK() { 496 return returnsCogsGlAccountPK; 497 } 498 499 public void setReturnsCogsGlAccountPK(GlAccountPK returnsCogsGlAccountPK) { 500 boolean update = true; 501 502 if(this.returnsCogsGlAccountPK != null) { 503 if(this.returnsCogsGlAccountPK.equals(returnsCogsGlAccountPK)) { 504 update = false; 505 } 506 } else if(returnsCogsGlAccountPK == null) { 507 update = false; 508 } 509 510 if(update) { 511 this.returnsCogsGlAccountPK = returnsCogsGlAccountPK; 512 returnsCogsGlAccountPKHasBeenModified = true; 513 clearHashAndString(); 514 } 515 } 516 517 public boolean getReturnsCogsGlAccountPKHasBeenModified() { 518 return returnsCogsGlAccountPKHasBeenModified; 519 } 520 521 public Long getFromTime() { 522 return fromTime; 523 } 524 525 public void setFromTime(Long fromTime) 526 throws PersistenceNotNullException { 527 checkForNull(fromTime); 528 529 boolean update = true; 530 531 if(this.fromTime != null) { 532 if(this.fromTime.equals(fromTime)) { 533 update = false; 534 } 535 } else if(fromTime == null) { 536 update = false; 537 } 538 539 if(update) { 540 this.fromTime = fromTime; 541 fromTimeHasBeenModified = true; 542 clearHashAndString(); 543 } 544 } 545 546 public boolean getFromTimeHasBeenModified() { 547 return fromTimeHasBeenModified; 548 } 549 550 public Long getThruTime() { 551 return thruTime; 552 } 553 554 public void setThruTime(Long thruTime) 555 throws PersistenceNotNullException { 556 checkForNull(thruTime); 557 558 boolean update = true; 559 560 if(this.thruTime != null) { 561 if(this.thruTime.equals(thruTime)) { 562 update = false; 563 } 564 } else if(thruTime == null) { 565 update = false; 566 } 567 568 if(update) { 569 this.thruTime = thruTime; 570 thruTimeHasBeenModified = true; 571 clearHashAndString(); 572 } 573 } 574 575 public boolean getThruTimeHasBeenModified() { 576 return thruTimeHasBeenModified; 577 } 578 579}