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