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