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