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