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 * ForumThreadDetailValue.java 021 */ 022 023package com.echothree.model.data.forum.server.value; 024 025import com.echothree.model.data.forum.common.pk.ForumThreadDetailPK; 026 027import com.echothree.model.data.forum.server.factory.ForumThreadDetailFactory; 028 029import com.echothree.model.data.forum.common.pk.ForumThreadPK; 030import com.echothree.model.data.icon.common.pk.IconPK; 031 032import com.echothree.util.common.exception.PersistenceCloneException; 033import com.echothree.util.common.exception.PersistenceNotNullException; 034 035import com.echothree.util.server.persistence.BaseValue; 036 037import java.io.Serializable; 038 039import javax.annotation.Nonnull; 040import javax.annotation.Nullable; 041 042public class ForumThreadDetailValue 043 extends BaseValue<ForumThreadDetailPK> 044 implements Cloneable, Serializable { 045 046 private ForumThreadPK forumThreadPK; 047 private boolean forumThreadPKHasBeenModified = false; 048 private String forumThreadName; 049 private boolean forumThreadNameHasBeenModified = false; 050 private IconPK iconPK; 051 private boolean iconPKHasBeenModified = false; 052 private Long postedTime; 053 private boolean postedTimeHasBeenModified = false; 054 private Integer sortOrder; 055 private boolean sortOrderHasBeenModified = false; 056 private Long fromTime; 057 private boolean fromTimeHasBeenModified = false; 058 private Long thruTime; 059 private boolean thruTimeHasBeenModified = false; 060 061 private transient Integer _hashCode = null; 062 private transient String _stringValue = null; 063 064 private void constructFields(ForumThreadPK forumThreadPK, String forumThreadName, IconPK iconPK, Long postedTime, Integer sortOrder, Long fromTime, Long thruTime) 065 throws PersistenceNotNullException { 066 checkForNull(forumThreadPK); 067 this.forumThreadPK = forumThreadPK; 068 checkForNull(forumThreadName); 069 this.forumThreadName = forumThreadName; 070 this.iconPK = iconPK; 071 checkForNull(postedTime); 072 this.postedTime = postedTime; 073 checkForNull(sortOrder); 074 this.sortOrder = sortOrder; 075 checkForNull(fromTime); 076 this.fromTime = fromTime; 077 checkForNull(thruTime); 078 this.thruTime = thruTime; 079 } 080 081 /** Creates a new instance of ForumThreadDetailValue */ 082 public ForumThreadDetailValue(ForumThreadDetailPK forumThreadDetailPK, ForumThreadPK forumThreadPK, String forumThreadName, IconPK iconPK, Long postedTime, Integer sortOrder, Long fromTime, Long thruTime) 083 throws PersistenceNotNullException { 084 super(forumThreadDetailPK); 085 constructFields(forumThreadPK, forumThreadName, iconPK, postedTime, sortOrder, fromTime, thruTime); 086 } 087 088 /** Creates a new instance of ForumThreadDetailValue */ 089 public ForumThreadDetailValue(ForumThreadPK forumThreadPK, String forumThreadName, IconPK iconPK, Long postedTime, Integer sortOrder, Long fromTime, Long thruTime) 090 throws PersistenceNotNullException { 091 super(); 092 constructFields(forumThreadPK, forumThreadName, iconPK, postedTime, sortOrder, fromTime, thruTime); 093 } 094 095 @Override 096 @Nonnull 097 public ForumThreadDetailFactory getBaseFactoryInstance() { 098 return ForumThreadDetailFactory.getInstance(); 099 } 100 101 @Override 102 @Nonnull 103 public ForumThreadDetailValue clone() { 104 Object result; 105 106 try { 107 result = super.clone(); 108 } catch (CloneNotSupportedException cnse) { 109 // This shouldn't happen, fail when it does. 110 throw new PersistenceCloneException(cnse); 111 } 112 113 return (ForumThreadDetailValue)result; 114 } 115 116 @Override 117 @Nonnull 118 public ForumThreadDetailPK getPrimaryKey() { 119 if(_primaryKey == null) { 120 _primaryKey = new ForumThreadDetailPK(entityId); 121 } 122 123 return _primaryKey; 124 } 125 126 private void clearHashAndString() { 127 _hashCode = null; 128 _stringValue = null; 129 } 130 131 @Override 132 public int hashCode() { 133 if(_hashCode == null) { 134 int hashCode = 17; 135 136 hashCode = 37 * hashCode + ((entityId != null) ? entityId.hashCode() : 0); 137 138 hashCode = 37 * hashCode + ((forumThreadPK != null) ? forumThreadPK.hashCode() : 0); 139 hashCode = 37 * hashCode + ((forumThreadName != null) ? forumThreadName.hashCode() : 0); 140 hashCode = 37 * hashCode + ((iconPK != null) ? iconPK.hashCode() : 0); 141 hashCode = 37 * hashCode + ((postedTime != null) ? postedTime.hashCode() : 0); 142 hashCode = 37 * hashCode + ((sortOrder != null) ? sortOrder.hashCode() : 0); 143 hashCode = 37 * hashCode + ((fromTime != null) ? fromTime.hashCode() : 0); 144 hashCode = 37 * hashCode + ((thruTime != null) ? thruTime.hashCode() : 0); 145 146 _hashCode = hashCode; 147 } 148 149 return _hashCode; 150 } 151 152 @Override 153 @Nonnull 154 public String toString() { 155 if(_stringValue == null) { 156 _stringValue = "{" + 157 "entityId=" + getEntityId() + 158 ", forumThreadPK=" + getForumThreadPK() + 159 ", forumThreadName=" + getForumThreadName() + 160 ", iconPK=" + getIconPK() + 161 ", postedTime=" + getPostedTime() + 162 ", sortOrder=" + getSortOrder() + 163 ", fromTime=" + getFromTime() + 164 ", thruTime=" + getThruTime() + 165 "}"; 166 } 167 return _stringValue; 168 } 169 170 @Override 171 public boolean equals(Object other) { 172 if(this == other) 173 return true; 174 175 if(!hasIdentity()) 176 return false; 177 178 if(other instanceof ForumThreadDetailValue that) { 179 if(!that.hasIdentity()) 180 return false; 181 182 Long thisEntityId = getEntityId(); 183 Long thatEntityId = that.getEntityId(); 184 185 boolean objectsEqual = thisEntityId.equals(thatEntityId); 186 if(objectsEqual) 187 objectsEqual = isIdentical(that); 188 189 return objectsEqual; 190 } else { 191 return false; 192 } 193 } 194 195 public boolean isIdentical(Object other) { 196 if(other instanceof ForumThreadDetailValue that) { 197 boolean objectsEqual = true; 198 199 200 if(objectsEqual) { 201 ForumThreadPK thisForumThreadPK = getForumThreadPK(); 202 ForumThreadPK thatForumThreadPK = that.getForumThreadPK(); 203 204 if(thisForumThreadPK == null) { 205 objectsEqual = objectsEqual && (thatForumThreadPK == null); 206 } else { 207 objectsEqual = objectsEqual && thisForumThreadPK.equals(thatForumThreadPK); 208 } 209 } 210 211 if(objectsEqual) { 212 String thisForumThreadName = getForumThreadName(); 213 String thatForumThreadName = that.getForumThreadName(); 214 215 if(thisForumThreadName == null) { 216 objectsEqual = objectsEqual && (thatForumThreadName == null); 217 } else { 218 objectsEqual = objectsEqual && thisForumThreadName.equals(thatForumThreadName); 219 } 220 } 221 222 if(objectsEqual) { 223 IconPK thisIconPK = getIconPK(); 224 IconPK thatIconPK = that.getIconPK(); 225 226 if(thisIconPK == null) { 227 objectsEqual = objectsEqual && (thatIconPK == null); 228 } else { 229 objectsEqual = objectsEqual && thisIconPK.equals(thatIconPK); 230 } 231 } 232 233 if(objectsEqual) { 234 Long thisPostedTime = getPostedTime(); 235 Long thatPostedTime = that.getPostedTime(); 236 237 if(thisPostedTime == null) { 238 objectsEqual = objectsEqual && (thatPostedTime == null); 239 } else { 240 objectsEqual = objectsEqual && thisPostedTime.equals(thatPostedTime); 241 } 242 } 243 244 if(objectsEqual) { 245 Integer thisSortOrder = getSortOrder(); 246 Integer thatSortOrder = that.getSortOrder(); 247 248 if(thisSortOrder == null) { 249 objectsEqual = objectsEqual && (thatSortOrder == null); 250 } else { 251 objectsEqual = objectsEqual && thisSortOrder.equals(thatSortOrder); 252 } 253 } 254 255 if(objectsEqual) { 256 Long thisFromTime = getFromTime(); 257 Long thatFromTime = that.getFromTime(); 258 259 if(thisFromTime == null) { 260 objectsEqual = objectsEqual && (thatFromTime == null); 261 } else { 262 objectsEqual = objectsEqual && thisFromTime.equals(thatFromTime); 263 } 264 } 265 266 if(objectsEqual) { 267 Long thisThruTime = getThruTime(); 268 Long thatThruTime = that.getThruTime(); 269 270 if(thisThruTime == null) { 271 objectsEqual = objectsEqual && (thatThruTime == null); 272 } else { 273 objectsEqual = objectsEqual && thisThruTime.equals(thatThruTime); 274 } 275 } 276 277 return objectsEqual; 278 } else { 279 return false; 280 } 281 } 282 283 @Override 284 public boolean hasBeenModified() { 285 return forumThreadPKHasBeenModified || forumThreadNameHasBeenModified || iconPKHasBeenModified || postedTimeHasBeenModified || sortOrderHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified; 286 } 287 288 @Override 289 public void clearHasBeenModified() { 290 forumThreadPKHasBeenModified = false; 291 forumThreadNameHasBeenModified = false; 292 iconPKHasBeenModified = false; 293 postedTimeHasBeenModified = false; 294 sortOrderHasBeenModified = false; 295 fromTimeHasBeenModified = false; 296 thruTimeHasBeenModified = false; 297 } 298 299 @Nonnull 300 public ForumThreadPK getForumThreadPK() { 301 return forumThreadPK; 302 } 303 304 public void setForumThreadPK(@Nonnull ForumThreadPK forumThreadPK) 305 throws PersistenceNotNullException { 306 checkForNull(forumThreadPK); 307 308 boolean update = true; 309 310 if(this.forumThreadPK != null) { 311 if(this.forumThreadPK.equals(forumThreadPK)) { 312 update = false; 313 } 314 } else if(forumThreadPK == null) { 315 update = false; 316 } 317 318 if(update) { 319 this.forumThreadPK = forumThreadPK; 320 forumThreadPKHasBeenModified = true; 321 clearHashAndString(); 322 } 323 } 324 325 public boolean getForumThreadPKHasBeenModified() { 326 return forumThreadPKHasBeenModified; 327 } 328 329 @Nonnull 330 public String getForumThreadName() { 331 return forumThreadName; 332 } 333 334 public void setForumThreadName(@Nonnull String forumThreadName) 335 throws PersistenceNotNullException { 336 checkForNull(forumThreadName); 337 338 boolean update = true; 339 340 if(this.forumThreadName != null) { 341 if(this.forumThreadName.equals(forumThreadName)) { 342 update = false; 343 } 344 } else if(forumThreadName == null) { 345 update = false; 346 } 347 348 if(update) { 349 this.forumThreadName = forumThreadName; 350 forumThreadNameHasBeenModified = true; 351 clearHashAndString(); 352 } 353 } 354 355 public boolean getForumThreadNameHasBeenModified() { 356 return forumThreadNameHasBeenModified; 357 } 358 359 @Nullable 360 public IconPK getIconPK() { 361 return iconPK; 362 } 363 364 public void setIconPK(@Nullable IconPK iconPK) { 365 boolean update = true; 366 367 if(this.iconPK != null) { 368 if(this.iconPK.equals(iconPK)) { 369 update = false; 370 } 371 } else if(iconPK == null) { 372 update = false; 373 } 374 375 if(update) { 376 this.iconPK = iconPK; 377 iconPKHasBeenModified = true; 378 clearHashAndString(); 379 } 380 } 381 382 public boolean getIconPKHasBeenModified() { 383 return iconPKHasBeenModified; 384 } 385 386 @Nonnull 387 public Long getPostedTime() { 388 return postedTime; 389 } 390 391 public void setPostedTime(@Nonnull Long postedTime) 392 throws PersistenceNotNullException { 393 checkForNull(postedTime); 394 395 boolean update = true; 396 397 if(this.postedTime != null) { 398 if(this.postedTime.equals(postedTime)) { 399 update = false; 400 } 401 } else if(postedTime == null) { 402 update = false; 403 } 404 405 if(update) { 406 this.postedTime = postedTime; 407 postedTimeHasBeenModified = true; 408 clearHashAndString(); 409 } 410 } 411 412 public boolean getPostedTimeHasBeenModified() { 413 return postedTimeHasBeenModified; 414 } 415 416 @Nonnull 417 public Integer getSortOrder() { 418 return sortOrder; 419 } 420 421 public void setSortOrder(@Nonnull Integer sortOrder) 422 throws PersistenceNotNullException { 423 checkForNull(sortOrder); 424 425 boolean update = true; 426 427 if(this.sortOrder != null) { 428 if(this.sortOrder.equals(sortOrder)) { 429 update = false; 430 } 431 } else if(sortOrder == null) { 432 update = false; 433 } 434 435 if(update) { 436 this.sortOrder = sortOrder; 437 sortOrderHasBeenModified = true; 438 clearHashAndString(); 439 } 440 } 441 442 public boolean getSortOrderHasBeenModified() { 443 return sortOrderHasBeenModified; 444 } 445 446 @Nonnull 447 public Long getFromTime() { 448 return fromTime; 449 } 450 451 public void setFromTime(@Nonnull Long fromTime) 452 throws PersistenceNotNullException { 453 checkForNull(fromTime); 454 455 boolean update = true; 456 457 if(this.fromTime != null) { 458 if(this.fromTime.equals(fromTime)) { 459 update = false; 460 } 461 } else if(fromTime == null) { 462 update = false; 463 } 464 465 if(update) { 466 this.fromTime = fromTime; 467 fromTimeHasBeenModified = true; 468 clearHashAndString(); 469 } 470 } 471 472 public boolean getFromTimeHasBeenModified() { 473 return fromTimeHasBeenModified; 474 } 475 476 @Nonnull 477 public Long getThruTime() { 478 return thruTime; 479 } 480 481 public void setThruTime(@Nonnull Long thruTime) 482 throws PersistenceNotNullException { 483 checkForNull(thruTime); 484 485 boolean update = true; 486 487 if(this.thruTime != null) { 488 if(this.thruTime.equals(thruTime)) { 489 update = false; 490 } 491 } else if(thruTime == null) { 492 update = false; 493 } 494 495 if(update) { 496 this.thruTime = thruTime; 497 thruTimeHasBeenModified = true; 498 clearHashAndString(); 499 } 500 } 501 502 public boolean getThruTimeHasBeenModified() { 503 return thruTimeHasBeenModified; 504 } 505 506}