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 * UserSessionValue.java 021 */ 022 023package com.echothree.model.data.user.server.value; 024 025import com.echothree.model.data.user.common.pk.UserSessionPK; 026 027import com.echothree.model.data.user.server.factory.UserSessionFactory; 028 029import com.echothree.model.data.user.common.pk.UserVisitPK; 030import com.echothree.model.data.party.common.pk.PartyPK; 031import com.echothree.model.data.party.common.pk.PartyRelationshipPK; 032 033import com.echothree.util.common.exception.PersistenceCloneException; 034import com.echothree.util.common.exception.PersistenceNotNullException; 035 036import com.echothree.util.server.persistence.BaseValue; 037 038import java.io.Serializable; 039 040import javax.annotation.Nonnull; 041import javax.annotation.Nullable; 042 043public class UserSessionValue 044 extends BaseValue<UserSessionPK> 045 implements Cloneable, Serializable { 046 047 private UserVisitPK userVisitPK; 048 private boolean userVisitPKHasBeenModified = false; 049 private PartyPK partyPK; 050 private boolean partyPKHasBeenModified = false; 051 private PartyRelationshipPK partyRelationshipPK; 052 private boolean partyRelationshipPKHasBeenModified = false; 053 private Long identityVerifiedTime; 054 private boolean identityVerifiedTimeHasBeenModified = 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(UserVisitPK userVisitPK, PartyPK partyPK, PartyRelationshipPK partyRelationshipPK, Long identityVerifiedTime, Long fromTime, Long thruTime) 064 throws PersistenceNotNullException { 065 checkForNull(userVisitPK); 066 this.userVisitPK = userVisitPK; 067 checkForNull(partyPK); 068 this.partyPK = partyPK; 069 this.partyRelationshipPK = partyRelationshipPK; 070 this.identityVerifiedTime = identityVerifiedTime; 071 checkForNull(fromTime); 072 this.fromTime = fromTime; 073 checkForNull(thruTime); 074 this.thruTime = thruTime; 075 } 076 077 /** Creates a new instance of UserSessionValue */ 078 public UserSessionValue(UserSessionPK userSessionPK, UserVisitPK userVisitPK, PartyPK partyPK, PartyRelationshipPK partyRelationshipPK, Long identityVerifiedTime, Long fromTime, Long thruTime) 079 throws PersistenceNotNullException { 080 super(userSessionPK); 081 constructFields(userVisitPK, partyPK, partyRelationshipPK, identityVerifiedTime, fromTime, thruTime); 082 } 083 084 /** Creates a new instance of UserSessionValue */ 085 public UserSessionValue(UserVisitPK userVisitPK, PartyPK partyPK, PartyRelationshipPK partyRelationshipPK, Long identityVerifiedTime, Long fromTime, Long thruTime) 086 throws PersistenceNotNullException { 087 super(); 088 constructFields(userVisitPK, partyPK, partyRelationshipPK, identityVerifiedTime, fromTime, thruTime); 089 } 090 091 @Override 092 @Nonnull 093 public UserSessionFactory getBaseFactoryInstance() { 094 return UserSessionFactory.getInstance(); 095 } 096 097 @Override 098 @Nonnull 099 public UserSessionValue 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 (UserSessionValue)result; 110 } 111 112 @Override 113 @Nonnull 114 public UserSessionPK getPrimaryKey() { 115 if(_primaryKey == null) { 116 _primaryKey = new UserSessionPK(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 + ((partyPK != null) ? partyPK.hashCode() : 0); 136 hashCode = 37 * hashCode + ((partyRelationshipPK != null) ? partyRelationshipPK.hashCode() : 0); 137 hashCode = 37 * hashCode + ((identityVerifiedTime != null) ? identityVerifiedTime.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 ", partyPK=" + getPartyPK() + 155 ", partyRelationshipPK=" + getPartyRelationshipPK() + 156 ", identityVerifiedTime=" + getIdentityVerifiedTime() + 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 UserSessionValue 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 UserSessionValue 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 PartyPK thisPartyPK = getPartyPK(); 207 PartyPK thatPartyPK = that.getPartyPK(); 208 209 if(thisPartyPK == null) { 210 objectsEqual = objectsEqual && (thatPartyPK == null); 211 } else { 212 objectsEqual = objectsEqual && thisPartyPK.equals(thatPartyPK); 213 } 214 } 215 216 if(objectsEqual) { 217 PartyRelationshipPK thisPartyRelationshipPK = getPartyRelationshipPK(); 218 PartyRelationshipPK thatPartyRelationshipPK = that.getPartyRelationshipPK(); 219 220 if(thisPartyRelationshipPK == null) { 221 objectsEqual = objectsEqual && (thatPartyRelationshipPK == null); 222 } else { 223 objectsEqual = objectsEqual && thisPartyRelationshipPK.equals(thatPartyRelationshipPK); 224 } 225 } 226 227 if(objectsEqual) { 228 Long thisIdentityVerifiedTime = getIdentityVerifiedTime(); 229 Long thatIdentityVerifiedTime = that.getIdentityVerifiedTime(); 230 231 if(thisIdentityVerifiedTime == null) { 232 objectsEqual = objectsEqual && (thatIdentityVerifiedTime == null); 233 } else { 234 objectsEqual = objectsEqual && thisIdentityVerifiedTime.equals(thatIdentityVerifiedTime); 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 || partyPKHasBeenModified || partyRelationshipPKHasBeenModified || identityVerifiedTimeHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified; 269 } 270 271 @Override 272 public void clearHasBeenModified() { 273 userVisitPKHasBeenModified = false; 274 partyPKHasBeenModified = false; 275 partyRelationshipPKHasBeenModified = false; 276 identityVerifiedTimeHasBeenModified = 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 PartyPK getPartyPK() { 313 return partyPK; 314 } 315 316 public void setPartyPK(@Nonnull PartyPK partyPK) 317 throws PersistenceNotNullException { 318 checkForNull(partyPK); 319 320 boolean update = true; 321 322 if(this.partyPK != null) { 323 if(this.partyPK.equals(partyPK)) { 324 update = false; 325 } 326 } else if(partyPK == null) { 327 update = false; 328 } 329 330 if(update) { 331 this.partyPK = partyPK; 332 partyPKHasBeenModified = true; 333 clearHashAndString(); 334 } 335 } 336 337 public boolean getPartyPKHasBeenModified() { 338 return partyPKHasBeenModified; 339 } 340 341 @Nullable 342 public PartyRelationshipPK getPartyRelationshipPK() { 343 return partyRelationshipPK; 344 } 345 346 public void setPartyRelationshipPK(@Nullable PartyRelationshipPK partyRelationshipPK) { 347 boolean update = true; 348 349 if(this.partyRelationshipPK != null) { 350 if(this.partyRelationshipPK.equals(partyRelationshipPK)) { 351 update = false; 352 } 353 } else if(partyRelationshipPK == null) { 354 update = false; 355 } 356 357 if(update) { 358 this.partyRelationshipPK = partyRelationshipPK; 359 partyRelationshipPKHasBeenModified = true; 360 clearHashAndString(); 361 } 362 } 363 364 public boolean getPartyRelationshipPKHasBeenModified() { 365 return partyRelationshipPKHasBeenModified; 366 } 367 368 @Nullable 369 public Long getIdentityVerifiedTime() { 370 return identityVerifiedTime; 371 } 372 373 public void setIdentityVerifiedTime(@Nullable Long identityVerifiedTime) { 374 boolean update = true; 375 376 if(this.identityVerifiedTime != null) { 377 if(this.identityVerifiedTime.equals(identityVerifiedTime)) { 378 update = false; 379 } 380 } else if(identityVerifiedTime == null) { 381 update = false; 382 } 383 384 if(update) { 385 this.identityVerifiedTime = identityVerifiedTime; 386 identityVerifiedTimeHasBeenModified = true; 387 clearHashAndString(); 388 } 389 } 390 391 public boolean getIdentityVerifiedTimeHasBeenModified() { 392 return identityVerifiedTimeHasBeenModified; 393 } 394 395 @Nonnull 396 public Long getFromTime() { 397 return fromTime; 398 } 399 400 public void setFromTime(@Nonnull Long fromTime) 401 throws PersistenceNotNullException { 402 checkForNull(fromTime); 403 404 boolean update = true; 405 406 if(this.fromTime != null) { 407 if(this.fromTime.equals(fromTime)) { 408 update = false; 409 } 410 } else if(fromTime == null) { 411 update = false; 412 } 413 414 if(update) { 415 this.fromTime = fromTime; 416 fromTimeHasBeenModified = true; 417 clearHashAndString(); 418 } 419 } 420 421 public boolean getFromTimeHasBeenModified() { 422 return fromTimeHasBeenModified; 423 } 424 425 @Nonnull 426 public Long getThruTime() { 427 return thruTime; 428 } 429 430 public void setThruTime(@Nonnull Long thruTime) 431 throws PersistenceNotNullException { 432 checkForNull(thruTime); 433 434 boolean update = true; 435 436 if(this.thruTime != null) { 437 if(this.thruTime.equals(thruTime)) { 438 update = false; 439 } 440 } else if(thruTime == null) { 441 update = false; 442 } 443 444 if(update) { 445 this.thruTime = thruTime; 446 thruTimeHasBeenModified = true; 447 clearHashAndString(); 448 } 449 } 450 451 public boolean getThruTimeHasBeenModified() { 452 return thruTimeHasBeenModified; 453 } 454 455}