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 * AssociateDetailValue.java 021 */ 022 023package com.echothree.model.data.associate.server.value; 024 025import com.echothree.model.data.associate.common.pk.AssociateDetailPK; 026 027import com.echothree.model.data.associate.server.factory.AssociateDetailFactory; 028 029import com.echothree.model.data.associate.common.pk.AssociatePK; 030import com.echothree.model.data.associate.common.pk.AssociateProgramPK; 031import com.echothree.model.data.party.common.pk.PartyPK; 032import com.echothree.model.data.core.common.pk.MimeTypePK; 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 AssociateDetailValue 045 extends BaseValue<AssociateDetailPK> 046 implements Cloneable, Serializable { 047 048 private AssociatePK associatePK; 049 private boolean associatePKHasBeenModified = false; 050 private AssociateProgramPK associateProgramPK; 051 private boolean associateProgramPKHasBeenModified = false; 052 private String associateName; 053 private boolean associateNameHasBeenModified = false; 054 private PartyPK partyPK; 055 private boolean partyPKHasBeenModified = false; 056 private String description; 057 private boolean descriptionHasBeenModified = false; 058 private MimeTypePK summaryMimeTypePK; 059 private boolean summaryMimeTypePKHasBeenModified = false; 060 private String summary; 061 private boolean summaryHasBeenModified = false; 062 private Long fromTime; 063 private boolean fromTimeHasBeenModified = false; 064 private Long thruTime; 065 private boolean thruTimeHasBeenModified = false; 066 067 private transient Integer _hashCode = null; 068 private transient String _stringValue = null; 069 070 private void constructFields(AssociatePK associatePK, AssociateProgramPK associateProgramPK, String associateName, PartyPK partyPK, String description, MimeTypePK summaryMimeTypePK, String summary, Long fromTime, Long thruTime) 071 throws PersistenceNotNullException { 072 this.associatePK = associatePK; 073 checkForNull(associateProgramPK); 074 this.associateProgramPK = associateProgramPK; 075 checkForNull(associateName); 076 this.associateName = associateName; 077 checkForNull(partyPK); 078 this.partyPK = partyPK; 079 checkForNull(description); 080 this.description = description; 081 checkForNull(summaryMimeTypePK); 082 this.summaryMimeTypePK = summaryMimeTypePK; 083 checkForNull(summary); 084 this.summary = summary; 085 checkForNull(fromTime); 086 this.fromTime = fromTime; 087 checkForNull(thruTime); 088 this.thruTime = thruTime; 089 } 090 091 /** Creates a new instance of AssociateDetailValue */ 092 public AssociateDetailValue(AssociateDetailPK associateDetailPK, AssociatePK associatePK, AssociateProgramPK associateProgramPK, String associateName, PartyPK partyPK, String description, MimeTypePK summaryMimeTypePK, String summary, Long fromTime, Long thruTime) 093 throws PersistenceNotNullException { 094 super(associateDetailPK); 095 constructFields(associatePK, associateProgramPK, associateName, partyPK, description, summaryMimeTypePK, summary, fromTime, thruTime); 096 } 097 098 /** Creates a new instance of AssociateDetailValue */ 099 public AssociateDetailValue(AssociatePK associatePK, AssociateProgramPK associateProgramPK, String associateName, PartyPK partyPK, String description, MimeTypePK summaryMimeTypePK, String summary, Long fromTime, Long thruTime) 100 throws PersistenceNotNullException { 101 super(); 102 constructFields(associatePK, associateProgramPK, associateName, partyPK, description, summaryMimeTypePK, summary, fromTime, thruTime); 103 } 104 105 @Override 106 @Nonnull 107 public AssociateDetailFactory getBaseFactoryInstance() { 108 return AssociateDetailFactory.getInstance(); 109 } 110 111 @Override 112 @Nonnull 113 public AssociateDetailValue clone() { 114 Object result; 115 116 try { 117 result = super.clone(); 118 } catch (CloneNotSupportedException cnse) { 119 // This shouldn't happen, fail when it does. 120 throw new PersistenceCloneException(cnse); 121 } 122 123 return (AssociateDetailValue)result; 124 } 125 126 @Override 127 @Nonnull 128 public AssociateDetailPK getPrimaryKey() { 129 if(_primaryKey == null) { 130 _primaryKey = new AssociateDetailPK(entityId); 131 } 132 133 return _primaryKey; 134 } 135 136 private void clearHashAndString() { 137 _hashCode = null; 138 _stringValue = null; 139 } 140 141 @Override 142 public int hashCode() { 143 if(_hashCode == null) { 144 int hashCode = 17; 145 146 hashCode = 37 * hashCode + ((entityId != null) ? entityId.hashCode() : 0); 147 148 hashCode = 37 * hashCode + ((associatePK != null) ? associatePK.hashCode() : 0); 149 hashCode = 37 * hashCode + ((associateProgramPK != null) ? associateProgramPK.hashCode() : 0); 150 hashCode = 37 * hashCode + ((associateName != null) ? associateName.hashCode() : 0); 151 hashCode = 37 * hashCode + ((partyPK != null) ? partyPK.hashCode() : 0); 152 hashCode = 37 * hashCode + ((description != null) ? description.hashCode() : 0); 153 hashCode = 37 * hashCode + ((summaryMimeTypePK != null) ? summaryMimeTypePK.hashCode() : 0); 154 hashCode = 37 * hashCode + ((summary != null) ? summary.hashCode() : 0); 155 hashCode = 37 * hashCode + ((fromTime != null) ? fromTime.hashCode() : 0); 156 hashCode = 37 * hashCode + ((thruTime != null) ? thruTime.hashCode() : 0); 157 158 _hashCode = hashCode; 159 } 160 161 return _hashCode; 162 } 163 164 @Override 165 @Nonnull 166 public String toString() { 167 if(_stringValue == null) { 168 _stringValue = "{" + 169 "entityId=" + getEntityId() + 170 ", associatePK=" + getAssociatePK() + 171 ", associateProgramPK=" + getAssociateProgramPK() + 172 ", associateName=" + getAssociateName() + 173 ", partyPK=" + getPartyPK() + 174 ", description=" + getDescription() + 175 ", summaryMimeTypePK=" + getSummaryMimeTypePK() + 176 ", summary=" + getSummary() + 177 ", fromTime=" + getFromTime() + 178 ", thruTime=" + getThruTime() + 179 "}"; 180 } 181 return _stringValue; 182 } 183 184 @Override 185 public boolean equals(Object other) { 186 if(this == other) 187 return true; 188 189 if(!hasIdentity()) 190 return false; 191 192 if(other instanceof AssociateDetailValue that) { 193 if(!that.hasIdentity()) 194 return false; 195 196 Long thisEntityId = getEntityId(); 197 Long thatEntityId = that.getEntityId(); 198 199 boolean objectsEqual = thisEntityId.equals(thatEntityId); 200 if(objectsEqual) 201 objectsEqual = isIdentical(that); 202 203 return objectsEqual; 204 } else { 205 return false; 206 } 207 } 208 209 public boolean isIdentical(Object other) { 210 if(other instanceof AssociateDetailValue that) { 211 boolean objectsEqual = true; 212 213 214 if(objectsEqual) { 215 AssociatePK thisAssociatePK = getAssociatePK(); 216 AssociatePK thatAssociatePK = that.getAssociatePK(); 217 218 if(thisAssociatePK == null) { 219 objectsEqual = objectsEqual && (thatAssociatePK == null); 220 } else { 221 objectsEqual = objectsEqual && thisAssociatePK.equals(thatAssociatePK); 222 } 223 } 224 225 if(objectsEqual) { 226 AssociateProgramPK thisAssociateProgramPK = getAssociateProgramPK(); 227 AssociateProgramPK thatAssociateProgramPK = that.getAssociateProgramPK(); 228 229 if(thisAssociateProgramPK == null) { 230 objectsEqual = objectsEqual && (thatAssociateProgramPK == null); 231 } else { 232 objectsEqual = objectsEqual && thisAssociateProgramPK.equals(thatAssociateProgramPK); 233 } 234 } 235 236 if(objectsEqual) { 237 String thisAssociateName = getAssociateName(); 238 String thatAssociateName = that.getAssociateName(); 239 240 if(thisAssociateName == null) { 241 objectsEqual = objectsEqual && (thatAssociateName == null); 242 } else { 243 objectsEqual = objectsEqual && thisAssociateName.equals(thatAssociateName); 244 } 245 } 246 247 if(objectsEqual) { 248 PartyPK thisPartyPK = getPartyPK(); 249 PartyPK thatPartyPK = that.getPartyPK(); 250 251 if(thisPartyPK == null) { 252 objectsEqual = objectsEqual && (thatPartyPK == null); 253 } else { 254 objectsEqual = objectsEqual && thisPartyPK.equals(thatPartyPK); 255 } 256 } 257 258 if(objectsEqual) { 259 String thisDescription = getDescription(); 260 String thatDescription = that.getDescription(); 261 262 if(thisDescription == null) { 263 objectsEqual = objectsEqual && (thatDescription == null); 264 } else { 265 objectsEqual = objectsEqual && thisDescription.equals(thatDescription); 266 } 267 } 268 269 if(objectsEqual) { 270 MimeTypePK thisSummaryMimeTypePK = getSummaryMimeTypePK(); 271 MimeTypePK thatSummaryMimeTypePK = that.getSummaryMimeTypePK(); 272 273 if(thisSummaryMimeTypePK == null) { 274 objectsEqual = objectsEqual && (thatSummaryMimeTypePK == null); 275 } else { 276 objectsEqual = objectsEqual && thisSummaryMimeTypePK.equals(thatSummaryMimeTypePK); 277 } 278 } 279 280 if(objectsEqual) { 281 String thisSummary = getSummary(); 282 String thatSummary = that.getSummary(); 283 284 if(thisSummary == null) { 285 objectsEqual = objectsEqual && (thatSummary == null); 286 } else { 287 objectsEqual = objectsEqual && thisSummary.equals(thatSummary); 288 } 289 } 290 291 if(objectsEqual) { 292 Long thisFromTime = getFromTime(); 293 Long thatFromTime = that.getFromTime(); 294 295 if(thisFromTime == null) { 296 objectsEqual = objectsEqual && (thatFromTime == null); 297 } else { 298 objectsEqual = objectsEqual && thisFromTime.equals(thatFromTime); 299 } 300 } 301 302 if(objectsEqual) { 303 Long thisThruTime = getThruTime(); 304 Long thatThruTime = that.getThruTime(); 305 306 if(thisThruTime == null) { 307 objectsEqual = objectsEqual && (thatThruTime == null); 308 } else { 309 objectsEqual = objectsEqual && thisThruTime.equals(thatThruTime); 310 } 311 } 312 313 return objectsEqual; 314 } else { 315 return false; 316 } 317 } 318 319 @Override 320 public boolean hasBeenModified() { 321 return associatePKHasBeenModified || associateProgramPKHasBeenModified || associateNameHasBeenModified || partyPKHasBeenModified || descriptionHasBeenModified || summaryMimeTypePKHasBeenModified || summaryHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified; 322 } 323 324 @Override 325 public void clearHasBeenModified() { 326 associatePKHasBeenModified = false; 327 associateProgramPKHasBeenModified = false; 328 associateNameHasBeenModified = false; 329 partyPKHasBeenModified = false; 330 descriptionHasBeenModified = false; 331 summaryMimeTypePKHasBeenModified = false; 332 summaryHasBeenModified = false; 333 fromTimeHasBeenModified = false; 334 thruTimeHasBeenModified = false; 335 } 336 337 @Nullable 338 public AssociatePK getAssociatePK() { 339 return associatePK; 340 } 341 342 public void setAssociatePK(@Nullable AssociatePK associatePK) { 343 boolean update = true; 344 345 if(this.associatePK != null) { 346 if(this.associatePK.equals(associatePK)) { 347 update = false; 348 } 349 } else if(associatePK == null) { 350 update = false; 351 } 352 353 if(update) { 354 this.associatePK = associatePK; 355 associatePKHasBeenModified = true; 356 clearHashAndString(); 357 } 358 } 359 360 public boolean getAssociatePKHasBeenModified() { 361 return associatePKHasBeenModified; 362 } 363 364 @Nonnull 365 public AssociateProgramPK getAssociateProgramPK() { 366 return associateProgramPK; 367 } 368 369 public void setAssociateProgramPK(@Nonnull AssociateProgramPK associateProgramPK) 370 throws PersistenceNotNullException { 371 checkForNull(associateProgramPK); 372 373 boolean update = true; 374 375 if(this.associateProgramPK != null) { 376 if(this.associateProgramPK.equals(associateProgramPK)) { 377 update = false; 378 } 379 } else if(associateProgramPK == null) { 380 update = false; 381 } 382 383 if(update) { 384 this.associateProgramPK = associateProgramPK; 385 associateProgramPKHasBeenModified = true; 386 clearHashAndString(); 387 } 388 } 389 390 public boolean getAssociateProgramPKHasBeenModified() { 391 return associateProgramPKHasBeenModified; 392 } 393 394 @Nonnull 395 public String getAssociateName() { 396 return associateName; 397 } 398 399 public void setAssociateName(@Nonnull String associateName) 400 throws PersistenceNotNullException { 401 checkForNull(associateName); 402 403 boolean update = true; 404 405 if(this.associateName != null) { 406 if(this.associateName.equals(associateName)) { 407 update = false; 408 } 409 } else if(associateName == null) { 410 update = false; 411 } 412 413 if(update) { 414 this.associateName = associateName; 415 associateNameHasBeenModified = true; 416 clearHashAndString(); 417 } 418 } 419 420 public boolean getAssociateNameHasBeenModified() { 421 return associateNameHasBeenModified; 422 } 423 424 @Nonnull 425 public PartyPK getPartyPK() { 426 return partyPK; 427 } 428 429 public void setPartyPK(@Nonnull PartyPK partyPK) 430 throws PersistenceNotNullException { 431 checkForNull(partyPK); 432 433 boolean update = true; 434 435 if(this.partyPK != null) { 436 if(this.partyPK.equals(partyPK)) { 437 update = false; 438 } 439 } else if(partyPK == null) { 440 update = false; 441 } 442 443 if(update) { 444 this.partyPK = partyPK; 445 partyPKHasBeenModified = true; 446 clearHashAndString(); 447 } 448 } 449 450 public boolean getPartyPKHasBeenModified() { 451 return partyPKHasBeenModified; 452 } 453 454 @Nonnull 455 public String getDescription() { 456 return description; 457 } 458 459 public void setDescription(@Nonnull String description) 460 throws PersistenceNotNullException { 461 checkForNull(description); 462 463 boolean update = true; 464 465 if(this.description != null) { 466 if(this.description.equals(description)) { 467 update = false; 468 } 469 } else if(description == null) { 470 update = false; 471 } 472 473 if(update) { 474 this.description = description; 475 descriptionHasBeenModified = true; 476 clearHashAndString(); 477 } 478 } 479 480 public boolean getDescriptionHasBeenModified() { 481 return descriptionHasBeenModified; 482 } 483 484 @Nonnull 485 public MimeTypePK getSummaryMimeTypePK() { 486 return summaryMimeTypePK; 487 } 488 489 public void setSummaryMimeTypePK(@Nonnull MimeTypePK summaryMimeTypePK) 490 throws PersistenceNotNullException { 491 checkForNull(summaryMimeTypePK); 492 493 boolean update = true; 494 495 if(this.summaryMimeTypePK != null) { 496 if(this.summaryMimeTypePK.equals(summaryMimeTypePK)) { 497 update = false; 498 } 499 } else if(summaryMimeTypePK == null) { 500 update = false; 501 } 502 503 if(update) { 504 this.summaryMimeTypePK = summaryMimeTypePK; 505 summaryMimeTypePKHasBeenModified = true; 506 clearHashAndString(); 507 } 508 } 509 510 public boolean getSummaryMimeTypePKHasBeenModified() { 511 return summaryMimeTypePKHasBeenModified; 512 } 513 514 @Nonnull 515 public String getSummary() { 516 return summary; 517 } 518 519 public void setSummary(@Nonnull String summary) 520 throws PersistenceNotNullException { 521 checkForNull(summary); 522 523 boolean update = true; 524 525 if(this.summary != null) { 526 if(this.summary.equals(summary)) { 527 update = false; 528 } 529 } else if(summary == null) { 530 update = false; 531 } 532 533 if(update) { 534 this.summary = summary; 535 summaryHasBeenModified = true; 536 clearHashAndString(); 537 } 538 } 539 540 public boolean getSummaryHasBeenModified() { 541 return summaryHasBeenModified; 542 } 543 544 @Nonnull 545 public Long getFromTime() { 546 return fromTime; 547 } 548 549 public void setFromTime(@Nonnull Long fromTime) 550 throws PersistenceNotNullException { 551 checkForNull(fromTime); 552 553 boolean update = true; 554 555 if(this.fromTime != null) { 556 if(this.fromTime.equals(fromTime)) { 557 update = false; 558 } 559 } else if(fromTime == null) { 560 update = false; 561 } 562 563 if(update) { 564 this.fromTime = fromTime; 565 fromTimeHasBeenModified = true; 566 clearHashAndString(); 567 } 568 } 569 570 public boolean getFromTimeHasBeenModified() { 571 return fromTimeHasBeenModified; 572 } 573 574 @Nonnull 575 public Long getThruTime() { 576 return thruTime; 577 } 578 579 public void setThruTime(@Nonnull Long thruTime) 580 throws PersistenceNotNullException { 581 checkForNull(thruTime); 582 583 boolean update = true; 584 585 if(this.thruTime != null) { 586 if(this.thruTime.equals(thruTime)) { 587 update = false; 588 } 589 } else if(thruTime == null) { 590 update = false; 591 } 592 593 if(update) { 594 this.thruTime = thruTime; 595 thruTimeHasBeenModified = true; 596 clearHashAndString(); 597 } 598 } 599 600 public boolean getThruTimeHasBeenModified() { 601 return thruTimeHasBeenModified; 602 } 603 604}