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