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 * AssociateReferralDetailValue.java 021 */ 022 023package com.echothree.model.data.associate.server.value; 024 025import com.echothree.model.data.associate.common.pk.AssociateReferralDetailPK; 026 027import com.echothree.model.data.associate.server.factory.AssociateReferralDetailFactory; 028 029import com.echothree.model.data.associate.common.pk.AssociateReferralPK; 030import com.echothree.model.data.associate.common.pk.AssociatePK; 031import com.echothree.model.data.associate.common.pk.AssociatePartyContactMechanismPK; 032import com.echothree.model.data.core.common.pk.EntityInstancePK; 033 034import com.echothree.util.common.exception.PersistenceCloneException; 035import com.echothree.util.common.exception.PersistenceNotNullException; 036 037import com.echothree.util.server.persistence.BaseValue; 038 039import java.io.Serializable; 040 041import javax.annotation.Nonnull; 042import javax.annotation.Nullable; 043 044public class AssociateReferralDetailValue 045 extends BaseValue<AssociateReferralDetailPK> 046 implements Cloneable, Serializable { 047 048 private AssociateReferralPK associateReferralPK; 049 private boolean associateReferralPKHasBeenModified = false; 050 private String associateReferralName; 051 private boolean associateReferralNameHasBeenModified = false; 052 private AssociatePK associatePK; 053 private boolean associatePKHasBeenModified = false; 054 private AssociatePartyContactMechanismPK associatePartyContactMechanismPK; 055 private boolean associatePartyContactMechanismPKHasBeenModified = false; 056 private EntityInstancePK targetEntityInstancePK; 057 private boolean targetEntityInstancePKHasBeenModified = false; 058 private Long associateReferralTime; 059 private boolean associateReferralTimeHasBeenModified = false; 060 private Long fromTime; 061 private boolean fromTimeHasBeenModified = false; 062 private Long thruTime; 063 private boolean thruTimeHasBeenModified = false; 064 065 private transient Integer _hashCode = null; 066 private transient String _stringValue = null; 067 068 private void constructFields(AssociateReferralPK associateReferralPK, String associateReferralName, AssociatePK associatePK, AssociatePartyContactMechanismPK associatePartyContactMechanismPK, EntityInstancePK targetEntityInstancePK, Long associateReferralTime, Long fromTime, Long thruTime) 069 throws PersistenceNotNullException { 070 this.associateReferralPK = associateReferralPK; 071 checkForNull(associateReferralName); 072 this.associateReferralName = associateReferralName; 073 checkForNull(associatePK); 074 this.associatePK = associatePK; 075 this.associatePartyContactMechanismPK = associatePartyContactMechanismPK; 076 this.targetEntityInstancePK = targetEntityInstancePK; 077 checkForNull(associateReferralTime); 078 this.associateReferralTime = associateReferralTime; 079 checkForNull(fromTime); 080 this.fromTime = fromTime; 081 checkForNull(thruTime); 082 this.thruTime = thruTime; 083 } 084 085 /** Creates a new instance of AssociateReferralDetailValue */ 086 public AssociateReferralDetailValue(AssociateReferralDetailPK associateReferralDetailPK, AssociateReferralPK associateReferralPK, String associateReferralName, AssociatePK associatePK, AssociatePartyContactMechanismPK associatePartyContactMechanismPK, EntityInstancePK targetEntityInstancePK, Long associateReferralTime, Long fromTime, Long thruTime) 087 throws PersistenceNotNullException { 088 super(associateReferralDetailPK); 089 constructFields(associateReferralPK, associateReferralName, associatePK, associatePartyContactMechanismPK, targetEntityInstancePK, associateReferralTime, fromTime, thruTime); 090 } 091 092 /** Creates a new instance of AssociateReferralDetailValue */ 093 public AssociateReferralDetailValue(AssociateReferralPK associateReferralPK, String associateReferralName, AssociatePK associatePK, AssociatePartyContactMechanismPK associatePartyContactMechanismPK, EntityInstancePK targetEntityInstancePK, Long associateReferralTime, Long fromTime, Long thruTime) 094 throws PersistenceNotNullException { 095 super(); 096 constructFields(associateReferralPK, associateReferralName, associatePK, associatePartyContactMechanismPK, targetEntityInstancePK, associateReferralTime, fromTime, thruTime); 097 } 098 099 @Override 100 @Nonnull 101 public AssociateReferralDetailFactory getBaseFactoryInstance() { 102 return AssociateReferralDetailFactory.getInstance(); 103 } 104 105 @Override 106 @Nonnull 107 public AssociateReferralDetailValue clone() { 108 Object result; 109 110 try { 111 result = super.clone(); 112 } catch (CloneNotSupportedException cnse) { 113 // This shouldn't happen, fail when it does. 114 throw new PersistenceCloneException(cnse); 115 } 116 117 return (AssociateReferralDetailValue)result; 118 } 119 120 @Override 121 @Nonnull 122 public AssociateReferralDetailPK getPrimaryKey() { 123 if(_primaryKey == null) { 124 _primaryKey = new AssociateReferralDetailPK(entityId); 125 } 126 127 return _primaryKey; 128 } 129 130 private void clearHashAndString() { 131 _hashCode = null; 132 _stringValue = null; 133 } 134 135 @Override 136 public int hashCode() { 137 if(_hashCode == null) { 138 int hashCode = 17; 139 140 hashCode = 37 * hashCode + ((entityId != null) ? entityId.hashCode() : 0); 141 142 hashCode = 37 * hashCode + ((associateReferralPK != null) ? associateReferralPK.hashCode() : 0); 143 hashCode = 37 * hashCode + ((associateReferralName != null) ? associateReferralName.hashCode() : 0); 144 hashCode = 37 * hashCode + ((associatePK != null) ? associatePK.hashCode() : 0); 145 hashCode = 37 * hashCode + ((associatePartyContactMechanismPK != null) ? associatePartyContactMechanismPK.hashCode() : 0); 146 hashCode = 37 * hashCode + ((targetEntityInstancePK != null) ? targetEntityInstancePK.hashCode() : 0); 147 hashCode = 37 * hashCode + ((associateReferralTime != null) ? associateReferralTime.hashCode() : 0); 148 hashCode = 37 * hashCode + ((fromTime != null) ? fromTime.hashCode() : 0); 149 hashCode = 37 * hashCode + ((thruTime != null) ? thruTime.hashCode() : 0); 150 151 _hashCode = hashCode; 152 } 153 154 return _hashCode; 155 } 156 157 @Override 158 @Nonnull 159 public String toString() { 160 if(_stringValue == null) { 161 _stringValue = "{" + 162 "entityId=" + getEntityId() + 163 ", associateReferralPK=" + getAssociateReferralPK() + 164 ", associateReferralName=" + getAssociateReferralName() + 165 ", associatePK=" + getAssociatePK() + 166 ", associatePartyContactMechanismPK=" + getAssociatePartyContactMechanismPK() + 167 ", targetEntityInstancePK=" + getTargetEntityInstancePK() + 168 ", associateReferralTime=" + getAssociateReferralTime() + 169 ", fromTime=" + getFromTime() + 170 ", thruTime=" + getThruTime() + 171 "}"; 172 } 173 return _stringValue; 174 } 175 176 @Override 177 public boolean equals(Object other) { 178 if(this == other) 179 return true; 180 181 if(!hasIdentity()) 182 return false; 183 184 if(other instanceof AssociateReferralDetailValue that) { 185 if(!that.hasIdentity()) 186 return false; 187 188 Long thisEntityId = getEntityId(); 189 Long thatEntityId = that.getEntityId(); 190 191 boolean objectsEqual = thisEntityId.equals(thatEntityId); 192 if(objectsEqual) 193 objectsEqual = isIdentical(that); 194 195 return objectsEqual; 196 } else { 197 return false; 198 } 199 } 200 201 public boolean isIdentical(Object other) { 202 if(other instanceof AssociateReferralDetailValue that) { 203 boolean objectsEqual = true; 204 205 206 if(objectsEqual) { 207 AssociateReferralPK thisAssociateReferralPK = getAssociateReferralPK(); 208 AssociateReferralPK thatAssociateReferralPK = that.getAssociateReferralPK(); 209 210 if(thisAssociateReferralPK == null) { 211 objectsEqual = objectsEqual && (thatAssociateReferralPK == null); 212 } else { 213 objectsEqual = objectsEqual && thisAssociateReferralPK.equals(thatAssociateReferralPK); 214 } 215 } 216 217 if(objectsEqual) { 218 String thisAssociateReferralName = getAssociateReferralName(); 219 String thatAssociateReferralName = that.getAssociateReferralName(); 220 221 if(thisAssociateReferralName == null) { 222 objectsEqual = objectsEqual && (thatAssociateReferralName == null); 223 } else { 224 objectsEqual = objectsEqual && thisAssociateReferralName.equals(thatAssociateReferralName); 225 } 226 } 227 228 if(objectsEqual) { 229 AssociatePK thisAssociatePK = getAssociatePK(); 230 AssociatePK thatAssociatePK = that.getAssociatePK(); 231 232 if(thisAssociatePK == null) { 233 objectsEqual = objectsEqual && (thatAssociatePK == null); 234 } else { 235 objectsEqual = objectsEqual && thisAssociatePK.equals(thatAssociatePK); 236 } 237 } 238 239 if(objectsEqual) { 240 AssociatePartyContactMechanismPK thisAssociatePartyContactMechanismPK = getAssociatePartyContactMechanismPK(); 241 AssociatePartyContactMechanismPK thatAssociatePartyContactMechanismPK = that.getAssociatePartyContactMechanismPK(); 242 243 if(thisAssociatePartyContactMechanismPK == null) { 244 objectsEqual = objectsEqual && (thatAssociatePartyContactMechanismPK == null); 245 } else { 246 objectsEqual = objectsEqual && thisAssociatePartyContactMechanismPK.equals(thatAssociatePartyContactMechanismPK); 247 } 248 } 249 250 if(objectsEqual) { 251 EntityInstancePK thisTargetEntityInstancePK = getTargetEntityInstancePK(); 252 EntityInstancePK thatTargetEntityInstancePK = that.getTargetEntityInstancePK(); 253 254 if(thisTargetEntityInstancePK == null) { 255 objectsEqual = objectsEqual && (thatTargetEntityInstancePK == null); 256 } else { 257 objectsEqual = objectsEqual && thisTargetEntityInstancePK.equals(thatTargetEntityInstancePK); 258 } 259 } 260 261 if(objectsEqual) { 262 Long thisAssociateReferralTime = getAssociateReferralTime(); 263 Long thatAssociateReferralTime = that.getAssociateReferralTime(); 264 265 if(thisAssociateReferralTime == null) { 266 objectsEqual = objectsEqual && (thatAssociateReferralTime == null); 267 } else { 268 objectsEqual = objectsEqual && thisAssociateReferralTime.equals(thatAssociateReferralTime); 269 } 270 } 271 272 if(objectsEqual) { 273 Long thisFromTime = getFromTime(); 274 Long thatFromTime = that.getFromTime(); 275 276 if(thisFromTime == null) { 277 objectsEqual = objectsEqual && (thatFromTime == null); 278 } else { 279 objectsEqual = objectsEqual && thisFromTime.equals(thatFromTime); 280 } 281 } 282 283 if(objectsEqual) { 284 Long thisThruTime = getThruTime(); 285 Long thatThruTime = that.getThruTime(); 286 287 if(thisThruTime == null) { 288 objectsEqual = objectsEqual && (thatThruTime == null); 289 } else { 290 objectsEqual = objectsEqual && thisThruTime.equals(thatThruTime); 291 } 292 } 293 294 return objectsEqual; 295 } else { 296 return false; 297 } 298 } 299 300 @Override 301 public boolean hasBeenModified() { 302 return associateReferralPKHasBeenModified || associateReferralNameHasBeenModified || associatePKHasBeenModified || associatePartyContactMechanismPKHasBeenModified || targetEntityInstancePKHasBeenModified || associateReferralTimeHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified; 303 } 304 305 @Override 306 public void clearHasBeenModified() { 307 associateReferralPKHasBeenModified = false; 308 associateReferralNameHasBeenModified = false; 309 associatePKHasBeenModified = false; 310 associatePartyContactMechanismPKHasBeenModified = false; 311 targetEntityInstancePKHasBeenModified = false; 312 associateReferralTimeHasBeenModified = false; 313 fromTimeHasBeenModified = false; 314 thruTimeHasBeenModified = false; 315 } 316 317 @Nullable 318 public AssociateReferralPK getAssociateReferralPK() { 319 return associateReferralPK; 320 } 321 322 public void setAssociateReferralPK(@Nullable AssociateReferralPK associateReferralPK) { 323 boolean update = true; 324 325 if(this.associateReferralPK != null) { 326 if(this.associateReferralPK.equals(associateReferralPK)) { 327 update = false; 328 } 329 } else if(associateReferralPK == null) { 330 update = false; 331 } 332 333 if(update) { 334 this.associateReferralPK = associateReferralPK; 335 associateReferralPKHasBeenModified = true; 336 clearHashAndString(); 337 } 338 } 339 340 public boolean getAssociateReferralPKHasBeenModified() { 341 return associateReferralPKHasBeenModified; 342 } 343 344 @Nonnull 345 public String getAssociateReferralName() { 346 return associateReferralName; 347 } 348 349 public void setAssociateReferralName(@Nonnull String associateReferralName) 350 throws PersistenceNotNullException { 351 checkForNull(associateReferralName); 352 353 boolean update = true; 354 355 if(this.associateReferralName != null) { 356 if(this.associateReferralName.equals(associateReferralName)) { 357 update = false; 358 } 359 } else if(associateReferralName == null) { 360 update = false; 361 } 362 363 if(update) { 364 this.associateReferralName = associateReferralName; 365 associateReferralNameHasBeenModified = true; 366 clearHashAndString(); 367 } 368 } 369 370 public boolean getAssociateReferralNameHasBeenModified() { 371 return associateReferralNameHasBeenModified; 372 } 373 374 @Nonnull 375 public AssociatePK getAssociatePK() { 376 return associatePK; 377 } 378 379 public void setAssociatePK(@Nonnull AssociatePK associatePK) 380 throws PersistenceNotNullException { 381 checkForNull(associatePK); 382 383 boolean update = true; 384 385 if(this.associatePK != null) { 386 if(this.associatePK.equals(associatePK)) { 387 update = false; 388 } 389 } else if(associatePK == null) { 390 update = false; 391 } 392 393 if(update) { 394 this.associatePK = associatePK; 395 associatePKHasBeenModified = true; 396 clearHashAndString(); 397 } 398 } 399 400 public boolean getAssociatePKHasBeenModified() { 401 return associatePKHasBeenModified; 402 } 403 404 @Nullable 405 public AssociatePartyContactMechanismPK getAssociatePartyContactMechanismPK() { 406 return associatePartyContactMechanismPK; 407 } 408 409 public void setAssociatePartyContactMechanismPK(@Nullable AssociatePartyContactMechanismPK associatePartyContactMechanismPK) { 410 boolean update = true; 411 412 if(this.associatePartyContactMechanismPK != null) { 413 if(this.associatePartyContactMechanismPK.equals(associatePartyContactMechanismPK)) { 414 update = false; 415 } 416 } else if(associatePartyContactMechanismPK == null) { 417 update = false; 418 } 419 420 if(update) { 421 this.associatePartyContactMechanismPK = associatePartyContactMechanismPK; 422 associatePartyContactMechanismPKHasBeenModified = true; 423 clearHashAndString(); 424 } 425 } 426 427 public boolean getAssociatePartyContactMechanismPKHasBeenModified() { 428 return associatePartyContactMechanismPKHasBeenModified; 429 } 430 431 @Nullable 432 public EntityInstancePK getTargetEntityInstancePK() { 433 return targetEntityInstancePK; 434 } 435 436 public void setTargetEntityInstancePK(@Nullable EntityInstancePK targetEntityInstancePK) { 437 boolean update = true; 438 439 if(this.targetEntityInstancePK != null) { 440 if(this.targetEntityInstancePK.equals(targetEntityInstancePK)) { 441 update = false; 442 } 443 } else if(targetEntityInstancePK == null) { 444 update = false; 445 } 446 447 if(update) { 448 this.targetEntityInstancePK = targetEntityInstancePK; 449 targetEntityInstancePKHasBeenModified = true; 450 clearHashAndString(); 451 } 452 } 453 454 public boolean getTargetEntityInstancePKHasBeenModified() { 455 return targetEntityInstancePKHasBeenModified; 456 } 457 458 @Nonnull 459 public Long getAssociateReferralTime() { 460 return associateReferralTime; 461 } 462 463 public void setAssociateReferralTime(@Nonnull Long associateReferralTime) 464 throws PersistenceNotNullException { 465 checkForNull(associateReferralTime); 466 467 boolean update = true; 468 469 if(this.associateReferralTime != null) { 470 if(this.associateReferralTime.equals(associateReferralTime)) { 471 update = false; 472 } 473 } else if(associateReferralTime == null) { 474 update = false; 475 } 476 477 if(update) { 478 this.associateReferralTime = associateReferralTime; 479 associateReferralTimeHasBeenModified = true; 480 clearHashAndString(); 481 } 482 } 483 484 public boolean getAssociateReferralTimeHasBeenModified() { 485 return associateReferralTimeHasBeenModified; 486 } 487 488 @Nonnull 489 public Long getFromTime() { 490 return fromTime; 491 } 492 493 public void setFromTime(@Nonnull Long fromTime) 494 throws PersistenceNotNullException { 495 checkForNull(fromTime); 496 497 boolean update = true; 498 499 if(this.fromTime != null) { 500 if(this.fromTime.equals(fromTime)) { 501 update = false; 502 } 503 } else if(fromTime == null) { 504 update = false; 505 } 506 507 if(update) { 508 this.fromTime = fromTime; 509 fromTimeHasBeenModified = true; 510 clearHashAndString(); 511 } 512 } 513 514 public boolean getFromTimeHasBeenModified() { 515 return fromTimeHasBeenModified; 516 } 517 518 @Nonnull 519 public Long getThruTime() { 520 return thruTime; 521 } 522 523 public void setThruTime(@Nonnull Long thruTime) 524 throws PersistenceNotNullException { 525 checkForNull(thruTime); 526 527 boolean update = true; 528 529 if(this.thruTime != null) { 530 if(this.thruTime.equals(thruTime)) { 531 update = false; 532 } 533 } else if(thruTime == null) { 534 update = false; 535 } 536 537 if(update) { 538 this.thruTime = thruTime; 539 thruTimeHasBeenModified = true; 540 clearHashAndString(); 541 } 542 } 543 544 public boolean getThruTimeHasBeenModified() { 545 return thruTimeHasBeenModified; 546 } 547 548}