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