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 * PartyTrainingClassDetailValue.java 021 */ 022 023package com.echothree.model.data.training.server.value; 024 025import com.echothree.model.data.training.common.pk.PartyTrainingClassDetailPK; 026 027import com.echothree.model.data.training.server.factory.PartyTrainingClassDetailFactory; 028 029import com.echothree.model.data.training.common.pk.PartyTrainingClassPK; 030import com.echothree.model.data.party.common.pk.PartyPK; 031import com.echothree.model.data.training.common.pk.TrainingClassPK; 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 PartyTrainingClassDetailValue 041 extends BaseValue<PartyTrainingClassDetailPK> 042 implements Cloneable, Serializable { 043 044 private PartyTrainingClassPK partyTrainingClassPK; 045 private boolean partyTrainingClassPKHasBeenModified = false; 046 private String partyTrainingClassName; 047 private boolean partyTrainingClassNameHasBeenModified = false; 048 private PartyPK partyPK; 049 private boolean partyPKHasBeenModified = false; 050 private TrainingClassPK trainingClassPK; 051 private boolean trainingClassPKHasBeenModified = false; 052 private Long completedTime; 053 private boolean completedTimeHasBeenModified = false; 054 private Long validUntilTime; 055 private boolean validUntilTimeHasBeenModified = 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(PartyTrainingClassPK partyTrainingClassPK, String partyTrainingClassName, PartyPK partyPK, TrainingClassPK trainingClassPK, Long completedTime, Long validUntilTime, Long fromTime, Long thruTime) 065 throws PersistenceNotNullException { 066 checkForNull(partyTrainingClassPK); 067 this.partyTrainingClassPK = partyTrainingClassPK; 068 checkForNull(partyTrainingClassName); 069 this.partyTrainingClassName = partyTrainingClassName; 070 checkForNull(partyPK); 071 this.partyPK = partyPK; 072 checkForNull(trainingClassPK); 073 this.trainingClassPK = trainingClassPK; 074 this.completedTime = completedTime; 075 this.validUntilTime = validUntilTime; 076 checkForNull(fromTime); 077 this.fromTime = fromTime; 078 checkForNull(thruTime); 079 this.thruTime = thruTime; 080 } 081 082 /** Creates a new instance of PartyTrainingClassDetailValue */ 083 public PartyTrainingClassDetailValue(PartyTrainingClassDetailPK partyTrainingClassDetailPK, PartyTrainingClassPK partyTrainingClassPK, String partyTrainingClassName, PartyPK partyPK, TrainingClassPK trainingClassPK, Long completedTime, Long validUntilTime, Long fromTime, Long thruTime) 084 throws PersistenceNotNullException { 085 super(partyTrainingClassDetailPK); 086 constructFields(partyTrainingClassPK, partyTrainingClassName, partyPK, trainingClassPK, completedTime, validUntilTime, fromTime, thruTime); 087 } 088 089 /** Creates a new instance of PartyTrainingClassDetailValue */ 090 public PartyTrainingClassDetailValue(PartyTrainingClassPK partyTrainingClassPK, String partyTrainingClassName, PartyPK partyPK, TrainingClassPK trainingClassPK, Long completedTime, Long validUntilTime, Long fromTime, Long thruTime) 091 throws PersistenceNotNullException { 092 super(); 093 constructFields(partyTrainingClassPK, partyTrainingClassName, partyPK, trainingClassPK, completedTime, validUntilTime, fromTime, thruTime); 094 } 095 096 @Override 097 public PartyTrainingClassDetailFactory getBaseFactoryInstance() { 098 return PartyTrainingClassDetailFactory.getInstance(); 099 } 100 101 @Override 102 public PartyTrainingClassDetailValue 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 (PartyTrainingClassDetailValue)result; 113 } 114 115 @Override 116 public PartyTrainingClassDetailPK getPrimaryKey() { 117 if(_primaryKey == null) { 118 _primaryKey = new PartyTrainingClassDetailPK(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 + ((partyTrainingClassPK != null) ? partyTrainingClassPK.hashCode() : 0); 137 hashCode = 37 * hashCode + ((partyTrainingClassName != null) ? partyTrainingClassName.hashCode() : 0); 138 hashCode = 37 * hashCode + ((partyPK != null) ? partyPK.hashCode() : 0); 139 hashCode = 37 * hashCode + ((trainingClassPK != null) ? trainingClassPK.hashCode() : 0); 140 hashCode = 37 * hashCode + ((completedTime != null) ? completedTime.hashCode() : 0); 141 hashCode = 37 * hashCode + ((validUntilTime != null) ? validUntilTime.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 ", partyTrainingClassPK=" + getPartyTrainingClassPK() + 157 ", partyTrainingClassName=" + getPartyTrainingClassName() + 158 ", partyPK=" + getPartyPK() + 159 ", trainingClassPK=" + getTrainingClassPK() + 160 ", completedTime=" + getCompletedTime() + 161 ", validUntilTime=" + getValidUntilTime() + 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 PartyTrainingClassDetailValue 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 PartyTrainingClassDetailValue that) { 196 boolean objectsEqual = true; 197 198 199 if(objectsEqual) { 200 PartyTrainingClassPK thisPartyTrainingClassPK = getPartyTrainingClassPK(); 201 PartyTrainingClassPK thatPartyTrainingClassPK = that.getPartyTrainingClassPK(); 202 203 if(thisPartyTrainingClassPK == null) { 204 objectsEqual = objectsEqual && (thatPartyTrainingClassPK == null); 205 } else { 206 objectsEqual = objectsEqual && thisPartyTrainingClassPK.equals(thatPartyTrainingClassPK); 207 } 208 } 209 210 if(objectsEqual) { 211 String thisPartyTrainingClassName = getPartyTrainingClassName(); 212 String thatPartyTrainingClassName = that.getPartyTrainingClassName(); 213 214 if(thisPartyTrainingClassName == null) { 215 objectsEqual = objectsEqual && (thatPartyTrainingClassName == null); 216 } else { 217 objectsEqual = objectsEqual && thisPartyTrainingClassName.equals(thatPartyTrainingClassName); 218 } 219 } 220 221 if(objectsEqual) { 222 PartyPK thisPartyPK = getPartyPK(); 223 PartyPK thatPartyPK = that.getPartyPK(); 224 225 if(thisPartyPK == null) { 226 objectsEqual = objectsEqual && (thatPartyPK == null); 227 } else { 228 objectsEqual = objectsEqual && thisPartyPK.equals(thatPartyPK); 229 } 230 } 231 232 if(objectsEqual) { 233 TrainingClassPK thisTrainingClassPK = getTrainingClassPK(); 234 TrainingClassPK thatTrainingClassPK = that.getTrainingClassPK(); 235 236 if(thisTrainingClassPK == null) { 237 objectsEqual = objectsEqual && (thatTrainingClassPK == null); 238 } else { 239 objectsEqual = objectsEqual && thisTrainingClassPK.equals(thatTrainingClassPK); 240 } 241 } 242 243 if(objectsEqual) { 244 Long thisCompletedTime = getCompletedTime(); 245 Long thatCompletedTime = that.getCompletedTime(); 246 247 if(thisCompletedTime == null) { 248 objectsEqual = objectsEqual && (thatCompletedTime == null); 249 } else { 250 objectsEqual = objectsEqual && thisCompletedTime.equals(thatCompletedTime); 251 } 252 } 253 254 if(objectsEqual) { 255 Long thisValidUntilTime = getValidUntilTime(); 256 Long thatValidUntilTime = that.getValidUntilTime(); 257 258 if(thisValidUntilTime == null) { 259 objectsEqual = objectsEqual && (thatValidUntilTime == null); 260 } else { 261 objectsEqual = objectsEqual && thisValidUntilTime.equals(thatValidUntilTime); 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 partyTrainingClassPKHasBeenModified || partyTrainingClassNameHasBeenModified || partyPKHasBeenModified || trainingClassPKHasBeenModified || completedTimeHasBeenModified || validUntilTimeHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified; 296 } 297 298 @Override 299 public void clearHasBeenModified() { 300 partyTrainingClassPKHasBeenModified = false; 301 partyTrainingClassNameHasBeenModified = false; 302 partyPKHasBeenModified = false; 303 trainingClassPKHasBeenModified = false; 304 completedTimeHasBeenModified = false; 305 validUntilTimeHasBeenModified = false; 306 fromTimeHasBeenModified = false; 307 thruTimeHasBeenModified = false; 308 } 309 310 public PartyTrainingClassPK getPartyTrainingClassPK() { 311 return partyTrainingClassPK; 312 } 313 314 public void setPartyTrainingClassPK(PartyTrainingClassPK partyTrainingClassPK) 315 throws PersistenceNotNullException { 316 checkForNull(partyTrainingClassPK); 317 318 boolean update = true; 319 320 if(this.partyTrainingClassPK != null) { 321 if(this.partyTrainingClassPK.equals(partyTrainingClassPK)) { 322 update = false; 323 } 324 } else if(partyTrainingClassPK == null) { 325 update = false; 326 } 327 328 if(update) { 329 this.partyTrainingClassPK = partyTrainingClassPK; 330 partyTrainingClassPKHasBeenModified = true; 331 clearHashAndString(); 332 } 333 } 334 335 public boolean getPartyTrainingClassPKHasBeenModified() { 336 return partyTrainingClassPKHasBeenModified; 337 } 338 339 public String getPartyTrainingClassName() { 340 return partyTrainingClassName; 341 } 342 343 public void setPartyTrainingClassName(String partyTrainingClassName) 344 throws PersistenceNotNullException { 345 checkForNull(partyTrainingClassName); 346 347 boolean update = true; 348 349 if(this.partyTrainingClassName != null) { 350 if(this.partyTrainingClassName.equals(partyTrainingClassName)) { 351 update = false; 352 } 353 } else if(partyTrainingClassName == null) { 354 update = false; 355 } 356 357 if(update) { 358 this.partyTrainingClassName = partyTrainingClassName; 359 partyTrainingClassNameHasBeenModified = true; 360 clearHashAndString(); 361 } 362 } 363 364 public boolean getPartyTrainingClassNameHasBeenModified() { 365 return partyTrainingClassNameHasBeenModified; 366 } 367 368 public PartyPK getPartyPK() { 369 return partyPK; 370 } 371 372 public void setPartyPK(PartyPK partyPK) 373 throws PersistenceNotNullException { 374 checkForNull(partyPK); 375 376 boolean update = true; 377 378 if(this.partyPK != null) { 379 if(this.partyPK.equals(partyPK)) { 380 update = false; 381 } 382 } else if(partyPK == null) { 383 update = false; 384 } 385 386 if(update) { 387 this.partyPK = partyPK; 388 partyPKHasBeenModified = true; 389 clearHashAndString(); 390 } 391 } 392 393 public boolean getPartyPKHasBeenModified() { 394 return partyPKHasBeenModified; 395 } 396 397 public TrainingClassPK getTrainingClassPK() { 398 return trainingClassPK; 399 } 400 401 public void setTrainingClassPK(TrainingClassPK trainingClassPK) 402 throws PersistenceNotNullException { 403 checkForNull(trainingClassPK); 404 405 boolean update = true; 406 407 if(this.trainingClassPK != null) { 408 if(this.trainingClassPK.equals(trainingClassPK)) { 409 update = false; 410 } 411 } else if(trainingClassPK == null) { 412 update = false; 413 } 414 415 if(update) { 416 this.trainingClassPK = trainingClassPK; 417 trainingClassPKHasBeenModified = true; 418 clearHashAndString(); 419 } 420 } 421 422 public boolean getTrainingClassPKHasBeenModified() { 423 return trainingClassPKHasBeenModified; 424 } 425 426 public Long getCompletedTime() { 427 return completedTime; 428 } 429 430 public void setCompletedTime(Long completedTime) { 431 boolean update = true; 432 433 if(this.completedTime != null) { 434 if(this.completedTime.equals(completedTime)) { 435 update = false; 436 } 437 } else if(completedTime == null) { 438 update = false; 439 } 440 441 if(update) { 442 this.completedTime = completedTime; 443 completedTimeHasBeenModified = true; 444 clearHashAndString(); 445 } 446 } 447 448 public boolean getCompletedTimeHasBeenModified() { 449 return completedTimeHasBeenModified; 450 } 451 452 public Long getValidUntilTime() { 453 return validUntilTime; 454 } 455 456 public void setValidUntilTime(Long validUntilTime) { 457 boolean update = true; 458 459 if(this.validUntilTime != null) { 460 if(this.validUntilTime.equals(validUntilTime)) { 461 update = false; 462 } 463 } else if(validUntilTime == null) { 464 update = false; 465 } 466 467 if(update) { 468 this.validUntilTime = validUntilTime; 469 validUntilTimeHasBeenModified = true; 470 clearHashAndString(); 471 } 472 } 473 474 public boolean getValidUntilTimeHasBeenModified() { 475 return validUntilTimeHasBeenModified; 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}