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