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