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 * 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 StringBuilder stringValue = new StringBuilder("{"); 162 163 stringValue.append("entityId=").append(getEntityId()); 164 165 stringValue.append(", associatePK=").append(getAssociatePK()); 166 stringValue.append(", associateProgramPK=").append(getAssociateProgramPK()); 167 stringValue.append(", associateName=").append(getAssociateName()); 168 stringValue.append(", partyPK=").append(getPartyPK()); 169 stringValue.append(", description=").append(getDescription()); 170 stringValue.append(", summaryMimeTypePK=").append(getSummaryMimeTypePK()); 171 stringValue.append(", summary=").append(getSummary()); 172 stringValue.append(", fromTime=").append(getFromTime()); 173 stringValue.append(", thruTime=").append(getThruTime()); 174 175 stringValue.append('}'); 176 177 _stringValue = stringValue.toString(); 178 } 179 return _stringValue; 180 } 181 182 @Override 183 public boolean equals(Object other) { 184 if(this == other) 185 return true; 186 187 if(!hasIdentity()) 188 return false; 189 190 if(other instanceof AssociateDetailValue) { 191 AssociateDetailValue that = (AssociateDetailValue)other; 192 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 = 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) { 211 AssociateDetailValue that = (AssociateDetailValue)other; 212 boolean objectsEqual = true; 213 214 215 if(objectsEqual) { 216 AssociatePK thisAssociatePK = getAssociatePK(); 217 AssociatePK thatAssociatePK = that.getAssociatePK(); 218 219 if(thisAssociatePK == null) { 220 objectsEqual = objectsEqual && (thatAssociatePK == null); 221 } else { 222 objectsEqual = objectsEqual && thisAssociatePK.equals(thatAssociatePK); 223 } 224 } 225 226 if(objectsEqual) { 227 AssociateProgramPK thisAssociateProgramPK = getAssociateProgramPK(); 228 AssociateProgramPK thatAssociateProgramPK = that.getAssociateProgramPK(); 229 230 if(thisAssociateProgramPK == null) { 231 objectsEqual = objectsEqual && (thatAssociateProgramPK == null); 232 } else { 233 objectsEqual = objectsEqual && thisAssociateProgramPK.equals(thatAssociateProgramPK); 234 } 235 } 236 237 if(objectsEqual) { 238 String thisAssociateName = getAssociateName(); 239 String thatAssociateName = that.getAssociateName(); 240 241 if(thisAssociateName == null) { 242 objectsEqual = objectsEqual && (thatAssociateName == null); 243 } else { 244 objectsEqual = objectsEqual && thisAssociateName.equals(thatAssociateName); 245 } 246 } 247 248 if(objectsEqual) { 249 PartyPK thisPartyPK = getPartyPK(); 250 PartyPK thatPartyPK = that.getPartyPK(); 251 252 if(thisPartyPK == null) { 253 objectsEqual = objectsEqual && (thatPartyPK == null); 254 } else { 255 objectsEqual = objectsEqual && thisPartyPK.equals(thatPartyPK); 256 } 257 } 258 259 if(objectsEqual) { 260 String thisDescription = getDescription(); 261 String thatDescription = that.getDescription(); 262 263 if(thisDescription == null) { 264 objectsEqual = objectsEqual && (thatDescription == null); 265 } else { 266 objectsEqual = objectsEqual && thisDescription.equals(thatDescription); 267 } 268 } 269 270 if(objectsEqual) { 271 MimeTypePK thisSummaryMimeTypePK = getSummaryMimeTypePK(); 272 MimeTypePK thatSummaryMimeTypePK = that.getSummaryMimeTypePK(); 273 274 if(thisSummaryMimeTypePK == null) { 275 objectsEqual = objectsEqual && (thatSummaryMimeTypePK == null); 276 } else { 277 objectsEqual = objectsEqual && thisSummaryMimeTypePK.equals(thatSummaryMimeTypePK); 278 } 279 } 280 281 if(objectsEqual) { 282 String thisSummary = getSummary(); 283 String thatSummary = that.getSummary(); 284 285 if(thisSummary == null) { 286 objectsEqual = objectsEqual && (thatSummary == null); 287 } else { 288 objectsEqual = objectsEqual && thisSummary.equals(thatSummary); 289 } 290 } 291 292 if(objectsEqual) { 293 Long thisFromTime = getFromTime(); 294 Long thatFromTime = that.getFromTime(); 295 296 if(thisFromTime == null) { 297 objectsEqual = objectsEqual && (thatFromTime == null); 298 } else { 299 objectsEqual = objectsEqual && thisFromTime.equals(thatFromTime); 300 } 301 } 302 303 if(objectsEqual) { 304 Long thisThruTime = getThruTime(); 305 Long thatThruTime = that.getThruTime(); 306 307 if(thisThruTime == null) { 308 objectsEqual = objectsEqual && (thatThruTime == null); 309 } else { 310 objectsEqual = objectsEqual && thisThruTime.equals(thatThruTime); 311 } 312 } 313 314 return objectsEqual; 315 } else { 316 return false; 317 } 318 } 319 320 @Override 321 public boolean hasBeenModified() { 322 return associatePKHasBeenModified || associateProgramPKHasBeenModified || associateNameHasBeenModified || partyPKHasBeenModified || descriptionHasBeenModified || summaryMimeTypePKHasBeenModified || summaryHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified; 323 } 324 325 @Override 326 public void clearHasBeenModified() { 327 associatePKHasBeenModified = false; 328 associateProgramPKHasBeenModified = false; 329 associateNameHasBeenModified = false; 330 partyPKHasBeenModified = false; 331 descriptionHasBeenModified = false; 332 summaryMimeTypePKHasBeenModified = false; 333 summaryHasBeenModified = false; 334 fromTimeHasBeenModified = false; 335 thruTimeHasBeenModified = false; 336 } 337 338 public AssociatePK getAssociatePK() { 339 return associatePK; 340 } 341 342 public void setAssociatePK(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 public AssociateProgramPK getAssociateProgramPK() { 365 return associateProgramPK; 366 } 367 368 public void setAssociateProgramPK(AssociateProgramPK associateProgramPK) 369 throws PersistenceNotNullException { 370 checkForNull(associateProgramPK); 371 372 boolean update = true; 373 374 if(this.associateProgramPK != null) { 375 if(this.associateProgramPK.equals(associateProgramPK)) { 376 update = false; 377 } 378 } else if(associateProgramPK == null) { 379 update = false; 380 } 381 382 if(update) { 383 this.associateProgramPK = associateProgramPK; 384 associateProgramPKHasBeenModified = true; 385 clearHashAndString(); 386 } 387 } 388 389 public boolean getAssociateProgramPKHasBeenModified() { 390 return associateProgramPKHasBeenModified; 391 } 392 393 public String getAssociateName() { 394 return associateName; 395 } 396 397 public void setAssociateName(String associateName) 398 throws PersistenceNotNullException { 399 checkForNull(associateName); 400 401 boolean update = true; 402 403 if(this.associateName != null) { 404 if(this.associateName.equals(associateName)) { 405 update = false; 406 } 407 } else if(associateName == null) { 408 update = false; 409 } 410 411 if(update) { 412 this.associateName = associateName; 413 associateNameHasBeenModified = true; 414 clearHashAndString(); 415 } 416 } 417 418 public boolean getAssociateNameHasBeenModified() { 419 return associateNameHasBeenModified; 420 } 421 422 public PartyPK getPartyPK() { 423 return partyPK; 424 } 425 426 public void setPartyPK(PartyPK partyPK) 427 throws PersistenceNotNullException { 428 checkForNull(partyPK); 429 430 boolean update = true; 431 432 if(this.partyPK != null) { 433 if(this.partyPK.equals(partyPK)) { 434 update = false; 435 } 436 } else if(partyPK == null) { 437 update = false; 438 } 439 440 if(update) { 441 this.partyPK = partyPK; 442 partyPKHasBeenModified = true; 443 clearHashAndString(); 444 } 445 } 446 447 public boolean getPartyPKHasBeenModified() { 448 return partyPKHasBeenModified; 449 } 450 451 public String getDescription() { 452 return description; 453 } 454 455 public void setDescription(String description) 456 throws PersistenceNotNullException { 457 checkForNull(description); 458 459 boolean update = true; 460 461 if(this.description != null) { 462 if(this.description.equals(description)) { 463 update = false; 464 } 465 } else if(description == null) { 466 update = false; 467 } 468 469 if(update) { 470 this.description = description; 471 descriptionHasBeenModified = true; 472 clearHashAndString(); 473 } 474 } 475 476 public boolean getDescriptionHasBeenModified() { 477 return descriptionHasBeenModified; 478 } 479 480 public MimeTypePK getSummaryMimeTypePK() { 481 return summaryMimeTypePK; 482 } 483 484 public void setSummaryMimeTypePK(MimeTypePK summaryMimeTypePK) 485 throws PersistenceNotNullException { 486 checkForNull(summaryMimeTypePK); 487 488 boolean update = true; 489 490 if(this.summaryMimeTypePK != null) { 491 if(this.summaryMimeTypePK.equals(summaryMimeTypePK)) { 492 update = false; 493 } 494 } else if(summaryMimeTypePK == null) { 495 update = false; 496 } 497 498 if(update) { 499 this.summaryMimeTypePK = summaryMimeTypePK; 500 summaryMimeTypePKHasBeenModified = true; 501 clearHashAndString(); 502 } 503 } 504 505 public boolean getSummaryMimeTypePKHasBeenModified() { 506 return summaryMimeTypePKHasBeenModified; 507 } 508 509 public String getSummary() { 510 return summary; 511 } 512 513 public void setSummary(String summary) 514 throws PersistenceNotNullException { 515 checkForNull(summary); 516 517 boolean update = true; 518 519 if(this.summary != null) { 520 if(this.summary.equals(summary)) { 521 update = false; 522 } 523 } else if(summary == null) { 524 update = false; 525 } 526 527 if(update) { 528 this.summary = summary; 529 summaryHasBeenModified = true; 530 clearHashAndString(); 531 } 532 } 533 534 public boolean getSummaryHasBeenModified() { 535 return summaryHasBeenModified; 536 } 537 538 public Long getFromTime() { 539 return fromTime; 540 } 541 542 public void setFromTime(Long fromTime) 543 throws PersistenceNotNullException { 544 checkForNull(fromTime); 545 546 boolean update = true; 547 548 if(this.fromTime != null) { 549 if(this.fromTime.equals(fromTime)) { 550 update = false; 551 } 552 } else if(fromTime == null) { 553 update = false; 554 } 555 556 if(update) { 557 this.fromTime = fromTime; 558 fromTimeHasBeenModified = true; 559 clearHashAndString(); 560 } 561 } 562 563 public boolean getFromTimeHasBeenModified() { 564 return fromTimeHasBeenModified; 565 } 566 567 public Long getThruTime() { 568 return thruTime; 569 } 570 571 public void setThruTime(Long thruTime) 572 throws PersistenceNotNullException { 573 checkForNull(thruTime); 574 575 boolean update = true; 576 577 if(this.thruTime != null) { 578 if(this.thruTime.equals(thruTime)) { 579 update = false; 580 } 581 } else if(thruTime == null) { 582 update = false; 583 } 584 585 if(update) { 586 this.thruTime = thruTime; 587 thruTimeHasBeenModified = true; 588 clearHashAndString(); 589 } 590 } 591 592 public boolean getThruTimeHasBeenModified() { 593 return thruTimeHasBeenModified; 594 } 595 596}