001// -------------------------------------------------------------------------------- 002// Copyright 2002-2026 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 * WishlistLineValue.java 021 */ 022 023package com.echothree.model.data.wishlist.server.value; 024 025import com.echothree.model.data.wishlist.common.pk.WishlistLinePK; 026 027import com.echothree.model.data.wishlist.server.factory.WishlistLineFactory; 028 029import com.echothree.model.data.order.common.pk.OrderLinePK; 030import com.echothree.model.data.offer.common.pk.OfferUsePK; 031import com.echothree.model.data.wishlist.common.pk.WishlistPriorityPK; 032import com.echothree.model.data.associate.common.pk.AssociateReferralPK; 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 041import javax.annotation.Nonnull; 042import javax.annotation.Nullable; 043 044public class WishlistLineValue 045 extends BaseValue<WishlistLinePK> 046 implements Cloneable, Serializable { 047 048 private OrderLinePK orderLinePK; 049 private boolean orderLinePKHasBeenModified = false; 050 private OfferUsePK offerUsePK; 051 private boolean offerUsePKHasBeenModified = false; 052 private WishlistPriorityPK wishlistPriorityPK; 053 private boolean wishlistPriorityPKHasBeenModified = false; 054 private AssociateReferralPK associateReferralPK; 055 private boolean associateReferralPKHasBeenModified = false; 056 private String comment; 057 private boolean commentHasBeenModified = 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(OrderLinePK orderLinePK, OfferUsePK offerUsePK, WishlistPriorityPK wishlistPriorityPK, AssociateReferralPK associateReferralPK, String comment, Long fromTime, Long thruTime) 067 throws PersistenceNotNullException { 068 checkForNull(orderLinePK); 069 this.orderLinePK = orderLinePK; 070 checkForNull(offerUsePK); 071 this.offerUsePK = offerUsePK; 072 checkForNull(wishlistPriorityPK); 073 this.wishlistPriorityPK = wishlistPriorityPK; 074 this.associateReferralPK = associateReferralPK; 075 this.comment = comment; 076 checkForNull(fromTime); 077 this.fromTime = fromTime; 078 checkForNull(thruTime); 079 this.thruTime = thruTime; 080 } 081 082 /** Creates a new instance of WishlistLineValue */ 083 public WishlistLineValue(WishlistLinePK wishlistLinePK, OrderLinePK orderLinePK, OfferUsePK offerUsePK, WishlistPriorityPK wishlistPriorityPK, AssociateReferralPK associateReferralPK, String comment, Long fromTime, Long thruTime) 084 throws PersistenceNotNullException { 085 super(wishlistLinePK); 086 constructFields(orderLinePK, offerUsePK, wishlistPriorityPK, associateReferralPK, comment, fromTime, thruTime); 087 } 088 089 /** Creates a new instance of WishlistLineValue */ 090 public WishlistLineValue(OrderLinePK orderLinePK, OfferUsePK offerUsePK, WishlistPriorityPK wishlistPriorityPK, AssociateReferralPK associateReferralPK, String comment, Long fromTime, Long thruTime) 091 throws PersistenceNotNullException { 092 super(); 093 constructFields(orderLinePK, offerUsePK, wishlistPriorityPK, associateReferralPK, comment, fromTime, thruTime); 094 } 095 096 @Override 097 @Nonnull 098 public WishlistLineFactory getBaseFactoryInstance() { 099 return WishlistLineFactory.getInstance(); 100 } 101 102 @Override 103 @Nonnull 104 public WishlistLineValue clone() { 105 Object result; 106 107 try { 108 result = super.clone(); 109 } catch (CloneNotSupportedException cnse) { 110 // This shouldn't happen, fail when it does. 111 throw new PersistenceCloneException(cnse); 112 } 113 114 return (WishlistLineValue)result; 115 } 116 117 @Override 118 @Nonnull 119 public WishlistLinePK getPrimaryKey() { 120 if(_primaryKey == null) { 121 _primaryKey = new WishlistLinePK(entityId); 122 } 123 124 return _primaryKey; 125 } 126 127 private void clearHashAndString() { 128 _hashCode = null; 129 _stringValue = null; 130 } 131 132 @Override 133 public int hashCode() { 134 if(_hashCode == null) { 135 int hashCode = 17; 136 137 hashCode = 37 * hashCode + ((entityId != null) ? entityId.hashCode() : 0); 138 139 hashCode = 37 * hashCode + ((orderLinePK != null) ? orderLinePK.hashCode() : 0); 140 hashCode = 37 * hashCode + ((offerUsePK != null) ? offerUsePK.hashCode() : 0); 141 hashCode = 37 * hashCode + ((wishlistPriorityPK != null) ? wishlistPriorityPK.hashCode() : 0); 142 hashCode = 37 * hashCode + ((associateReferralPK != null) ? associateReferralPK.hashCode() : 0); 143 hashCode = 37 * hashCode + ((comment != null) ? comment.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 @Nonnull 155 public String toString() { 156 if(_stringValue == null) { 157 _stringValue = "{" + 158 "entityId=" + getEntityId() + 159 ", orderLinePK=" + getOrderLinePK() + 160 ", offerUsePK=" + getOfferUsePK() + 161 ", wishlistPriorityPK=" + getWishlistPriorityPK() + 162 ", associateReferralPK=" + getAssociateReferralPK() + 163 ", comment=" + getComment() + 164 ", fromTime=" + getFromTime() + 165 ", thruTime=" + getThruTime() + 166 "}"; 167 } 168 return _stringValue; 169 } 170 171 @Override 172 public boolean equals(Object other) { 173 if(this == other) 174 return true; 175 176 if(!hasIdentity()) 177 return false; 178 179 if(other instanceof WishlistLineValue that) { 180 if(!that.hasIdentity()) 181 return false; 182 183 Long thisEntityId = getEntityId(); 184 Long thatEntityId = that.getEntityId(); 185 186 boolean objectsEqual = thisEntityId.equals(thatEntityId); 187 if(objectsEqual) 188 objectsEqual = isIdentical(that); 189 190 return objectsEqual; 191 } else { 192 return false; 193 } 194 } 195 196 public boolean isIdentical(Object other) { 197 if(other instanceof WishlistLineValue that) { 198 boolean objectsEqual = true; 199 200 201 if(objectsEqual) { 202 OrderLinePK thisOrderLinePK = getOrderLinePK(); 203 OrderLinePK thatOrderLinePK = that.getOrderLinePK(); 204 205 if(thisOrderLinePK == null) { 206 objectsEqual = objectsEqual && (thatOrderLinePK == null); 207 } else { 208 objectsEqual = objectsEqual && thisOrderLinePK.equals(thatOrderLinePK); 209 } 210 } 211 212 if(objectsEqual) { 213 OfferUsePK thisOfferUsePK = getOfferUsePK(); 214 OfferUsePK thatOfferUsePK = that.getOfferUsePK(); 215 216 if(thisOfferUsePK == null) { 217 objectsEqual = objectsEqual && (thatOfferUsePK == null); 218 } else { 219 objectsEqual = objectsEqual && thisOfferUsePK.equals(thatOfferUsePK); 220 } 221 } 222 223 if(objectsEqual) { 224 WishlistPriorityPK thisWishlistPriorityPK = getWishlistPriorityPK(); 225 WishlistPriorityPK thatWishlistPriorityPK = that.getWishlistPriorityPK(); 226 227 if(thisWishlistPriorityPK == null) { 228 objectsEqual = objectsEqual && (thatWishlistPriorityPK == null); 229 } else { 230 objectsEqual = objectsEqual && thisWishlistPriorityPK.equals(thatWishlistPriorityPK); 231 } 232 } 233 234 if(objectsEqual) { 235 AssociateReferralPK thisAssociateReferralPK = getAssociateReferralPK(); 236 AssociateReferralPK thatAssociateReferralPK = that.getAssociateReferralPK(); 237 238 if(thisAssociateReferralPK == null) { 239 objectsEqual = objectsEqual && (thatAssociateReferralPK == null); 240 } else { 241 objectsEqual = objectsEqual && thisAssociateReferralPK.equals(thatAssociateReferralPK); 242 } 243 } 244 245 if(objectsEqual) { 246 String thisComment = getComment(); 247 String thatComment = that.getComment(); 248 249 if(thisComment == null) { 250 objectsEqual = objectsEqual && (thatComment == null); 251 } else { 252 objectsEqual = objectsEqual && thisComment.equals(thatComment); 253 } 254 } 255 256 if(objectsEqual) { 257 Long thisFromTime = getFromTime(); 258 Long thatFromTime = that.getFromTime(); 259 260 if(thisFromTime == null) { 261 objectsEqual = objectsEqual && (thatFromTime == null); 262 } else { 263 objectsEqual = objectsEqual && thisFromTime.equals(thatFromTime); 264 } 265 } 266 267 if(objectsEqual) { 268 Long thisThruTime = getThruTime(); 269 Long thatThruTime = that.getThruTime(); 270 271 if(thisThruTime == null) { 272 objectsEqual = objectsEqual && (thatThruTime == null); 273 } else { 274 objectsEqual = objectsEqual && thisThruTime.equals(thatThruTime); 275 } 276 } 277 278 return objectsEqual; 279 } else { 280 return false; 281 } 282 } 283 284 @Override 285 public boolean hasBeenModified() { 286 return orderLinePKHasBeenModified || offerUsePKHasBeenModified || wishlistPriorityPKHasBeenModified || associateReferralPKHasBeenModified || commentHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified; 287 } 288 289 @Override 290 public void clearHasBeenModified() { 291 orderLinePKHasBeenModified = false; 292 offerUsePKHasBeenModified = false; 293 wishlistPriorityPKHasBeenModified = false; 294 associateReferralPKHasBeenModified = false; 295 commentHasBeenModified = false; 296 fromTimeHasBeenModified = false; 297 thruTimeHasBeenModified = false; 298 } 299 300 @Nonnull 301 public OrderLinePK getOrderLinePK() { 302 return orderLinePK; 303 } 304 305 public void setOrderLinePK(@Nonnull OrderLinePK orderLinePK) 306 throws PersistenceNotNullException { 307 checkForNull(orderLinePK); 308 309 boolean update = true; 310 311 if(this.orderLinePK != null) { 312 if(this.orderLinePK.equals(orderLinePK)) { 313 update = false; 314 } 315 } else if(orderLinePK == null) { 316 update = false; 317 } 318 319 if(update) { 320 this.orderLinePK = orderLinePK; 321 orderLinePKHasBeenModified = true; 322 clearHashAndString(); 323 } 324 } 325 326 public boolean getOrderLinePKHasBeenModified() { 327 return orderLinePKHasBeenModified; 328 } 329 330 @Nonnull 331 public OfferUsePK getOfferUsePK() { 332 return offerUsePK; 333 } 334 335 public void setOfferUsePK(@Nonnull OfferUsePK offerUsePK) 336 throws PersistenceNotNullException { 337 checkForNull(offerUsePK); 338 339 boolean update = true; 340 341 if(this.offerUsePK != null) { 342 if(this.offerUsePK.equals(offerUsePK)) { 343 update = false; 344 } 345 } else if(offerUsePK == null) { 346 update = false; 347 } 348 349 if(update) { 350 this.offerUsePK = offerUsePK; 351 offerUsePKHasBeenModified = true; 352 clearHashAndString(); 353 } 354 } 355 356 public boolean getOfferUsePKHasBeenModified() { 357 return offerUsePKHasBeenModified; 358 } 359 360 @Nonnull 361 public WishlistPriorityPK getWishlistPriorityPK() { 362 return wishlistPriorityPK; 363 } 364 365 public void setWishlistPriorityPK(@Nonnull WishlistPriorityPK wishlistPriorityPK) 366 throws PersistenceNotNullException { 367 checkForNull(wishlistPriorityPK); 368 369 boolean update = true; 370 371 if(this.wishlistPriorityPK != null) { 372 if(this.wishlistPriorityPK.equals(wishlistPriorityPK)) { 373 update = false; 374 } 375 } else if(wishlistPriorityPK == null) { 376 update = false; 377 } 378 379 if(update) { 380 this.wishlistPriorityPK = wishlistPriorityPK; 381 wishlistPriorityPKHasBeenModified = true; 382 clearHashAndString(); 383 } 384 } 385 386 public boolean getWishlistPriorityPKHasBeenModified() { 387 return wishlistPriorityPKHasBeenModified; 388 } 389 390 @Nullable 391 public AssociateReferralPK getAssociateReferralPK() { 392 return associateReferralPK; 393 } 394 395 public void setAssociateReferralPK(@Nullable AssociateReferralPK associateReferralPK) { 396 boolean update = true; 397 398 if(this.associateReferralPK != null) { 399 if(this.associateReferralPK.equals(associateReferralPK)) { 400 update = false; 401 } 402 } else if(associateReferralPK == null) { 403 update = false; 404 } 405 406 if(update) { 407 this.associateReferralPK = associateReferralPK; 408 associateReferralPKHasBeenModified = true; 409 clearHashAndString(); 410 } 411 } 412 413 public boolean getAssociateReferralPKHasBeenModified() { 414 return associateReferralPKHasBeenModified; 415 } 416 417 @Nullable 418 public String getComment() { 419 return comment; 420 } 421 422 public void setComment(@Nullable String comment) { 423 boolean update = true; 424 425 if(this.comment != null) { 426 if(this.comment.equals(comment)) { 427 update = false; 428 } 429 } else if(comment == null) { 430 update = false; 431 } 432 433 if(update) { 434 this.comment = comment; 435 commentHasBeenModified = true; 436 clearHashAndString(); 437 } 438 } 439 440 public boolean getCommentHasBeenModified() { 441 return commentHasBeenModified; 442 } 443 444 @Nonnull 445 public Long getFromTime() { 446 return fromTime; 447 } 448 449 public void setFromTime(@Nonnull Long fromTime) 450 throws PersistenceNotNullException { 451 checkForNull(fromTime); 452 453 boolean update = true; 454 455 if(this.fromTime != null) { 456 if(this.fromTime.equals(fromTime)) { 457 update = false; 458 } 459 } else if(fromTime == null) { 460 update = false; 461 } 462 463 if(update) { 464 this.fromTime = fromTime; 465 fromTimeHasBeenModified = true; 466 clearHashAndString(); 467 } 468 } 469 470 public boolean getFromTimeHasBeenModified() { 471 return fromTimeHasBeenModified; 472 } 473 474 @Nonnull 475 public Long getThruTime() { 476 return thruTime; 477 } 478 479 public void setThruTime(@Nonnull Long thruTime) 480 throws PersistenceNotNullException { 481 checkForNull(thruTime); 482 483 boolean update = true; 484 485 if(this.thruTime != null) { 486 if(this.thruTime.equals(thruTime)) { 487 update = false; 488 } 489 } else if(thruTime == null) { 490 update = false; 491 } 492 493 if(update) { 494 this.thruTime = thruTime; 495 thruTimeHasBeenModified = true; 496 clearHashAndString(); 497 } 498 } 499 500 public boolean getThruTimeHasBeenModified() { 501 return thruTimeHasBeenModified; 502 } 503 504}