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 * OrderPaymentPreferenceDetailValue.java 021 */ 022 023package com.echothree.model.data.order.server.value; 024 025import com.echothree.model.data.order.common.pk.OrderPaymentPreferenceDetailPK; 026 027import com.echothree.model.data.order.server.factory.OrderPaymentPreferenceDetailFactory; 028 029import com.echothree.model.data.order.common.pk.OrderPaymentPreferencePK; 030import com.echothree.model.data.order.common.pk.OrderPK; 031import com.echothree.model.data.payment.common.pk.PaymentMethodPK; 032import com.echothree.model.data.payment.common.pk.PartyPaymentMethodPK; 033 034import com.echothree.util.common.exception.PersistenceCloneException; 035import com.echothree.util.common.exception.PersistenceNotNullException; 036 037import com.echothree.util.server.persistence.BaseValue; 038 039import java.io.Serializable; 040 041public class OrderPaymentPreferenceDetailValue 042 extends BaseValue<OrderPaymentPreferenceDetailPK> 043 implements Cloneable, Serializable { 044 045 private OrderPaymentPreferencePK orderPaymentPreferencePK; 046 private boolean orderPaymentPreferencePKHasBeenModified = false; 047 private OrderPK orderPK; 048 private boolean orderPKHasBeenModified = false; 049 private Integer orderPaymentPreferenceSequence; 050 private boolean orderPaymentPreferenceSequenceHasBeenModified = false; 051 private PaymentMethodPK paymentMethodPK; 052 private boolean paymentMethodPKHasBeenModified = false; 053 private PartyPaymentMethodPK partyPaymentMethodPK; 054 private boolean partyPaymentMethodPKHasBeenModified = false; 055 private Boolean wasPresent; 056 private boolean wasPresentHasBeenModified = false; 057 private Long maximumAmount; 058 private boolean maximumAmountHasBeenModified = false; 059 private Integer sortOrder; 060 private boolean sortOrderHasBeenModified = false; 061 private Long fromTime; 062 private boolean fromTimeHasBeenModified = false; 063 private Long thruTime; 064 private boolean thruTimeHasBeenModified = false; 065 066 private transient Integer _hashCode = null; 067 private transient String _stringValue = null; 068 069 private void constructFields(OrderPaymentPreferencePK orderPaymentPreferencePK, OrderPK orderPK, Integer orderPaymentPreferenceSequence, PaymentMethodPK paymentMethodPK, PartyPaymentMethodPK partyPaymentMethodPK, Boolean wasPresent, Long maximumAmount, Integer sortOrder, Long fromTime, Long thruTime) 070 throws PersistenceNotNullException { 071 checkForNull(orderPaymentPreferencePK); 072 this.orderPaymentPreferencePK = orderPaymentPreferencePK; 073 checkForNull(orderPK); 074 this.orderPK = orderPK; 075 checkForNull(orderPaymentPreferenceSequence); 076 this.orderPaymentPreferenceSequence = orderPaymentPreferenceSequence; 077 checkForNull(paymentMethodPK); 078 this.paymentMethodPK = paymentMethodPK; 079 this.partyPaymentMethodPK = partyPaymentMethodPK; 080 this.wasPresent = wasPresent; 081 this.maximumAmount = maximumAmount; 082 checkForNull(sortOrder); 083 this.sortOrder = sortOrder; 084 checkForNull(fromTime); 085 this.fromTime = fromTime; 086 checkForNull(thruTime); 087 this.thruTime = thruTime; 088 } 089 090 /** Creates a new instance of OrderPaymentPreferenceDetailValue */ 091 public OrderPaymentPreferenceDetailValue(OrderPaymentPreferenceDetailPK orderPaymentPreferenceDetailPK, OrderPaymentPreferencePK orderPaymentPreferencePK, OrderPK orderPK, Integer orderPaymentPreferenceSequence, PaymentMethodPK paymentMethodPK, PartyPaymentMethodPK partyPaymentMethodPK, Boolean wasPresent, Long maximumAmount, Integer sortOrder, Long fromTime, Long thruTime) 092 throws PersistenceNotNullException { 093 super(orderPaymentPreferenceDetailPK); 094 constructFields(orderPaymentPreferencePK, orderPK, orderPaymentPreferenceSequence, paymentMethodPK, partyPaymentMethodPK, wasPresent, maximumAmount, sortOrder, fromTime, thruTime); 095 } 096 097 /** Creates a new instance of OrderPaymentPreferenceDetailValue */ 098 public OrderPaymentPreferenceDetailValue(OrderPaymentPreferencePK orderPaymentPreferencePK, OrderPK orderPK, Integer orderPaymentPreferenceSequence, PaymentMethodPK paymentMethodPK, PartyPaymentMethodPK partyPaymentMethodPK, Boolean wasPresent, Long maximumAmount, Integer sortOrder, Long fromTime, Long thruTime) 099 throws PersistenceNotNullException { 100 super(); 101 constructFields(orderPaymentPreferencePK, orderPK, orderPaymentPreferenceSequence, paymentMethodPK, partyPaymentMethodPK, wasPresent, maximumAmount, sortOrder, fromTime, thruTime); 102 } 103 104 @Override 105 public OrderPaymentPreferenceDetailFactory getBaseFactoryInstance() { 106 return OrderPaymentPreferenceDetailFactory.getInstance(); 107 } 108 109 @Override 110 public OrderPaymentPreferenceDetailValue 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 (OrderPaymentPreferenceDetailValue)result; 121 } 122 123 @Override 124 public OrderPaymentPreferenceDetailPK getPrimaryKey() { 125 if(_primaryKey == null) { 126 _primaryKey = new OrderPaymentPreferenceDetailPK(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 + ((orderPaymentPreferencePK != null) ? orderPaymentPreferencePK.hashCode() : 0); 145 hashCode = 37 * hashCode + ((orderPK != null) ? orderPK.hashCode() : 0); 146 hashCode = 37 * hashCode + ((orderPaymentPreferenceSequence != null) ? orderPaymentPreferenceSequence.hashCode() : 0); 147 hashCode = 37 * hashCode + ((paymentMethodPK != null) ? paymentMethodPK.hashCode() : 0); 148 hashCode = 37 * hashCode + ((partyPaymentMethodPK != null) ? partyPaymentMethodPK.hashCode() : 0); 149 hashCode = 37 * hashCode + ((wasPresent != null) ? wasPresent.hashCode() : 0); 150 hashCode = 37 * hashCode + ((maximumAmount != null) ? maximumAmount.hashCode() : 0); 151 hashCode = 37 * hashCode + ((sortOrder != null) ? sortOrder.hashCode() : 0); 152 hashCode = 37 * hashCode + ((fromTime != null) ? fromTime.hashCode() : 0); 153 hashCode = 37 * hashCode + ((thruTime != null) ? thruTime.hashCode() : 0); 154 155 _hashCode = hashCode; 156 } 157 158 return _hashCode; 159 } 160 161 @Override 162 public String toString() { 163 if(_stringValue == null) { 164 StringBuilder stringValue = new StringBuilder("{"); 165 166 stringValue.append("entityId=").append(getEntityId()); 167 168 stringValue.append(", orderPaymentPreferencePK=").append(getOrderPaymentPreferencePK()); 169 stringValue.append(", orderPK=").append(getOrderPK()); 170 stringValue.append(", orderPaymentPreferenceSequence=").append(getOrderPaymentPreferenceSequence()); 171 stringValue.append(", paymentMethodPK=").append(getPaymentMethodPK()); 172 stringValue.append(", partyPaymentMethodPK=").append(getPartyPaymentMethodPK()); 173 stringValue.append(", wasPresent=").append(getWasPresent()); 174 stringValue.append(", maximumAmount=").append(getMaximumAmount()); 175 stringValue.append(", sortOrder=").append(getSortOrder()); 176 stringValue.append(", fromTime=").append(getFromTime()); 177 stringValue.append(", thruTime=").append(getThruTime()); 178 179 stringValue.append('}'); 180 181 _stringValue = stringValue.toString(); 182 } 183 return _stringValue; 184 } 185 186 @Override 187 public boolean equals(Object other) { 188 if(this == other) 189 return true; 190 191 if(!hasIdentity()) 192 return false; 193 194 if(other instanceof OrderPaymentPreferenceDetailValue) { 195 OrderPaymentPreferenceDetailValue that = (OrderPaymentPreferenceDetailValue)other; 196 197 if(!that.hasIdentity()) 198 return false; 199 200 Long thisEntityId = getEntityId(); 201 Long thatEntityId = that.getEntityId(); 202 203 boolean objectsEqual = thisEntityId.equals(thatEntityId); 204 if(objectsEqual) 205 objectsEqual = objectsEqual && isIdentical(that); 206 207 return objectsEqual; 208 } else { 209 return false; 210 } 211 } 212 213 public boolean isIdentical(Object other) { 214 if(other instanceof OrderPaymentPreferenceDetailValue) { 215 OrderPaymentPreferenceDetailValue that = (OrderPaymentPreferenceDetailValue)other; 216 boolean objectsEqual = true; 217 218 219 if(objectsEqual) { 220 OrderPaymentPreferencePK thisOrderPaymentPreferencePK = getOrderPaymentPreferencePK(); 221 OrderPaymentPreferencePK thatOrderPaymentPreferencePK = that.getOrderPaymentPreferencePK(); 222 223 if(thisOrderPaymentPreferencePK == null) { 224 objectsEqual = objectsEqual && (thatOrderPaymentPreferencePK == null); 225 } else { 226 objectsEqual = objectsEqual && thisOrderPaymentPreferencePK.equals(thatOrderPaymentPreferencePK); 227 } 228 } 229 230 if(objectsEqual) { 231 OrderPK thisOrderPK = getOrderPK(); 232 OrderPK thatOrderPK = that.getOrderPK(); 233 234 if(thisOrderPK == null) { 235 objectsEqual = objectsEqual && (thatOrderPK == null); 236 } else { 237 objectsEqual = objectsEqual && thisOrderPK.equals(thatOrderPK); 238 } 239 } 240 241 if(objectsEqual) { 242 Integer thisOrderPaymentPreferenceSequence = getOrderPaymentPreferenceSequence(); 243 Integer thatOrderPaymentPreferenceSequence = that.getOrderPaymentPreferenceSequence(); 244 245 if(thisOrderPaymentPreferenceSequence == null) { 246 objectsEqual = objectsEqual && (thatOrderPaymentPreferenceSequence == null); 247 } else { 248 objectsEqual = objectsEqual && thisOrderPaymentPreferenceSequence.equals(thatOrderPaymentPreferenceSequence); 249 } 250 } 251 252 if(objectsEqual) { 253 PaymentMethodPK thisPaymentMethodPK = getPaymentMethodPK(); 254 PaymentMethodPK thatPaymentMethodPK = that.getPaymentMethodPK(); 255 256 if(thisPaymentMethodPK == null) { 257 objectsEqual = objectsEqual && (thatPaymentMethodPK == null); 258 } else { 259 objectsEqual = objectsEqual && thisPaymentMethodPK.equals(thatPaymentMethodPK); 260 } 261 } 262 263 if(objectsEqual) { 264 PartyPaymentMethodPK thisPartyPaymentMethodPK = getPartyPaymentMethodPK(); 265 PartyPaymentMethodPK thatPartyPaymentMethodPK = that.getPartyPaymentMethodPK(); 266 267 if(thisPartyPaymentMethodPK == null) { 268 objectsEqual = objectsEqual && (thatPartyPaymentMethodPK == null); 269 } else { 270 objectsEqual = objectsEqual && thisPartyPaymentMethodPK.equals(thatPartyPaymentMethodPK); 271 } 272 } 273 274 if(objectsEqual) { 275 Boolean thisWasPresent = getWasPresent(); 276 Boolean thatWasPresent = that.getWasPresent(); 277 278 if(thisWasPresent == null) { 279 objectsEqual = objectsEqual && (thatWasPresent == null); 280 } else { 281 objectsEqual = objectsEqual && thisWasPresent.equals(thatWasPresent); 282 } 283 } 284 285 if(objectsEqual) { 286 Long thisMaximumAmount = getMaximumAmount(); 287 Long thatMaximumAmount = that.getMaximumAmount(); 288 289 if(thisMaximumAmount == null) { 290 objectsEqual = objectsEqual && (thatMaximumAmount == null); 291 } else { 292 objectsEqual = objectsEqual && thisMaximumAmount.equals(thatMaximumAmount); 293 } 294 } 295 296 if(objectsEqual) { 297 Integer thisSortOrder = getSortOrder(); 298 Integer thatSortOrder = that.getSortOrder(); 299 300 if(thisSortOrder == null) { 301 objectsEqual = objectsEqual && (thatSortOrder == null); 302 } else { 303 objectsEqual = objectsEqual && thisSortOrder.equals(thatSortOrder); 304 } 305 } 306 307 if(objectsEqual) { 308 Long thisFromTime = getFromTime(); 309 Long thatFromTime = that.getFromTime(); 310 311 if(thisFromTime == null) { 312 objectsEqual = objectsEqual && (thatFromTime == null); 313 } else { 314 objectsEqual = objectsEqual && thisFromTime.equals(thatFromTime); 315 } 316 } 317 318 if(objectsEqual) { 319 Long thisThruTime = getThruTime(); 320 Long thatThruTime = that.getThruTime(); 321 322 if(thisThruTime == null) { 323 objectsEqual = objectsEqual && (thatThruTime == null); 324 } else { 325 objectsEqual = objectsEqual && thisThruTime.equals(thatThruTime); 326 } 327 } 328 329 return objectsEqual; 330 } else { 331 return false; 332 } 333 } 334 335 @Override 336 public boolean hasBeenModified() { 337 return orderPaymentPreferencePKHasBeenModified || orderPKHasBeenModified || orderPaymentPreferenceSequenceHasBeenModified || paymentMethodPKHasBeenModified || partyPaymentMethodPKHasBeenModified || wasPresentHasBeenModified || maximumAmountHasBeenModified || sortOrderHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified; 338 } 339 340 @Override 341 public void clearHasBeenModified() { 342 orderPaymentPreferencePKHasBeenModified = false; 343 orderPKHasBeenModified = false; 344 orderPaymentPreferenceSequenceHasBeenModified = false; 345 paymentMethodPKHasBeenModified = false; 346 partyPaymentMethodPKHasBeenModified = false; 347 wasPresentHasBeenModified = false; 348 maximumAmountHasBeenModified = false; 349 sortOrderHasBeenModified = false; 350 fromTimeHasBeenModified = false; 351 thruTimeHasBeenModified = false; 352 } 353 354 public OrderPaymentPreferencePK getOrderPaymentPreferencePK() { 355 return orderPaymentPreferencePK; 356 } 357 358 public void setOrderPaymentPreferencePK(OrderPaymentPreferencePK orderPaymentPreferencePK) 359 throws PersistenceNotNullException { 360 checkForNull(orderPaymentPreferencePK); 361 362 boolean update = true; 363 364 if(this.orderPaymentPreferencePK != null) { 365 if(this.orderPaymentPreferencePK.equals(orderPaymentPreferencePK)) { 366 update = false; 367 } 368 } else if(orderPaymentPreferencePK == null) { 369 update = false; 370 } 371 372 if(update) { 373 this.orderPaymentPreferencePK = orderPaymentPreferencePK; 374 orderPaymentPreferencePKHasBeenModified = true; 375 clearHashAndString(); 376 } 377 } 378 379 public boolean getOrderPaymentPreferencePKHasBeenModified() { 380 return orderPaymentPreferencePKHasBeenModified; 381 } 382 383 public OrderPK getOrderPK() { 384 return orderPK; 385 } 386 387 public void setOrderPK(OrderPK orderPK) 388 throws PersistenceNotNullException { 389 checkForNull(orderPK); 390 391 boolean update = true; 392 393 if(this.orderPK != null) { 394 if(this.orderPK.equals(orderPK)) { 395 update = false; 396 } 397 } else if(orderPK == null) { 398 update = false; 399 } 400 401 if(update) { 402 this.orderPK = orderPK; 403 orderPKHasBeenModified = true; 404 clearHashAndString(); 405 } 406 } 407 408 public boolean getOrderPKHasBeenModified() { 409 return orderPKHasBeenModified; 410 } 411 412 public Integer getOrderPaymentPreferenceSequence() { 413 return orderPaymentPreferenceSequence; 414 } 415 416 public void setOrderPaymentPreferenceSequence(Integer orderPaymentPreferenceSequence) 417 throws PersistenceNotNullException { 418 checkForNull(orderPaymentPreferenceSequence); 419 420 boolean update = true; 421 422 if(this.orderPaymentPreferenceSequence != null) { 423 if(this.orderPaymentPreferenceSequence.equals(orderPaymentPreferenceSequence)) { 424 update = false; 425 } 426 } else if(orderPaymentPreferenceSequence == null) { 427 update = false; 428 } 429 430 if(update) { 431 this.orderPaymentPreferenceSequence = orderPaymentPreferenceSequence; 432 orderPaymentPreferenceSequenceHasBeenModified = true; 433 clearHashAndString(); 434 } 435 } 436 437 public boolean getOrderPaymentPreferenceSequenceHasBeenModified() { 438 return orderPaymentPreferenceSequenceHasBeenModified; 439 } 440 441 public PaymentMethodPK getPaymentMethodPK() { 442 return paymentMethodPK; 443 } 444 445 public void setPaymentMethodPK(PaymentMethodPK paymentMethodPK) 446 throws PersistenceNotNullException { 447 checkForNull(paymentMethodPK); 448 449 boolean update = true; 450 451 if(this.paymentMethodPK != null) { 452 if(this.paymentMethodPK.equals(paymentMethodPK)) { 453 update = false; 454 } 455 } else if(paymentMethodPK == null) { 456 update = false; 457 } 458 459 if(update) { 460 this.paymentMethodPK = paymentMethodPK; 461 paymentMethodPKHasBeenModified = true; 462 clearHashAndString(); 463 } 464 } 465 466 public boolean getPaymentMethodPKHasBeenModified() { 467 return paymentMethodPKHasBeenModified; 468 } 469 470 public PartyPaymentMethodPK getPartyPaymentMethodPK() { 471 return partyPaymentMethodPK; 472 } 473 474 public void setPartyPaymentMethodPK(PartyPaymentMethodPK partyPaymentMethodPK) { 475 boolean update = true; 476 477 if(this.partyPaymentMethodPK != null) { 478 if(this.partyPaymentMethodPK.equals(partyPaymentMethodPK)) { 479 update = false; 480 } 481 } else if(partyPaymentMethodPK == null) { 482 update = false; 483 } 484 485 if(update) { 486 this.partyPaymentMethodPK = partyPaymentMethodPK; 487 partyPaymentMethodPKHasBeenModified = true; 488 clearHashAndString(); 489 } 490 } 491 492 public boolean getPartyPaymentMethodPKHasBeenModified() { 493 return partyPaymentMethodPKHasBeenModified; 494 } 495 496 public Boolean getWasPresent() { 497 return wasPresent; 498 } 499 500 public void setWasPresent(Boolean wasPresent) { 501 boolean update = true; 502 503 if(this.wasPresent != null) { 504 if(this.wasPresent.equals(wasPresent)) { 505 update = false; 506 } 507 } else if(wasPresent == null) { 508 update = false; 509 } 510 511 if(update) { 512 this.wasPresent = wasPresent; 513 wasPresentHasBeenModified = true; 514 clearHashAndString(); 515 } 516 } 517 518 public boolean getWasPresentHasBeenModified() { 519 return wasPresentHasBeenModified; 520 } 521 522 public Long getMaximumAmount() { 523 return maximumAmount; 524 } 525 526 public void setMaximumAmount(Long maximumAmount) { 527 boolean update = true; 528 529 if(this.maximumAmount != null) { 530 if(this.maximumAmount.equals(maximumAmount)) { 531 update = false; 532 } 533 } else if(maximumAmount == null) { 534 update = false; 535 } 536 537 if(update) { 538 this.maximumAmount = maximumAmount; 539 maximumAmountHasBeenModified = true; 540 clearHashAndString(); 541 } 542 } 543 544 public boolean getMaximumAmountHasBeenModified() { 545 return maximumAmountHasBeenModified; 546 } 547 548 public Integer getSortOrder() { 549 return sortOrder; 550 } 551 552 public void setSortOrder(Integer sortOrder) 553 throws PersistenceNotNullException { 554 checkForNull(sortOrder); 555 556 boolean update = true; 557 558 if(this.sortOrder != null) { 559 if(this.sortOrder.equals(sortOrder)) { 560 update = false; 561 } 562 } else if(sortOrder == null) { 563 update = false; 564 } 565 566 if(update) { 567 this.sortOrder = sortOrder; 568 sortOrderHasBeenModified = true; 569 clearHashAndString(); 570 } 571 } 572 573 public boolean getSortOrderHasBeenModified() { 574 return sortOrderHasBeenModified; 575 } 576 577 public Long getFromTime() { 578 return fromTime; 579 } 580 581 public void setFromTime(Long fromTime) 582 throws PersistenceNotNullException { 583 checkForNull(fromTime); 584 585 boolean update = true; 586 587 if(this.fromTime != null) { 588 if(this.fromTime.equals(fromTime)) { 589 update = false; 590 } 591 } else if(fromTime == null) { 592 update = false; 593 } 594 595 if(update) { 596 this.fromTime = fromTime; 597 fromTimeHasBeenModified = true; 598 clearHashAndString(); 599 } 600 } 601 602 public boolean getFromTimeHasBeenModified() { 603 return fromTimeHasBeenModified; 604 } 605 606 public Long getThruTime() { 607 return thruTime; 608 } 609 610 public void setThruTime(Long thruTime) 611 throws PersistenceNotNullException { 612 checkForNull(thruTime); 613 614 boolean update = true; 615 616 if(this.thruTime != null) { 617 if(this.thruTime.equals(thruTime)) { 618 update = false; 619 } 620 } else if(thruTime == null) { 621 update = false; 622 } 623 624 if(update) { 625 this.thruTime = thruTime; 626 thruTimeHasBeenModified = true; 627 clearHashAndString(); 628 } 629 } 630 631 public boolean getThruTimeHasBeenModified() { 632 return thruTimeHasBeenModified; 633 } 634 635}