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