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