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 * TrackDetailValue.java 021 */ 022 023package com.echothree.model.data.track.server.value; 024 025import com.echothree.model.data.track.common.pk.TrackDetailPK; 026 027import com.echothree.model.data.track.server.factory.TrackDetailFactory; 028 029import com.echothree.model.data.track.common.pk.TrackPK; 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 TrackDetailValue 039 extends BaseValue<TrackDetailPK> 040 implements Cloneable, Serializable { 041 042 private TrackPK trackPK; 043 private boolean trackPKHasBeenModified = false; 044 private String trackName; 045 private boolean trackNameHasBeenModified = false; 046 private String valueSha1Hash; 047 private boolean valueSha1HashHasBeenModified = false; 048 private String value; 049 private boolean valueHasBeenModified = false; 050 private Boolean isDefault; 051 private boolean isDefaultHasBeenModified = false; 052 private Integer sortOrder; 053 private boolean sortOrderHasBeenModified = false; 054 private Long fromTime; 055 private boolean fromTimeHasBeenModified = false; 056 private Long thruTime; 057 private boolean thruTimeHasBeenModified = false; 058 059 private transient Integer _hashCode = null; 060 private transient String _stringValue = null; 061 062 private void constructFields(TrackPK trackPK, String trackName, String valueSha1Hash, String value, Boolean isDefault, Integer sortOrder, Long fromTime, Long thruTime) 063 throws PersistenceNotNullException { 064 checkForNull(trackPK); 065 this.trackPK = trackPK; 066 checkForNull(trackName); 067 this.trackName = trackName; 068 checkForNull(valueSha1Hash); 069 this.valueSha1Hash = valueSha1Hash; 070 checkForNull(value); 071 this.value = value; 072 checkForNull(isDefault); 073 this.isDefault = isDefault; 074 checkForNull(sortOrder); 075 this.sortOrder = sortOrder; 076 checkForNull(fromTime); 077 this.fromTime = fromTime; 078 checkForNull(thruTime); 079 this.thruTime = thruTime; 080 } 081 082 /** Creates a new instance of TrackDetailValue */ 083 public TrackDetailValue(TrackDetailPK trackDetailPK, TrackPK trackPK, String trackName, String valueSha1Hash, String value, Boolean isDefault, Integer sortOrder, Long fromTime, Long thruTime) 084 throws PersistenceNotNullException { 085 super(trackDetailPK); 086 constructFields(trackPK, trackName, valueSha1Hash, value, isDefault, sortOrder, fromTime, thruTime); 087 } 088 089 /** Creates a new instance of TrackDetailValue */ 090 public TrackDetailValue(TrackPK trackPK, String trackName, String valueSha1Hash, String value, Boolean isDefault, Integer sortOrder, Long fromTime, Long thruTime) 091 throws PersistenceNotNullException { 092 super(); 093 constructFields(trackPK, trackName, valueSha1Hash, value, isDefault, sortOrder, fromTime, thruTime); 094 } 095 096 @Override 097 public TrackDetailFactory getBaseFactoryInstance() { 098 return TrackDetailFactory.getInstance(); 099 } 100 101 @Override 102 public TrackDetailValue 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 (TrackDetailValue)result; 113 } 114 115 @Override 116 public TrackDetailPK getPrimaryKey() { 117 if(_primaryKey == null) { 118 _primaryKey = new TrackDetailPK(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 + ((trackPK != null) ? trackPK.hashCode() : 0); 137 hashCode = 37 * hashCode + ((trackName != null) ? trackName.hashCode() : 0); 138 hashCode = 37 * hashCode + ((valueSha1Hash != null) ? valueSha1Hash.hashCode() : 0); 139 hashCode = 37 * hashCode + ((value != null) ? value.hashCode() : 0); 140 hashCode = 37 * hashCode + ((isDefault != null) ? isDefault.hashCode() : 0); 141 hashCode = 37 * hashCode + ((sortOrder != null) ? sortOrder.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(", trackPK=").append(getTrackPK()); 159 stringValue.append(", trackName=").append(getTrackName()); 160 stringValue.append(", valueSha1Hash=").append(getValueSha1Hash()); 161 stringValue.append(", value=").append(getValue()); 162 stringValue.append(", isDefault=").append(getIsDefault()); 163 stringValue.append(", sortOrder=").append(getSortOrder()); 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 TrackDetailValue) { 183 TrackDetailValue that = (TrackDetailValue)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 TrackDetailValue) { 203 TrackDetailValue that = (TrackDetailValue)other; 204 boolean objectsEqual = true; 205 206 207 if(objectsEqual) { 208 TrackPK thisTrackPK = getTrackPK(); 209 TrackPK thatTrackPK = that.getTrackPK(); 210 211 if(thisTrackPK == null) { 212 objectsEqual = objectsEqual && (thatTrackPK == null); 213 } else { 214 objectsEqual = objectsEqual && thisTrackPK.equals(thatTrackPK); 215 } 216 } 217 218 if(objectsEqual) { 219 String thisTrackName = getTrackName(); 220 String thatTrackName = that.getTrackName(); 221 222 if(thisTrackName == null) { 223 objectsEqual = objectsEqual && (thatTrackName == null); 224 } else { 225 objectsEqual = objectsEqual && thisTrackName.equals(thatTrackName); 226 } 227 } 228 229 if(objectsEqual) { 230 String thisValueSha1Hash = getValueSha1Hash(); 231 String thatValueSha1Hash = that.getValueSha1Hash(); 232 233 if(thisValueSha1Hash == null) { 234 objectsEqual = objectsEqual && (thatValueSha1Hash == null); 235 } else { 236 objectsEqual = objectsEqual && thisValueSha1Hash.equals(thatValueSha1Hash); 237 } 238 } 239 240 if(objectsEqual) { 241 String thisValue = getValue(); 242 String thatValue = that.getValue(); 243 244 if(thisValue == null) { 245 objectsEqual = objectsEqual && (thatValue == null); 246 } else { 247 objectsEqual = objectsEqual && thisValue.equals(thatValue); 248 } 249 } 250 251 if(objectsEqual) { 252 Boolean thisIsDefault = getIsDefault(); 253 Boolean thatIsDefault = that.getIsDefault(); 254 255 if(thisIsDefault == null) { 256 objectsEqual = objectsEqual && (thatIsDefault == null); 257 } else { 258 objectsEqual = objectsEqual && thisIsDefault.equals(thatIsDefault); 259 } 260 } 261 262 if(objectsEqual) { 263 Integer thisSortOrder = getSortOrder(); 264 Integer thatSortOrder = that.getSortOrder(); 265 266 if(thisSortOrder == null) { 267 objectsEqual = objectsEqual && (thatSortOrder == null); 268 } else { 269 objectsEqual = objectsEqual && thisSortOrder.equals(thatSortOrder); 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 trackPKHasBeenModified || trackNameHasBeenModified || valueSha1HashHasBeenModified || valueHasBeenModified || isDefaultHasBeenModified || sortOrderHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified; 304 } 305 306 @Override 307 public void clearHasBeenModified() { 308 trackPKHasBeenModified = false; 309 trackNameHasBeenModified = false; 310 valueSha1HashHasBeenModified = false; 311 valueHasBeenModified = false; 312 isDefaultHasBeenModified = false; 313 sortOrderHasBeenModified = false; 314 fromTimeHasBeenModified = false; 315 thruTimeHasBeenModified = false; 316 } 317 318 public TrackPK getTrackPK() { 319 return trackPK; 320 } 321 322 public void setTrackPK(TrackPK trackPK) 323 throws PersistenceNotNullException { 324 checkForNull(trackPK); 325 326 boolean update = true; 327 328 if(this.trackPK != null) { 329 if(this.trackPK.equals(trackPK)) { 330 update = false; 331 } 332 } else if(trackPK == null) { 333 update = false; 334 } 335 336 if(update) { 337 this.trackPK = trackPK; 338 trackPKHasBeenModified = true; 339 clearHashAndString(); 340 } 341 } 342 343 public boolean getTrackPKHasBeenModified() { 344 return trackPKHasBeenModified; 345 } 346 347 public String getTrackName() { 348 return trackName; 349 } 350 351 public void setTrackName(String trackName) 352 throws PersistenceNotNullException { 353 checkForNull(trackName); 354 355 boolean update = true; 356 357 if(this.trackName != null) { 358 if(this.trackName.equals(trackName)) { 359 update = false; 360 } 361 } else if(trackName == null) { 362 update = false; 363 } 364 365 if(update) { 366 this.trackName = trackName; 367 trackNameHasBeenModified = true; 368 clearHashAndString(); 369 } 370 } 371 372 public boolean getTrackNameHasBeenModified() { 373 return trackNameHasBeenModified; 374 } 375 376 public String getValueSha1Hash() { 377 return valueSha1Hash; 378 } 379 380 public void setValueSha1Hash(String valueSha1Hash) 381 throws PersistenceNotNullException { 382 checkForNull(valueSha1Hash); 383 384 boolean update = true; 385 386 if(this.valueSha1Hash != null) { 387 if(this.valueSha1Hash.equals(valueSha1Hash)) { 388 update = false; 389 } 390 } else if(valueSha1Hash == null) { 391 update = false; 392 } 393 394 if(update) { 395 this.valueSha1Hash = valueSha1Hash; 396 valueSha1HashHasBeenModified = true; 397 clearHashAndString(); 398 } 399 } 400 401 public boolean getValueSha1HashHasBeenModified() { 402 return valueSha1HashHasBeenModified; 403 } 404 405 public String getValue() { 406 return value; 407 } 408 409 public void setValue(String value) 410 throws PersistenceNotNullException { 411 checkForNull(value); 412 413 boolean update = true; 414 415 if(this.value != null) { 416 if(this.value.equals(value)) { 417 update = false; 418 } 419 } else if(value == null) { 420 update = false; 421 } 422 423 if(update) { 424 this.value = value; 425 valueHasBeenModified = true; 426 clearHashAndString(); 427 } 428 } 429 430 public boolean getValueHasBeenModified() { 431 return valueHasBeenModified; 432 } 433 434 public Boolean getIsDefault() { 435 return isDefault; 436 } 437 438 public void setIsDefault(Boolean isDefault) 439 throws PersistenceNotNullException { 440 checkForNull(isDefault); 441 442 boolean update = true; 443 444 if(this.isDefault != null) { 445 if(this.isDefault.equals(isDefault)) { 446 update = false; 447 } 448 } else if(isDefault == null) { 449 update = false; 450 } 451 452 if(update) { 453 this.isDefault = isDefault; 454 isDefaultHasBeenModified = true; 455 clearHashAndString(); 456 } 457 } 458 459 public boolean getIsDefaultHasBeenModified() { 460 return isDefaultHasBeenModified; 461 } 462 463 public Integer getSortOrder() { 464 return sortOrder; 465 } 466 467 public void setSortOrder(Integer sortOrder) 468 throws PersistenceNotNullException { 469 checkForNull(sortOrder); 470 471 boolean update = true; 472 473 if(this.sortOrder != null) { 474 if(this.sortOrder.equals(sortOrder)) { 475 update = false; 476 } 477 } else if(sortOrder == null) { 478 update = false; 479 } 480 481 if(update) { 482 this.sortOrder = sortOrder; 483 sortOrderHasBeenModified = true; 484 clearHashAndString(); 485 } 486 } 487 488 public boolean getSortOrderHasBeenModified() { 489 return sortOrderHasBeenModified; 490 } 491 492 public Long getFromTime() { 493 return fromTime; 494 } 495 496 public void setFromTime(Long fromTime) 497 throws PersistenceNotNullException { 498 checkForNull(fromTime); 499 500 boolean update = true; 501 502 if(this.fromTime != null) { 503 if(this.fromTime.equals(fromTime)) { 504 update = false; 505 } 506 } else if(fromTime == null) { 507 update = false; 508 } 509 510 if(update) { 511 this.fromTime = fromTime; 512 fromTimeHasBeenModified = true; 513 clearHashAndString(); 514 } 515 } 516 517 public boolean getFromTimeHasBeenModified() { 518 return fromTimeHasBeenModified; 519 } 520 521 public Long getThruTime() { 522 return thruTime; 523 } 524 525 public void setThruTime(Long thruTime) 526 throws PersistenceNotNullException { 527 checkForNull(thruTime); 528 529 boolean update = true; 530 531 if(this.thruTime != null) { 532 if(this.thruTime.equals(thruTime)) { 533 update = false; 534 } 535 } else if(thruTime == null) { 536 update = false; 537 } 538 539 if(update) { 540 this.thruTime = thruTime; 541 thruTimeHasBeenModified = true; 542 clearHashAndString(); 543 } 544 } 545 546 public boolean getThruTimeHasBeenModified() { 547 return thruTimeHasBeenModified; 548 } 549 550}