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