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