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 * 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
041import javax.annotation.Nonnull;
042import javax.annotation.Nullable;
043
044public class EmploymentDetailValue
045        extends BaseValue<EmploymentDetailPK>
046        implements Cloneable, Serializable {
047    
048    private EmploymentPK employmentPK;
049    private boolean employmentPKHasBeenModified = false;
050    private String employmentName;
051    private boolean employmentNameHasBeenModified = false;
052    private PartyPK partyPK;
053    private boolean partyPKHasBeenModified = false;
054    private PartyPK companyPartyPK;
055    private boolean companyPartyPKHasBeenModified = false;
056    private Long startTime;
057    private boolean startTimeHasBeenModified = false;
058    private Long endTime;
059    private boolean endTimeHasBeenModified = false;
060    private TerminationTypePK terminationTypePK;
061    private boolean terminationTypePKHasBeenModified = false;
062    private TerminationReasonPK terminationReasonPK;
063    private boolean terminationReasonPKHasBeenModified = false;
064    private Long fromTime;
065    private boolean fromTimeHasBeenModified = false;
066    private Long thruTime;
067    private boolean thruTimeHasBeenModified = false;
068    
069    private transient Integer _hashCode = null;
070    private transient String _stringValue = null;
071    
072    private void constructFields(EmploymentPK employmentPK, String employmentName, PartyPK partyPK, PartyPK companyPartyPK, Long startTime, Long endTime, TerminationTypePK terminationTypePK, TerminationReasonPK terminationReasonPK, Long fromTime, Long thruTime)
073            throws PersistenceNotNullException {
074        checkForNull(employmentPK);
075        this.employmentPK = employmentPK;
076        checkForNull(employmentName);
077        this.employmentName = employmentName;
078        checkForNull(partyPK);
079        this.partyPK = partyPK;
080        checkForNull(companyPartyPK);
081        this.companyPartyPK = companyPartyPK;
082        checkForNull(startTime);
083        this.startTime = startTime;
084        this.endTime = endTime;
085        this.terminationTypePK = terminationTypePK;
086        this.terminationReasonPK = terminationReasonPK;
087        checkForNull(fromTime);
088        this.fromTime = fromTime;
089        checkForNull(thruTime);
090        this.thruTime = thruTime;
091    }
092    
093    /** Creates a new instance of EmploymentDetailValue */
094    public EmploymentDetailValue(EmploymentDetailPK employmentDetailPK, EmploymentPK employmentPK, String employmentName, PartyPK partyPK, PartyPK companyPartyPK, Long startTime, Long endTime, TerminationTypePK terminationTypePK, TerminationReasonPK terminationReasonPK, Long fromTime, Long thruTime)
095            throws PersistenceNotNullException {
096        super(employmentDetailPK);
097        constructFields(employmentPK, employmentName, partyPK, companyPartyPK, startTime, endTime, terminationTypePK, terminationReasonPK, fromTime, thruTime);
098    }
099    
100    /** Creates a new instance of EmploymentDetailValue */
101    public EmploymentDetailValue(EmploymentPK employmentPK, String employmentName, PartyPK partyPK, PartyPK companyPartyPK, Long startTime, Long endTime, TerminationTypePK terminationTypePK, TerminationReasonPK terminationReasonPK, Long fromTime, Long thruTime)
102            throws PersistenceNotNullException {
103        super();
104        constructFields(employmentPK, employmentName, partyPK, companyPartyPK, startTime, endTime, terminationTypePK, terminationReasonPK, fromTime, thruTime);
105    }
106    
107    @Override
108    @Nonnull
109    public EmploymentDetailFactory getBaseFactoryInstance() {
110        return EmploymentDetailFactory.getInstance();
111    }
112    
113    @Override
114    @Nonnull
115    public EmploymentDetailValue 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 (EmploymentDetailValue)result;
126    }
127    
128    @Override
129    @Nonnull
130    public EmploymentDetailPK getPrimaryKey() {
131        if(_primaryKey == null) {
132            _primaryKey = new EmploymentDetailPK(entityId);
133        }
134        
135        return _primaryKey;
136    }
137    
138    private void clearHashAndString() {
139        _hashCode = null;
140        _stringValue = null;
141    }
142    
143    @Override
144    public int hashCode() {
145        if(_hashCode == null) {
146            int hashCode = 17;
147            
148            hashCode = 37 * hashCode + ((entityId != null) ? entityId.hashCode() : 0);
149            
150            hashCode = 37 * hashCode + ((employmentPK != null) ? employmentPK.hashCode() : 0);
151            hashCode = 37 * hashCode + ((employmentName != null) ? employmentName.hashCode() : 0);
152            hashCode = 37 * hashCode + ((partyPK != null) ? partyPK.hashCode() : 0);
153            hashCode = 37 * hashCode + ((companyPartyPK != null) ? companyPartyPK.hashCode() : 0);
154            hashCode = 37 * hashCode + ((startTime != null) ? startTime.hashCode() : 0);
155            hashCode = 37 * hashCode + ((endTime != null) ? endTime.hashCode() : 0);
156            hashCode = 37 * hashCode + ((terminationTypePK != null) ? terminationTypePK.hashCode() : 0);
157            hashCode = 37 * hashCode + ((terminationReasonPK != null) ? terminationReasonPK.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    @Nonnull
169    public String toString() {
170        if(_stringValue == null) {
171            _stringValue = "{" + 
172                    "entityId=" + getEntityId() +
173                    ", employmentPK=" + getEmploymentPK() +
174                    ", employmentName=" + getEmploymentName() +
175                    ", partyPK=" + getPartyPK() +
176                    ", companyPartyPK=" + getCompanyPartyPK() +
177                    ", startTime=" + getStartTime() +
178                    ", endTime=" + getEndTime() +
179                    ", terminationTypePK=" + getTerminationTypePK() +
180                    ", terminationReasonPK=" + getTerminationReasonPK() +
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  EmploymentDetailValue 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 EmploymentDetailValue that) {
215            boolean objectsEqual = true;
216            
217            
218            if(objectsEqual) {
219                EmploymentPK thisEmploymentPK = getEmploymentPK();
220                EmploymentPK thatEmploymentPK = that.getEmploymentPK();
221                
222                if(thisEmploymentPK == null) {
223                    objectsEqual = objectsEqual && (thatEmploymentPK == null);
224                } else {
225                    objectsEqual = objectsEqual && thisEmploymentPK.equals(thatEmploymentPK);
226                }
227            }
228            
229            if(objectsEqual) {
230                String thisEmploymentName = getEmploymentName();
231                String thatEmploymentName = that.getEmploymentName();
232                
233                if(thisEmploymentName == null) {
234                    objectsEqual = objectsEqual && (thatEmploymentName == null);
235                } else {
236                    objectsEqual = objectsEqual && thisEmploymentName.equals(thatEmploymentName);
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                Long thisStartTime = getStartTime();
264                Long thatStartTime = that.getStartTime();
265                
266                if(thisStartTime == null) {
267                    objectsEqual = objectsEqual && (thatStartTime == null);
268                } else {
269                    objectsEqual = objectsEqual && thisStartTime.equals(thatStartTime);
270                }
271            }
272            
273            if(objectsEqual) {
274                Long thisEndTime = getEndTime();
275                Long thatEndTime = that.getEndTime();
276                
277                if(thisEndTime == null) {
278                    objectsEqual = objectsEqual && (thatEndTime == null);
279                } else {
280                    objectsEqual = objectsEqual && thisEndTime.equals(thatEndTime);
281                }
282            }
283            
284            if(objectsEqual) {
285                TerminationTypePK thisTerminationTypePK = getTerminationTypePK();
286                TerminationTypePK thatTerminationTypePK = that.getTerminationTypePK();
287                
288                if(thisTerminationTypePK == null) {
289                    objectsEqual = objectsEqual && (thatTerminationTypePK == null);
290                } else {
291                    objectsEqual = objectsEqual && thisTerminationTypePK.equals(thatTerminationTypePK);
292                }
293            }
294            
295            if(objectsEqual) {
296                TerminationReasonPK thisTerminationReasonPK = getTerminationReasonPK();
297                TerminationReasonPK thatTerminationReasonPK = that.getTerminationReasonPK();
298                
299                if(thisTerminationReasonPK == null) {
300                    objectsEqual = objectsEqual && (thatTerminationReasonPK == null);
301                } else {
302                    objectsEqual = objectsEqual && thisTerminationReasonPK.equals(thatTerminationReasonPK);
303                }
304            }
305            
306            if(objectsEqual) {
307                Long thisFromTime = getFromTime();
308                Long thatFromTime = that.getFromTime();
309                
310                if(thisFromTime == null) {
311                    objectsEqual = objectsEqual && (thatFromTime == null);
312                } else {
313                    objectsEqual = objectsEqual && thisFromTime.equals(thatFromTime);
314                }
315            }
316            
317            if(objectsEqual) {
318                Long thisThruTime = getThruTime();
319                Long thatThruTime = that.getThruTime();
320                
321                if(thisThruTime == null) {
322                    objectsEqual = objectsEqual && (thatThruTime == null);
323                } else {
324                    objectsEqual = objectsEqual && thisThruTime.equals(thatThruTime);
325                }
326            }
327            
328            return objectsEqual;
329        } else {
330            return false;
331        }
332    }
333    
334    @Override
335    public boolean hasBeenModified() {
336        return employmentPKHasBeenModified || employmentNameHasBeenModified || partyPKHasBeenModified || companyPartyPKHasBeenModified || startTimeHasBeenModified || endTimeHasBeenModified || terminationTypePKHasBeenModified || terminationReasonPKHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified;
337    }
338    
339    @Override
340    public void clearHasBeenModified() {
341        employmentPKHasBeenModified = false;
342        employmentNameHasBeenModified = false;
343        partyPKHasBeenModified = false;
344        companyPartyPKHasBeenModified = false;
345        startTimeHasBeenModified = false;
346        endTimeHasBeenModified = false;
347        terminationTypePKHasBeenModified = false;
348        terminationReasonPKHasBeenModified = false;
349        fromTimeHasBeenModified = false;
350        thruTimeHasBeenModified = false;
351    }
352    
353    @Nonnull
354    public EmploymentPK getEmploymentPK() {
355        return employmentPK;
356    }
357    
358    public void setEmploymentPK(@Nonnull EmploymentPK employmentPK)
359            throws PersistenceNotNullException {
360        checkForNull(employmentPK);
361        
362        boolean update = true;
363        
364        if(this.employmentPK != null) {
365            if(this.employmentPK.equals(employmentPK)) {
366                update = false;
367            }
368        } else if(employmentPK == null) {
369            update = false;
370        }
371        
372        if(update) {
373            this.employmentPK = employmentPK;
374            employmentPKHasBeenModified = true;
375            clearHashAndString();
376        }
377    }
378    
379    public boolean getEmploymentPKHasBeenModified() {
380        return employmentPKHasBeenModified;
381    }
382    
383    @Nonnull
384    public String getEmploymentName() {
385        return employmentName;
386    }
387    
388    public void setEmploymentName(@Nonnull String employmentName)
389            throws PersistenceNotNullException {
390        checkForNull(employmentName);
391        
392        boolean update = true;
393        
394        if(this.employmentName != null) {
395            if(this.employmentName.equals(employmentName)) {
396                update = false;
397            }
398        } else if(employmentName == null) {
399            update = false;
400        }
401        
402        if(update) {
403            this.employmentName = employmentName;
404            employmentNameHasBeenModified = true;
405            clearHashAndString();
406        }
407    }
408    
409    public boolean getEmploymentNameHasBeenModified() {
410        return employmentNameHasBeenModified;
411    }
412    
413    @Nonnull
414    public PartyPK getPartyPK() {
415        return partyPK;
416    }
417    
418    public void setPartyPK(@Nonnull PartyPK partyPK)
419            throws PersistenceNotNullException {
420        checkForNull(partyPK);
421        
422        boolean update = true;
423        
424        if(this.partyPK != null) {
425            if(this.partyPK.equals(partyPK)) {
426                update = false;
427            }
428        } else if(partyPK == null) {
429            update = false;
430        }
431        
432        if(update) {
433            this.partyPK = partyPK;
434            partyPKHasBeenModified = true;
435            clearHashAndString();
436        }
437    }
438    
439    public boolean getPartyPKHasBeenModified() {
440        return partyPKHasBeenModified;
441    }
442    
443    @Nonnull
444    public PartyPK getCompanyPartyPK() {
445        return companyPartyPK;
446    }
447    
448    public void setCompanyPartyPK(@Nonnull PartyPK companyPartyPK)
449            throws PersistenceNotNullException {
450        checkForNull(companyPartyPK);
451        
452        boolean update = true;
453        
454        if(this.companyPartyPK != null) {
455            if(this.companyPartyPK.equals(companyPartyPK)) {
456                update = false;
457            }
458        } else if(companyPartyPK == null) {
459            update = false;
460        }
461        
462        if(update) {
463            this.companyPartyPK = companyPartyPK;
464            companyPartyPKHasBeenModified = true;
465            clearHashAndString();
466        }
467    }
468    
469    public boolean getCompanyPartyPKHasBeenModified() {
470        return companyPartyPKHasBeenModified;
471    }
472    
473    @Nonnull
474    public Long getStartTime() {
475        return startTime;
476    }
477    
478    public void setStartTime(@Nonnull Long startTime)
479            throws PersistenceNotNullException {
480        checkForNull(startTime);
481        
482        boolean update = true;
483        
484        if(this.startTime != null) {
485            if(this.startTime.equals(startTime)) {
486                update = false;
487            }
488        } else if(startTime == null) {
489            update = false;
490        }
491        
492        if(update) {
493            this.startTime = startTime;
494            startTimeHasBeenModified = true;
495            clearHashAndString();
496        }
497    }
498    
499    public boolean getStartTimeHasBeenModified() {
500        return startTimeHasBeenModified;
501    }
502    
503    @Nullable
504    public Long getEndTime() {
505        return endTime;
506    }
507    
508    public void setEndTime(@Nullable Long endTime) {
509        boolean update = true;
510        
511        if(this.endTime != null) {
512            if(this.endTime.equals(endTime)) {
513                update = false;
514            }
515        } else if(endTime == null) {
516            update = false;
517        }
518        
519        if(update) {
520            this.endTime = endTime;
521            endTimeHasBeenModified = true;
522            clearHashAndString();
523        }
524    }
525    
526    public boolean getEndTimeHasBeenModified() {
527        return endTimeHasBeenModified;
528    }
529    
530    @Nullable
531    public TerminationTypePK getTerminationTypePK() {
532        return terminationTypePK;
533    }
534    
535    public void setTerminationTypePK(@Nullable TerminationTypePK terminationTypePK) {
536        boolean update = true;
537        
538        if(this.terminationTypePK != null) {
539            if(this.terminationTypePK.equals(terminationTypePK)) {
540                update = false;
541            }
542        } else if(terminationTypePK == null) {
543            update = false;
544        }
545        
546        if(update) {
547            this.terminationTypePK = terminationTypePK;
548            terminationTypePKHasBeenModified = true;
549            clearHashAndString();
550        }
551    }
552    
553    public boolean getTerminationTypePKHasBeenModified() {
554        return terminationTypePKHasBeenModified;
555    }
556    
557    @Nullable
558    public TerminationReasonPK getTerminationReasonPK() {
559        return terminationReasonPK;
560    }
561    
562    public void setTerminationReasonPK(@Nullable TerminationReasonPK terminationReasonPK) {
563        boolean update = true;
564        
565        if(this.terminationReasonPK != null) {
566            if(this.terminationReasonPK.equals(terminationReasonPK)) {
567                update = false;
568            }
569        } else if(terminationReasonPK == null) {
570            update = false;
571        }
572        
573        if(update) {
574            this.terminationReasonPK = terminationReasonPK;
575            terminationReasonPKHasBeenModified = true;
576            clearHashAndString();
577        }
578    }
579    
580    public boolean getTerminationReasonPKHasBeenModified() {
581        return terminationReasonPKHasBeenModified;
582    }
583    
584    @Nonnull
585    public Long getFromTime() {
586        return fromTime;
587    }
588    
589    public void setFromTime(@Nonnull Long fromTime)
590            throws PersistenceNotNullException {
591        checkForNull(fromTime);
592        
593        boolean update = true;
594        
595        if(this.fromTime != null) {
596            if(this.fromTime.equals(fromTime)) {
597                update = false;
598            }
599        } else if(fromTime == null) {
600            update = false;
601        }
602        
603        if(update) {
604            this.fromTime = fromTime;
605            fromTimeHasBeenModified = true;
606            clearHashAndString();
607        }
608    }
609    
610    public boolean getFromTimeHasBeenModified() {
611        return fromTimeHasBeenModified;
612    }
613    
614    @Nonnull
615    public Long getThruTime() {
616        return thruTime;
617    }
618    
619    public void setThruTime(@Nonnull Long thruTime)
620            throws PersistenceNotNullException {
621        checkForNull(thruTime);
622        
623        boolean update = true;
624        
625        if(this.thruTime != null) {
626            if(this.thruTime.equals(thruTime)) {
627                update = false;
628            }
629        } else if(thruTime == null) {
630            update = false;
631        }
632        
633        if(update) {
634            this.thruTime = thruTime;
635            thruTimeHasBeenModified = true;
636            clearHashAndString();
637        }
638    }
639    
640    public boolean getThruTimeHasBeenModified() {
641        return thruTimeHasBeenModified;
642    }
643    
644}