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