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