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 * ForumPartyRoleValue.java 021 */ 022 023package com.echothree.model.data.forum.server.value; 024 025import com.echothree.model.data.forum.common.pk.ForumPartyRolePK; 026 027import com.echothree.model.data.forum.server.factory.ForumPartyRoleFactory; 028 029import com.echothree.model.data.forum.common.pk.ForumPK; 030import com.echothree.model.data.party.common.pk.PartyPK; 031import com.echothree.model.data.forum.common.pk.ForumRoleTypePK; 032 033import com.echothree.util.common.exception.PersistenceCloneException; 034import com.echothree.util.common.exception.PersistenceNotNullException; 035 036import com.echothree.util.server.persistence.BaseValue; 037 038import java.io.Serializable; 039 040import javax.annotation.Nonnull; 041import javax.annotation.Nullable; 042 043public class ForumPartyRoleValue 044 extends BaseValue<ForumPartyRolePK> 045 implements Cloneable, Serializable { 046 047 private ForumPK forumPK; 048 private boolean forumPKHasBeenModified = false; 049 private PartyPK partyPK; 050 private boolean partyPKHasBeenModified = false; 051 private ForumRoleTypePK forumRoleTypePK; 052 private boolean forumRoleTypePKHasBeenModified = false; 053 private Long fromTime; 054 private boolean fromTimeHasBeenModified = false; 055 private Long thruTime; 056 private boolean thruTimeHasBeenModified = false; 057 058 private transient Integer _hashCode = null; 059 private transient String _stringValue = null; 060 061 private void constructFields(ForumPK forumPK, PartyPK partyPK, ForumRoleTypePK forumRoleTypePK, Long fromTime, Long thruTime) 062 throws PersistenceNotNullException { 063 checkForNull(forumPK); 064 this.forumPK = forumPK; 065 checkForNull(partyPK); 066 this.partyPK = partyPK; 067 checkForNull(forumRoleTypePK); 068 this.forumRoleTypePK = forumRoleTypePK; 069 checkForNull(fromTime); 070 this.fromTime = fromTime; 071 checkForNull(thruTime); 072 this.thruTime = thruTime; 073 } 074 075 /** Creates a new instance of ForumPartyRoleValue */ 076 public ForumPartyRoleValue(ForumPartyRolePK forumPartyRolePK, ForumPK forumPK, PartyPK partyPK, ForumRoleTypePK forumRoleTypePK, Long fromTime, Long thruTime) 077 throws PersistenceNotNullException { 078 super(forumPartyRolePK); 079 constructFields(forumPK, partyPK, forumRoleTypePK, fromTime, thruTime); 080 } 081 082 /** Creates a new instance of ForumPartyRoleValue */ 083 public ForumPartyRoleValue(ForumPK forumPK, PartyPK partyPK, ForumRoleTypePK forumRoleTypePK, Long fromTime, Long thruTime) 084 throws PersistenceNotNullException { 085 super(); 086 constructFields(forumPK, partyPK, forumRoleTypePK, fromTime, thruTime); 087 } 088 089 @Override 090 @Nonnull 091 public ForumPartyRoleFactory getBaseFactoryInstance() { 092 return ForumPartyRoleFactory.getInstance(); 093 } 094 095 @Override 096 @Nonnull 097 public ForumPartyRoleValue clone() { 098 Object result; 099 100 try { 101 result = super.clone(); 102 } catch (CloneNotSupportedException cnse) { 103 // This shouldn't happen, fail when it does. 104 throw new PersistenceCloneException(cnse); 105 } 106 107 return (ForumPartyRoleValue)result; 108 } 109 110 @Override 111 @Nonnull 112 public ForumPartyRolePK getPrimaryKey() { 113 if(_primaryKey == null) { 114 _primaryKey = new ForumPartyRolePK(entityId); 115 } 116 117 return _primaryKey; 118 } 119 120 private void clearHashAndString() { 121 _hashCode = null; 122 _stringValue = null; 123 } 124 125 @Override 126 public int hashCode() { 127 if(_hashCode == null) { 128 int hashCode = 17; 129 130 hashCode = 37 * hashCode + ((entityId != null) ? entityId.hashCode() : 0); 131 132 hashCode = 37 * hashCode + ((forumPK != null) ? forumPK.hashCode() : 0); 133 hashCode = 37 * hashCode + ((partyPK != null) ? partyPK.hashCode() : 0); 134 hashCode = 37 * hashCode + ((forumRoleTypePK != null) ? forumRoleTypePK.hashCode() : 0); 135 hashCode = 37 * hashCode + ((fromTime != null) ? fromTime.hashCode() : 0); 136 hashCode = 37 * hashCode + ((thruTime != null) ? thruTime.hashCode() : 0); 137 138 _hashCode = hashCode; 139 } 140 141 return _hashCode; 142 } 143 144 @Override 145 @Nonnull 146 public String toString() { 147 if(_stringValue == null) { 148 _stringValue = "{" + 149 "entityId=" + getEntityId() + 150 ", forumPK=" + getForumPK() + 151 ", partyPK=" + getPartyPK() + 152 ", forumRoleTypePK=" + getForumRoleTypePK() + 153 ", fromTime=" + getFromTime() + 154 ", thruTime=" + getThruTime() + 155 "}"; 156 } 157 return _stringValue; 158 } 159 160 @Override 161 public boolean equals(Object other) { 162 if(this == other) 163 return true; 164 165 if(!hasIdentity()) 166 return false; 167 168 if(other instanceof ForumPartyRoleValue that) { 169 if(!that.hasIdentity()) 170 return false; 171 172 Long thisEntityId = getEntityId(); 173 Long thatEntityId = that.getEntityId(); 174 175 boolean objectsEqual = thisEntityId.equals(thatEntityId); 176 if(objectsEqual) 177 objectsEqual = isIdentical(that); 178 179 return objectsEqual; 180 } else { 181 return false; 182 } 183 } 184 185 public boolean isIdentical(Object other) { 186 if(other instanceof ForumPartyRoleValue that) { 187 boolean objectsEqual = true; 188 189 190 if(objectsEqual) { 191 ForumPK thisForumPK = getForumPK(); 192 ForumPK thatForumPK = that.getForumPK(); 193 194 if(thisForumPK == null) { 195 objectsEqual = objectsEqual && (thatForumPK == null); 196 } else { 197 objectsEqual = objectsEqual && thisForumPK.equals(thatForumPK); 198 } 199 } 200 201 if(objectsEqual) { 202 PartyPK thisPartyPK = getPartyPK(); 203 PartyPK thatPartyPK = that.getPartyPK(); 204 205 if(thisPartyPK == null) { 206 objectsEqual = objectsEqual && (thatPartyPK == null); 207 } else { 208 objectsEqual = objectsEqual && thisPartyPK.equals(thatPartyPK); 209 } 210 } 211 212 if(objectsEqual) { 213 ForumRoleTypePK thisForumRoleTypePK = getForumRoleTypePK(); 214 ForumRoleTypePK thatForumRoleTypePK = that.getForumRoleTypePK(); 215 216 if(thisForumRoleTypePK == null) { 217 objectsEqual = objectsEqual && (thatForumRoleTypePK == null); 218 } else { 219 objectsEqual = objectsEqual && thisForumRoleTypePK.equals(thatForumRoleTypePK); 220 } 221 } 222 223 if(objectsEqual) { 224 Long thisFromTime = getFromTime(); 225 Long thatFromTime = that.getFromTime(); 226 227 if(thisFromTime == null) { 228 objectsEqual = objectsEqual && (thatFromTime == null); 229 } else { 230 objectsEqual = objectsEqual && thisFromTime.equals(thatFromTime); 231 } 232 } 233 234 if(objectsEqual) { 235 Long thisThruTime = getThruTime(); 236 Long thatThruTime = that.getThruTime(); 237 238 if(thisThruTime == null) { 239 objectsEqual = objectsEqual && (thatThruTime == null); 240 } else { 241 objectsEqual = objectsEqual && thisThruTime.equals(thatThruTime); 242 } 243 } 244 245 return objectsEqual; 246 } else { 247 return false; 248 } 249 } 250 251 @Override 252 public boolean hasBeenModified() { 253 return forumPKHasBeenModified || partyPKHasBeenModified || forumRoleTypePKHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified; 254 } 255 256 @Override 257 public void clearHasBeenModified() { 258 forumPKHasBeenModified = false; 259 partyPKHasBeenModified = false; 260 forumRoleTypePKHasBeenModified = false; 261 fromTimeHasBeenModified = false; 262 thruTimeHasBeenModified = false; 263 } 264 265 @Nonnull 266 public ForumPK getForumPK() { 267 return forumPK; 268 } 269 270 public void setForumPK(@Nonnull ForumPK forumPK) 271 throws PersistenceNotNullException { 272 checkForNull(forumPK); 273 274 boolean update = true; 275 276 if(this.forumPK != null) { 277 if(this.forumPK.equals(forumPK)) { 278 update = false; 279 } 280 } else if(forumPK == null) { 281 update = false; 282 } 283 284 if(update) { 285 this.forumPK = forumPK; 286 forumPKHasBeenModified = true; 287 clearHashAndString(); 288 } 289 } 290 291 public boolean getForumPKHasBeenModified() { 292 return forumPKHasBeenModified; 293 } 294 295 @Nonnull 296 public PartyPK getPartyPK() { 297 return partyPK; 298 } 299 300 public void setPartyPK(@Nonnull PartyPK partyPK) 301 throws PersistenceNotNullException { 302 checkForNull(partyPK); 303 304 boolean update = true; 305 306 if(this.partyPK != null) { 307 if(this.partyPK.equals(partyPK)) { 308 update = false; 309 } 310 } else if(partyPK == null) { 311 update = false; 312 } 313 314 if(update) { 315 this.partyPK = partyPK; 316 partyPKHasBeenModified = true; 317 clearHashAndString(); 318 } 319 } 320 321 public boolean getPartyPKHasBeenModified() { 322 return partyPKHasBeenModified; 323 } 324 325 @Nonnull 326 public ForumRoleTypePK getForumRoleTypePK() { 327 return forumRoleTypePK; 328 } 329 330 public void setForumRoleTypePK(@Nonnull ForumRoleTypePK forumRoleTypePK) 331 throws PersistenceNotNullException { 332 checkForNull(forumRoleTypePK); 333 334 boolean update = true; 335 336 if(this.forumRoleTypePK != null) { 337 if(this.forumRoleTypePK.equals(forumRoleTypePK)) { 338 update = false; 339 } 340 } else if(forumRoleTypePK == null) { 341 update = false; 342 } 343 344 if(update) { 345 this.forumRoleTypePK = forumRoleTypePK; 346 forumRoleTypePKHasBeenModified = true; 347 clearHashAndString(); 348 } 349 } 350 351 public boolean getForumRoleTypePKHasBeenModified() { 352 return forumRoleTypePKHasBeenModified; 353 } 354 355 @Nonnull 356 public Long getFromTime() { 357 return fromTime; 358 } 359 360 public void setFromTime(@Nonnull Long fromTime) 361 throws PersistenceNotNullException { 362 checkForNull(fromTime); 363 364 boolean update = true; 365 366 if(this.fromTime != null) { 367 if(this.fromTime.equals(fromTime)) { 368 update = false; 369 } 370 } else if(fromTime == null) { 371 update = false; 372 } 373 374 if(update) { 375 this.fromTime = fromTime; 376 fromTimeHasBeenModified = true; 377 clearHashAndString(); 378 } 379 } 380 381 public boolean getFromTimeHasBeenModified() { 382 return fromTimeHasBeenModified; 383 } 384 385 @Nonnull 386 public Long getThruTime() { 387 return thruTime; 388 } 389 390 public void setThruTime(@Nonnull Long thruTime) 391 throws PersistenceNotNullException { 392 checkForNull(thruTime); 393 394 boolean update = true; 395 396 if(this.thruTime != null) { 397 if(this.thruTime.equals(thruTime)) { 398 update = false; 399 } 400 } else if(thruTime == null) { 401 update = false; 402 } 403 404 if(update) { 405 this.thruTime = thruTime; 406 thruTimeHasBeenModified = true; 407 clearHashAndString(); 408 } 409 } 410 411 public boolean getThruTimeHasBeenModified() { 412 return thruTimeHasBeenModified; 413 } 414 415}