001// -------------------------------------------------------------------------------- 002// Copyright 2002-2026 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 * UserVisitTrackValue.java 021 */ 022 023package com.echothree.model.data.track.server.value; 024 025import com.echothree.model.data.track.common.pk.UserVisitTrackPK; 026 027import com.echothree.model.data.track.server.factory.UserVisitTrackFactory; 028 029import com.echothree.model.data.user.common.pk.UserVisitPK; 030import com.echothree.model.data.track.common.pk.TrackPK; 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 039import javax.annotation.Nonnull; 040import javax.annotation.Nullable; 041 042public class UserVisitTrackValue 043 extends BaseValue<UserVisitTrackPK> 044 implements Cloneable, Serializable { 045 046 private UserVisitPK userVisitPK; 047 private boolean userVisitPKHasBeenModified = false; 048 private Integer userVisitTrackSequence; 049 private boolean userVisitTrackSequenceHasBeenModified = false; 050 private Long time; 051 private boolean timeHasBeenModified = false; 052 private TrackPK trackPK; 053 private boolean trackPKHasBeenModified = 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(UserVisitPK userVisitPK, Integer userVisitTrackSequence, Long time, TrackPK trackPK, Long fromTime, Long thruTime) 063 throws PersistenceNotNullException { 064 checkForNull(userVisitPK); 065 this.userVisitPK = userVisitPK; 066 checkForNull(userVisitTrackSequence); 067 this.userVisitTrackSequence = userVisitTrackSequence; 068 checkForNull(time); 069 this.time = time; 070 this.trackPK = trackPK; 071 checkForNull(fromTime); 072 this.fromTime = fromTime; 073 checkForNull(thruTime); 074 this.thruTime = thruTime; 075 } 076 077 /** Creates a new instance of UserVisitTrackValue */ 078 public UserVisitTrackValue(UserVisitTrackPK userVisitTrackPK, UserVisitPK userVisitPK, Integer userVisitTrackSequence, Long time, TrackPK trackPK, Long fromTime, Long thruTime) 079 throws PersistenceNotNullException { 080 super(userVisitTrackPK); 081 constructFields(userVisitPK, userVisitTrackSequence, time, trackPK, fromTime, thruTime); 082 } 083 084 /** Creates a new instance of UserVisitTrackValue */ 085 public UserVisitTrackValue(UserVisitPK userVisitPK, Integer userVisitTrackSequence, Long time, TrackPK trackPK, Long fromTime, Long thruTime) 086 throws PersistenceNotNullException { 087 super(); 088 constructFields(userVisitPK, userVisitTrackSequence, time, trackPK, fromTime, thruTime); 089 } 090 091 @Override 092 @Nonnull 093 public UserVisitTrackFactory getBaseFactoryInstance() { 094 return UserVisitTrackFactory.getInstance(); 095 } 096 097 @Override 098 @Nonnull 099 public UserVisitTrackValue clone() { 100 Object result; 101 102 try { 103 result = super.clone(); 104 } catch (CloneNotSupportedException cnse) { 105 // This shouldn't happen, fail when it does. 106 throw new PersistenceCloneException(cnse); 107 } 108 109 return (UserVisitTrackValue)result; 110 } 111 112 @Override 113 @Nonnull 114 public UserVisitTrackPK getPrimaryKey() { 115 if(_primaryKey == null) { 116 _primaryKey = new UserVisitTrackPK(entityId); 117 } 118 119 return _primaryKey; 120 } 121 122 private void clearHashAndString() { 123 _hashCode = null; 124 _stringValue = null; 125 } 126 127 @Override 128 public int hashCode() { 129 if(_hashCode == null) { 130 int hashCode = 17; 131 132 hashCode = 37 * hashCode + ((entityId != null) ? entityId.hashCode() : 0); 133 134 hashCode = 37 * hashCode + ((userVisitPK != null) ? userVisitPK.hashCode() : 0); 135 hashCode = 37 * hashCode + ((userVisitTrackSequence != null) ? userVisitTrackSequence.hashCode() : 0); 136 hashCode = 37 * hashCode + ((time != null) ? time.hashCode() : 0); 137 hashCode = 37 * hashCode + ((trackPK != null) ? trackPK.hashCode() : 0); 138 hashCode = 37 * hashCode + ((fromTime != null) ? fromTime.hashCode() : 0); 139 hashCode = 37 * hashCode + ((thruTime != null) ? thruTime.hashCode() : 0); 140 141 _hashCode = hashCode; 142 } 143 144 return _hashCode; 145 } 146 147 @Override 148 @Nonnull 149 public String toString() { 150 if(_stringValue == null) { 151 _stringValue = "{" + 152 "entityId=" + getEntityId() + 153 ", userVisitPK=" + getUserVisitPK() + 154 ", userVisitTrackSequence=" + getUserVisitTrackSequence() + 155 ", time=" + getTime() + 156 ", trackPK=" + getTrackPK() + 157 ", fromTime=" + getFromTime() + 158 ", thruTime=" + getThruTime() + 159 "}"; 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 UserVisitTrackValue that) { 173 if(!that.hasIdentity()) 174 return false; 175 176 Long thisEntityId = getEntityId(); 177 Long thatEntityId = that.getEntityId(); 178 179 boolean objectsEqual = thisEntityId.equals(thatEntityId); 180 if(objectsEqual) 181 objectsEqual = isIdentical(that); 182 183 return objectsEqual; 184 } else { 185 return false; 186 } 187 } 188 189 public boolean isIdentical(Object other) { 190 if(other instanceof UserVisitTrackValue that) { 191 boolean objectsEqual = true; 192 193 194 if(objectsEqual) { 195 UserVisitPK thisUserVisitPK = getUserVisitPK(); 196 UserVisitPK thatUserVisitPK = that.getUserVisitPK(); 197 198 if(thisUserVisitPK == null) { 199 objectsEqual = objectsEqual && (thatUserVisitPK == null); 200 } else { 201 objectsEqual = objectsEqual && thisUserVisitPK.equals(thatUserVisitPK); 202 } 203 } 204 205 if(objectsEqual) { 206 Integer thisUserVisitTrackSequence = getUserVisitTrackSequence(); 207 Integer thatUserVisitTrackSequence = that.getUserVisitTrackSequence(); 208 209 if(thisUserVisitTrackSequence == null) { 210 objectsEqual = objectsEqual && (thatUserVisitTrackSequence == null); 211 } else { 212 objectsEqual = objectsEqual && thisUserVisitTrackSequence.equals(thatUserVisitTrackSequence); 213 } 214 } 215 216 if(objectsEqual) { 217 Long thisTime = getTime(); 218 Long thatTime = that.getTime(); 219 220 if(thisTime == null) { 221 objectsEqual = objectsEqual && (thatTime == null); 222 } else { 223 objectsEqual = objectsEqual && thisTime.equals(thatTime); 224 } 225 } 226 227 if(objectsEqual) { 228 TrackPK thisTrackPK = getTrackPK(); 229 TrackPK thatTrackPK = that.getTrackPK(); 230 231 if(thisTrackPK == null) { 232 objectsEqual = objectsEqual && (thatTrackPK == null); 233 } else { 234 objectsEqual = objectsEqual && thisTrackPK.equals(thatTrackPK); 235 } 236 } 237 238 if(objectsEqual) { 239 Long thisFromTime = getFromTime(); 240 Long thatFromTime = that.getFromTime(); 241 242 if(thisFromTime == null) { 243 objectsEqual = objectsEqual && (thatFromTime == null); 244 } else { 245 objectsEqual = objectsEqual && thisFromTime.equals(thatFromTime); 246 } 247 } 248 249 if(objectsEqual) { 250 Long thisThruTime = getThruTime(); 251 Long thatThruTime = that.getThruTime(); 252 253 if(thisThruTime == null) { 254 objectsEqual = objectsEqual && (thatThruTime == null); 255 } else { 256 objectsEqual = objectsEqual && thisThruTime.equals(thatThruTime); 257 } 258 } 259 260 return objectsEqual; 261 } else { 262 return false; 263 } 264 } 265 266 @Override 267 public boolean hasBeenModified() { 268 return userVisitPKHasBeenModified || userVisitTrackSequenceHasBeenModified || timeHasBeenModified || trackPKHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified; 269 } 270 271 @Override 272 public void clearHasBeenModified() { 273 userVisitPKHasBeenModified = false; 274 userVisitTrackSequenceHasBeenModified = false; 275 timeHasBeenModified = false; 276 trackPKHasBeenModified = false; 277 fromTimeHasBeenModified = false; 278 thruTimeHasBeenModified = false; 279 } 280 281 @Nonnull 282 public UserVisitPK getUserVisitPK() { 283 return userVisitPK; 284 } 285 286 public void setUserVisitPK(@Nonnull UserVisitPK userVisitPK) 287 throws PersistenceNotNullException { 288 checkForNull(userVisitPK); 289 290 boolean update = true; 291 292 if(this.userVisitPK != null) { 293 if(this.userVisitPK.equals(userVisitPK)) { 294 update = false; 295 } 296 } else if(userVisitPK == null) { 297 update = false; 298 } 299 300 if(update) { 301 this.userVisitPK = userVisitPK; 302 userVisitPKHasBeenModified = true; 303 clearHashAndString(); 304 } 305 } 306 307 public boolean getUserVisitPKHasBeenModified() { 308 return userVisitPKHasBeenModified; 309 } 310 311 @Nonnull 312 public Integer getUserVisitTrackSequence() { 313 return userVisitTrackSequence; 314 } 315 316 public void setUserVisitTrackSequence(@Nonnull Integer userVisitTrackSequence) 317 throws PersistenceNotNullException { 318 checkForNull(userVisitTrackSequence); 319 320 boolean update = true; 321 322 if(this.userVisitTrackSequence != null) { 323 if(this.userVisitTrackSequence.equals(userVisitTrackSequence)) { 324 update = false; 325 } 326 } else if(userVisitTrackSequence == null) { 327 update = false; 328 } 329 330 if(update) { 331 this.userVisitTrackSequence = userVisitTrackSequence; 332 userVisitTrackSequenceHasBeenModified = true; 333 clearHashAndString(); 334 } 335 } 336 337 public boolean getUserVisitTrackSequenceHasBeenModified() { 338 return userVisitTrackSequenceHasBeenModified; 339 } 340 341 @Nonnull 342 public Long getTime() { 343 return time; 344 } 345 346 public void setTime(@Nonnull Long time) 347 throws PersistenceNotNullException { 348 checkForNull(time); 349 350 boolean update = true; 351 352 if(this.time != null) { 353 if(this.time.equals(time)) { 354 update = false; 355 } 356 } else if(time == null) { 357 update = false; 358 } 359 360 if(update) { 361 this.time = time; 362 timeHasBeenModified = true; 363 clearHashAndString(); 364 } 365 } 366 367 public boolean getTimeHasBeenModified() { 368 return timeHasBeenModified; 369 } 370 371 @Nullable 372 public TrackPK getTrackPK() { 373 return trackPK; 374 } 375 376 public void setTrackPK(@Nullable TrackPK trackPK) { 377 boolean update = true; 378 379 if(this.trackPK != null) { 380 if(this.trackPK.equals(trackPK)) { 381 update = false; 382 } 383 } else if(trackPK == null) { 384 update = false; 385 } 386 387 if(update) { 388 this.trackPK = trackPK; 389 trackPKHasBeenModified = true; 390 clearHashAndString(); 391 } 392 } 393 394 public boolean getTrackPKHasBeenModified() { 395 return trackPKHasBeenModified; 396 } 397 398 @Nonnull 399 public Long getFromTime() { 400 return fromTime; 401 } 402 403 public void setFromTime(@Nonnull Long fromTime) 404 throws PersistenceNotNullException { 405 checkForNull(fromTime); 406 407 boolean update = true; 408 409 if(this.fromTime != null) { 410 if(this.fromTime.equals(fromTime)) { 411 update = false; 412 } 413 } else if(fromTime == null) { 414 update = false; 415 } 416 417 if(update) { 418 this.fromTime = fromTime; 419 fromTimeHasBeenModified = true; 420 clearHashAndString(); 421 } 422 } 423 424 public boolean getFromTimeHasBeenModified() { 425 return fromTimeHasBeenModified; 426 } 427 428 @Nonnull 429 public Long getThruTime() { 430 return thruTime; 431 } 432 433 public void setThruTime(@Nonnull Long thruTime) 434 throws PersistenceNotNullException { 435 checkForNull(thruTime); 436 437 boolean update = true; 438 439 if(this.thruTime != null) { 440 if(this.thruTime.equals(thruTime)) { 441 update = false; 442 } 443 } else if(thruTime == null) { 444 update = false; 445 } 446 447 if(update) { 448 this.thruTime = thruTime; 449 thruTimeHasBeenModified = true; 450 clearHashAndString(); 451 } 452 } 453 454 public boolean getThruTimeHasBeenModified() { 455 return thruTimeHasBeenModified; 456 } 457 458}