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 * TrainingClassPageTranslationValue.java 021 */ 022 023package com.echothree.model.data.training.server.value; 024 025import com.echothree.model.data.training.common.pk.TrainingClassPageTranslationPK; 026 027import com.echothree.model.data.training.server.factory.TrainingClassPageTranslationFactory; 028 029import com.echothree.model.data.training.common.pk.TrainingClassPagePK; 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 TrainingClassPageTranslationValue 041 extends BaseValue<TrainingClassPageTranslationPK> 042 implements Cloneable, Serializable { 043 044 private TrainingClassPagePK trainingClassPagePK; 045 private boolean trainingClassPagePKHasBeenModified = false; 046 private LanguagePK languagePK; 047 private boolean languagePKHasBeenModified = false; 048 private String description; 049 private boolean descriptionHasBeenModified = false; 050 private MimeTypePK pageMimeTypePK; 051 private boolean pageMimeTypePKHasBeenModified = false; 052 private String page; 053 private boolean pageHasBeenModified = false; 054 private Long fromTime; 055 private boolean fromTimeHasBeenModified = false; 056 private Long thruTime; 057 private boolean thruTimeHasBeenModified = false; 058 059 private transient Integer _hashCode = null; 060 private transient String _stringValue = null; 061 062 private void constructFields(TrainingClassPagePK trainingClassPagePK, LanguagePK languagePK, String description, MimeTypePK pageMimeTypePK, String page, Long fromTime, Long thruTime) 063 throws PersistenceNotNullException { 064 checkForNull(trainingClassPagePK); 065 this.trainingClassPagePK = trainingClassPagePK; 066 checkForNull(languagePK); 067 this.languagePK = languagePK; 068 checkForNull(description); 069 this.description = description; 070 checkForNull(pageMimeTypePK); 071 this.pageMimeTypePK = pageMimeTypePK; 072 checkForNull(page); 073 this.page = page; 074 checkForNull(fromTime); 075 this.fromTime = fromTime; 076 checkForNull(thruTime); 077 this.thruTime = thruTime; 078 } 079 080 /** Creates a new instance of TrainingClassPageTranslationValue */ 081 public TrainingClassPageTranslationValue(TrainingClassPageTranslationPK trainingClassPageTranslationPK, TrainingClassPagePK trainingClassPagePK, LanguagePK languagePK, String description, MimeTypePK pageMimeTypePK, String page, Long fromTime, Long thruTime) 082 throws PersistenceNotNullException { 083 super(trainingClassPageTranslationPK); 084 constructFields(trainingClassPagePK, languagePK, description, pageMimeTypePK, page, fromTime, thruTime); 085 } 086 087 /** Creates a new instance of TrainingClassPageTranslationValue */ 088 public TrainingClassPageTranslationValue(TrainingClassPagePK trainingClassPagePK, LanguagePK languagePK, String description, MimeTypePK pageMimeTypePK, String page, Long fromTime, Long thruTime) 089 throws PersistenceNotNullException { 090 super(); 091 constructFields(trainingClassPagePK, languagePK, description, pageMimeTypePK, page, fromTime, thruTime); 092 } 093 094 @Override 095 public TrainingClassPageTranslationFactory getBaseFactoryInstance() { 096 return TrainingClassPageTranslationFactory.getInstance(); 097 } 098 099 @Override 100 public TrainingClassPageTranslationValue clone() { 101 Object result; 102 103 try { 104 result = super.clone(); 105 } catch (CloneNotSupportedException cnse) { 106 // This shouldn't happen, fail when it does. 107 throw new PersistenceCloneException(cnse); 108 } 109 110 return (TrainingClassPageTranslationValue)result; 111 } 112 113 @Override 114 public TrainingClassPageTranslationPK getPrimaryKey() { 115 if(_primaryKey == null) { 116 _primaryKey = new TrainingClassPageTranslationPK(entityId); 117 } 118 119 return _primaryKey; 120 } 121 122 private void clearHashAndString() { 123 _hashCode = null; 124 _stringValue = null; 125 } 126 127 @Override 128 public int hashCode() { 129 if(_hashCode == null) { 130 int hashCode = 17; 131 132 hashCode = 37 * hashCode + ((entityId != null) ? entityId.hashCode() : 0); 133 134 hashCode = 37 * hashCode + ((trainingClassPagePK != null) ? trainingClassPagePK.hashCode() : 0); 135 hashCode = 37 * hashCode + ((languagePK != null) ? languagePK.hashCode() : 0); 136 hashCode = 37 * hashCode + ((description != null) ? description.hashCode() : 0); 137 hashCode = 37 * hashCode + ((pageMimeTypePK != null) ? pageMimeTypePK.hashCode() : 0); 138 hashCode = 37 * hashCode + ((page != null) ? page.hashCode() : 0); 139 hashCode = 37 * hashCode + ((fromTime != null) ? fromTime.hashCode() : 0); 140 hashCode = 37 * hashCode + ((thruTime != null) ? thruTime.hashCode() : 0); 141 142 _hashCode = hashCode; 143 } 144 145 return _hashCode; 146 } 147 148 @Override 149 public String toString() { 150 if(_stringValue == null) { 151 _stringValue = "{" + 152 "entityId=" + getEntityId() + 153 ", trainingClassPagePK=" + getTrainingClassPagePK() + 154 ", languagePK=" + getLanguagePK() + 155 ", description=" + getDescription() + 156 ", pageMimeTypePK=" + getPageMimeTypePK() + 157 ", page=" + getPage() + 158 ", fromTime=" + getFromTime() + 159 ", thruTime=" + getThruTime() + 160 "}"; 161 } 162 return _stringValue; 163 } 164 165 @Override 166 public boolean equals(Object other) { 167 if(this == other) 168 return true; 169 170 if(!hasIdentity()) 171 return false; 172 173 if(other instanceof TrainingClassPageTranslationValue that) { 174 if(!that.hasIdentity()) 175 return false; 176 177 Long thisEntityId = getEntityId(); 178 Long thatEntityId = that.getEntityId(); 179 180 boolean objectsEqual = thisEntityId.equals(thatEntityId); 181 if(objectsEqual) 182 objectsEqual = isIdentical(that); 183 184 return objectsEqual; 185 } else { 186 return false; 187 } 188 } 189 190 public boolean isIdentical(Object other) { 191 if(other instanceof TrainingClassPageTranslationValue that) { 192 boolean objectsEqual = true; 193 194 195 if(objectsEqual) { 196 TrainingClassPagePK thisTrainingClassPagePK = getTrainingClassPagePK(); 197 TrainingClassPagePK thatTrainingClassPagePK = that.getTrainingClassPagePK(); 198 199 if(thisTrainingClassPagePK == null) { 200 objectsEqual = objectsEqual && (thatTrainingClassPagePK == null); 201 } else { 202 objectsEqual = objectsEqual && thisTrainingClassPagePK.equals(thatTrainingClassPagePK); 203 } 204 } 205 206 if(objectsEqual) { 207 LanguagePK thisLanguagePK = getLanguagePK(); 208 LanguagePK thatLanguagePK = that.getLanguagePK(); 209 210 if(thisLanguagePK == null) { 211 objectsEqual = objectsEqual && (thatLanguagePK == null); 212 } else { 213 objectsEqual = objectsEqual && thisLanguagePK.equals(thatLanguagePK); 214 } 215 } 216 217 if(objectsEqual) { 218 String thisDescription = getDescription(); 219 String thatDescription = that.getDescription(); 220 221 if(thisDescription == null) { 222 objectsEqual = objectsEqual && (thatDescription == null); 223 } else { 224 objectsEqual = objectsEqual && thisDescription.equals(thatDescription); 225 } 226 } 227 228 if(objectsEqual) { 229 MimeTypePK thisPageMimeTypePK = getPageMimeTypePK(); 230 MimeTypePK thatPageMimeTypePK = that.getPageMimeTypePK(); 231 232 if(thisPageMimeTypePK == null) { 233 objectsEqual = objectsEqual && (thatPageMimeTypePK == null); 234 } else { 235 objectsEqual = objectsEqual && thisPageMimeTypePK.equals(thatPageMimeTypePK); 236 } 237 } 238 239 if(objectsEqual) { 240 String thisPage = getPage(); 241 String thatPage = that.getPage(); 242 243 if(thisPage == null) { 244 objectsEqual = objectsEqual && (thatPage == null); 245 } else { 246 objectsEqual = objectsEqual && thisPage.equals(thatPage); 247 } 248 } 249 250 if(objectsEqual) { 251 Long thisFromTime = getFromTime(); 252 Long thatFromTime = that.getFromTime(); 253 254 if(thisFromTime == null) { 255 objectsEqual = objectsEqual && (thatFromTime == null); 256 } else { 257 objectsEqual = objectsEqual && thisFromTime.equals(thatFromTime); 258 } 259 } 260 261 if(objectsEqual) { 262 Long thisThruTime = getThruTime(); 263 Long thatThruTime = that.getThruTime(); 264 265 if(thisThruTime == null) { 266 objectsEqual = objectsEqual && (thatThruTime == null); 267 } else { 268 objectsEqual = objectsEqual && thisThruTime.equals(thatThruTime); 269 } 270 } 271 272 return objectsEqual; 273 } else { 274 return false; 275 } 276 } 277 278 @Override 279 public boolean hasBeenModified() { 280 return trainingClassPagePKHasBeenModified || languagePKHasBeenModified || descriptionHasBeenModified || pageMimeTypePKHasBeenModified || pageHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified; 281 } 282 283 @Override 284 public void clearHasBeenModified() { 285 trainingClassPagePKHasBeenModified = false; 286 languagePKHasBeenModified = false; 287 descriptionHasBeenModified = false; 288 pageMimeTypePKHasBeenModified = false; 289 pageHasBeenModified = false; 290 fromTimeHasBeenModified = false; 291 thruTimeHasBeenModified = false; 292 } 293 294 public TrainingClassPagePK getTrainingClassPagePK() { 295 return trainingClassPagePK; 296 } 297 298 public void setTrainingClassPagePK(TrainingClassPagePK trainingClassPagePK) 299 throws PersistenceNotNullException { 300 checkForNull(trainingClassPagePK); 301 302 boolean update = true; 303 304 if(this.trainingClassPagePK != null) { 305 if(this.trainingClassPagePK.equals(trainingClassPagePK)) { 306 update = false; 307 } 308 } else if(trainingClassPagePK == null) { 309 update = false; 310 } 311 312 if(update) { 313 this.trainingClassPagePK = trainingClassPagePK; 314 trainingClassPagePKHasBeenModified = true; 315 clearHashAndString(); 316 } 317 } 318 319 public boolean getTrainingClassPagePKHasBeenModified() { 320 return trainingClassPagePKHasBeenModified; 321 } 322 323 public LanguagePK getLanguagePK() { 324 return languagePK; 325 } 326 327 public void setLanguagePK(LanguagePK languagePK) 328 throws PersistenceNotNullException { 329 checkForNull(languagePK); 330 331 boolean update = true; 332 333 if(this.languagePK != null) { 334 if(this.languagePK.equals(languagePK)) { 335 update = false; 336 } 337 } else if(languagePK == null) { 338 update = false; 339 } 340 341 if(update) { 342 this.languagePK = languagePK; 343 languagePKHasBeenModified = true; 344 clearHashAndString(); 345 } 346 } 347 348 public boolean getLanguagePKHasBeenModified() { 349 return languagePKHasBeenModified; 350 } 351 352 public String getDescription() { 353 return description; 354 } 355 356 public void setDescription(String description) 357 throws PersistenceNotNullException { 358 checkForNull(description); 359 360 boolean update = true; 361 362 if(this.description != null) { 363 if(this.description.equals(description)) { 364 update = false; 365 } 366 } else if(description == null) { 367 update = false; 368 } 369 370 if(update) { 371 this.description = description; 372 descriptionHasBeenModified = true; 373 clearHashAndString(); 374 } 375 } 376 377 public boolean getDescriptionHasBeenModified() { 378 return descriptionHasBeenModified; 379 } 380 381 public MimeTypePK getPageMimeTypePK() { 382 return pageMimeTypePK; 383 } 384 385 public void setPageMimeTypePK(MimeTypePK pageMimeTypePK) 386 throws PersistenceNotNullException { 387 checkForNull(pageMimeTypePK); 388 389 boolean update = true; 390 391 if(this.pageMimeTypePK != null) { 392 if(this.pageMimeTypePK.equals(pageMimeTypePK)) { 393 update = false; 394 } 395 } else if(pageMimeTypePK == null) { 396 update = false; 397 } 398 399 if(update) { 400 this.pageMimeTypePK = pageMimeTypePK; 401 pageMimeTypePKHasBeenModified = true; 402 clearHashAndString(); 403 } 404 } 405 406 public boolean getPageMimeTypePKHasBeenModified() { 407 return pageMimeTypePKHasBeenModified; 408 } 409 410 public String getPage() { 411 return page; 412 } 413 414 public void setPage(String page) 415 throws PersistenceNotNullException { 416 checkForNull(page); 417 418 boolean update = true; 419 420 if(this.page != null) { 421 if(this.page.equals(page)) { 422 update = false; 423 } 424 } else if(page == null) { 425 update = false; 426 } 427 428 if(update) { 429 this.page = page; 430 pageHasBeenModified = true; 431 clearHashAndString(); 432 } 433 } 434 435 public boolean getPageHasBeenModified() { 436 return pageHasBeenModified; 437 } 438 439 public Long getFromTime() { 440 return fromTime; 441 } 442 443 public void setFromTime(Long fromTime) 444 throws PersistenceNotNullException { 445 checkForNull(fromTime); 446 447 boolean update = true; 448 449 if(this.fromTime != null) { 450 if(this.fromTime.equals(fromTime)) { 451 update = false; 452 } 453 } else if(fromTime == null) { 454 update = false; 455 } 456 457 if(update) { 458 this.fromTime = fromTime; 459 fromTimeHasBeenModified = true; 460 clearHashAndString(); 461 } 462 } 463 464 public boolean getFromTimeHasBeenModified() { 465 return fromTimeHasBeenModified; 466 } 467 468 public Long getThruTime() { 469 return thruTime; 470 } 471 472 public void setThruTime(Long thruTime) 473 throws PersistenceNotNullException { 474 checkForNull(thruTime); 475 476 boolean update = true; 477 478 if(this.thruTime != null) { 479 if(this.thruTime.equals(thruTime)) { 480 update = false; 481 } 482 } else if(thruTime == null) { 483 update = false; 484 } 485 486 if(update) { 487 this.thruTime = thruTime; 488 thruTimeHasBeenModified = true; 489 clearHashAndString(); 490 } 491 } 492 493 public boolean getThruTimeHasBeenModified() { 494 return thruTimeHasBeenModified; 495 } 496 497}