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 * 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 StringBuilder stringValue = new StringBuilder("{"); 147 148 stringValue.append("entityId=").append(getEntityId()); 149 150 stringValue.append(", offerUsePK=").append(getOfferUsePK()); 151 stringValue.append(", offerPK=").append(getOfferPK()); 152 stringValue.append(", usePK=").append(getUsePK()); 153 stringValue.append(", salesOrderSequencePK=").append(getSalesOrderSequencePK()); 154 stringValue.append(", fromTime=").append(getFromTime()); 155 stringValue.append(", thruTime=").append(getThruTime()); 156 157 stringValue.append('}'); 158 159 _stringValue = stringValue.toString(); 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 OfferUseDetailValue) { 173 OfferUseDetailValue that = (OfferUseDetailValue)other; 174 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 = 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) { 193 OfferUseDetailValue that = (OfferUseDetailValue)other; 194 boolean objectsEqual = true; 195 196 197 if(objectsEqual) { 198 OfferUsePK thisOfferUsePK = getOfferUsePK(); 199 OfferUsePK thatOfferUsePK = that.getOfferUsePK(); 200 201 if(thisOfferUsePK == null) { 202 objectsEqual = objectsEqual && (thatOfferUsePK == null); 203 } else { 204 objectsEqual = objectsEqual && thisOfferUsePK.equals(thatOfferUsePK); 205 } 206 } 207 208 if(objectsEqual) { 209 OfferPK thisOfferPK = getOfferPK(); 210 OfferPK thatOfferPK = that.getOfferPK(); 211 212 if(thisOfferPK == null) { 213 objectsEqual = objectsEqual && (thatOfferPK == null); 214 } else { 215 objectsEqual = objectsEqual && thisOfferPK.equals(thatOfferPK); 216 } 217 } 218 219 if(objectsEqual) { 220 UsePK thisUsePK = getUsePK(); 221 UsePK thatUsePK = that.getUsePK(); 222 223 if(thisUsePK == null) { 224 objectsEqual = objectsEqual && (thatUsePK == null); 225 } else { 226 objectsEqual = objectsEqual && thisUsePK.equals(thatUsePK); 227 } 228 } 229 230 if(objectsEqual) { 231 SequencePK thisSalesOrderSequencePK = getSalesOrderSequencePK(); 232 SequencePK thatSalesOrderSequencePK = that.getSalesOrderSequencePK(); 233 234 if(thisSalesOrderSequencePK == null) { 235 objectsEqual = objectsEqual && (thatSalesOrderSequencePK == null); 236 } else { 237 objectsEqual = objectsEqual && thisSalesOrderSequencePK.equals(thatSalesOrderSequencePK); 238 } 239 } 240 241 if(objectsEqual) { 242 Long thisFromTime = getFromTime(); 243 Long thatFromTime = that.getFromTime(); 244 245 if(thisFromTime == null) { 246 objectsEqual = objectsEqual && (thatFromTime == null); 247 } else { 248 objectsEqual = objectsEqual && thisFromTime.equals(thatFromTime); 249 } 250 } 251 252 if(objectsEqual) { 253 Long thisThruTime = getThruTime(); 254 Long thatThruTime = that.getThruTime(); 255 256 if(thisThruTime == null) { 257 objectsEqual = objectsEqual && (thatThruTime == null); 258 } else { 259 objectsEqual = objectsEqual && thisThruTime.equals(thatThruTime); 260 } 261 } 262 263 return objectsEqual; 264 } else { 265 return false; 266 } 267 } 268 269 @Override 270 public boolean hasBeenModified() { 271 return offerUsePKHasBeenModified || offerPKHasBeenModified || usePKHasBeenModified || salesOrderSequencePKHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified; 272 } 273 274 @Override 275 public void clearHasBeenModified() { 276 offerUsePKHasBeenModified = false; 277 offerPKHasBeenModified = false; 278 usePKHasBeenModified = false; 279 salesOrderSequencePKHasBeenModified = false; 280 fromTimeHasBeenModified = false; 281 thruTimeHasBeenModified = false; 282 } 283 284 public OfferUsePK getOfferUsePK() { 285 return offerUsePK; 286 } 287 288 public void setOfferUsePK(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 public OfferPK getOfferPK() { 314 return offerPK; 315 } 316 317 public void setOfferPK(OfferPK offerPK) 318 throws PersistenceNotNullException { 319 checkForNull(offerPK); 320 321 boolean update = true; 322 323 if(this.offerPK != null) { 324 if(this.offerPK.equals(offerPK)) { 325 update = false; 326 } 327 } else if(offerPK == null) { 328 update = false; 329 } 330 331 if(update) { 332 this.offerPK = offerPK; 333 offerPKHasBeenModified = true; 334 clearHashAndString(); 335 } 336 } 337 338 public boolean getOfferPKHasBeenModified() { 339 return offerPKHasBeenModified; 340 } 341 342 public UsePK getUsePK() { 343 return usePK; 344 } 345 346 public void setUsePK(UsePK usePK) 347 throws PersistenceNotNullException { 348 checkForNull(usePK); 349 350 boolean update = true; 351 352 if(this.usePK != null) { 353 if(this.usePK.equals(usePK)) { 354 update = false; 355 } 356 } else if(usePK == null) { 357 update = false; 358 } 359 360 if(update) { 361 this.usePK = usePK; 362 usePKHasBeenModified = true; 363 clearHashAndString(); 364 } 365 } 366 367 public boolean getUsePKHasBeenModified() { 368 return usePKHasBeenModified; 369 } 370 371 public SequencePK getSalesOrderSequencePK() { 372 return salesOrderSequencePK; 373 } 374 375 public void setSalesOrderSequencePK(SequencePK salesOrderSequencePK) { 376 boolean update = true; 377 378 if(this.salesOrderSequencePK != null) { 379 if(this.salesOrderSequencePK.equals(salesOrderSequencePK)) { 380 update = false; 381 } 382 } else if(salesOrderSequencePK == null) { 383 update = false; 384 } 385 386 if(update) { 387 this.salesOrderSequencePK = salesOrderSequencePK; 388 salesOrderSequencePKHasBeenModified = true; 389 clearHashAndString(); 390 } 391 } 392 393 public boolean getSalesOrderSequencePKHasBeenModified() { 394 return salesOrderSequencePKHasBeenModified; 395 } 396 397 public Long getFromTime() { 398 return fromTime; 399 } 400 401 public void setFromTime(Long fromTime) 402 throws PersistenceNotNullException { 403 checkForNull(fromTime); 404 405 boolean update = true; 406 407 if(this.fromTime != null) { 408 if(this.fromTime.equals(fromTime)) { 409 update = false; 410 } 411 } else if(fromTime == null) { 412 update = false; 413 } 414 415 if(update) { 416 this.fromTime = fromTime; 417 fromTimeHasBeenModified = true; 418 clearHashAndString(); 419 } 420 } 421 422 public boolean getFromTimeHasBeenModified() { 423 return fromTimeHasBeenModified; 424 } 425 426 public Long getThruTime() { 427 return thruTime; 428 } 429 430 public void setThruTime(Long thruTime) 431 throws PersistenceNotNullException { 432 checkForNull(thruTime); 433 434 boolean update = true; 435 436 if(this.thruTime != null) { 437 if(this.thruTime.equals(thruTime)) { 438 update = false; 439 } 440 } else if(thruTime == null) { 441 update = false; 442 } 443 444 if(update) { 445 this.thruTime = thruTime; 446 thruTimeHasBeenModified = true; 447 clearHashAndString(); 448 } 449 } 450 451 public boolean getThruTimeHasBeenModified() { 452 return thruTimeHasBeenModified; 453 } 454 455}