001// -------------------------------------------------------------------------------- 002// Copyright 2002-2025 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 * TrainingClassAnswerTranslationValue.java 021 */ 022 023package com.echothree.model.data.training.server.value; 024 025import com.echothree.model.data.training.common.pk.TrainingClassAnswerTranslationPK; 026 027import com.echothree.model.data.training.server.factory.TrainingClassAnswerTranslationFactory; 028 029import com.echothree.model.data.training.common.pk.TrainingClassAnswerPK; 030import com.echothree.model.data.party.common.pk.LanguagePK; 031import com.echothree.model.data.core.common.pk.MimeTypePK; 032 033import com.echothree.util.common.exception.PersistenceCloneException; 034import com.echothree.util.common.exception.PersistenceNotNullException; 035 036import com.echothree.util.server.persistence.BaseValue; 037 038import java.io.Serializable; 039 040public class TrainingClassAnswerTranslationValue 041 extends BaseValue<TrainingClassAnswerTranslationPK> 042 implements Cloneable, Serializable { 043 044 private TrainingClassAnswerPK trainingClassAnswerPK; 045 private boolean trainingClassAnswerPKHasBeenModified = false; 046 private LanguagePK languagePK; 047 private boolean languagePKHasBeenModified = false; 048 private MimeTypePK answerMimeTypePK; 049 private boolean answerMimeTypePKHasBeenModified = false; 050 private String answer; 051 private boolean answerHasBeenModified = false; 052 private MimeTypePK selectedMimeTypePK; 053 private boolean selectedMimeTypePKHasBeenModified = false; 054 private String selected; 055 private boolean selectedHasBeenModified = 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(TrainingClassAnswerPK trainingClassAnswerPK, LanguagePK languagePK, MimeTypePK answerMimeTypePK, String answer, MimeTypePK selectedMimeTypePK, String selected, Long fromTime, Long thruTime) 065 throws PersistenceNotNullException { 066 checkForNull(trainingClassAnswerPK); 067 this.trainingClassAnswerPK = trainingClassAnswerPK; 068 checkForNull(languagePK); 069 this.languagePK = languagePK; 070 checkForNull(answerMimeTypePK); 071 this.answerMimeTypePK = answerMimeTypePK; 072 checkForNull(answer); 073 this.answer = answer; 074 this.selectedMimeTypePK = selectedMimeTypePK; 075 this.selected = selected; 076 checkForNull(fromTime); 077 this.fromTime = fromTime; 078 checkForNull(thruTime); 079 this.thruTime = thruTime; 080 } 081 082 /** Creates a new instance of TrainingClassAnswerTranslationValue */ 083 public TrainingClassAnswerTranslationValue(TrainingClassAnswerTranslationPK trainingClassAnswerTranslationPK, TrainingClassAnswerPK trainingClassAnswerPK, LanguagePK languagePK, MimeTypePK answerMimeTypePK, String answer, MimeTypePK selectedMimeTypePK, String selected, Long fromTime, Long thruTime) 084 throws PersistenceNotNullException { 085 super(trainingClassAnswerTranslationPK); 086 constructFields(trainingClassAnswerPK, languagePK, answerMimeTypePK, answer, selectedMimeTypePK, selected, fromTime, thruTime); 087 } 088 089 /** Creates a new instance of TrainingClassAnswerTranslationValue */ 090 public TrainingClassAnswerTranslationValue(TrainingClassAnswerPK trainingClassAnswerPK, LanguagePK languagePK, MimeTypePK answerMimeTypePK, String answer, MimeTypePK selectedMimeTypePK, String selected, Long fromTime, Long thruTime) 091 throws PersistenceNotNullException { 092 super(); 093 constructFields(trainingClassAnswerPK, languagePK, answerMimeTypePK, answer, selectedMimeTypePK, selected, fromTime, thruTime); 094 } 095 096 @Override 097 public TrainingClassAnswerTranslationFactory getBaseFactoryInstance() { 098 return TrainingClassAnswerTranslationFactory.getInstance(); 099 } 100 101 @Override 102 public TrainingClassAnswerTranslationValue 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 (TrainingClassAnswerTranslationValue)result; 113 } 114 115 @Override 116 public TrainingClassAnswerTranslationPK getPrimaryKey() { 117 if(_primaryKey == null) { 118 _primaryKey = new TrainingClassAnswerTranslationPK(entityId); 119 } 120 121 return _primaryKey; 122 } 123 124 private void clearHashAndString() { 125 _hashCode = null; 126 _stringValue = null; 127 } 128 129 @Override 130 public int hashCode() { 131 if(_hashCode == null) { 132 int hashCode = 17; 133 134 hashCode = 37 * hashCode + ((entityId != null) ? entityId.hashCode() : 0); 135 136 hashCode = 37 * hashCode + ((trainingClassAnswerPK != null) ? trainingClassAnswerPK.hashCode() : 0); 137 hashCode = 37 * hashCode + ((languagePK != null) ? languagePK.hashCode() : 0); 138 hashCode = 37 * hashCode + ((answerMimeTypePK != null) ? answerMimeTypePK.hashCode() : 0); 139 hashCode = 37 * hashCode + ((answer != null) ? answer.hashCode() : 0); 140 hashCode = 37 * hashCode + ((selectedMimeTypePK != null) ? selectedMimeTypePK.hashCode() : 0); 141 hashCode = 37 * hashCode + ((selected != null) ? selected.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 public String toString() { 153 if(_stringValue == null) { 154 _stringValue = "{" + 155 "entityId=" + getEntityId() + 156 ", trainingClassAnswerPK=" + getTrainingClassAnswerPK() + 157 ", languagePK=" + getLanguagePK() + 158 ", answerMimeTypePK=" + getAnswerMimeTypePK() + 159 ", answer=" + getAnswer() + 160 ", selectedMimeTypePK=" + getSelectedMimeTypePK() + 161 ", selected=" + getSelected() + 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 TrainingClassAnswerTranslationValue 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 TrainingClassAnswerTranslationValue that) { 196 boolean objectsEqual = true; 197 198 199 if(objectsEqual) { 200 TrainingClassAnswerPK thisTrainingClassAnswerPK = getTrainingClassAnswerPK(); 201 TrainingClassAnswerPK thatTrainingClassAnswerPK = that.getTrainingClassAnswerPK(); 202 203 if(thisTrainingClassAnswerPK == null) { 204 objectsEqual = objectsEqual && (thatTrainingClassAnswerPK == null); 205 } else { 206 objectsEqual = objectsEqual && thisTrainingClassAnswerPK.equals(thatTrainingClassAnswerPK); 207 } 208 } 209 210 if(objectsEqual) { 211 LanguagePK thisLanguagePK = getLanguagePK(); 212 LanguagePK thatLanguagePK = that.getLanguagePK(); 213 214 if(thisLanguagePK == null) { 215 objectsEqual = objectsEqual && (thatLanguagePK == null); 216 } else { 217 objectsEqual = objectsEqual && thisLanguagePK.equals(thatLanguagePK); 218 } 219 } 220 221 if(objectsEqual) { 222 MimeTypePK thisAnswerMimeTypePK = getAnswerMimeTypePK(); 223 MimeTypePK thatAnswerMimeTypePK = that.getAnswerMimeTypePK(); 224 225 if(thisAnswerMimeTypePK == null) { 226 objectsEqual = objectsEqual && (thatAnswerMimeTypePK == null); 227 } else { 228 objectsEqual = objectsEqual && thisAnswerMimeTypePK.equals(thatAnswerMimeTypePK); 229 } 230 } 231 232 if(objectsEqual) { 233 String thisAnswer = getAnswer(); 234 String thatAnswer = that.getAnswer(); 235 236 if(thisAnswer == null) { 237 objectsEqual = objectsEqual && (thatAnswer == null); 238 } else { 239 objectsEqual = objectsEqual && thisAnswer.equals(thatAnswer); 240 } 241 } 242 243 if(objectsEqual) { 244 MimeTypePK thisSelectedMimeTypePK = getSelectedMimeTypePK(); 245 MimeTypePK thatSelectedMimeTypePK = that.getSelectedMimeTypePK(); 246 247 if(thisSelectedMimeTypePK == null) { 248 objectsEqual = objectsEqual && (thatSelectedMimeTypePK == null); 249 } else { 250 objectsEqual = objectsEqual && thisSelectedMimeTypePK.equals(thatSelectedMimeTypePK); 251 } 252 } 253 254 if(objectsEqual) { 255 String thisSelected = getSelected(); 256 String thatSelected = that.getSelected(); 257 258 if(thisSelected == null) { 259 objectsEqual = objectsEqual && (thatSelected == null); 260 } else { 261 objectsEqual = objectsEqual && thisSelected.equals(thatSelected); 262 } 263 } 264 265 if(objectsEqual) { 266 Long thisFromTime = getFromTime(); 267 Long thatFromTime = that.getFromTime(); 268 269 if(thisFromTime == null) { 270 objectsEqual = objectsEqual && (thatFromTime == null); 271 } else { 272 objectsEqual = objectsEqual && thisFromTime.equals(thatFromTime); 273 } 274 } 275 276 if(objectsEqual) { 277 Long thisThruTime = getThruTime(); 278 Long thatThruTime = that.getThruTime(); 279 280 if(thisThruTime == null) { 281 objectsEqual = objectsEqual && (thatThruTime == null); 282 } else { 283 objectsEqual = objectsEqual && thisThruTime.equals(thatThruTime); 284 } 285 } 286 287 return objectsEqual; 288 } else { 289 return false; 290 } 291 } 292 293 @Override 294 public boolean hasBeenModified() { 295 return trainingClassAnswerPKHasBeenModified || languagePKHasBeenModified || answerMimeTypePKHasBeenModified || answerHasBeenModified || selectedMimeTypePKHasBeenModified || selectedHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified; 296 } 297 298 @Override 299 public void clearHasBeenModified() { 300 trainingClassAnswerPKHasBeenModified = false; 301 languagePKHasBeenModified = false; 302 answerMimeTypePKHasBeenModified = false; 303 answerHasBeenModified = false; 304 selectedMimeTypePKHasBeenModified = false; 305 selectedHasBeenModified = false; 306 fromTimeHasBeenModified = false; 307 thruTimeHasBeenModified = false; 308 } 309 310 public TrainingClassAnswerPK getTrainingClassAnswerPK() { 311 return trainingClassAnswerPK; 312 } 313 314 public void setTrainingClassAnswerPK(TrainingClassAnswerPK trainingClassAnswerPK) 315 throws PersistenceNotNullException { 316 checkForNull(trainingClassAnswerPK); 317 318 boolean update = true; 319 320 if(this.trainingClassAnswerPK != null) { 321 if(this.trainingClassAnswerPK.equals(trainingClassAnswerPK)) { 322 update = false; 323 } 324 } else if(trainingClassAnswerPK == null) { 325 update = false; 326 } 327 328 if(update) { 329 this.trainingClassAnswerPK = trainingClassAnswerPK; 330 trainingClassAnswerPKHasBeenModified = true; 331 clearHashAndString(); 332 } 333 } 334 335 public boolean getTrainingClassAnswerPKHasBeenModified() { 336 return trainingClassAnswerPKHasBeenModified; 337 } 338 339 public LanguagePK getLanguagePK() { 340 return languagePK; 341 } 342 343 public void setLanguagePK(LanguagePK languagePK) 344 throws PersistenceNotNullException { 345 checkForNull(languagePK); 346 347 boolean update = true; 348 349 if(this.languagePK != null) { 350 if(this.languagePK.equals(languagePK)) { 351 update = false; 352 } 353 } else if(languagePK == null) { 354 update = false; 355 } 356 357 if(update) { 358 this.languagePK = languagePK; 359 languagePKHasBeenModified = true; 360 clearHashAndString(); 361 } 362 } 363 364 public boolean getLanguagePKHasBeenModified() { 365 return languagePKHasBeenModified; 366 } 367 368 public MimeTypePK getAnswerMimeTypePK() { 369 return answerMimeTypePK; 370 } 371 372 public void setAnswerMimeTypePK(MimeTypePK answerMimeTypePK) 373 throws PersistenceNotNullException { 374 checkForNull(answerMimeTypePK); 375 376 boolean update = true; 377 378 if(this.answerMimeTypePK != null) { 379 if(this.answerMimeTypePK.equals(answerMimeTypePK)) { 380 update = false; 381 } 382 } else if(answerMimeTypePK == null) { 383 update = false; 384 } 385 386 if(update) { 387 this.answerMimeTypePK = answerMimeTypePK; 388 answerMimeTypePKHasBeenModified = true; 389 clearHashAndString(); 390 } 391 } 392 393 public boolean getAnswerMimeTypePKHasBeenModified() { 394 return answerMimeTypePKHasBeenModified; 395 } 396 397 public String getAnswer() { 398 return answer; 399 } 400 401 public void setAnswer(String answer) 402 throws PersistenceNotNullException { 403 checkForNull(answer); 404 405 boolean update = true; 406 407 if(this.answer != null) { 408 if(this.answer.equals(answer)) { 409 update = false; 410 } 411 } else if(answer == null) { 412 update = false; 413 } 414 415 if(update) { 416 this.answer = answer; 417 answerHasBeenModified = true; 418 clearHashAndString(); 419 } 420 } 421 422 public boolean getAnswerHasBeenModified() { 423 return answerHasBeenModified; 424 } 425 426 public MimeTypePK getSelectedMimeTypePK() { 427 return selectedMimeTypePK; 428 } 429 430 public void setSelectedMimeTypePK(MimeTypePK selectedMimeTypePK) { 431 boolean update = true; 432 433 if(this.selectedMimeTypePK != null) { 434 if(this.selectedMimeTypePK.equals(selectedMimeTypePK)) { 435 update = false; 436 } 437 } else if(selectedMimeTypePK == null) { 438 update = false; 439 } 440 441 if(update) { 442 this.selectedMimeTypePK = selectedMimeTypePK; 443 selectedMimeTypePKHasBeenModified = true; 444 clearHashAndString(); 445 } 446 } 447 448 public boolean getSelectedMimeTypePKHasBeenModified() { 449 return selectedMimeTypePKHasBeenModified; 450 } 451 452 public String getSelected() { 453 return selected; 454 } 455 456 public void setSelected(String selected) { 457 boolean update = true; 458 459 if(this.selected != null) { 460 if(this.selected.equals(selected)) { 461 update = false; 462 } 463 } else if(selected == null) { 464 update = false; 465 } 466 467 if(update) { 468 this.selected = selected; 469 selectedHasBeenModified = true; 470 clearHashAndString(); 471 } 472 } 473 474 public boolean getSelectedHasBeenModified() { 475 return selectedHasBeenModified; 476 } 477 478 public Long getFromTime() { 479 return fromTime; 480 } 481 482 public void setFromTime(Long fromTime) 483 throws PersistenceNotNullException { 484 checkForNull(fromTime); 485 486 boolean update = true; 487 488 if(this.fromTime != null) { 489 if(this.fromTime.equals(fromTime)) { 490 update = false; 491 } 492 } else if(fromTime == null) { 493 update = false; 494 } 495 496 if(update) { 497 this.fromTime = fromTime; 498 fromTimeHasBeenModified = true; 499 clearHashAndString(); 500 } 501 } 502 503 public boolean getFromTimeHasBeenModified() { 504 return fromTimeHasBeenModified; 505 } 506 507 public Long getThruTime() { 508 return thruTime; 509 } 510 511 public void setThruTime(Long thruTime) 512 throws PersistenceNotNullException { 513 checkForNull(thruTime); 514 515 boolean update = true; 516 517 if(this.thruTime != null) { 518 if(this.thruTime.equals(thruTime)) { 519 update = false; 520 } 521 } else if(thruTime == null) { 522 update = false; 523 } 524 525 if(update) { 526 this.thruTime = thruTime; 527 thruTimeHasBeenModified = true; 528 clearHashAndString(); 529 } 530 } 531 532 public boolean getThruTimeHasBeenModified() { 533 return thruTimeHasBeenModified; 534 } 535 536}