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