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 * 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 040public class UserKeyDetailValue 041 extends BaseValue<UserKeyDetailPK> 042 implements Cloneable, Serializable { 043 044 private UserKeyPK userKeyPK; 045 private boolean userKeyPKHasBeenModified = false; 046 private String userKeyName; 047 private boolean userKeyNameHasBeenModified = false; 048 private PartyPK partyPK; 049 private boolean partyPKHasBeenModified = false; 050 private PartyRelationshipPK partyRelationshipPK; 051 private boolean partyRelationshipPKHasBeenModified = false; 052 private Long fromTime; 053 private boolean fromTimeHasBeenModified = false; 054 private Long thruTime; 055 private boolean thruTimeHasBeenModified = false; 056 057 private transient Integer _hashCode = null; 058 private transient String _stringValue = null; 059 060 private void constructFields(UserKeyPK userKeyPK, String userKeyName, PartyPK partyPK, PartyRelationshipPK partyRelationshipPK, Long fromTime, Long thruTime) 061 throws PersistenceNotNullException { 062 checkForNull(userKeyPK); 063 this.userKeyPK = userKeyPK; 064 checkForNull(userKeyName); 065 this.userKeyName = userKeyName; 066 this.partyPK = partyPK; 067 this.partyRelationshipPK = partyRelationshipPK; 068 checkForNull(fromTime); 069 this.fromTime = fromTime; 070 checkForNull(thruTime); 071 this.thruTime = thruTime; 072 } 073 074 /** Creates a new instance of UserKeyDetailValue */ 075 public UserKeyDetailValue(UserKeyDetailPK userKeyDetailPK, UserKeyPK userKeyPK, String userKeyName, PartyPK partyPK, PartyRelationshipPK partyRelationshipPK, Long fromTime, Long thruTime) 076 throws PersistenceNotNullException { 077 super(userKeyDetailPK); 078 constructFields(userKeyPK, userKeyName, partyPK, partyRelationshipPK, fromTime, thruTime); 079 } 080 081 /** Creates a new instance of UserKeyDetailValue */ 082 public UserKeyDetailValue(UserKeyPK userKeyPK, String userKeyName, PartyPK partyPK, PartyRelationshipPK partyRelationshipPK, Long fromTime, Long thruTime) 083 throws PersistenceNotNullException { 084 super(); 085 constructFields(userKeyPK, userKeyName, partyPK, partyRelationshipPK, fromTime, thruTime); 086 } 087 088 @Override 089 public UserKeyDetailFactory getBaseFactoryInstance() { 090 return UserKeyDetailFactory.getInstance(); 091 } 092 093 @Override 094 public UserKeyDetailValue clone() { 095 Object result; 096 097 try { 098 result = super.clone(); 099 } catch (CloneNotSupportedException cnse) { 100 // This shouldn't happen, fail when it does. 101 throw new PersistenceCloneException(cnse); 102 } 103 104 return (UserKeyDetailValue)result; 105 } 106 107 @Override 108 public UserKeyDetailPK getPrimaryKey() { 109 if(_primaryKey == null) { 110 _primaryKey = new UserKeyDetailPK(entityId); 111 } 112 113 return _primaryKey; 114 } 115 116 private void clearHashAndString() { 117 _hashCode = null; 118 _stringValue = null; 119 } 120 121 @Override 122 public int hashCode() { 123 if(_hashCode == null) { 124 int hashCode = 17; 125 126 hashCode = 37 * hashCode + ((entityId != null) ? entityId.hashCode() : 0); 127 128 hashCode = 37 * hashCode + ((userKeyPK != null) ? userKeyPK.hashCode() : 0); 129 hashCode = 37 * hashCode + ((userKeyName != null) ? userKeyName.hashCode() : 0); 130 hashCode = 37 * hashCode + ((partyPK != null) ? partyPK.hashCode() : 0); 131 hashCode = 37 * hashCode + ((partyRelationshipPK != null) ? partyRelationshipPK.hashCode() : 0); 132 hashCode = 37 * hashCode + ((fromTime != null) ? fromTime.hashCode() : 0); 133 hashCode = 37 * hashCode + ((thruTime != null) ? thruTime.hashCode() : 0); 134 135 _hashCode = hashCode; 136 } 137 138 return _hashCode; 139 } 140 141 @Override 142 public String toString() { 143 if(_stringValue == null) { 144 StringBuilder stringValue = new StringBuilder("{"); 145 146 stringValue.append("entityId=").append(getEntityId()); 147 148 stringValue.append(", userKeyPK=").append(getUserKeyPK()); 149 stringValue.append(", userKeyName=").append(getUserKeyName()); 150 stringValue.append(", partyPK=").append(getPartyPK()); 151 stringValue.append(", partyRelationshipPK=").append(getPartyRelationshipPK()); 152 stringValue.append(", fromTime=").append(getFromTime()); 153 stringValue.append(", thruTime=").append(getThruTime()); 154 155 stringValue.append('}'); 156 157 _stringValue = stringValue.toString(); 158 } 159 return _stringValue; 160 } 161 162 @Override 163 public boolean equals(Object other) { 164 if(this == other) 165 return true; 166 167 if(!hasIdentity()) 168 return false; 169 170 if(other instanceof UserKeyDetailValue) { 171 UserKeyDetailValue that = (UserKeyDetailValue)other; 172 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 = 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) { 191 UserKeyDetailValue that = (UserKeyDetailValue)other; 192 boolean objectsEqual = true; 193 194 195 if(objectsEqual) { 196 UserKeyPK thisUserKeyPK = getUserKeyPK(); 197 UserKeyPK thatUserKeyPK = that.getUserKeyPK(); 198 199 if(thisUserKeyPK == null) { 200 objectsEqual = objectsEqual && (thatUserKeyPK == null); 201 } else { 202 objectsEqual = objectsEqual && thisUserKeyPK.equals(thatUserKeyPK); 203 } 204 } 205 206 if(objectsEqual) { 207 String thisUserKeyName = getUserKeyName(); 208 String thatUserKeyName = that.getUserKeyName(); 209 210 if(thisUserKeyName == null) { 211 objectsEqual = objectsEqual && (thatUserKeyName == null); 212 } else { 213 objectsEqual = objectsEqual && thisUserKeyName.equals(thatUserKeyName); 214 } 215 } 216 217 if(objectsEqual) { 218 PartyPK thisPartyPK = getPartyPK(); 219 PartyPK thatPartyPK = that.getPartyPK(); 220 221 if(thisPartyPK == null) { 222 objectsEqual = objectsEqual && (thatPartyPK == null); 223 } else { 224 objectsEqual = objectsEqual && thisPartyPK.equals(thatPartyPK); 225 } 226 } 227 228 if(objectsEqual) { 229 PartyRelationshipPK thisPartyRelationshipPK = getPartyRelationshipPK(); 230 PartyRelationshipPK thatPartyRelationshipPK = that.getPartyRelationshipPK(); 231 232 if(thisPartyRelationshipPK == null) { 233 objectsEqual = objectsEqual && (thatPartyRelationshipPK == null); 234 } else { 235 objectsEqual = objectsEqual && thisPartyRelationshipPK.equals(thatPartyRelationshipPK); 236 } 237 } 238 239 if(objectsEqual) { 240 Long thisFromTime = getFromTime(); 241 Long thatFromTime = that.getFromTime(); 242 243 if(thisFromTime == null) { 244 objectsEqual = objectsEqual && (thatFromTime == null); 245 } else { 246 objectsEqual = objectsEqual && thisFromTime.equals(thatFromTime); 247 } 248 } 249 250 if(objectsEqual) { 251 Long thisThruTime = getThruTime(); 252 Long thatThruTime = that.getThruTime(); 253 254 if(thisThruTime == null) { 255 objectsEqual = objectsEqual && (thatThruTime == null); 256 } else { 257 objectsEqual = objectsEqual && thisThruTime.equals(thatThruTime); 258 } 259 } 260 261 return objectsEqual; 262 } else { 263 return false; 264 } 265 } 266 267 @Override 268 public boolean hasBeenModified() { 269 return userKeyPKHasBeenModified || userKeyNameHasBeenModified || partyPKHasBeenModified || partyRelationshipPKHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified; 270 } 271 272 @Override 273 public void clearHasBeenModified() { 274 userKeyPKHasBeenModified = false; 275 userKeyNameHasBeenModified = false; 276 partyPKHasBeenModified = false; 277 partyRelationshipPKHasBeenModified = false; 278 fromTimeHasBeenModified = false; 279 thruTimeHasBeenModified = false; 280 } 281 282 public UserKeyPK getUserKeyPK() { 283 return userKeyPK; 284 } 285 286 public void setUserKeyPK(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 public String getUserKeyName() { 312 return userKeyName; 313 } 314 315 public void setUserKeyName(String userKeyName) 316 throws PersistenceNotNullException { 317 checkForNull(userKeyName); 318 319 boolean update = true; 320 321 if(this.userKeyName != null) { 322 if(this.userKeyName.equals(userKeyName)) { 323 update = false; 324 } 325 } else if(userKeyName == null) { 326 update = false; 327 } 328 329 if(update) { 330 this.userKeyName = userKeyName; 331 userKeyNameHasBeenModified = true; 332 clearHashAndString(); 333 } 334 } 335 336 public boolean getUserKeyNameHasBeenModified() { 337 return userKeyNameHasBeenModified; 338 } 339 340 public PartyPK getPartyPK() { 341 return partyPK; 342 } 343 344 public void setPartyPK(PartyPK partyPK) { 345 boolean update = true; 346 347 if(this.partyPK != null) { 348 if(this.partyPK.equals(partyPK)) { 349 update = false; 350 } 351 } else if(partyPK == null) { 352 update = false; 353 } 354 355 if(update) { 356 this.partyPK = partyPK; 357 partyPKHasBeenModified = true; 358 clearHashAndString(); 359 } 360 } 361 362 public boolean getPartyPKHasBeenModified() { 363 return partyPKHasBeenModified; 364 } 365 366 public PartyRelationshipPK getPartyRelationshipPK() { 367 return partyRelationshipPK; 368 } 369 370 public void setPartyRelationshipPK(PartyRelationshipPK partyRelationshipPK) { 371 boolean update = true; 372 373 if(this.partyRelationshipPK != null) { 374 if(this.partyRelationshipPK.equals(partyRelationshipPK)) { 375 update = false; 376 } 377 } else if(partyRelationshipPK == null) { 378 update = false; 379 } 380 381 if(update) { 382 this.partyRelationshipPK = partyRelationshipPK; 383 partyRelationshipPKHasBeenModified = true; 384 clearHashAndString(); 385 } 386 } 387 388 public boolean getPartyRelationshipPKHasBeenModified() { 389 return partyRelationshipPKHasBeenModified; 390 } 391 392 public Long getFromTime() { 393 return fromTime; 394 } 395 396 public void setFromTime(Long fromTime) 397 throws PersistenceNotNullException { 398 checkForNull(fromTime); 399 400 boolean update = true; 401 402 if(this.fromTime != null) { 403 if(this.fromTime.equals(fromTime)) { 404 update = false; 405 } 406 } else if(fromTime == null) { 407 update = false; 408 } 409 410 if(update) { 411 this.fromTime = fromTime; 412 fromTimeHasBeenModified = true; 413 clearHashAndString(); 414 } 415 } 416 417 public boolean getFromTimeHasBeenModified() { 418 return fromTimeHasBeenModified; 419 } 420 421 public Long getThruTime() { 422 return thruTime; 423 } 424 425 public void setThruTime(Long thruTime) 426 throws PersistenceNotNullException { 427 checkForNull(thruTime); 428 429 boolean update = true; 430 431 if(this.thruTime != null) { 432 if(this.thruTime.equals(thruTime)) { 433 update = false; 434 } 435 } else if(thruTime == null) { 436 update = false; 437 } 438 439 if(update) { 440 this.thruTime = thruTime; 441 thruTimeHasBeenModified = true; 442 clearHashAndString(); 443 } 444 } 445 446 public boolean getThruTimeHasBeenModified() { 447 return thruTimeHasBeenModified; 448 } 449 450}