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 * UserKeyDetailValue.java 021 */ 022 023package com.echothree.model.data.user.server.value; 024 025import com.echothree.model.data.user.common.pk.UserKeyDetailPK; 026 027import com.echothree.model.data.user.server.factory.UserKeyDetailFactory; 028 029import com.echothree.model.data.user.common.pk.UserKeyPK; 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 UserKeyDetailValue 044 extends BaseValue<UserKeyDetailPK> 045 implements Cloneable, Serializable { 046 047 private UserKeyPK userKeyPK; 048 private boolean userKeyPKHasBeenModified = false; 049 private String userKeyName; 050 private boolean userKeyNameHasBeenModified = false; 051 private PartyPK partyPK; 052 private boolean partyPKHasBeenModified = false; 053 private PartyRelationshipPK partyRelationshipPK; 054 private boolean partyRelationshipPKHasBeenModified = 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(UserKeyPK userKeyPK, String userKeyName, PartyPK partyPK, PartyRelationshipPK partyRelationshipPK, Long fromTime, Long thruTime) 064 throws PersistenceNotNullException { 065 checkForNull(userKeyPK); 066 this.userKeyPK = userKeyPK; 067 checkForNull(userKeyName); 068 this.userKeyName = userKeyName; 069 this.partyPK = partyPK; 070 this.partyRelationshipPK = partyRelationshipPK; 071 checkForNull(fromTime); 072 this.fromTime = fromTime; 073 checkForNull(thruTime); 074 this.thruTime = thruTime; 075 } 076 077 /** Creates a new instance of UserKeyDetailValue */ 078 public UserKeyDetailValue(UserKeyDetailPK userKeyDetailPK, UserKeyPK userKeyPK, String userKeyName, PartyPK partyPK, PartyRelationshipPK partyRelationshipPK, Long fromTime, Long thruTime) 079 throws PersistenceNotNullException { 080 super(userKeyDetailPK); 081 constructFields(userKeyPK, userKeyName, partyPK, partyRelationshipPK, fromTime, thruTime); 082 } 083 084 /** Creates a new instance of UserKeyDetailValue */ 085 public UserKeyDetailValue(UserKeyPK userKeyPK, String userKeyName, PartyPK partyPK, PartyRelationshipPK partyRelationshipPK, Long fromTime, Long thruTime) 086 throws PersistenceNotNullException { 087 super(); 088 constructFields(userKeyPK, userKeyName, partyPK, partyRelationshipPK, fromTime, thruTime); 089 } 090 091 @Override 092 @Nonnull 093 public UserKeyDetailFactory getBaseFactoryInstance() { 094 return UserKeyDetailFactory.getInstance(); 095 } 096 097 @Override 098 @Nonnull 099 public UserKeyDetailValue 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 (UserKeyDetailValue)result; 110 } 111 112 @Override 113 @Nonnull 114 public UserKeyDetailPK getPrimaryKey() { 115 if(_primaryKey == null) { 116 _primaryKey = new UserKeyDetailPK(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 + ((userKeyPK != null) ? userKeyPK.hashCode() : 0); 135 hashCode = 37 * hashCode + ((userKeyName != null) ? userKeyName.hashCode() : 0); 136 hashCode = 37 * hashCode + ((partyPK != null) ? partyPK.hashCode() : 0); 137 hashCode = 37 * hashCode + ((partyRelationshipPK != null) ? partyRelationshipPK.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 ", userKeyPK=" + getUserKeyPK() + 154 ", userKeyName=" + getUserKeyName() + 155 ", partyPK=" + getPartyPK() + 156 ", partyRelationshipPK=" + getPartyRelationshipPK() + 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 UserKeyDetailValue 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 UserKeyDetailValue that) { 191 boolean objectsEqual = true; 192 193 194 if(objectsEqual) { 195 UserKeyPK thisUserKeyPK = getUserKeyPK(); 196 UserKeyPK thatUserKeyPK = that.getUserKeyPK(); 197 198 if(thisUserKeyPK == null) { 199 objectsEqual = objectsEqual && (thatUserKeyPK == null); 200 } else { 201 objectsEqual = objectsEqual && thisUserKeyPK.equals(thatUserKeyPK); 202 } 203 } 204 205 if(objectsEqual) { 206 String thisUserKeyName = getUserKeyName(); 207 String thatUserKeyName = that.getUserKeyName(); 208 209 if(thisUserKeyName == null) { 210 objectsEqual = objectsEqual && (thatUserKeyName == null); 211 } else { 212 objectsEqual = objectsEqual && thisUserKeyName.equals(thatUserKeyName); 213 } 214 } 215 216 if(objectsEqual) { 217 PartyPK thisPartyPK = getPartyPK(); 218 PartyPK thatPartyPK = that.getPartyPK(); 219 220 if(thisPartyPK == null) { 221 objectsEqual = objectsEqual && (thatPartyPK == null); 222 } else { 223 objectsEqual = objectsEqual && thisPartyPK.equals(thatPartyPK); 224 } 225 } 226 227 if(objectsEqual) { 228 PartyRelationshipPK thisPartyRelationshipPK = getPartyRelationshipPK(); 229 PartyRelationshipPK thatPartyRelationshipPK = that.getPartyRelationshipPK(); 230 231 if(thisPartyRelationshipPK == null) { 232 objectsEqual = objectsEqual && (thatPartyRelationshipPK == null); 233 } else { 234 objectsEqual = objectsEqual && thisPartyRelationshipPK.equals(thatPartyRelationshipPK); 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 userKeyPKHasBeenModified || userKeyNameHasBeenModified || partyPKHasBeenModified || partyRelationshipPKHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified; 269 } 270 271 @Override 272 public void clearHasBeenModified() { 273 userKeyPKHasBeenModified = false; 274 userKeyNameHasBeenModified = false; 275 partyPKHasBeenModified = false; 276 partyRelationshipPKHasBeenModified = false; 277 fromTimeHasBeenModified = false; 278 thruTimeHasBeenModified = false; 279 } 280 281 @Nonnull 282 public UserKeyPK getUserKeyPK() { 283 return userKeyPK; 284 } 285 286 public void setUserKeyPK(@Nonnull UserKeyPK userKeyPK) 287 throws PersistenceNotNullException { 288 checkForNull(userKeyPK); 289 290 boolean update = true; 291 292 if(this.userKeyPK != null) { 293 if(this.userKeyPK.equals(userKeyPK)) { 294 update = false; 295 } 296 } else if(userKeyPK == null) { 297 update = false; 298 } 299 300 if(update) { 301 this.userKeyPK = userKeyPK; 302 userKeyPKHasBeenModified = true; 303 clearHashAndString(); 304 } 305 } 306 307 public boolean getUserKeyPKHasBeenModified() { 308 return userKeyPKHasBeenModified; 309 } 310 311 @Nonnull 312 public String getUserKeyName() { 313 return userKeyName; 314 } 315 316 public void setUserKeyName(@Nonnull String userKeyName) 317 throws PersistenceNotNullException { 318 checkForNull(userKeyName); 319 320 boolean update = true; 321 322 if(this.userKeyName != null) { 323 if(this.userKeyName.equals(userKeyName)) { 324 update = false; 325 } 326 } else if(userKeyName == null) { 327 update = false; 328 } 329 330 if(update) { 331 this.userKeyName = userKeyName; 332 userKeyNameHasBeenModified = true; 333 clearHashAndString(); 334 } 335 } 336 337 public boolean getUserKeyNameHasBeenModified() { 338 return userKeyNameHasBeenModified; 339 } 340 341 @Nullable 342 public PartyPK getPartyPK() { 343 return partyPK; 344 } 345 346 public void setPartyPK(@Nullable PartyPK partyPK) { 347 boolean update = true; 348 349 if(this.partyPK != null) { 350 if(this.partyPK.equals(partyPK)) { 351 update = false; 352 } 353 } else if(partyPK == null) { 354 update = false; 355 } 356 357 if(update) { 358 this.partyPK = partyPK; 359 partyPKHasBeenModified = true; 360 clearHashAndString(); 361 } 362 } 363 364 public boolean getPartyPKHasBeenModified() { 365 return partyPKHasBeenModified; 366 } 367 368 @Nullable 369 public PartyRelationshipPK getPartyRelationshipPK() { 370 return partyRelationshipPK; 371 } 372 373 public void setPartyRelationshipPK(@Nullable PartyRelationshipPK partyRelationshipPK) { 374 boolean update = true; 375 376 if(this.partyRelationshipPK != null) { 377 if(this.partyRelationshipPK.equals(partyRelationshipPK)) { 378 update = false; 379 } 380 } else if(partyRelationshipPK == null) { 381 update = false; 382 } 383 384 if(update) { 385 this.partyRelationshipPK = partyRelationshipPK; 386 partyRelationshipPKHasBeenModified = true; 387 clearHashAndString(); 388 } 389 } 390 391 public boolean getPartyRelationshipPKHasBeenModified() { 392 return partyRelationshipPKHasBeenModified; 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}