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