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 * OfferNameElementDetailValue.java 021 */ 022 023package com.echothree.model.data.offer.server.value; 024 025import com.echothree.model.data.offer.common.pk.OfferNameElementDetailPK; 026 027import com.echothree.model.data.offer.server.factory.OfferNameElementDetailFactory; 028 029import com.echothree.model.data.offer.common.pk.OfferNameElementPK; 030 031import com.echothree.util.common.exception.PersistenceCloneException; 032import com.echothree.util.common.exception.PersistenceNotNullException; 033 034import com.echothree.util.server.persistence.BaseValue; 035 036import java.io.Serializable; 037 038public class OfferNameElementDetailValue 039 extends BaseValue<OfferNameElementDetailPK> 040 implements Cloneable, Serializable { 041 042 private OfferNameElementPK offerNameElementPK; 043 private boolean offerNameElementPKHasBeenModified = false; 044 private String offerNameElementName; 045 private boolean offerNameElementNameHasBeenModified = false; 046 private Integer offset; 047 private boolean offsetHasBeenModified = false; 048 private Integer length; 049 private boolean lengthHasBeenModified = false; 050 private String validationPattern; 051 private boolean validationPatternHasBeenModified = false; 052 private Long fromTime; 053 private boolean fromTimeHasBeenModified = false; 054 private Long thruTime; 055 private boolean thruTimeHasBeenModified = false; 056 057 private transient Integer _hashCode = null; 058 private transient String _stringValue = null; 059 060 private void constructFields(OfferNameElementPK offerNameElementPK, String offerNameElementName, Integer offset, Integer length, String validationPattern, Long fromTime, Long thruTime) 061 throws PersistenceNotNullException { 062 checkForNull(offerNameElementPK); 063 this.offerNameElementPK = offerNameElementPK; 064 checkForNull(offerNameElementName); 065 this.offerNameElementName = offerNameElementName; 066 checkForNull(offset); 067 this.offset = offset; 068 checkForNull(length); 069 this.length = length; 070 this.validationPattern = validationPattern; 071 checkForNull(fromTime); 072 this.fromTime = fromTime; 073 checkForNull(thruTime); 074 this.thruTime = thruTime; 075 } 076 077 /** Creates a new instance of OfferNameElementDetailValue */ 078 public OfferNameElementDetailValue(OfferNameElementDetailPK offerNameElementDetailPK, OfferNameElementPK offerNameElementPK, String offerNameElementName, Integer offset, Integer length, String validationPattern, Long fromTime, Long thruTime) 079 throws PersistenceNotNullException { 080 super(offerNameElementDetailPK); 081 constructFields(offerNameElementPK, offerNameElementName, offset, length, validationPattern, fromTime, thruTime); 082 } 083 084 /** Creates a new instance of OfferNameElementDetailValue */ 085 public OfferNameElementDetailValue(OfferNameElementPK offerNameElementPK, String offerNameElementName, Integer offset, Integer length, String validationPattern, Long fromTime, Long thruTime) 086 throws PersistenceNotNullException { 087 super(); 088 constructFields(offerNameElementPK, offerNameElementName, offset, length, validationPattern, fromTime, thruTime); 089 } 090 091 @Override 092 public OfferNameElementDetailFactory getBaseFactoryInstance() { 093 return OfferNameElementDetailFactory.getInstance(); 094 } 095 096 @Override 097 public OfferNameElementDetailValue 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 (OfferNameElementDetailValue)result; 108 } 109 110 @Override 111 public OfferNameElementDetailPK getPrimaryKey() { 112 if(_primaryKey == null) { 113 _primaryKey = new OfferNameElementDetailPK(entityId); 114 } 115 116 return _primaryKey; 117 } 118 119 private void clearHashAndString() { 120 _hashCode = null; 121 _stringValue = null; 122 } 123 124 @Override 125 public int hashCode() { 126 if(_hashCode == null) { 127 int hashCode = 17; 128 129 hashCode = 37 * hashCode + ((entityId != null) ? entityId.hashCode() : 0); 130 131 hashCode = 37 * hashCode + ((offerNameElementPK != null) ? offerNameElementPK.hashCode() : 0); 132 hashCode = 37 * hashCode + ((offerNameElementName != null) ? offerNameElementName.hashCode() : 0); 133 hashCode = 37 * hashCode + ((offset != null) ? offset.hashCode() : 0); 134 hashCode = 37 * hashCode + ((length != null) ? length.hashCode() : 0); 135 hashCode = 37 * hashCode + ((validationPattern != null) ? validationPattern.hashCode() : 0); 136 hashCode = 37 * hashCode + ((fromTime != null) ? fromTime.hashCode() : 0); 137 hashCode = 37 * hashCode + ((thruTime != null) ? thruTime.hashCode() : 0); 138 139 _hashCode = hashCode; 140 } 141 142 return _hashCode; 143 } 144 145 @Override 146 public String toString() { 147 if(_stringValue == null) { 148 _stringValue = "{" + 149 "entityId=" + getEntityId() + 150 ", offerNameElementPK=" + getOfferNameElementPK() + 151 ", offerNameElementName=" + getOfferNameElementName() + 152 ", offset=" + getOffset() + 153 ", length=" + getLength() + 154 ", validationPattern=" + getValidationPattern() + 155 ", fromTime=" + getFromTime() + 156 ", thruTime=" + getThruTime() + 157 "}"; 158 } 159 return _stringValue; 160 } 161 162 @Override 163 public boolean equals(Object other) { 164 if(this == other) 165 return true; 166 167 if(!hasIdentity()) 168 return false; 169 170 if(other instanceof OfferNameElementDetailValue that) { 171 if(!that.hasIdentity()) 172 return false; 173 174 Long thisEntityId = getEntityId(); 175 Long thatEntityId = that.getEntityId(); 176 177 boolean objectsEqual = thisEntityId.equals(thatEntityId); 178 if(objectsEqual) 179 objectsEqual = isIdentical(that); 180 181 return objectsEqual; 182 } else { 183 return false; 184 } 185 } 186 187 public boolean isIdentical(Object other) { 188 if(other instanceof OfferNameElementDetailValue that) { 189 boolean objectsEqual = true; 190 191 192 if(objectsEqual) { 193 OfferNameElementPK thisOfferNameElementPK = getOfferNameElementPK(); 194 OfferNameElementPK thatOfferNameElementPK = that.getOfferNameElementPK(); 195 196 if(thisOfferNameElementPK == null) { 197 objectsEqual = objectsEqual && (thatOfferNameElementPK == null); 198 } else { 199 objectsEqual = objectsEqual && thisOfferNameElementPK.equals(thatOfferNameElementPK); 200 } 201 } 202 203 if(objectsEqual) { 204 String thisOfferNameElementName = getOfferNameElementName(); 205 String thatOfferNameElementName = that.getOfferNameElementName(); 206 207 if(thisOfferNameElementName == null) { 208 objectsEqual = objectsEqual && (thatOfferNameElementName == null); 209 } else { 210 objectsEqual = objectsEqual && thisOfferNameElementName.equals(thatOfferNameElementName); 211 } 212 } 213 214 if(objectsEqual) { 215 Integer thisOffset = getOffset(); 216 Integer thatOffset = that.getOffset(); 217 218 if(thisOffset == null) { 219 objectsEqual = objectsEqual && (thatOffset == null); 220 } else { 221 objectsEqual = objectsEqual && thisOffset.equals(thatOffset); 222 } 223 } 224 225 if(objectsEqual) { 226 Integer thisLength = getLength(); 227 Integer thatLength = that.getLength(); 228 229 if(thisLength == null) { 230 objectsEqual = objectsEqual && (thatLength == null); 231 } else { 232 objectsEqual = objectsEqual && thisLength.equals(thatLength); 233 } 234 } 235 236 if(objectsEqual) { 237 String thisValidationPattern = getValidationPattern(); 238 String thatValidationPattern = that.getValidationPattern(); 239 240 if(thisValidationPattern == null) { 241 objectsEqual = objectsEqual && (thatValidationPattern == null); 242 } else { 243 objectsEqual = objectsEqual && thisValidationPattern.equals(thatValidationPattern); 244 } 245 } 246 247 if(objectsEqual) { 248 Long thisFromTime = getFromTime(); 249 Long thatFromTime = that.getFromTime(); 250 251 if(thisFromTime == null) { 252 objectsEqual = objectsEqual && (thatFromTime == null); 253 } else { 254 objectsEqual = objectsEqual && thisFromTime.equals(thatFromTime); 255 } 256 } 257 258 if(objectsEqual) { 259 Long thisThruTime = getThruTime(); 260 Long thatThruTime = that.getThruTime(); 261 262 if(thisThruTime == null) { 263 objectsEqual = objectsEqual && (thatThruTime == null); 264 } else { 265 objectsEqual = objectsEqual && thisThruTime.equals(thatThruTime); 266 } 267 } 268 269 return objectsEqual; 270 } else { 271 return false; 272 } 273 } 274 275 @Override 276 public boolean hasBeenModified() { 277 return offerNameElementPKHasBeenModified || offerNameElementNameHasBeenModified || offsetHasBeenModified || lengthHasBeenModified || validationPatternHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified; 278 } 279 280 @Override 281 public void clearHasBeenModified() { 282 offerNameElementPKHasBeenModified = false; 283 offerNameElementNameHasBeenModified = false; 284 offsetHasBeenModified = false; 285 lengthHasBeenModified = false; 286 validationPatternHasBeenModified = false; 287 fromTimeHasBeenModified = false; 288 thruTimeHasBeenModified = false; 289 } 290 291 public OfferNameElementPK getOfferNameElementPK() { 292 return offerNameElementPK; 293 } 294 295 public void setOfferNameElementPK(OfferNameElementPK offerNameElementPK) 296 throws PersistenceNotNullException { 297 checkForNull(offerNameElementPK); 298 299 boolean update = true; 300 301 if(this.offerNameElementPK != null) { 302 if(this.offerNameElementPK.equals(offerNameElementPK)) { 303 update = false; 304 } 305 } else if(offerNameElementPK == null) { 306 update = false; 307 } 308 309 if(update) { 310 this.offerNameElementPK = offerNameElementPK; 311 offerNameElementPKHasBeenModified = true; 312 clearHashAndString(); 313 } 314 } 315 316 public boolean getOfferNameElementPKHasBeenModified() { 317 return offerNameElementPKHasBeenModified; 318 } 319 320 public String getOfferNameElementName() { 321 return offerNameElementName; 322 } 323 324 public void setOfferNameElementName(String offerNameElementName) 325 throws PersistenceNotNullException { 326 checkForNull(offerNameElementName); 327 328 boolean update = true; 329 330 if(this.offerNameElementName != null) { 331 if(this.offerNameElementName.equals(offerNameElementName)) { 332 update = false; 333 } 334 } else if(offerNameElementName == null) { 335 update = false; 336 } 337 338 if(update) { 339 this.offerNameElementName = offerNameElementName; 340 offerNameElementNameHasBeenModified = true; 341 clearHashAndString(); 342 } 343 } 344 345 public boolean getOfferNameElementNameHasBeenModified() { 346 return offerNameElementNameHasBeenModified; 347 } 348 349 public Integer getOffset() { 350 return offset; 351 } 352 353 public void setOffset(Integer offset) 354 throws PersistenceNotNullException { 355 checkForNull(offset); 356 357 boolean update = true; 358 359 if(this.offset != null) { 360 if(this.offset.equals(offset)) { 361 update = false; 362 } 363 } else if(offset == null) { 364 update = false; 365 } 366 367 if(update) { 368 this.offset = offset; 369 offsetHasBeenModified = true; 370 clearHashAndString(); 371 } 372 } 373 374 public boolean getOffsetHasBeenModified() { 375 return offsetHasBeenModified; 376 } 377 378 public Integer getLength() { 379 return length; 380 } 381 382 public void setLength(Integer length) 383 throws PersistenceNotNullException { 384 checkForNull(length); 385 386 boolean update = true; 387 388 if(this.length != null) { 389 if(this.length.equals(length)) { 390 update = false; 391 } 392 } else if(length == null) { 393 update = false; 394 } 395 396 if(update) { 397 this.length = length; 398 lengthHasBeenModified = true; 399 clearHashAndString(); 400 } 401 } 402 403 public boolean getLengthHasBeenModified() { 404 return lengthHasBeenModified; 405 } 406 407 public String getValidationPattern() { 408 return validationPattern; 409 } 410 411 public void setValidationPattern(String validationPattern) { 412 boolean update = true; 413 414 if(this.validationPattern != null) { 415 if(this.validationPattern.equals(validationPattern)) { 416 update = false; 417 } 418 } else if(validationPattern == null) { 419 update = false; 420 } 421 422 if(update) { 423 this.validationPattern = validationPattern; 424 validationPatternHasBeenModified = true; 425 clearHashAndString(); 426 } 427 } 428 429 public boolean getValidationPatternHasBeenModified() { 430 return validationPatternHasBeenModified; 431 } 432 433 public Long getFromTime() { 434 return fromTime; 435 } 436 437 public void setFromTime(Long fromTime) 438 throws PersistenceNotNullException { 439 checkForNull(fromTime); 440 441 boolean update = true; 442 443 if(this.fromTime != null) { 444 if(this.fromTime.equals(fromTime)) { 445 update = false; 446 } 447 } else if(fromTime == null) { 448 update = false; 449 } 450 451 if(update) { 452 this.fromTime = fromTime; 453 fromTimeHasBeenModified = true; 454 clearHashAndString(); 455 } 456 } 457 458 public boolean getFromTimeHasBeenModified() { 459 return fromTimeHasBeenModified; 460 } 461 462 public Long getThruTime() { 463 return thruTime; 464 } 465 466 public void setThruTime(Long thruTime) 467 throws PersistenceNotNullException { 468 checkForNull(thruTime); 469 470 boolean update = true; 471 472 if(this.thruTime != null) { 473 if(this.thruTime.equals(thruTime)) { 474 update = false; 475 } 476 } else if(thruTime == null) { 477 update = false; 478 } 479 480 if(update) { 481 this.thruTime = thruTime; 482 thruTimeHasBeenModified = true; 483 clearHashAndString(); 484 } 485 } 486 487 public boolean getThruTimeHasBeenModified() { 488 return thruTimeHasBeenModified; 489 } 490 491}