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 * UserVisitStatusValue.java 021 */ 022 023package com.echothree.model.data.user.server.value; 024 025import com.echothree.model.data.user.common.pk.UserVisitStatusPK; 026 027import com.echothree.model.data.user.server.factory.UserVisitStatusFactory; 028 029import com.echothree.model.data.user.common.pk.UserVisitPK; 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 UserVisitStatusValue 039 extends BaseValue<UserVisitStatusPK> 040 implements Cloneable, Serializable { 041 042 private UserVisitPK userVisitPK; 043 private boolean userVisitPKHasBeenModified = false; 044 private Integer userVisitCommandSequence; 045 private boolean userVisitCommandSequenceHasBeenModified = false; 046 private Integer userVisitCachedSearchSequence; 047 private boolean userVisitCachedSearchSequenceHasBeenModified = false; 048 private Integer userVisitCampaignSequence; 049 private boolean userVisitCampaignSequenceHasBeenModified = false; 050 private Integer userVisitTrackSequence; 051 private boolean userVisitTrackSequenceHasBeenModified = false; 052 053 private transient Integer _hashCode = null; 054 private transient String _stringValue = null; 055 056 private void constructFields(UserVisitPK userVisitPK, Integer userVisitCommandSequence, Integer userVisitCachedSearchSequence, Integer userVisitCampaignSequence, Integer userVisitTrackSequence) 057 throws PersistenceNotNullException { 058 checkForNull(userVisitPK); 059 this.userVisitPK = userVisitPK; 060 checkForNull(userVisitCommandSequence); 061 this.userVisitCommandSequence = userVisitCommandSequence; 062 checkForNull(userVisitCachedSearchSequence); 063 this.userVisitCachedSearchSequence = userVisitCachedSearchSequence; 064 checkForNull(userVisitCampaignSequence); 065 this.userVisitCampaignSequence = userVisitCampaignSequence; 066 checkForNull(userVisitTrackSequence); 067 this.userVisitTrackSequence = userVisitTrackSequence; 068 } 069 070 /** Creates a new instance of UserVisitStatusValue */ 071 public UserVisitStatusValue(UserVisitStatusPK userVisitStatusPK, UserVisitPK userVisitPK, Integer userVisitCommandSequence, Integer userVisitCachedSearchSequence, Integer userVisitCampaignSequence, Integer userVisitTrackSequence) 072 throws PersistenceNotNullException { 073 super(userVisitStatusPK); 074 constructFields(userVisitPK, userVisitCommandSequence, userVisitCachedSearchSequence, userVisitCampaignSequence, userVisitTrackSequence); 075 } 076 077 /** Creates a new instance of UserVisitStatusValue */ 078 public UserVisitStatusValue(UserVisitPK userVisitPK, Integer userVisitCommandSequence, Integer userVisitCachedSearchSequence, Integer userVisitCampaignSequence, Integer userVisitTrackSequence) 079 throws PersistenceNotNullException { 080 super(); 081 constructFields(userVisitPK, userVisitCommandSequence, userVisitCachedSearchSequence, userVisitCampaignSequence, userVisitTrackSequence); 082 } 083 084 @Override 085 public UserVisitStatusFactory getBaseFactoryInstance() { 086 return UserVisitStatusFactory.getInstance(); 087 } 088 089 @Override 090 public UserVisitStatusValue clone() { 091 Object result; 092 093 try { 094 result = super.clone(); 095 } catch (CloneNotSupportedException cnse) { 096 // This shouldn't happen, fail when it does. 097 throw new PersistenceCloneException(cnse); 098 } 099 100 return (UserVisitStatusValue)result; 101 } 102 103 @Override 104 public UserVisitStatusPK getPrimaryKey() { 105 if(_primaryKey == null) { 106 _primaryKey = new UserVisitStatusPK(entityId); 107 } 108 109 return _primaryKey; 110 } 111 112 private void clearHashAndString() { 113 _hashCode = null; 114 _stringValue = null; 115 } 116 117 @Override 118 public int hashCode() { 119 if(_hashCode == null) { 120 int hashCode = 17; 121 122 hashCode = 37 * hashCode + ((entityId != null) ? entityId.hashCode() : 0); 123 124 hashCode = 37 * hashCode + ((userVisitPK != null) ? userVisitPK.hashCode() : 0); 125 hashCode = 37 * hashCode + ((userVisitCommandSequence != null) ? userVisitCommandSequence.hashCode() : 0); 126 hashCode = 37 * hashCode + ((userVisitCachedSearchSequence != null) ? userVisitCachedSearchSequence.hashCode() : 0); 127 hashCode = 37 * hashCode + ((userVisitCampaignSequence != null) ? userVisitCampaignSequence.hashCode() : 0); 128 hashCode = 37 * hashCode + ((userVisitTrackSequence != null) ? userVisitTrackSequence.hashCode() : 0); 129 130 _hashCode = hashCode; 131 } 132 133 return _hashCode; 134 } 135 136 @Override 137 public String toString() { 138 if(_stringValue == null) { 139 _stringValue = "{" + 140 "entityId=" + getEntityId() + 141 ", userVisitPK=" + getUserVisitPK() + 142 ", userVisitCommandSequence=" + getUserVisitCommandSequence() + 143 ", userVisitCachedSearchSequence=" + getUserVisitCachedSearchSequence() + 144 ", userVisitCampaignSequence=" + getUserVisitCampaignSequence() + 145 ", userVisitTrackSequence=" + getUserVisitTrackSequence() + 146 "}"; 147 } 148 return _stringValue; 149 } 150 151 @Override 152 public boolean equals(Object other) { 153 if(this == other) 154 return true; 155 156 if(!hasIdentity()) 157 return false; 158 159 if(other instanceof UserVisitStatusValue that) { 160 if(!that.hasIdentity()) 161 return false; 162 163 Long thisEntityId = getEntityId(); 164 Long thatEntityId = that.getEntityId(); 165 166 boolean objectsEqual = thisEntityId.equals(thatEntityId); 167 if(objectsEqual) 168 objectsEqual = isIdentical(that); 169 170 return objectsEqual; 171 } else { 172 return false; 173 } 174 } 175 176 public boolean isIdentical(Object other) { 177 if(other instanceof UserVisitStatusValue that) { 178 boolean objectsEqual = true; 179 180 181 if(objectsEqual) { 182 UserVisitPK thisUserVisitPK = getUserVisitPK(); 183 UserVisitPK thatUserVisitPK = that.getUserVisitPK(); 184 185 if(thisUserVisitPK == null) { 186 objectsEqual = objectsEqual && (thatUserVisitPK == null); 187 } else { 188 objectsEqual = objectsEqual && thisUserVisitPK.equals(thatUserVisitPK); 189 } 190 } 191 192 if(objectsEqual) { 193 Integer thisUserVisitCommandSequence = getUserVisitCommandSequence(); 194 Integer thatUserVisitCommandSequence = that.getUserVisitCommandSequence(); 195 196 if(thisUserVisitCommandSequence == null) { 197 objectsEqual = objectsEqual && (thatUserVisitCommandSequence == null); 198 } else { 199 objectsEqual = objectsEqual && thisUserVisitCommandSequence.equals(thatUserVisitCommandSequence); 200 } 201 } 202 203 if(objectsEqual) { 204 Integer thisUserVisitCachedSearchSequence = getUserVisitCachedSearchSequence(); 205 Integer thatUserVisitCachedSearchSequence = that.getUserVisitCachedSearchSequence(); 206 207 if(thisUserVisitCachedSearchSequence == null) { 208 objectsEqual = objectsEqual && (thatUserVisitCachedSearchSequence == null); 209 } else { 210 objectsEqual = objectsEqual && thisUserVisitCachedSearchSequence.equals(thatUserVisitCachedSearchSequence); 211 } 212 } 213 214 if(objectsEqual) { 215 Integer thisUserVisitCampaignSequence = getUserVisitCampaignSequence(); 216 Integer thatUserVisitCampaignSequence = that.getUserVisitCampaignSequence(); 217 218 if(thisUserVisitCampaignSequence == null) { 219 objectsEqual = objectsEqual && (thatUserVisitCampaignSequence == null); 220 } else { 221 objectsEqual = objectsEqual && thisUserVisitCampaignSequence.equals(thatUserVisitCampaignSequence); 222 } 223 } 224 225 if(objectsEqual) { 226 Integer thisUserVisitTrackSequence = getUserVisitTrackSequence(); 227 Integer thatUserVisitTrackSequence = that.getUserVisitTrackSequence(); 228 229 if(thisUserVisitTrackSequence == null) { 230 objectsEqual = objectsEqual && (thatUserVisitTrackSequence == null); 231 } else { 232 objectsEqual = objectsEqual && thisUserVisitTrackSequence.equals(thatUserVisitTrackSequence); 233 } 234 } 235 236 return objectsEqual; 237 } else { 238 return false; 239 } 240 } 241 242 @Override 243 public boolean hasBeenModified() { 244 return userVisitPKHasBeenModified || userVisitCommandSequenceHasBeenModified || userVisitCachedSearchSequenceHasBeenModified || userVisitCampaignSequenceHasBeenModified || userVisitTrackSequenceHasBeenModified; 245 } 246 247 @Override 248 public void clearHasBeenModified() { 249 userVisitPKHasBeenModified = false; 250 userVisitCommandSequenceHasBeenModified = false; 251 userVisitCachedSearchSequenceHasBeenModified = false; 252 userVisitCampaignSequenceHasBeenModified = false; 253 userVisitTrackSequenceHasBeenModified = false; 254 } 255 256 public UserVisitPK getUserVisitPK() { 257 return userVisitPK; 258 } 259 260 public void setUserVisitPK(UserVisitPK userVisitPK) 261 throws PersistenceNotNullException { 262 checkForNull(userVisitPK); 263 264 boolean update = true; 265 266 if(this.userVisitPK != null) { 267 if(this.userVisitPK.equals(userVisitPK)) { 268 update = false; 269 } 270 } else if(userVisitPK == null) { 271 update = false; 272 } 273 274 if(update) { 275 this.userVisitPK = userVisitPK; 276 userVisitPKHasBeenModified = true; 277 clearHashAndString(); 278 } 279 } 280 281 public boolean getUserVisitPKHasBeenModified() { 282 return userVisitPKHasBeenModified; 283 } 284 285 public Integer getUserVisitCommandSequence() { 286 return userVisitCommandSequence; 287 } 288 289 public void setUserVisitCommandSequence(Integer userVisitCommandSequence) 290 throws PersistenceNotNullException { 291 checkForNull(userVisitCommandSequence); 292 293 boolean update = true; 294 295 if(this.userVisitCommandSequence != null) { 296 if(this.userVisitCommandSequence.equals(userVisitCommandSequence)) { 297 update = false; 298 } 299 } else if(userVisitCommandSequence == null) { 300 update = false; 301 } 302 303 if(update) { 304 this.userVisitCommandSequence = userVisitCommandSequence; 305 userVisitCommandSequenceHasBeenModified = true; 306 clearHashAndString(); 307 } 308 } 309 310 public boolean getUserVisitCommandSequenceHasBeenModified() { 311 return userVisitCommandSequenceHasBeenModified; 312 } 313 314 public Integer getUserVisitCachedSearchSequence() { 315 return userVisitCachedSearchSequence; 316 } 317 318 public void setUserVisitCachedSearchSequence(Integer userVisitCachedSearchSequence) 319 throws PersistenceNotNullException { 320 checkForNull(userVisitCachedSearchSequence); 321 322 boolean update = true; 323 324 if(this.userVisitCachedSearchSequence != null) { 325 if(this.userVisitCachedSearchSequence.equals(userVisitCachedSearchSequence)) { 326 update = false; 327 } 328 } else if(userVisitCachedSearchSequence == null) { 329 update = false; 330 } 331 332 if(update) { 333 this.userVisitCachedSearchSequence = userVisitCachedSearchSequence; 334 userVisitCachedSearchSequenceHasBeenModified = true; 335 clearHashAndString(); 336 } 337 } 338 339 public boolean getUserVisitCachedSearchSequenceHasBeenModified() { 340 return userVisitCachedSearchSequenceHasBeenModified; 341 } 342 343 public Integer getUserVisitCampaignSequence() { 344 return userVisitCampaignSequence; 345 } 346 347 public void setUserVisitCampaignSequence(Integer userVisitCampaignSequence) 348 throws PersistenceNotNullException { 349 checkForNull(userVisitCampaignSequence); 350 351 boolean update = true; 352 353 if(this.userVisitCampaignSequence != null) { 354 if(this.userVisitCampaignSequence.equals(userVisitCampaignSequence)) { 355 update = false; 356 } 357 } else if(userVisitCampaignSequence == null) { 358 update = false; 359 } 360 361 if(update) { 362 this.userVisitCampaignSequence = userVisitCampaignSequence; 363 userVisitCampaignSequenceHasBeenModified = true; 364 clearHashAndString(); 365 } 366 } 367 368 public boolean getUserVisitCampaignSequenceHasBeenModified() { 369 return userVisitCampaignSequenceHasBeenModified; 370 } 371 372 public Integer getUserVisitTrackSequence() { 373 return userVisitTrackSequence; 374 } 375 376 public void setUserVisitTrackSequence(Integer userVisitTrackSequence) 377 throws PersistenceNotNullException { 378 checkForNull(userVisitTrackSequence); 379 380 boolean update = true; 381 382 if(this.userVisitTrackSequence != null) { 383 if(this.userVisitTrackSequence.equals(userVisitTrackSequence)) { 384 update = false; 385 } 386 } else if(userVisitTrackSequence == null) { 387 update = false; 388 } 389 390 if(update) { 391 this.userVisitTrackSequence = userVisitTrackSequence; 392 userVisitTrackSequenceHasBeenModified = true; 393 clearHashAndString(); 394 } 395 } 396 397 public boolean getUserVisitTrackSequenceHasBeenModified() { 398 return userVisitTrackSequenceHasBeenModified; 399 } 400 401}