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 * WishlistValue.java 021 */ 022 023package com.echothree.model.data.wishlist.server.value; 024 025import com.echothree.model.data.wishlist.common.pk.WishlistPK; 026 027import com.echothree.model.data.wishlist.server.factory.WishlistFactory; 028 029import com.echothree.model.data.order.common.pk.OrderPK; 030import com.echothree.model.data.offer.common.pk.OfferUsePK; 031import com.echothree.model.data.wishlist.common.pk.WishlistTypePK; 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 040import javax.annotation.Nonnull; 041import javax.annotation.Nullable; 042 043public class WishlistValue 044 extends BaseValue<WishlistPK> 045 implements Cloneable, Serializable { 046 047 private OrderPK orderPK; 048 private boolean orderPKHasBeenModified = false; 049 private OfferUsePK offerUsePK; 050 private boolean offerUsePKHasBeenModified = false; 051 private WishlistTypePK wishlistTypePK; 052 private boolean wishlistTypePKHasBeenModified = false; 053 private Long fromTime; 054 private boolean fromTimeHasBeenModified = false; 055 private Long thruTime; 056 private boolean thruTimeHasBeenModified = false; 057 058 private transient Integer _hashCode = null; 059 private transient String _stringValue = null; 060 061 private void constructFields(OrderPK orderPK, OfferUsePK offerUsePK, WishlistTypePK wishlistTypePK, Long fromTime, Long thruTime) 062 throws PersistenceNotNullException { 063 checkForNull(orderPK); 064 this.orderPK = orderPK; 065 checkForNull(offerUsePK); 066 this.offerUsePK = offerUsePK; 067 checkForNull(wishlistTypePK); 068 this.wishlistTypePK = wishlistTypePK; 069 checkForNull(fromTime); 070 this.fromTime = fromTime; 071 checkForNull(thruTime); 072 this.thruTime = thruTime; 073 } 074 075 /** Creates a new instance of WishlistValue */ 076 public WishlistValue(WishlistPK wishlistPK, OrderPK orderPK, OfferUsePK offerUsePK, WishlistTypePK wishlistTypePK, Long fromTime, Long thruTime) 077 throws PersistenceNotNullException { 078 super(wishlistPK); 079 constructFields(orderPK, offerUsePK, wishlistTypePK, fromTime, thruTime); 080 } 081 082 /** Creates a new instance of WishlistValue */ 083 public WishlistValue(OrderPK orderPK, OfferUsePK offerUsePK, WishlistTypePK wishlistTypePK, Long fromTime, Long thruTime) 084 throws PersistenceNotNullException { 085 super(); 086 constructFields(orderPK, offerUsePK, wishlistTypePK, fromTime, thruTime); 087 } 088 089 @Override 090 @Nonnull 091 public WishlistFactory getBaseFactoryInstance() { 092 return WishlistFactory.getInstance(); 093 } 094 095 @Override 096 @Nonnull 097 public WishlistValue clone() { 098 Object result; 099 100 try { 101 result = super.clone(); 102 } catch (CloneNotSupportedException cnse) { 103 // This shouldn't happen, fail when it does. 104 throw new PersistenceCloneException(cnse); 105 } 106 107 return (WishlistValue)result; 108 } 109 110 @Override 111 @Nonnull 112 public WishlistPK getPrimaryKey() { 113 if(_primaryKey == null) { 114 _primaryKey = new WishlistPK(entityId); 115 } 116 117 return _primaryKey; 118 } 119 120 private void clearHashAndString() { 121 _hashCode = null; 122 _stringValue = null; 123 } 124 125 @Override 126 public int hashCode() { 127 if(_hashCode == null) { 128 int hashCode = 17; 129 130 hashCode = 37 * hashCode + ((entityId != null) ? entityId.hashCode() : 0); 131 132 hashCode = 37 * hashCode + ((orderPK != null) ? orderPK.hashCode() : 0); 133 hashCode = 37 * hashCode + ((offerUsePK != null) ? offerUsePK.hashCode() : 0); 134 hashCode = 37 * hashCode + ((wishlistTypePK != null) ? wishlistTypePK.hashCode() : 0); 135 hashCode = 37 * hashCode + ((fromTime != null) ? fromTime.hashCode() : 0); 136 hashCode = 37 * hashCode + ((thruTime != null) ? thruTime.hashCode() : 0); 137 138 _hashCode = hashCode; 139 } 140 141 return _hashCode; 142 } 143 144 @Override 145 @Nonnull 146 public String toString() { 147 if(_stringValue == null) { 148 _stringValue = "{" + 149 "entityId=" + getEntityId() + 150 ", orderPK=" + getOrderPK() + 151 ", offerUsePK=" + getOfferUsePK() + 152 ", wishlistTypePK=" + getWishlistTypePK() + 153 ", fromTime=" + getFromTime() + 154 ", thruTime=" + getThruTime() + 155 "}"; 156 } 157 return _stringValue; 158 } 159 160 @Override 161 public boolean equals(Object other) { 162 if(this == other) 163 return true; 164 165 if(!hasIdentity()) 166 return false; 167 168 if(other instanceof WishlistValue that) { 169 if(!that.hasIdentity()) 170 return false; 171 172 Long thisEntityId = getEntityId(); 173 Long thatEntityId = that.getEntityId(); 174 175 boolean objectsEqual = thisEntityId.equals(thatEntityId); 176 if(objectsEqual) 177 objectsEqual = isIdentical(that); 178 179 return objectsEqual; 180 } else { 181 return false; 182 } 183 } 184 185 public boolean isIdentical(Object other) { 186 if(other instanceof WishlistValue that) { 187 boolean objectsEqual = true; 188 189 190 if(objectsEqual) { 191 OrderPK thisOrderPK = getOrderPK(); 192 OrderPK thatOrderPK = that.getOrderPK(); 193 194 if(thisOrderPK == null) { 195 objectsEqual = objectsEqual && (thatOrderPK == null); 196 } else { 197 objectsEqual = objectsEqual && thisOrderPK.equals(thatOrderPK); 198 } 199 } 200 201 if(objectsEqual) { 202 OfferUsePK thisOfferUsePK = getOfferUsePK(); 203 OfferUsePK thatOfferUsePK = that.getOfferUsePK(); 204 205 if(thisOfferUsePK == null) { 206 objectsEqual = objectsEqual && (thatOfferUsePK == null); 207 } else { 208 objectsEqual = objectsEqual && thisOfferUsePK.equals(thatOfferUsePK); 209 } 210 } 211 212 if(objectsEqual) { 213 WishlistTypePK thisWishlistTypePK = getWishlistTypePK(); 214 WishlistTypePK thatWishlistTypePK = that.getWishlistTypePK(); 215 216 if(thisWishlistTypePK == null) { 217 objectsEqual = objectsEqual && (thatWishlistTypePK == null); 218 } else { 219 objectsEqual = objectsEqual && thisWishlistTypePK.equals(thatWishlistTypePK); 220 } 221 } 222 223 if(objectsEqual) { 224 Long thisFromTime = getFromTime(); 225 Long thatFromTime = that.getFromTime(); 226 227 if(thisFromTime == null) { 228 objectsEqual = objectsEqual && (thatFromTime == null); 229 } else { 230 objectsEqual = objectsEqual && thisFromTime.equals(thatFromTime); 231 } 232 } 233 234 if(objectsEqual) { 235 Long thisThruTime = getThruTime(); 236 Long thatThruTime = that.getThruTime(); 237 238 if(thisThruTime == null) { 239 objectsEqual = objectsEqual && (thatThruTime == null); 240 } else { 241 objectsEqual = objectsEqual && thisThruTime.equals(thatThruTime); 242 } 243 } 244 245 return objectsEqual; 246 } else { 247 return false; 248 } 249 } 250 251 @Override 252 public boolean hasBeenModified() { 253 return orderPKHasBeenModified || offerUsePKHasBeenModified || wishlistTypePKHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified; 254 } 255 256 @Override 257 public void clearHasBeenModified() { 258 orderPKHasBeenModified = false; 259 offerUsePKHasBeenModified = false; 260 wishlistTypePKHasBeenModified = false; 261 fromTimeHasBeenModified = false; 262 thruTimeHasBeenModified = false; 263 } 264 265 @Nonnull 266 public OrderPK getOrderPK() { 267 return orderPK; 268 } 269 270 public void setOrderPK(@Nonnull OrderPK orderPK) 271 throws PersistenceNotNullException { 272 checkForNull(orderPK); 273 274 boolean update = true; 275 276 if(this.orderPK != null) { 277 if(this.orderPK.equals(orderPK)) { 278 update = false; 279 } 280 } else if(orderPK == null) { 281 update = false; 282 } 283 284 if(update) { 285 this.orderPK = orderPK; 286 orderPKHasBeenModified = true; 287 clearHashAndString(); 288 } 289 } 290 291 public boolean getOrderPKHasBeenModified() { 292 return orderPKHasBeenModified; 293 } 294 295 @Nonnull 296 public OfferUsePK getOfferUsePK() { 297 return offerUsePK; 298 } 299 300 public void setOfferUsePK(@Nonnull OfferUsePK offerUsePK) 301 throws PersistenceNotNullException { 302 checkForNull(offerUsePK); 303 304 boolean update = true; 305 306 if(this.offerUsePK != null) { 307 if(this.offerUsePK.equals(offerUsePK)) { 308 update = false; 309 } 310 } else if(offerUsePK == null) { 311 update = false; 312 } 313 314 if(update) { 315 this.offerUsePK = offerUsePK; 316 offerUsePKHasBeenModified = true; 317 clearHashAndString(); 318 } 319 } 320 321 public boolean getOfferUsePKHasBeenModified() { 322 return offerUsePKHasBeenModified; 323 } 324 325 @Nonnull 326 public WishlistTypePK getWishlistTypePK() { 327 return wishlistTypePK; 328 } 329 330 public void setWishlistTypePK(@Nonnull WishlistTypePK wishlistTypePK) 331 throws PersistenceNotNullException { 332 checkForNull(wishlistTypePK); 333 334 boolean update = true; 335 336 if(this.wishlistTypePK != null) { 337 if(this.wishlistTypePK.equals(wishlistTypePK)) { 338 update = false; 339 } 340 } else if(wishlistTypePK == null) { 341 update = false; 342 } 343 344 if(update) { 345 this.wishlistTypePK = wishlistTypePK; 346 wishlistTypePKHasBeenModified = true; 347 clearHashAndString(); 348 } 349 } 350 351 public boolean getWishlistTypePKHasBeenModified() { 352 return wishlistTypePKHasBeenModified; 353 } 354 355 @Nonnull 356 public Long getFromTime() { 357 return fromTime; 358 } 359 360 public void setFromTime(@Nonnull Long fromTime) 361 throws PersistenceNotNullException { 362 checkForNull(fromTime); 363 364 boolean update = true; 365 366 if(this.fromTime != null) { 367 if(this.fromTime.equals(fromTime)) { 368 update = false; 369 } 370 } else if(fromTime == null) { 371 update = false; 372 } 373 374 if(update) { 375 this.fromTime = fromTime; 376 fromTimeHasBeenModified = true; 377 clearHashAndString(); 378 } 379 } 380 381 public boolean getFromTimeHasBeenModified() { 382 return fromTimeHasBeenModified; 383 } 384 385 @Nonnull 386 public Long getThruTime() { 387 return thruTime; 388 } 389 390 public void setThruTime(@Nonnull Long thruTime) 391 throws PersistenceNotNullException { 392 checkForNull(thruTime); 393 394 boolean update = true; 395 396 if(this.thruTime != null) { 397 if(this.thruTime.equals(thruTime)) { 398 update = false; 399 } 400 } else if(thruTime == null) { 401 update = false; 402 } 403 404 if(update) { 405 this.thruTime = thruTime; 406 thruTimeHasBeenModified = true; 407 clearHashAndString(); 408 } 409 } 410 411 public boolean getThruTimeHasBeenModified() { 412 return thruTimeHasBeenModified; 413 } 414 415}