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