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 * 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 StringBuilder stringValue = new StringBuilder("{"); 155 156 stringValue.append("entityId=").append(getEntityId()); 157 158 stringValue.append(", locationNameElementPK=").append(getLocationNameElementPK()); 159 stringValue.append(", locationTypePK=").append(getLocationTypePK()); 160 stringValue.append(", locationNameElementName=").append(getLocationNameElementName()); 161 stringValue.append(", offset=").append(getOffset()); 162 stringValue.append(", length=").append(getLength()); 163 stringValue.append(", validationPattern=").append(getValidationPattern()); 164 stringValue.append(", fromTime=").append(getFromTime()); 165 stringValue.append(", thruTime=").append(getThruTime()); 166 167 stringValue.append('}'); 168 169 _stringValue = stringValue.toString(); 170 } 171 return _stringValue; 172 } 173 174 @Override 175 public boolean equals(Object other) { 176 if(this == other) 177 return true; 178 179 if(!hasIdentity()) 180 return false; 181 182 if(other instanceof LocationNameElementDetailValue) { 183 LocationNameElementDetailValue that = (LocationNameElementDetailValue)other; 184 185 if(!that.hasIdentity()) 186 return false; 187 188 Long thisEntityId = getEntityId(); 189 Long thatEntityId = that.getEntityId(); 190 191 boolean objectsEqual = thisEntityId.equals(thatEntityId); 192 if(objectsEqual) 193 objectsEqual = objectsEqual && isIdentical(that); 194 195 return objectsEqual; 196 } else { 197 return false; 198 } 199 } 200 201 public boolean isIdentical(Object other) { 202 if(other instanceof LocationNameElementDetailValue) { 203 LocationNameElementDetailValue that = (LocationNameElementDetailValue)other; 204 boolean objectsEqual = true; 205 206 207 if(objectsEqual) { 208 LocationNameElementPK thisLocationNameElementPK = getLocationNameElementPK(); 209 LocationNameElementPK thatLocationNameElementPK = that.getLocationNameElementPK(); 210 211 if(thisLocationNameElementPK == null) { 212 objectsEqual = objectsEqual && (thatLocationNameElementPK == null); 213 } else { 214 objectsEqual = objectsEqual && thisLocationNameElementPK.equals(thatLocationNameElementPK); 215 } 216 } 217 218 if(objectsEqual) { 219 LocationTypePK thisLocationTypePK = getLocationTypePK(); 220 LocationTypePK thatLocationTypePK = that.getLocationTypePK(); 221 222 if(thisLocationTypePK == null) { 223 objectsEqual = objectsEqual && (thatLocationTypePK == null); 224 } else { 225 objectsEqual = objectsEqual && thisLocationTypePK.equals(thatLocationTypePK); 226 } 227 } 228 229 if(objectsEqual) { 230 String thisLocationNameElementName = getLocationNameElementName(); 231 String thatLocationNameElementName = that.getLocationNameElementName(); 232 233 if(thisLocationNameElementName == null) { 234 objectsEqual = objectsEqual && (thatLocationNameElementName == null); 235 } else { 236 objectsEqual = objectsEqual && thisLocationNameElementName.equals(thatLocationNameElementName); 237 } 238 } 239 240 if(objectsEqual) { 241 Integer thisOffset = getOffset(); 242 Integer thatOffset = that.getOffset(); 243 244 if(thisOffset == null) { 245 objectsEqual = objectsEqual && (thatOffset == null); 246 } else { 247 objectsEqual = objectsEqual && thisOffset.equals(thatOffset); 248 } 249 } 250 251 if(objectsEqual) { 252 Integer thisLength = getLength(); 253 Integer thatLength = that.getLength(); 254 255 if(thisLength == null) { 256 objectsEqual = objectsEqual && (thatLength == null); 257 } else { 258 objectsEqual = objectsEqual && thisLength.equals(thatLength); 259 } 260 } 261 262 if(objectsEqual) { 263 String thisValidationPattern = getValidationPattern(); 264 String thatValidationPattern = that.getValidationPattern(); 265 266 if(thisValidationPattern == null) { 267 objectsEqual = objectsEqual && (thatValidationPattern == null); 268 } else { 269 objectsEqual = objectsEqual && thisValidationPattern.equals(thatValidationPattern); 270 } 271 } 272 273 if(objectsEqual) { 274 Long thisFromTime = getFromTime(); 275 Long thatFromTime = that.getFromTime(); 276 277 if(thisFromTime == null) { 278 objectsEqual = objectsEqual && (thatFromTime == null); 279 } else { 280 objectsEqual = objectsEqual && thisFromTime.equals(thatFromTime); 281 } 282 } 283 284 if(objectsEqual) { 285 Long thisThruTime = getThruTime(); 286 Long thatThruTime = that.getThruTime(); 287 288 if(thisThruTime == null) { 289 objectsEqual = objectsEqual && (thatThruTime == null); 290 } else { 291 objectsEqual = objectsEqual && thisThruTime.equals(thatThruTime); 292 } 293 } 294 295 return objectsEqual; 296 } else { 297 return false; 298 } 299 } 300 301 @Override 302 public boolean hasBeenModified() { 303 return locationNameElementPKHasBeenModified || locationTypePKHasBeenModified || locationNameElementNameHasBeenModified || offsetHasBeenModified || lengthHasBeenModified || validationPatternHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified; 304 } 305 306 @Override 307 public void clearHasBeenModified() { 308 locationNameElementPKHasBeenModified = false; 309 locationTypePKHasBeenModified = false; 310 locationNameElementNameHasBeenModified = false; 311 offsetHasBeenModified = false; 312 lengthHasBeenModified = false; 313 validationPatternHasBeenModified = false; 314 fromTimeHasBeenModified = false; 315 thruTimeHasBeenModified = false; 316 } 317 318 public LocationNameElementPK getLocationNameElementPK() { 319 return locationNameElementPK; 320 } 321 322 public void setLocationNameElementPK(LocationNameElementPK locationNameElementPK) 323 throws PersistenceNotNullException { 324 checkForNull(locationNameElementPK); 325 326 boolean update = true; 327 328 if(this.locationNameElementPK != null) { 329 if(this.locationNameElementPK.equals(locationNameElementPK)) { 330 update = false; 331 } 332 } else if(locationNameElementPK == null) { 333 update = false; 334 } 335 336 if(update) { 337 this.locationNameElementPK = locationNameElementPK; 338 locationNameElementPKHasBeenModified = true; 339 clearHashAndString(); 340 } 341 } 342 343 public boolean getLocationNameElementPKHasBeenModified() { 344 return locationNameElementPKHasBeenModified; 345 } 346 347 public LocationTypePK getLocationTypePK() { 348 return locationTypePK; 349 } 350 351 public void setLocationTypePK(LocationTypePK locationTypePK) 352 throws PersistenceNotNullException { 353 checkForNull(locationTypePK); 354 355 boolean update = true; 356 357 if(this.locationTypePK != null) { 358 if(this.locationTypePK.equals(locationTypePK)) { 359 update = false; 360 } 361 } else if(locationTypePK == null) { 362 update = false; 363 } 364 365 if(update) { 366 this.locationTypePK = locationTypePK; 367 locationTypePKHasBeenModified = true; 368 clearHashAndString(); 369 } 370 } 371 372 public boolean getLocationTypePKHasBeenModified() { 373 return locationTypePKHasBeenModified; 374 } 375 376 public String getLocationNameElementName() { 377 return locationNameElementName; 378 } 379 380 public void setLocationNameElementName(String locationNameElementName) 381 throws PersistenceNotNullException { 382 checkForNull(locationNameElementName); 383 384 boolean update = true; 385 386 if(this.locationNameElementName != null) { 387 if(this.locationNameElementName.equals(locationNameElementName)) { 388 update = false; 389 } 390 } else if(locationNameElementName == null) { 391 update = false; 392 } 393 394 if(update) { 395 this.locationNameElementName = locationNameElementName; 396 locationNameElementNameHasBeenModified = true; 397 clearHashAndString(); 398 } 399 } 400 401 public boolean getLocationNameElementNameHasBeenModified() { 402 return locationNameElementNameHasBeenModified; 403 } 404 405 public Integer getOffset() { 406 return offset; 407 } 408 409 public void setOffset(Integer offset) 410 throws PersistenceNotNullException { 411 checkForNull(offset); 412 413 boolean update = true; 414 415 if(this.offset != null) { 416 if(this.offset.equals(offset)) { 417 update = false; 418 } 419 } else if(offset == null) { 420 update = false; 421 } 422 423 if(update) { 424 this.offset = offset; 425 offsetHasBeenModified = true; 426 clearHashAndString(); 427 } 428 } 429 430 public boolean getOffsetHasBeenModified() { 431 return offsetHasBeenModified; 432 } 433 434 public Integer getLength() { 435 return length; 436 } 437 438 public void setLength(Integer length) 439 throws PersistenceNotNullException { 440 checkForNull(length); 441 442 boolean update = true; 443 444 if(this.length != null) { 445 if(this.length.equals(length)) { 446 update = false; 447 } 448 } else if(length == null) { 449 update = false; 450 } 451 452 if(update) { 453 this.length = length; 454 lengthHasBeenModified = true; 455 clearHashAndString(); 456 } 457 } 458 459 public boolean getLengthHasBeenModified() { 460 return lengthHasBeenModified; 461 } 462 463 public String getValidationPattern() { 464 return validationPattern; 465 } 466 467 public void setValidationPattern(String validationPattern) { 468 boolean update = true; 469 470 if(this.validationPattern != null) { 471 if(this.validationPattern.equals(validationPattern)) { 472 update = false; 473 } 474 } else if(validationPattern == null) { 475 update = false; 476 } 477 478 if(update) { 479 this.validationPattern = validationPattern; 480 validationPatternHasBeenModified = true; 481 clearHashAndString(); 482 } 483 } 484 485 public boolean getValidationPatternHasBeenModified() { 486 return validationPatternHasBeenModified; 487 } 488 489 public Long getFromTime() { 490 return fromTime; 491 } 492 493 public void setFromTime(Long fromTime) 494 throws PersistenceNotNullException { 495 checkForNull(fromTime); 496 497 boolean update = true; 498 499 if(this.fromTime != null) { 500 if(this.fromTime.equals(fromTime)) { 501 update = false; 502 } 503 } else if(fromTime == null) { 504 update = false; 505 } 506 507 if(update) { 508 this.fromTime = fromTime; 509 fromTimeHasBeenModified = true; 510 clearHashAndString(); 511 } 512 } 513 514 public boolean getFromTimeHasBeenModified() { 515 return fromTimeHasBeenModified; 516 } 517 518 public Long getThruTime() { 519 return thruTime; 520 } 521 522 public void setThruTime(Long thruTime) 523 throws PersistenceNotNullException { 524 checkForNull(thruTime); 525 526 boolean update = true; 527 528 if(this.thruTime != null) { 529 if(this.thruTime.equals(thruTime)) { 530 update = false; 531 } 532 } else if(thruTime == null) { 533 update = false; 534 } 535 536 if(update) { 537 this.thruTime = thruTime; 538 thruTimeHasBeenModified = true; 539 clearHashAndString(); 540 } 541 } 542 543 public boolean getThruTimeHasBeenModified() { 544 return thruTimeHasBeenModified; 545 } 546 547}