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 * 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            _stringValue = "{" + 
171                    "entityId=" + getEntityId() +
172                    ", leavePK=" + getLeavePK() +
173                    ", leaveName=" + getLeaveName() +
174                    ", partyPK=" + getPartyPK() +
175                    ", companyPartyPK=" + getCompanyPartyPK() +
176                    ", leaveTypePK=" + getLeaveTypePK() +
177                    ", leaveReasonPK=" + getLeaveReasonPK() +
178                    ", startTime=" + getStartTime() +
179                    ", endTime=" + getEndTime() +
180                    ", totalTime=" + getTotalTime() +
181                    ", fromTime=" + getFromTime() +
182                    ", thruTime=" + getThruTime() +
183                    "}";
184        }
185        return _stringValue;
186    }
187    
188    @Override
189    public boolean equals(Object other) {
190        if(this == other)
191            return true;
192        
193        if(!hasIdentity())
194            return false;
195        
196        if(other instanceof  LeaveDetailValue that) {
197            if(!that.hasIdentity())
198                return false;
199            
200            Long thisEntityId = getEntityId();
201            Long thatEntityId = that.getEntityId();
202            
203            boolean objectsEqual = thisEntityId.equals(thatEntityId);
204            if(objectsEqual)
205                objectsEqual = isIdentical(that);
206            
207            return objectsEqual;
208        } else {
209            return false;
210        }
211    }
212    
213    public boolean isIdentical(Object other) {
214        if(other instanceof LeaveDetailValue that) {
215            boolean objectsEqual = true;
216            
217            
218            if(objectsEqual) {
219                LeavePK thisLeavePK = getLeavePK();
220                LeavePK thatLeavePK = that.getLeavePK();
221                
222                if(thisLeavePK == null) {
223                    objectsEqual = objectsEqual && (thatLeavePK == null);
224                } else {
225                    objectsEqual = objectsEqual && thisLeavePK.equals(thatLeavePK);
226                }
227            }
228            
229            if(objectsEqual) {
230                String thisLeaveName = getLeaveName();
231                String thatLeaveName = that.getLeaveName();
232                
233                if(thisLeaveName == null) {
234                    objectsEqual = objectsEqual && (thatLeaveName == null);
235                } else {
236                    objectsEqual = objectsEqual && thisLeaveName.equals(thatLeaveName);
237                }
238            }
239            
240            if(objectsEqual) {
241                PartyPK thisPartyPK = getPartyPK();
242                PartyPK thatPartyPK = that.getPartyPK();
243                
244                if(thisPartyPK == null) {
245                    objectsEqual = objectsEqual && (thatPartyPK == null);
246                } else {
247                    objectsEqual = objectsEqual && thisPartyPK.equals(thatPartyPK);
248                }
249            }
250            
251            if(objectsEqual) {
252                PartyPK thisCompanyPartyPK = getCompanyPartyPK();
253                PartyPK thatCompanyPartyPK = that.getCompanyPartyPK();
254                
255                if(thisCompanyPartyPK == null) {
256                    objectsEqual = objectsEqual && (thatCompanyPartyPK == null);
257                } else {
258                    objectsEqual = objectsEqual && thisCompanyPartyPK.equals(thatCompanyPartyPK);
259                }
260            }
261            
262            if(objectsEqual) {
263                LeaveTypePK thisLeaveTypePK = getLeaveTypePK();
264                LeaveTypePK thatLeaveTypePK = that.getLeaveTypePK();
265                
266                if(thisLeaveTypePK == null) {
267                    objectsEqual = objectsEqual && (thatLeaveTypePK == null);
268                } else {
269                    objectsEqual = objectsEqual && thisLeaveTypePK.equals(thatLeaveTypePK);
270                }
271            }
272            
273            if(objectsEqual) {
274                LeaveReasonPK thisLeaveReasonPK = getLeaveReasonPK();
275                LeaveReasonPK thatLeaveReasonPK = that.getLeaveReasonPK();
276                
277                if(thisLeaveReasonPK == null) {
278                    objectsEqual = objectsEqual && (thatLeaveReasonPK == null);
279                } else {
280                    objectsEqual = objectsEqual && thisLeaveReasonPK.equals(thatLeaveReasonPK);
281                }
282            }
283            
284            if(objectsEqual) {
285                Long thisStartTime = getStartTime();
286                Long thatStartTime = that.getStartTime();
287                
288                if(thisStartTime == null) {
289                    objectsEqual = objectsEqual && (thatStartTime == null);
290                } else {
291                    objectsEqual = objectsEqual && thisStartTime.equals(thatStartTime);
292                }
293            }
294            
295            if(objectsEqual) {
296                Long thisEndTime = getEndTime();
297                Long thatEndTime = that.getEndTime();
298                
299                if(thisEndTime == null) {
300                    objectsEqual = objectsEqual && (thatEndTime == null);
301                } else {
302                    objectsEqual = objectsEqual && thisEndTime.equals(thatEndTime);
303                }
304            }
305            
306            if(objectsEqual) {
307                Long thisTotalTime = getTotalTime();
308                Long thatTotalTime = that.getTotalTime();
309                
310                if(thisTotalTime == null) {
311                    objectsEqual = objectsEqual && (thatTotalTime == null);
312                } else {
313                    objectsEqual = objectsEqual && thisTotalTime.equals(thatTotalTime);
314                }
315            }
316            
317            if(objectsEqual) {
318                Long thisFromTime = getFromTime();
319                Long thatFromTime = that.getFromTime();
320                
321                if(thisFromTime == null) {
322                    objectsEqual = objectsEqual && (thatFromTime == null);
323                } else {
324                    objectsEqual = objectsEqual && thisFromTime.equals(thatFromTime);
325                }
326            }
327            
328            if(objectsEqual) {
329                Long thisThruTime = getThruTime();
330                Long thatThruTime = that.getThruTime();
331                
332                if(thisThruTime == null) {
333                    objectsEqual = objectsEqual && (thatThruTime == null);
334                } else {
335                    objectsEqual = objectsEqual && thisThruTime.equals(thatThruTime);
336                }
337            }
338            
339            return objectsEqual;
340        } else {
341            return false;
342        }
343    }
344    
345    @Override
346    public boolean hasBeenModified() {
347        return leavePKHasBeenModified || leaveNameHasBeenModified || partyPKHasBeenModified || companyPartyPKHasBeenModified || leaveTypePKHasBeenModified || leaveReasonPKHasBeenModified || startTimeHasBeenModified || endTimeHasBeenModified || totalTimeHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified;
348    }
349    
350    @Override
351    public void clearHasBeenModified() {
352        leavePKHasBeenModified = false;
353        leaveNameHasBeenModified = false;
354        partyPKHasBeenModified = false;
355        companyPartyPKHasBeenModified = false;
356        leaveTypePKHasBeenModified = false;
357        leaveReasonPKHasBeenModified = false;
358        startTimeHasBeenModified = false;
359        endTimeHasBeenModified = false;
360        totalTimeHasBeenModified = false;
361        fromTimeHasBeenModified = false;
362        thruTimeHasBeenModified = false;
363    }
364    
365    public LeavePK getLeavePK() {
366        return leavePK;
367    }
368    
369    public void setLeavePK(LeavePK leavePK)
370            throws PersistenceNotNullException {
371        checkForNull(leavePK);
372        
373        boolean update = true;
374        
375        if(this.leavePK != null) {
376            if(this.leavePK.equals(leavePK)) {
377                update = false;
378            }
379        } else if(leavePK == null) {
380            update = false;
381        }
382        
383        if(update) {
384            this.leavePK = leavePK;
385            leavePKHasBeenModified = true;
386            clearHashAndString();
387        }
388    }
389    
390    public boolean getLeavePKHasBeenModified() {
391        return leavePKHasBeenModified;
392    }
393    
394    public String getLeaveName() {
395        return leaveName;
396    }
397    
398    public void setLeaveName(String leaveName)
399            throws PersistenceNotNullException {
400        checkForNull(leaveName);
401        
402        boolean update = true;
403        
404        if(this.leaveName != null) {
405            if(this.leaveName.equals(leaveName)) {
406                update = false;
407            }
408        } else if(leaveName == null) {
409            update = false;
410        }
411        
412        if(update) {
413            this.leaveName = leaveName;
414            leaveNameHasBeenModified = true;
415            clearHashAndString();
416        }
417    }
418    
419    public boolean getLeaveNameHasBeenModified() {
420        return leaveNameHasBeenModified;
421    }
422    
423    public PartyPK getPartyPK() {
424        return partyPK;
425    }
426    
427    public void setPartyPK(PartyPK partyPK)
428            throws PersistenceNotNullException {
429        checkForNull(partyPK);
430        
431        boolean update = true;
432        
433        if(this.partyPK != null) {
434            if(this.partyPK.equals(partyPK)) {
435                update = false;
436            }
437        } else if(partyPK == null) {
438            update = false;
439        }
440        
441        if(update) {
442            this.partyPK = partyPK;
443            partyPKHasBeenModified = true;
444            clearHashAndString();
445        }
446    }
447    
448    public boolean getPartyPKHasBeenModified() {
449        return partyPKHasBeenModified;
450    }
451    
452    public PartyPK getCompanyPartyPK() {
453        return companyPartyPK;
454    }
455    
456    public void setCompanyPartyPK(PartyPK companyPartyPK)
457            throws PersistenceNotNullException {
458        checkForNull(companyPartyPK);
459        
460        boolean update = true;
461        
462        if(this.companyPartyPK != null) {
463            if(this.companyPartyPK.equals(companyPartyPK)) {
464                update = false;
465            }
466        } else if(companyPartyPK == null) {
467            update = false;
468        }
469        
470        if(update) {
471            this.companyPartyPK = companyPartyPK;
472            companyPartyPKHasBeenModified = true;
473            clearHashAndString();
474        }
475    }
476    
477    public boolean getCompanyPartyPKHasBeenModified() {
478        return companyPartyPKHasBeenModified;
479    }
480    
481    public LeaveTypePK getLeaveTypePK() {
482        return leaveTypePK;
483    }
484    
485    public void setLeaveTypePK(LeaveTypePK leaveTypePK)
486            throws PersistenceNotNullException {
487        checkForNull(leaveTypePK);
488        
489        boolean update = true;
490        
491        if(this.leaveTypePK != null) {
492            if(this.leaveTypePK.equals(leaveTypePK)) {
493                update = false;
494            }
495        } else if(leaveTypePK == null) {
496            update = false;
497        }
498        
499        if(update) {
500            this.leaveTypePK = leaveTypePK;
501            leaveTypePKHasBeenModified = true;
502            clearHashAndString();
503        }
504    }
505    
506    public boolean getLeaveTypePKHasBeenModified() {
507        return leaveTypePKHasBeenModified;
508    }
509    
510    public LeaveReasonPK getLeaveReasonPK() {
511        return leaveReasonPK;
512    }
513    
514    public void setLeaveReasonPK(LeaveReasonPK leaveReasonPK)
515            throws PersistenceNotNullException {
516        checkForNull(leaveReasonPK);
517        
518        boolean update = true;
519        
520        if(this.leaveReasonPK != null) {
521            if(this.leaveReasonPK.equals(leaveReasonPK)) {
522                update = false;
523            }
524        } else if(leaveReasonPK == null) {
525            update = false;
526        }
527        
528        if(update) {
529            this.leaveReasonPK = leaveReasonPK;
530            leaveReasonPKHasBeenModified = true;
531            clearHashAndString();
532        }
533    }
534    
535    public boolean getLeaveReasonPKHasBeenModified() {
536        return leaveReasonPKHasBeenModified;
537    }
538    
539    public Long getStartTime() {
540        return startTime;
541    }
542    
543    public void setStartTime(Long startTime)
544            throws PersistenceNotNullException {
545        checkForNull(startTime);
546        
547        boolean update = true;
548        
549        if(this.startTime != null) {
550            if(this.startTime.equals(startTime)) {
551                update = false;
552            }
553        } else if(startTime == null) {
554            update = false;
555        }
556        
557        if(update) {
558            this.startTime = startTime;
559            startTimeHasBeenModified = true;
560            clearHashAndString();
561        }
562    }
563    
564    public boolean getStartTimeHasBeenModified() {
565        return startTimeHasBeenModified;
566    }
567    
568    public Long getEndTime() {
569        return endTime;
570    }
571    
572    public void setEndTime(Long endTime) {
573        boolean update = true;
574        
575        if(this.endTime != null) {
576            if(this.endTime.equals(endTime)) {
577                update = false;
578            }
579        } else if(endTime == null) {
580            update = false;
581        }
582        
583        if(update) {
584            this.endTime = endTime;
585            endTimeHasBeenModified = true;
586            clearHashAndString();
587        }
588    }
589    
590    public boolean getEndTimeHasBeenModified() {
591        return endTimeHasBeenModified;
592    }
593    
594    public Long getTotalTime() {
595        return totalTime;
596    }
597    
598    public void setTotalTime(Long totalTime) {
599        boolean update = true;
600        
601        if(this.totalTime != null) {
602            if(this.totalTime.equals(totalTime)) {
603                update = false;
604            }
605        } else if(totalTime == null) {
606            update = false;
607        }
608        
609        if(update) {
610            this.totalTime = totalTime;
611            totalTimeHasBeenModified = true;
612            clearHashAndString();
613        }
614    }
615    
616    public boolean getTotalTimeHasBeenModified() {
617        return totalTimeHasBeenModified;
618    }
619    
620    public Long getFromTime() {
621        return fromTime;
622    }
623    
624    public void setFromTime(Long fromTime)
625            throws PersistenceNotNullException {
626        checkForNull(fromTime);
627        
628        boolean update = true;
629        
630        if(this.fromTime != null) {
631            if(this.fromTime.equals(fromTime)) {
632                update = false;
633            }
634        } else if(fromTime == null) {
635            update = false;
636        }
637        
638        if(update) {
639            this.fromTime = fromTime;
640            fromTimeHasBeenModified = true;
641            clearHashAndString();
642        }
643    }
644    
645    public boolean getFromTimeHasBeenModified() {
646        return fromTimeHasBeenModified;
647    }
648    
649    public Long getThruTime() {
650        return thruTime;
651    }
652    
653    public void setThruTime(Long thruTime)
654            throws PersistenceNotNullException {
655        checkForNull(thruTime);
656        
657        boolean update = true;
658        
659        if(this.thruTime != null) {
660            if(this.thruTime.equals(thruTime)) {
661                update = false;
662            }
663        } else if(thruTime == null) {
664            update = false;
665        }
666        
667        if(update) {
668            this.thruTime = thruTime;
669            thruTimeHasBeenModified = true;
670            clearHashAndString();
671        }
672    }
673    
674    public boolean getThruTimeHasBeenModified() {
675        return thruTimeHasBeenModified;
676    }
677    
678}