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 * 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 StringBuilder stringValue = new StringBuilder("{"); 151 152 stringValue.append("entityId=").append(getEntityId()); 153 154 stringValue.append(", orderLinePK=").append(getOrderLinePK()); 155 stringValue.append(", offerUsePK=").append(getOfferUsePK()); 156 stringValue.append(", wishlistPriorityPK=").append(getWishlistPriorityPK()); 157 stringValue.append(", associateReferralPK=").append(getAssociateReferralPK()); 158 stringValue.append(", comment=").append(getComment()); 159 stringValue.append(", fromTime=").append(getFromTime()); 160 stringValue.append(", thruTime=").append(getThruTime()); 161 162 stringValue.append('}'); 163 164 _stringValue = stringValue.toString(); 165 } 166 return _stringValue; 167 } 168 169 @Override 170 public boolean equals(Object other) { 171 if(this == other) 172 return true; 173 174 if(!hasIdentity()) 175 return false; 176 177 if(other instanceof WishlistLineValue) { 178 WishlistLineValue that = (WishlistLineValue)other; 179 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 = 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) { 198 WishlistLineValue that = (WishlistLineValue)other; 199 boolean objectsEqual = true; 200 201 202 if(objectsEqual) { 203 OrderLinePK thisOrderLinePK = getOrderLinePK(); 204 OrderLinePK thatOrderLinePK = that.getOrderLinePK(); 205 206 if(thisOrderLinePK == null) { 207 objectsEqual = objectsEqual && (thatOrderLinePK == null); 208 } else { 209 objectsEqual = objectsEqual && thisOrderLinePK.equals(thatOrderLinePK); 210 } 211 } 212 213 if(objectsEqual) { 214 OfferUsePK thisOfferUsePK = getOfferUsePK(); 215 OfferUsePK thatOfferUsePK = that.getOfferUsePK(); 216 217 if(thisOfferUsePK == null) { 218 objectsEqual = objectsEqual && (thatOfferUsePK == null); 219 } else { 220 objectsEqual = objectsEqual && thisOfferUsePK.equals(thatOfferUsePK); 221 } 222 } 223 224 if(objectsEqual) { 225 WishlistPriorityPK thisWishlistPriorityPK = getWishlistPriorityPK(); 226 WishlistPriorityPK thatWishlistPriorityPK = that.getWishlistPriorityPK(); 227 228 if(thisWishlistPriorityPK == null) { 229 objectsEqual = objectsEqual && (thatWishlistPriorityPK == null); 230 } else { 231 objectsEqual = objectsEqual && thisWishlistPriorityPK.equals(thatWishlistPriorityPK); 232 } 233 } 234 235 if(objectsEqual) { 236 AssociateReferralPK thisAssociateReferralPK = getAssociateReferralPK(); 237 AssociateReferralPK thatAssociateReferralPK = that.getAssociateReferralPK(); 238 239 if(thisAssociateReferralPK == null) { 240 objectsEqual = objectsEqual && (thatAssociateReferralPK == null); 241 } else { 242 objectsEqual = objectsEqual && thisAssociateReferralPK.equals(thatAssociateReferralPK); 243 } 244 } 245 246 if(objectsEqual) { 247 String thisComment = getComment(); 248 String thatComment = that.getComment(); 249 250 if(thisComment == null) { 251 objectsEqual = objectsEqual && (thatComment == null); 252 } else { 253 objectsEqual = objectsEqual && thisComment.equals(thatComment); 254 } 255 } 256 257 if(objectsEqual) { 258 Long thisFromTime = getFromTime(); 259 Long thatFromTime = that.getFromTime(); 260 261 if(thisFromTime == null) { 262 objectsEqual = objectsEqual && (thatFromTime == null); 263 } else { 264 objectsEqual = objectsEqual && thisFromTime.equals(thatFromTime); 265 } 266 } 267 268 if(objectsEqual) { 269 Long thisThruTime = getThruTime(); 270 Long thatThruTime = that.getThruTime(); 271 272 if(thisThruTime == null) { 273 objectsEqual = objectsEqual && (thatThruTime == null); 274 } else { 275 objectsEqual = objectsEqual && thisThruTime.equals(thatThruTime); 276 } 277 } 278 279 return objectsEqual; 280 } else { 281 return false; 282 } 283 } 284 285 @Override 286 public boolean hasBeenModified() { 287 return orderLinePKHasBeenModified || offerUsePKHasBeenModified || wishlistPriorityPKHasBeenModified || associateReferralPKHasBeenModified || commentHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified; 288 } 289 290 @Override 291 public void clearHasBeenModified() { 292 orderLinePKHasBeenModified = false; 293 offerUsePKHasBeenModified = false; 294 wishlistPriorityPKHasBeenModified = false; 295 associateReferralPKHasBeenModified = false; 296 commentHasBeenModified = false; 297 fromTimeHasBeenModified = false; 298 thruTimeHasBeenModified = false; 299 } 300 301 public OrderLinePK getOrderLinePK() { 302 return orderLinePK; 303 } 304 305 public void setOrderLinePK(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 public OfferUsePK getOfferUsePK() { 331 return offerUsePK; 332 } 333 334 public void setOfferUsePK(OfferUsePK offerUsePK) 335 throws PersistenceNotNullException { 336 checkForNull(offerUsePK); 337 338 boolean update = true; 339 340 if(this.offerUsePK != null) { 341 if(this.offerUsePK.equals(offerUsePK)) { 342 update = false; 343 } 344 } else if(offerUsePK == null) { 345 update = false; 346 } 347 348 if(update) { 349 this.offerUsePK = offerUsePK; 350 offerUsePKHasBeenModified = true; 351 clearHashAndString(); 352 } 353 } 354 355 public boolean getOfferUsePKHasBeenModified() { 356 return offerUsePKHasBeenModified; 357 } 358 359 public WishlistPriorityPK getWishlistPriorityPK() { 360 return wishlistPriorityPK; 361 } 362 363 public void setWishlistPriorityPK(WishlistPriorityPK wishlistPriorityPK) 364 throws PersistenceNotNullException { 365 checkForNull(wishlistPriorityPK); 366 367 boolean update = true; 368 369 if(this.wishlistPriorityPK != null) { 370 if(this.wishlistPriorityPK.equals(wishlistPriorityPK)) { 371 update = false; 372 } 373 } else if(wishlistPriorityPK == null) { 374 update = false; 375 } 376 377 if(update) { 378 this.wishlistPriorityPK = wishlistPriorityPK; 379 wishlistPriorityPKHasBeenModified = true; 380 clearHashAndString(); 381 } 382 } 383 384 public boolean getWishlistPriorityPKHasBeenModified() { 385 return wishlistPriorityPKHasBeenModified; 386 } 387 388 public AssociateReferralPK getAssociateReferralPK() { 389 return associateReferralPK; 390 } 391 392 public void setAssociateReferralPK(AssociateReferralPK associateReferralPK) { 393 boolean update = true; 394 395 if(this.associateReferralPK != null) { 396 if(this.associateReferralPK.equals(associateReferralPK)) { 397 update = false; 398 } 399 } else if(associateReferralPK == null) { 400 update = false; 401 } 402 403 if(update) { 404 this.associateReferralPK = associateReferralPK; 405 associateReferralPKHasBeenModified = true; 406 clearHashAndString(); 407 } 408 } 409 410 public boolean getAssociateReferralPKHasBeenModified() { 411 return associateReferralPKHasBeenModified; 412 } 413 414 public String getComment() { 415 return comment; 416 } 417 418 public void setComment(String comment) { 419 boolean update = true; 420 421 if(this.comment != null) { 422 if(this.comment.equals(comment)) { 423 update = false; 424 } 425 } else if(comment == null) { 426 update = false; 427 } 428 429 if(update) { 430 this.comment = comment; 431 commentHasBeenModified = true; 432 clearHashAndString(); 433 } 434 } 435 436 public boolean getCommentHasBeenModified() { 437 return commentHasBeenModified; 438 } 439 440 public Long getFromTime() { 441 return fromTime; 442 } 443 444 public void setFromTime(Long fromTime) 445 throws PersistenceNotNullException { 446 checkForNull(fromTime); 447 448 boolean update = true; 449 450 if(this.fromTime != null) { 451 if(this.fromTime.equals(fromTime)) { 452 update = false; 453 } 454 } else if(fromTime == null) { 455 update = false; 456 } 457 458 if(update) { 459 this.fromTime = fromTime; 460 fromTimeHasBeenModified = true; 461 clearHashAndString(); 462 } 463 } 464 465 public boolean getFromTimeHasBeenModified() { 466 return fromTimeHasBeenModified; 467 } 468 469 public Long getThruTime() { 470 return thruTime; 471 } 472 473 public void setThruTime(Long thruTime) 474 throws PersistenceNotNullException { 475 checkForNull(thruTime); 476 477 boolean update = true; 478 479 if(this.thruTime != null) { 480 if(this.thruTime.equals(thruTime)) { 481 update = false; 482 } 483 } else if(thruTime == null) { 484 update = false; 485 } 486 487 if(update) { 488 this.thruTime = thruTime; 489 thruTimeHasBeenModified = true; 490 clearHashAndString(); 491 } 492 } 493 494 public boolean getThruTimeHasBeenModified() { 495 return thruTimeHasBeenModified; 496 } 497 498}