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