001// -------------------------------------------------------------------------------- 002// Copyright 2002-2024 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 StringBuilder stringValue = new StringBuilder("{"); 161 162 stringValue.append("entityId=").append(getEntityId()); 163 164 stringValue.append(", forumMessagePK=").append(getForumMessagePK()); 165 stringValue.append(", forumMessageName=").append(getForumMessageName()); 166 stringValue.append(", forumThreadPK=").append(getForumThreadPK()); 167 stringValue.append(", forumMessageTypePK=").append(getForumMessageTypePK()); 168 stringValue.append(", parentForumMessagePK=").append(getParentForumMessagePK()); 169 stringValue.append(", iconPK=").append(getIconPK()); 170 stringValue.append(", postedTime=").append(getPostedTime()); 171 stringValue.append(", fromTime=").append(getFromTime()); 172 stringValue.append(", thruTime=").append(getThruTime()); 173 174 stringValue.append('}'); 175 176 _stringValue = stringValue.toString(); 177 } 178 return _stringValue; 179 } 180 181 @Override 182 public boolean equals(Object other) { 183 if(this == other) 184 return true; 185 186 if(!hasIdentity()) 187 return false; 188 189 if(other instanceof ForumMessageDetailValue) { 190 ForumMessageDetailValue that = (ForumMessageDetailValue)other; 191 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 = 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) { 210 ForumMessageDetailValue that = (ForumMessageDetailValue)other; 211 boolean objectsEqual = true; 212 213 214 if(objectsEqual) { 215 ForumMessagePK thisForumMessagePK = getForumMessagePK(); 216 ForumMessagePK thatForumMessagePK = that.getForumMessagePK(); 217 218 if(thisForumMessagePK == null) { 219 objectsEqual = objectsEqual && (thatForumMessagePK == null); 220 } else { 221 objectsEqual = objectsEqual && thisForumMessagePK.equals(thatForumMessagePK); 222 } 223 } 224 225 if(objectsEqual) { 226 String thisForumMessageName = getForumMessageName(); 227 String thatForumMessageName = that.getForumMessageName(); 228 229 if(thisForumMessageName == null) { 230 objectsEqual = objectsEqual && (thatForumMessageName == null); 231 } else { 232 objectsEqual = objectsEqual && thisForumMessageName.equals(thatForumMessageName); 233 } 234 } 235 236 if(objectsEqual) { 237 ForumThreadPK thisForumThreadPK = getForumThreadPK(); 238 ForumThreadPK thatForumThreadPK = that.getForumThreadPK(); 239 240 if(thisForumThreadPK == null) { 241 objectsEqual = objectsEqual && (thatForumThreadPK == null); 242 } else { 243 objectsEqual = objectsEqual && thisForumThreadPK.equals(thatForumThreadPK); 244 } 245 } 246 247 if(objectsEqual) { 248 ForumMessageTypePK thisForumMessageTypePK = getForumMessageTypePK(); 249 ForumMessageTypePK thatForumMessageTypePK = that.getForumMessageTypePK(); 250 251 if(thisForumMessageTypePK == null) { 252 objectsEqual = objectsEqual && (thatForumMessageTypePK == null); 253 } else { 254 objectsEqual = objectsEqual && thisForumMessageTypePK.equals(thatForumMessageTypePK); 255 } 256 } 257 258 if(objectsEqual) { 259 ForumMessagePK thisParentForumMessagePK = getParentForumMessagePK(); 260 ForumMessagePK thatParentForumMessagePK = that.getParentForumMessagePK(); 261 262 if(thisParentForumMessagePK == null) { 263 objectsEqual = objectsEqual && (thatParentForumMessagePK == null); 264 } else { 265 objectsEqual = objectsEqual && thisParentForumMessagePK.equals(thatParentForumMessagePK); 266 } 267 } 268 269 if(objectsEqual) { 270 IconPK thisIconPK = getIconPK(); 271 IconPK thatIconPK = that.getIconPK(); 272 273 if(thisIconPK == null) { 274 objectsEqual = objectsEqual && (thatIconPK == null); 275 } else { 276 objectsEqual = objectsEqual && thisIconPK.equals(thatIconPK); 277 } 278 } 279 280 if(objectsEqual) { 281 Long thisPostedTime = getPostedTime(); 282 Long thatPostedTime = that.getPostedTime(); 283 284 if(thisPostedTime == null) { 285 objectsEqual = objectsEqual && (thatPostedTime == null); 286 } else { 287 objectsEqual = objectsEqual && thisPostedTime.equals(thatPostedTime); 288 } 289 } 290 291 if(objectsEqual) { 292 Long thisFromTime = getFromTime(); 293 Long thatFromTime = that.getFromTime(); 294 295 if(thisFromTime == null) { 296 objectsEqual = objectsEqual && (thatFromTime == null); 297 } else { 298 objectsEqual = objectsEqual && thisFromTime.equals(thatFromTime); 299 } 300 } 301 302 if(objectsEqual) { 303 Long thisThruTime = getThruTime(); 304 Long thatThruTime = that.getThruTime(); 305 306 if(thisThruTime == null) { 307 objectsEqual = objectsEqual && (thatThruTime == null); 308 } else { 309 objectsEqual = objectsEqual && thisThruTime.equals(thatThruTime); 310 } 311 } 312 313 return objectsEqual; 314 } else { 315 return false; 316 } 317 } 318 319 @Override 320 public boolean hasBeenModified() { 321 return forumMessagePKHasBeenModified || forumMessageNameHasBeenModified || forumThreadPKHasBeenModified || forumMessageTypePKHasBeenModified || parentForumMessagePKHasBeenModified || iconPKHasBeenModified || postedTimeHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified; 322 } 323 324 @Override 325 public void clearHasBeenModified() { 326 forumMessagePKHasBeenModified = false; 327 forumMessageNameHasBeenModified = false; 328 forumThreadPKHasBeenModified = false; 329 forumMessageTypePKHasBeenModified = false; 330 parentForumMessagePKHasBeenModified = false; 331 iconPKHasBeenModified = false; 332 postedTimeHasBeenModified = false; 333 fromTimeHasBeenModified = false; 334 thruTimeHasBeenModified = false; 335 } 336 337 public ForumMessagePK getForumMessagePK() { 338 return forumMessagePK; 339 } 340 341 public void setForumMessagePK(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 public String getForumMessageName() { 367 return forumMessageName; 368 } 369 370 public void setForumMessageName(String forumMessageName) 371 throws PersistenceNotNullException { 372 checkForNull(forumMessageName); 373 374 boolean update = true; 375 376 if(this.forumMessageName != null) { 377 if(this.forumMessageName.equals(forumMessageName)) { 378 update = false; 379 } 380 } else if(forumMessageName == null) { 381 update = false; 382 } 383 384 if(update) { 385 this.forumMessageName = forumMessageName; 386 forumMessageNameHasBeenModified = true; 387 clearHashAndString(); 388 } 389 } 390 391 public boolean getForumMessageNameHasBeenModified() { 392 return forumMessageNameHasBeenModified; 393 } 394 395 public ForumThreadPK getForumThreadPK() { 396 return forumThreadPK; 397 } 398 399 public void setForumThreadPK(ForumThreadPK forumThreadPK) 400 throws PersistenceNotNullException { 401 checkForNull(forumThreadPK); 402 403 boolean update = true; 404 405 if(this.forumThreadPK != null) { 406 if(this.forumThreadPK.equals(forumThreadPK)) { 407 update = false; 408 } 409 } else if(forumThreadPK == null) { 410 update = false; 411 } 412 413 if(update) { 414 this.forumThreadPK = forumThreadPK; 415 forumThreadPKHasBeenModified = true; 416 clearHashAndString(); 417 } 418 } 419 420 public boolean getForumThreadPKHasBeenModified() { 421 return forumThreadPKHasBeenModified; 422 } 423 424 public ForumMessageTypePK getForumMessageTypePK() { 425 return forumMessageTypePK; 426 } 427 428 public void setForumMessageTypePK(ForumMessageTypePK forumMessageTypePK) 429 throws PersistenceNotNullException { 430 checkForNull(forumMessageTypePK); 431 432 boolean update = true; 433 434 if(this.forumMessageTypePK != null) { 435 if(this.forumMessageTypePK.equals(forumMessageTypePK)) { 436 update = false; 437 } 438 } else if(forumMessageTypePK == null) { 439 update = false; 440 } 441 442 if(update) { 443 this.forumMessageTypePK = forumMessageTypePK; 444 forumMessageTypePKHasBeenModified = true; 445 clearHashAndString(); 446 } 447 } 448 449 public boolean getForumMessageTypePKHasBeenModified() { 450 return forumMessageTypePKHasBeenModified; 451 } 452 453 public ForumMessagePK getParentForumMessagePK() { 454 return parentForumMessagePK; 455 } 456 457 public void setParentForumMessagePK(ForumMessagePK parentForumMessagePK) { 458 boolean update = true; 459 460 if(this.parentForumMessagePK != null) { 461 if(this.parentForumMessagePK.equals(parentForumMessagePK)) { 462 update = false; 463 } 464 } else if(parentForumMessagePK == null) { 465 update = false; 466 } 467 468 if(update) { 469 this.parentForumMessagePK = parentForumMessagePK; 470 parentForumMessagePKHasBeenModified = true; 471 clearHashAndString(); 472 } 473 } 474 475 public boolean getParentForumMessagePKHasBeenModified() { 476 return parentForumMessagePKHasBeenModified; 477 } 478 479 public IconPK getIconPK() { 480 return iconPK; 481 } 482 483 public void setIconPK(IconPK iconPK) { 484 boolean update = true; 485 486 if(this.iconPK != null) { 487 if(this.iconPK.equals(iconPK)) { 488 update = false; 489 } 490 } else if(iconPK == null) { 491 update = false; 492 } 493 494 if(update) { 495 this.iconPK = iconPK; 496 iconPKHasBeenModified = true; 497 clearHashAndString(); 498 } 499 } 500 501 public boolean getIconPKHasBeenModified() { 502 return iconPKHasBeenModified; 503 } 504 505 public Long getPostedTime() { 506 return postedTime; 507 } 508 509 public void setPostedTime(Long postedTime) 510 throws PersistenceNotNullException { 511 checkForNull(postedTime); 512 513 boolean update = true; 514 515 if(this.postedTime != null) { 516 if(this.postedTime.equals(postedTime)) { 517 update = false; 518 } 519 } else if(postedTime == null) { 520 update = false; 521 } 522 523 if(update) { 524 this.postedTime = postedTime; 525 postedTimeHasBeenModified = true; 526 clearHashAndString(); 527 } 528 } 529 530 public boolean getPostedTimeHasBeenModified() { 531 return postedTimeHasBeenModified; 532 } 533 534 public Long getFromTime() { 535 return fromTime; 536 } 537 538 public void setFromTime(Long fromTime) 539 throws PersistenceNotNullException { 540 checkForNull(fromTime); 541 542 boolean update = true; 543 544 if(this.fromTime != null) { 545 if(this.fromTime.equals(fromTime)) { 546 update = false; 547 } 548 } else if(fromTime == null) { 549 update = false; 550 } 551 552 if(update) { 553 this.fromTime = fromTime; 554 fromTimeHasBeenModified = true; 555 clearHashAndString(); 556 } 557 } 558 559 public boolean getFromTimeHasBeenModified() { 560 return fromTimeHasBeenModified; 561 } 562 563 public Long getThruTime() { 564 return thruTime; 565 } 566 567 public void setThruTime(Long thruTime) 568 throws PersistenceNotNullException { 569 checkForNull(thruTime); 570 571 boolean update = true; 572 573 if(this.thruTime != null) { 574 if(this.thruTime.equals(thruTime)) { 575 update = false; 576 } 577 } else if(thruTime == null) { 578 update = false; 579 } 580 581 if(update) { 582 this.thruTime = thruTime; 583 thruTimeHasBeenModified = true; 584 clearHashAndString(); 585 } 586 } 587 588 public boolean getThruTimeHasBeenModified() { 589 return thruTimeHasBeenModified; 590 } 591 592}