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 * EmploymentDetailValue.java 021 */ 022 023package com.echothree.model.data.employee.server.value; 024 025import com.echothree.model.data.employee.common.pk.EmploymentDetailPK; 026 027import com.echothree.model.data.employee.server.factory.EmploymentDetailFactory; 028 029import com.echothree.model.data.employee.common.pk.EmploymentPK; 030import com.echothree.model.data.party.common.pk.PartyPK; 031import com.echothree.model.data.employee.common.pk.TerminationTypePK; 032import com.echothree.model.data.employee.common.pk.TerminationReasonPK; 033 034import com.echothree.util.common.exception.PersistenceCloneException; 035import com.echothree.util.common.exception.PersistenceNotNullException; 036 037import com.echothree.util.server.persistence.BaseValue; 038 039import java.io.Serializable; 040 041public class EmploymentDetailValue 042 extends BaseValue<EmploymentDetailPK> 043 implements Cloneable, Serializable { 044 045 private EmploymentPK employmentPK; 046 private boolean employmentPKHasBeenModified = false; 047 private String employmentName; 048 private boolean employmentNameHasBeenModified = false; 049 private PartyPK partyPK; 050 private boolean partyPKHasBeenModified = false; 051 private PartyPK companyPartyPK; 052 private boolean companyPartyPKHasBeenModified = false; 053 private Long startTime; 054 private boolean startTimeHasBeenModified = false; 055 private Long endTime; 056 private boolean endTimeHasBeenModified = false; 057 private TerminationTypePK terminationTypePK; 058 private boolean terminationTypePKHasBeenModified = false; 059 private TerminationReasonPK terminationReasonPK; 060 private boolean terminationReasonPKHasBeenModified = false; 061 private Long fromTime; 062 private boolean fromTimeHasBeenModified = false; 063 private Long thruTime; 064 private boolean thruTimeHasBeenModified = false; 065 066 private transient Integer _hashCode = null; 067 private transient String _stringValue = null; 068 069 private void constructFields(EmploymentPK employmentPK, String employmentName, PartyPK partyPK, PartyPK companyPartyPK, Long startTime, Long endTime, TerminationTypePK terminationTypePK, TerminationReasonPK terminationReasonPK, Long fromTime, Long thruTime) 070 throws PersistenceNotNullException { 071 checkForNull(employmentPK); 072 this.employmentPK = employmentPK; 073 checkForNull(employmentName); 074 this.employmentName = employmentName; 075 checkForNull(partyPK); 076 this.partyPK = partyPK; 077 checkForNull(companyPartyPK); 078 this.companyPartyPK = companyPartyPK; 079 checkForNull(startTime); 080 this.startTime = startTime; 081 this.endTime = endTime; 082 this.terminationTypePK = terminationTypePK; 083 this.terminationReasonPK = terminationReasonPK; 084 checkForNull(fromTime); 085 this.fromTime = fromTime; 086 checkForNull(thruTime); 087 this.thruTime = thruTime; 088 } 089 090 /** Creates a new instance of EmploymentDetailValue */ 091 public EmploymentDetailValue(EmploymentDetailPK employmentDetailPK, EmploymentPK employmentPK, String employmentName, PartyPK partyPK, PartyPK companyPartyPK, Long startTime, Long endTime, TerminationTypePK terminationTypePK, TerminationReasonPK terminationReasonPK, Long fromTime, Long thruTime) 092 throws PersistenceNotNullException { 093 super(employmentDetailPK); 094 constructFields(employmentPK, employmentName, partyPK, companyPartyPK, startTime, endTime, terminationTypePK, terminationReasonPK, fromTime, thruTime); 095 } 096 097 /** Creates a new instance of EmploymentDetailValue */ 098 public EmploymentDetailValue(EmploymentPK employmentPK, String employmentName, PartyPK partyPK, PartyPK companyPartyPK, Long startTime, Long endTime, TerminationTypePK terminationTypePK, TerminationReasonPK terminationReasonPK, Long fromTime, Long thruTime) 099 throws PersistenceNotNullException { 100 super(); 101 constructFields(employmentPK, employmentName, partyPK, companyPartyPK, startTime, endTime, terminationTypePK, terminationReasonPK, fromTime, thruTime); 102 } 103 104 @Override 105 public EmploymentDetailFactory getBaseFactoryInstance() { 106 return EmploymentDetailFactory.getInstance(); 107 } 108 109 @Override 110 public EmploymentDetailValue clone() { 111 Object result; 112 113 try { 114 result = super.clone(); 115 } catch (CloneNotSupportedException cnse) { 116 // This shouldn't happen, fail when it does. 117 throw new PersistenceCloneException(cnse); 118 } 119 120 return (EmploymentDetailValue)result; 121 } 122 123 @Override 124 public EmploymentDetailPK getPrimaryKey() { 125 if(_primaryKey == null) { 126 _primaryKey = new EmploymentDetailPK(entityId); 127 } 128 129 return _primaryKey; 130 } 131 132 private void clearHashAndString() { 133 _hashCode = null; 134 _stringValue = null; 135 } 136 137 @Override 138 public int hashCode() { 139 if(_hashCode == null) { 140 int hashCode = 17; 141 142 hashCode = 37 * hashCode + ((entityId != null) ? entityId.hashCode() : 0); 143 144 hashCode = 37 * hashCode + ((employmentPK != null) ? employmentPK.hashCode() : 0); 145 hashCode = 37 * hashCode + ((employmentName != null) ? employmentName.hashCode() : 0); 146 hashCode = 37 * hashCode + ((partyPK != null) ? partyPK.hashCode() : 0); 147 hashCode = 37 * hashCode + ((companyPartyPK != null) ? companyPartyPK.hashCode() : 0); 148 hashCode = 37 * hashCode + ((startTime != null) ? startTime.hashCode() : 0); 149 hashCode = 37 * hashCode + ((endTime != null) ? endTime.hashCode() : 0); 150 hashCode = 37 * hashCode + ((terminationTypePK != null) ? terminationTypePK.hashCode() : 0); 151 hashCode = 37 * hashCode + ((terminationReasonPK != null) ? terminationReasonPK.hashCode() : 0); 152 hashCode = 37 * hashCode + ((fromTime != null) ? fromTime.hashCode() : 0); 153 hashCode = 37 * hashCode + ((thruTime != null) ? thruTime.hashCode() : 0); 154 155 _hashCode = hashCode; 156 } 157 158 return _hashCode; 159 } 160 161 @Override 162 public String toString() { 163 if(_stringValue == null) { 164 _stringValue = "{" + 165 "entityId=" + getEntityId() + 166 ", employmentPK=" + getEmploymentPK() + 167 ", employmentName=" + getEmploymentName() + 168 ", partyPK=" + getPartyPK() + 169 ", companyPartyPK=" + getCompanyPartyPK() + 170 ", startTime=" + getStartTime() + 171 ", endTime=" + getEndTime() + 172 ", terminationTypePK=" + getTerminationTypePK() + 173 ", terminationReasonPK=" + getTerminationReasonPK() + 174 ", fromTime=" + getFromTime() + 175 ", thruTime=" + getThruTime() + 176 "}"; 177 } 178 return _stringValue; 179 } 180 181 @Override 182 public boolean equals(Object other) { 183 if(this == other) 184 return true; 185 186 if(!hasIdentity()) 187 return false; 188 189 if(other instanceof EmploymentDetailValue that) { 190 if(!that.hasIdentity()) 191 return false; 192 193 Long thisEntityId = getEntityId(); 194 Long thatEntityId = that.getEntityId(); 195 196 boolean objectsEqual = thisEntityId.equals(thatEntityId); 197 if(objectsEqual) 198 objectsEqual = isIdentical(that); 199 200 return objectsEqual; 201 } else { 202 return false; 203 } 204 } 205 206 public boolean isIdentical(Object other) { 207 if(other instanceof EmploymentDetailValue that) { 208 boolean objectsEqual = true; 209 210 211 if(objectsEqual) { 212 EmploymentPK thisEmploymentPK = getEmploymentPK(); 213 EmploymentPK thatEmploymentPK = that.getEmploymentPK(); 214 215 if(thisEmploymentPK == null) { 216 objectsEqual = objectsEqual && (thatEmploymentPK == null); 217 } else { 218 objectsEqual = objectsEqual && thisEmploymentPK.equals(thatEmploymentPK); 219 } 220 } 221 222 if(objectsEqual) { 223 String thisEmploymentName = getEmploymentName(); 224 String thatEmploymentName = that.getEmploymentName(); 225 226 if(thisEmploymentName == null) { 227 objectsEqual = objectsEqual && (thatEmploymentName == null); 228 } else { 229 objectsEqual = objectsEqual && thisEmploymentName.equals(thatEmploymentName); 230 } 231 } 232 233 if(objectsEqual) { 234 PartyPK thisPartyPK = getPartyPK(); 235 PartyPK thatPartyPK = that.getPartyPK(); 236 237 if(thisPartyPK == null) { 238 objectsEqual = objectsEqual && (thatPartyPK == null); 239 } else { 240 objectsEqual = objectsEqual && thisPartyPK.equals(thatPartyPK); 241 } 242 } 243 244 if(objectsEqual) { 245 PartyPK thisCompanyPartyPK = getCompanyPartyPK(); 246 PartyPK thatCompanyPartyPK = that.getCompanyPartyPK(); 247 248 if(thisCompanyPartyPK == null) { 249 objectsEqual = objectsEqual && (thatCompanyPartyPK == null); 250 } else { 251 objectsEqual = objectsEqual && thisCompanyPartyPK.equals(thatCompanyPartyPK); 252 } 253 } 254 255 if(objectsEqual) { 256 Long thisStartTime = getStartTime(); 257 Long thatStartTime = that.getStartTime(); 258 259 if(thisStartTime == null) { 260 objectsEqual = objectsEqual && (thatStartTime == null); 261 } else { 262 objectsEqual = objectsEqual && thisStartTime.equals(thatStartTime); 263 } 264 } 265 266 if(objectsEqual) { 267 Long thisEndTime = getEndTime(); 268 Long thatEndTime = that.getEndTime(); 269 270 if(thisEndTime == null) { 271 objectsEqual = objectsEqual && (thatEndTime == null); 272 } else { 273 objectsEqual = objectsEqual && thisEndTime.equals(thatEndTime); 274 } 275 } 276 277 if(objectsEqual) { 278 TerminationTypePK thisTerminationTypePK = getTerminationTypePK(); 279 TerminationTypePK thatTerminationTypePK = that.getTerminationTypePK(); 280 281 if(thisTerminationTypePK == null) { 282 objectsEqual = objectsEqual && (thatTerminationTypePK == null); 283 } else { 284 objectsEqual = objectsEqual && thisTerminationTypePK.equals(thatTerminationTypePK); 285 } 286 } 287 288 if(objectsEqual) { 289 TerminationReasonPK thisTerminationReasonPK = getTerminationReasonPK(); 290 TerminationReasonPK thatTerminationReasonPK = that.getTerminationReasonPK(); 291 292 if(thisTerminationReasonPK == null) { 293 objectsEqual = objectsEqual && (thatTerminationReasonPK == null); 294 } else { 295 objectsEqual = objectsEqual && thisTerminationReasonPK.equals(thatTerminationReasonPK); 296 } 297 } 298 299 if(objectsEqual) { 300 Long thisFromTime = getFromTime(); 301 Long thatFromTime = that.getFromTime(); 302 303 if(thisFromTime == null) { 304 objectsEqual = objectsEqual && (thatFromTime == null); 305 } else { 306 objectsEqual = objectsEqual && thisFromTime.equals(thatFromTime); 307 } 308 } 309 310 if(objectsEqual) { 311 Long thisThruTime = getThruTime(); 312 Long thatThruTime = that.getThruTime(); 313 314 if(thisThruTime == null) { 315 objectsEqual = objectsEqual && (thatThruTime == null); 316 } else { 317 objectsEqual = objectsEqual && thisThruTime.equals(thatThruTime); 318 } 319 } 320 321 return objectsEqual; 322 } else { 323 return false; 324 } 325 } 326 327 @Override 328 public boolean hasBeenModified() { 329 return employmentPKHasBeenModified || employmentNameHasBeenModified || partyPKHasBeenModified || companyPartyPKHasBeenModified || startTimeHasBeenModified || endTimeHasBeenModified || terminationTypePKHasBeenModified || terminationReasonPKHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified; 330 } 331 332 @Override 333 public void clearHasBeenModified() { 334 employmentPKHasBeenModified = false; 335 employmentNameHasBeenModified = false; 336 partyPKHasBeenModified = false; 337 companyPartyPKHasBeenModified = false; 338 startTimeHasBeenModified = false; 339 endTimeHasBeenModified = false; 340 terminationTypePKHasBeenModified = false; 341 terminationReasonPKHasBeenModified = false; 342 fromTimeHasBeenModified = false; 343 thruTimeHasBeenModified = false; 344 } 345 346 public EmploymentPK getEmploymentPK() { 347 return employmentPK; 348 } 349 350 public void setEmploymentPK(EmploymentPK employmentPK) 351 throws PersistenceNotNullException { 352 checkForNull(employmentPK); 353 354 boolean update = true; 355 356 if(this.employmentPK != null) { 357 if(this.employmentPK.equals(employmentPK)) { 358 update = false; 359 } 360 } else if(employmentPK == null) { 361 update = false; 362 } 363 364 if(update) { 365 this.employmentPK = employmentPK; 366 employmentPKHasBeenModified = true; 367 clearHashAndString(); 368 } 369 } 370 371 public boolean getEmploymentPKHasBeenModified() { 372 return employmentPKHasBeenModified; 373 } 374 375 public String getEmploymentName() { 376 return employmentName; 377 } 378 379 public void setEmploymentName(String employmentName) 380 throws PersistenceNotNullException { 381 checkForNull(employmentName); 382 383 boolean update = true; 384 385 if(this.employmentName != null) { 386 if(this.employmentName.equals(employmentName)) { 387 update = false; 388 } 389 } else if(employmentName == null) { 390 update = false; 391 } 392 393 if(update) { 394 this.employmentName = employmentName; 395 employmentNameHasBeenModified = true; 396 clearHashAndString(); 397 } 398 } 399 400 public boolean getEmploymentNameHasBeenModified() { 401 return employmentNameHasBeenModified; 402 } 403 404 public PartyPK getPartyPK() { 405 return partyPK; 406 } 407 408 public void setPartyPK(PartyPK partyPK) 409 throws PersistenceNotNullException { 410 checkForNull(partyPK); 411 412 boolean update = true; 413 414 if(this.partyPK != null) { 415 if(this.partyPK.equals(partyPK)) { 416 update = false; 417 } 418 } else if(partyPK == null) { 419 update = false; 420 } 421 422 if(update) { 423 this.partyPK = partyPK; 424 partyPKHasBeenModified = true; 425 clearHashAndString(); 426 } 427 } 428 429 public boolean getPartyPKHasBeenModified() { 430 return partyPKHasBeenModified; 431 } 432 433 public PartyPK getCompanyPartyPK() { 434 return companyPartyPK; 435 } 436 437 public void setCompanyPartyPK(PartyPK companyPartyPK) 438 throws PersistenceNotNullException { 439 checkForNull(companyPartyPK); 440 441 boolean update = true; 442 443 if(this.companyPartyPK != null) { 444 if(this.companyPartyPK.equals(companyPartyPK)) { 445 update = false; 446 } 447 } else if(companyPartyPK == null) { 448 update = false; 449 } 450 451 if(update) { 452 this.companyPartyPK = companyPartyPK; 453 companyPartyPKHasBeenModified = true; 454 clearHashAndString(); 455 } 456 } 457 458 public boolean getCompanyPartyPKHasBeenModified() { 459 return companyPartyPKHasBeenModified; 460 } 461 462 public Long getStartTime() { 463 return startTime; 464 } 465 466 public void setStartTime(Long startTime) 467 throws PersistenceNotNullException { 468 checkForNull(startTime); 469 470 boolean update = true; 471 472 if(this.startTime != null) { 473 if(this.startTime.equals(startTime)) { 474 update = false; 475 } 476 } else if(startTime == null) { 477 update = false; 478 } 479 480 if(update) { 481 this.startTime = startTime; 482 startTimeHasBeenModified = true; 483 clearHashAndString(); 484 } 485 } 486 487 public boolean getStartTimeHasBeenModified() { 488 return startTimeHasBeenModified; 489 } 490 491 public Long getEndTime() { 492 return endTime; 493 } 494 495 public void setEndTime(Long endTime) { 496 boolean update = true; 497 498 if(this.endTime != null) { 499 if(this.endTime.equals(endTime)) { 500 update = false; 501 } 502 } else if(endTime == null) { 503 update = false; 504 } 505 506 if(update) { 507 this.endTime = endTime; 508 endTimeHasBeenModified = true; 509 clearHashAndString(); 510 } 511 } 512 513 public boolean getEndTimeHasBeenModified() { 514 return endTimeHasBeenModified; 515 } 516 517 public TerminationTypePK getTerminationTypePK() { 518 return terminationTypePK; 519 } 520 521 public void setTerminationTypePK(TerminationTypePK terminationTypePK) { 522 boolean update = true; 523 524 if(this.terminationTypePK != null) { 525 if(this.terminationTypePK.equals(terminationTypePK)) { 526 update = false; 527 } 528 } else if(terminationTypePK == null) { 529 update = false; 530 } 531 532 if(update) { 533 this.terminationTypePK = terminationTypePK; 534 terminationTypePKHasBeenModified = true; 535 clearHashAndString(); 536 } 537 } 538 539 public boolean getTerminationTypePKHasBeenModified() { 540 return terminationTypePKHasBeenModified; 541 } 542 543 public TerminationReasonPK getTerminationReasonPK() { 544 return terminationReasonPK; 545 } 546 547 public void setTerminationReasonPK(TerminationReasonPK terminationReasonPK) { 548 boolean update = true; 549 550 if(this.terminationReasonPK != null) { 551 if(this.terminationReasonPK.equals(terminationReasonPK)) { 552 update = false; 553 } 554 } else if(terminationReasonPK == null) { 555 update = false; 556 } 557 558 if(update) { 559 this.terminationReasonPK = terminationReasonPK; 560 terminationReasonPKHasBeenModified = true; 561 clearHashAndString(); 562 } 563 } 564 565 public boolean getTerminationReasonPKHasBeenModified() { 566 return terminationReasonPKHasBeenModified; 567 } 568 569 public Long getFromTime() { 570 return fromTime; 571 } 572 573 public void setFromTime(Long fromTime) 574 throws PersistenceNotNullException { 575 checkForNull(fromTime); 576 577 boolean update = true; 578 579 if(this.fromTime != null) { 580 if(this.fromTime.equals(fromTime)) { 581 update = false; 582 } 583 } else if(fromTime == null) { 584 update = false; 585 } 586 587 if(update) { 588 this.fromTime = fromTime; 589 fromTimeHasBeenModified = true; 590 clearHashAndString(); 591 } 592 } 593 594 public boolean getFromTimeHasBeenModified() { 595 return fromTimeHasBeenModified; 596 } 597 598 public Long getThruTime() { 599 return thruTime; 600 } 601 602 public void setThruTime(Long thruTime) 603 throws PersistenceNotNullException { 604 checkForNull(thruTime); 605 606 boolean update = true; 607 608 if(this.thruTime != null) { 609 if(this.thruTime.equals(thruTime)) { 610 update = false; 611 } 612 } else if(thruTime == null) { 613 update = false; 614 } 615 616 if(update) { 617 this.thruTime = thruTime; 618 thruTimeHasBeenModified = true; 619 clearHashAndString(); 620 } 621 } 622 623 public boolean getThruTimeHasBeenModified() { 624 return thruTimeHasBeenModified; 625 } 626 627}