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 * GlAccountDetailValue.java
021 */
022
023package com.echothree.model.data.accounting.server.value;
024
025import com.echothree.model.data.accounting.common.pk.GlAccountDetailPK;
026
027import com.echothree.model.data.accounting.server.factory.GlAccountDetailFactory;
028
029import com.echothree.model.data.accounting.common.pk.GlAccountPK;
030import com.echothree.model.data.accounting.common.pk.GlAccountTypePK;
031import com.echothree.model.data.accounting.common.pk.GlAccountClassPK;
032import com.echothree.model.data.accounting.common.pk.GlAccountCategoryPK;
033import com.echothree.model.data.accounting.common.pk.GlResourceTypePK;
034import com.echothree.model.data.accounting.common.pk.CurrencyPK;
035
036import com.echothree.util.common.exception.PersistenceCloneException;
037import com.echothree.util.common.exception.PersistenceNotNullException;
038
039import com.echothree.util.server.persistence.BaseValue;
040
041import java.io.Serializable;
042
043public class GlAccountDetailValue
044        extends BaseValue<GlAccountDetailPK>
045        implements Cloneable, Serializable {
046    
047    private GlAccountPK glAccountPK;
048    private boolean glAccountPKHasBeenModified = false;
049    private String glAccountName;
050    private boolean glAccountNameHasBeenModified = false;
051    private GlAccountPK parentGlAccountPK;
052    private boolean parentGlAccountPKHasBeenModified = false;
053    private GlAccountTypePK glAccountTypePK;
054    private boolean glAccountTypePKHasBeenModified = false;
055    private GlAccountClassPK glAccountClassPK;
056    private boolean glAccountClassPKHasBeenModified = false;
057    private GlAccountCategoryPK glAccountCategoryPK;
058    private boolean glAccountCategoryPKHasBeenModified = false;
059    private GlResourceTypePK glResourceTypePK;
060    private boolean glResourceTypePKHasBeenModified = false;
061    private CurrencyPK currencyPK;
062    private boolean currencyPKHasBeenModified = false;
063    private Boolean isDefault;
064    private boolean isDefaultHasBeenModified = false;
065    private Long fromTime;
066    private boolean fromTimeHasBeenModified = false;
067    private Long thruTime;
068    private boolean thruTimeHasBeenModified = false;
069    
070    private transient Integer _hashCode = null;
071    private transient String _stringValue = null;
072    
073    private void constructFields(GlAccountPK glAccountPK, String glAccountName, GlAccountPK parentGlAccountPK, GlAccountTypePK glAccountTypePK, GlAccountClassPK glAccountClassPK, GlAccountCategoryPK glAccountCategoryPK, GlResourceTypePK glResourceTypePK, CurrencyPK currencyPK, Boolean isDefault, Long fromTime, Long thruTime)
074            throws PersistenceNotNullException {
075        checkForNull(glAccountPK);
076        this.glAccountPK = glAccountPK;
077        checkForNull(glAccountName);
078        this.glAccountName = glAccountName;
079        this.parentGlAccountPK = parentGlAccountPK;
080        checkForNull(glAccountTypePK);
081        this.glAccountTypePK = glAccountTypePK;
082        checkForNull(glAccountClassPK);
083        this.glAccountClassPK = glAccountClassPK;
084        this.glAccountCategoryPK = glAccountCategoryPK;
085        checkForNull(glResourceTypePK);
086        this.glResourceTypePK = glResourceTypePK;
087        checkForNull(currencyPK);
088        this.currencyPK = currencyPK;
089        this.isDefault = isDefault;
090        checkForNull(fromTime);
091        this.fromTime = fromTime;
092        checkForNull(thruTime);
093        this.thruTime = thruTime;
094    }
095    
096    /** Creates a new instance of GlAccountDetailValue */
097    public GlAccountDetailValue(GlAccountDetailPK glAccountDetailPK, GlAccountPK glAccountPK, String glAccountName, GlAccountPK parentGlAccountPK, GlAccountTypePK glAccountTypePK, GlAccountClassPK glAccountClassPK, GlAccountCategoryPK glAccountCategoryPK, GlResourceTypePK glResourceTypePK, CurrencyPK currencyPK, Boolean isDefault, Long fromTime, Long thruTime)
098            throws PersistenceNotNullException {
099        super(glAccountDetailPK);
100        constructFields(glAccountPK, glAccountName, parentGlAccountPK, glAccountTypePK, glAccountClassPK, glAccountCategoryPK, glResourceTypePK, currencyPK, isDefault, fromTime, thruTime);
101    }
102    
103    /** Creates a new instance of GlAccountDetailValue */
104    public GlAccountDetailValue(GlAccountPK glAccountPK, String glAccountName, GlAccountPK parentGlAccountPK, GlAccountTypePK glAccountTypePK, GlAccountClassPK glAccountClassPK, GlAccountCategoryPK glAccountCategoryPK, GlResourceTypePK glResourceTypePK, CurrencyPK currencyPK, Boolean isDefault, Long fromTime, Long thruTime)
105            throws PersistenceNotNullException {
106        super();
107        constructFields(glAccountPK, glAccountName, parentGlAccountPK, glAccountTypePK, glAccountClassPK, glAccountCategoryPK, glResourceTypePK, currencyPK, isDefault, fromTime, thruTime);
108    }
109    
110   @Override
111   public GlAccountDetailFactory getBaseFactoryInstance() {
112        return GlAccountDetailFactory.getInstance();
113    }
114    
115    @Override
116    public GlAccountDetailValue clone() {
117        Object result;
118        
119        try {
120            result = super.clone();
121        } catch (CloneNotSupportedException cnse) {
122            // This shouldn't happen, fail when it does.
123            throw new PersistenceCloneException(cnse);
124        }
125        
126        return (GlAccountDetailValue)result;
127    }
128    
129   @Override
130    public GlAccountDetailPK getPrimaryKey() {
131        if(_primaryKey == null) {
132            _primaryKey = new GlAccountDetailPK(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 + ((glAccountPK != null) ? glAccountPK.hashCode() : 0);
151            hashCode = 37 * hashCode + ((glAccountName != null) ? glAccountName.hashCode() : 0);
152            hashCode = 37 * hashCode + ((parentGlAccountPK != null) ? parentGlAccountPK.hashCode() : 0);
153            hashCode = 37 * hashCode + ((glAccountTypePK != null) ? glAccountTypePK.hashCode() : 0);
154            hashCode = 37 * hashCode + ((glAccountClassPK != null) ? glAccountClassPK.hashCode() : 0);
155            hashCode = 37 * hashCode + ((glAccountCategoryPK != null) ? glAccountCategoryPK.hashCode() : 0);
156            hashCode = 37 * hashCode + ((glResourceTypePK != null) ? glResourceTypePK.hashCode() : 0);
157            hashCode = 37 * hashCode + ((currencyPK != null) ? currencyPK.hashCode() : 0);
158            hashCode = 37 * hashCode + ((isDefault != null) ? isDefault.hashCode() : 0);
159            hashCode = 37 * hashCode + ((fromTime != null) ? fromTime.hashCode() : 0);
160            hashCode = 37 * hashCode + ((thruTime != null) ? thruTime.hashCode() : 0);
161            
162            _hashCode = hashCode;
163        }
164        
165        return _hashCode;
166    }
167    
168    @Override
169    public String toString() {
170        if(_stringValue == null) {
171            _stringValue = "{" + 
172                    "entityId=" + getEntityId() +
173                    ", glAccountPK=" + getGlAccountPK() +
174                    ", glAccountName=" + getGlAccountName() +
175                    ", parentGlAccountPK=" + getParentGlAccountPK() +
176                    ", glAccountTypePK=" + getGlAccountTypePK() +
177                    ", glAccountClassPK=" + getGlAccountClassPK() +
178                    ", glAccountCategoryPK=" + getGlAccountCategoryPK() +
179                    ", glResourceTypePK=" + getGlResourceTypePK() +
180                    ", currencyPK=" + getCurrencyPK() +
181                    ", isDefault=" + getIsDefault() +
182                    ", fromTime=" + getFromTime() +
183                    ", thruTime=" + getThruTime() +
184                    "}";
185        }
186        return _stringValue;
187    }
188    
189    @Override
190    public boolean equals(Object other) {
191        if(this == other)
192            return true;
193        
194        if(!hasIdentity())
195            return false;
196        
197        if(other instanceof  GlAccountDetailValue that) {
198            if(!that.hasIdentity())
199                return false;
200            
201            Long thisEntityId = getEntityId();
202            Long thatEntityId = that.getEntityId();
203            
204            boolean objectsEqual = thisEntityId.equals(thatEntityId);
205            if(objectsEqual)
206                objectsEqual = isIdentical(that);
207            
208            return objectsEqual;
209        } else {
210            return false;
211        }
212    }
213    
214    public boolean isIdentical(Object other) {
215        if(other instanceof GlAccountDetailValue that) {
216            boolean objectsEqual = true;
217            
218            
219            if(objectsEqual) {
220                GlAccountPK thisGlAccountPK = getGlAccountPK();
221                GlAccountPK thatGlAccountPK = that.getGlAccountPK();
222                
223                if(thisGlAccountPK == null) {
224                    objectsEqual = objectsEqual && (thatGlAccountPK == null);
225                } else {
226                    objectsEqual = objectsEqual && thisGlAccountPK.equals(thatGlAccountPK);
227                }
228            }
229            
230            if(objectsEqual) {
231                String thisGlAccountName = getGlAccountName();
232                String thatGlAccountName = that.getGlAccountName();
233                
234                if(thisGlAccountName == null) {
235                    objectsEqual = objectsEqual && (thatGlAccountName == null);
236                } else {
237                    objectsEqual = objectsEqual && thisGlAccountName.equals(thatGlAccountName);
238                }
239            }
240            
241            if(objectsEqual) {
242                GlAccountPK thisParentGlAccountPK = getParentGlAccountPK();
243                GlAccountPK thatParentGlAccountPK = that.getParentGlAccountPK();
244                
245                if(thisParentGlAccountPK == null) {
246                    objectsEqual = objectsEqual && (thatParentGlAccountPK == null);
247                } else {
248                    objectsEqual = objectsEqual && thisParentGlAccountPK.equals(thatParentGlAccountPK);
249                }
250            }
251            
252            if(objectsEqual) {
253                GlAccountTypePK thisGlAccountTypePK = getGlAccountTypePK();
254                GlAccountTypePK thatGlAccountTypePK = that.getGlAccountTypePK();
255                
256                if(thisGlAccountTypePK == null) {
257                    objectsEqual = objectsEqual && (thatGlAccountTypePK == null);
258                } else {
259                    objectsEqual = objectsEqual && thisGlAccountTypePK.equals(thatGlAccountTypePK);
260                }
261            }
262            
263            if(objectsEqual) {
264                GlAccountClassPK thisGlAccountClassPK = getGlAccountClassPK();
265                GlAccountClassPK thatGlAccountClassPK = that.getGlAccountClassPK();
266                
267                if(thisGlAccountClassPK == null) {
268                    objectsEqual = objectsEqual && (thatGlAccountClassPK == null);
269                } else {
270                    objectsEqual = objectsEqual && thisGlAccountClassPK.equals(thatGlAccountClassPK);
271                }
272            }
273            
274            if(objectsEqual) {
275                GlAccountCategoryPK thisGlAccountCategoryPK = getGlAccountCategoryPK();
276                GlAccountCategoryPK thatGlAccountCategoryPK = that.getGlAccountCategoryPK();
277                
278                if(thisGlAccountCategoryPK == null) {
279                    objectsEqual = objectsEqual && (thatGlAccountCategoryPK == null);
280                } else {
281                    objectsEqual = objectsEqual && thisGlAccountCategoryPK.equals(thatGlAccountCategoryPK);
282                }
283            }
284            
285            if(objectsEqual) {
286                GlResourceTypePK thisGlResourceTypePK = getGlResourceTypePK();
287                GlResourceTypePK thatGlResourceTypePK = that.getGlResourceTypePK();
288                
289                if(thisGlResourceTypePK == null) {
290                    objectsEqual = objectsEqual && (thatGlResourceTypePK == null);
291                } else {
292                    objectsEqual = objectsEqual && thisGlResourceTypePK.equals(thatGlResourceTypePK);
293                }
294            }
295            
296            if(objectsEqual) {
297                CurrencyPK thisCurrencyPK = getCurrencyPK();
298                CurrencyPK thatCurrencyPK = that.getCurrencyPK();
299                
300                if(thisCurrencyPK == null) {
301                    objectsEqual = objectsEqual && (thatCurrencyPK == null);
302                } else {
303                    objectsEqual = objectsEqual && thisCurrencyPK.equals(thatCurrencyPK);
304                }
305            }
306            
307            if(objectsEqual) {
308                Boolean thisIsDefault = getIsDefault();
309                Boolean thatIsDefault = that.getIsDefault();
310                
311                if(thisIsDefault == null) {
312                    objectsEqual = objectsEqual && (thatIsDefault == null);
313                } else {
314                    objectsEqual = objectsEqual && thisIsDefault.equals(thatIsDefault);
315                }
316            }
317            
318            if(objectsEqual) {
319                Long thisFromTime = getFromTime();
320                Long thatFromTime = that.getFromTime();
321                
322                if(thisFromTime == null) {
323                    objectsEqual = objectsEqual && (thatFromTime == null);
324                } else {
325                    objectsEqual = objectsEqual && thisFromTime.equals(thatFromTime);
326                }
327            }
328            
329            if(objectsEqual) {
330                Long thisThruTime = getThruTime();
331                Long thatThruTime = that.getThruTime();
332                
333                if(thisThruTime == null) {
334                    objectsEqual = objectsEqual && (thatThruTime == null);
335                } else {
336                    objectsEqual = objectsEqual && thisThruTime.equals(thatThruTime);
337                }
338            }
339            
340            return objectsEqual;
341        } else {
342            return false;
343        }
344    }
345    
346    @Override
347    public boolean hasBeenModified() {
348        return glAccountPKHasBeenModified || glAccountNameHasBeenModified || parentGlAccountPKHasBeenModified || glAccountTypePKHasBeenModified || glAccountClassPKHasBeenModified || glAccountCategoryPKHasBeenModified || glResourceTypePKHasBeenModified || currencyPKHasBeenModified || isDefaultHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified;
349    }
350    
351    @Override
352    public void clearHasBeenModified() {
353        glAccountPKHasBeenModified = false;
354        glAccountNameHasBeenModified = false;
355        parentGlAccountPKHasBeenModified = false;
356        glAccountTypePKHasBeenModified = false;
357        glAccountClassPKHasBeenModified = false;
358        glAccountCategoryPKHasBeenModified = false;
359        glResourceTypePKHasBeenModified = false;
360        currencyPKHasBeenModified = false;
361        isDefaultHasBeenModified = false;
362        fromTimeHasBeenModified = false;
363        thruTimeHasBeenModified = false;
364    }
365    
366    public GlAccountPK getGlAccountPK() {
367        return glAccountPK;
368    }
369    
370    public void setGlAccountPK(GlAccountPK glAccountPK)
371            throws PersistenceNotNullException {
372        checkForNull(glAccountPK);
373        
374        boolean update = true;
375        
376        if(this.glAccountPK != null) {
377            if(this.glAccountPK.equals(glAccountPK)) {
378                update = false;
379            }
380        } else if(glAccountPK == null) {
381            update = false;
382        }
383        
384        if(update) {
385            this.glAccountPK = glAccountPK;
386            glAccountPKHasBeenModified = true;
387            clearHashAndString();
388        }
389    }
390    
391    public boolean getGlAccountPKHasBeenModified() {
392        return glAccountPKHasBeenModified;
393    }
394    
395    public String getGlAccountName() {
396        return glAccountName;
397    }
398    
399    public void setGlAccountName(String glAccountName)
400            throws PersistenceNotNullException {
401        checkForNull(glAccountName);
402        
403        boolean update = true;
404        
405        if(this.glAccountName != null) {
406            if(this.glAccountName.equals(glAccountName)) {
407                update = false;
408            }
409        } else if(glAccountName == null) {
410            update = false;
411        }
412        
413        if(update) {
414            this.glAccountName = glAccountName;
415            glAccountNameHasBeenModified = true;
416            clearHashAndString();
417        }
418    }
419    
420    public boolean getGlAccountNameHasBeenModified() {
421        return glAccountNameHasBeenModified;
422    }
423    
424    public GlAccountPK getParentGlAccountPK() {
425        return parentGlAccountPK;
426    }
427    
428    public void setParentGlAccountPK(GlAccountPK parentGlAccountPK) {
429        boolean update = true;
430        
431        if(this.parentGlAccountPK != null) {
432            if(this.parentGlAccountPK.equals(parentGlAccountPK)) {
433                update = false;
434            }
435        } else if(parentGlAccountPK == null) {
436            update = false;
437        }
438        
439        if(update) {
440            this.parentGlAccountPK = parentGlAccountPK;
441            parentGlAccountPKHasBeenModified = true;
442            clearHashAndString();
443        }
444    }
445    
446    public boolean getParentGlAccountPKHasBeenModified() {
447        return parentGlAccountPKHasBeenModified;
448    }
449    
450    public GlAccountTypePK getGlAccountTypePK() {
451        return glAccountTypePK;
452    }
453    
454    public void setGlAccountTypePK(GlAccountTypePK glAccountTypePK)
455            throws PersistenceNotNullException {
456        checkForNull(glAccountTypePK);
457        
458        boolean update = true;
459        
460        if(this.glAccountTypePK != null) {
461            if(this.glAccountTypePK.equals(glAccountTypePK)) {
462                update = false;
463            }
464        } else if(glAccountTypePK == null) {
465            update = false;
466        }
467        
468        if(update) {
469            this.glAccountTypePK = glAccountTypePK;
470            glAccountTypePKHasBeenModified = true;
471            clearHashAndString();
472        }
473    }
474    
475    public boolean getGlAccountTypePKHasBeenModified() {
476        return glAccountTypePKHasBeenModified;
477    }
478    
479    public GlAccountClassPK getGlAccountClassPK() {
480        return glAccountClassPK;
481    }
482    
483    public void setGlAccountClassPK(GlAccountClassPK glAccountClassPK)
484            throws PersistenceNotNullException {
485        checkForNull(glAccountClassPK);
486        
487        boolean update = true;
488        
489        if(this.glAccountClassPK != null) {
490            if(this.glAccountClassPK.equals(glAccountClassPK)) {
491                update = false;
492            }
493        } else if(glAccountClassPK == null) {
494            update = false;
495        }
496        
497        if(update) {
498            this.glAccountClassPK = glAccountClassPK;
499            glAccountClassPKHasBeenModified = true;
500            clearHashAndString();
501        }
502    }
503    
504    public boolean getGlAccountClassPKHasBeenModified() {
505        return glAccountClassPKHasBeenModified;
506    }
507    
508    public GlAccountCategoryPK getGlAccountCategoryPK() {
509        return glAccountCategoryPK;
510    }
511    
512    public void setGlAccountCategoryPK(GlAccountCategoryPK glAccountCategoryPK) {
513        boolean update = true;
514        
515        if(this.glAccountCategoryPK != null) {
516            if(this.glAccountCategoryPK.equals(glAccountCategoryPK)) {
517                update = false;
518            }
519        } else if(glAccountCategoryPK == null) {
520            update = false;
521        }
522        
523        if(update) {
524            this.glAccountCategoryPK = glAccountCategoryPK;
525            glAccountCategoryPKHasBeenModified = true;
526            clearHashAndString();
527        }
528    }
529    
530    public boolean getGlAccountCategoryPKHasBeenModified() {
531        return glAccountCategoryPKHasBeenModified;
532    }
533    
534    public GlResourceTypePK getGlResourceTypePK() {
535        return glResourceTypePK;
536    }
537    
538    public void setGlResourceTypePK(GlResourceTypePK glResourceTypePK)
539            throws PersistenceNotNullException {
540        checkForNull(glResourceTypePK);
541        
542        boolean update = true;
543        
544        if(this.glResourceTypePK != null) {
545            if(this.glResourceTypePK.equals(glResourceTypePK)) {
546                update = false;
547            }
548        } else if(glResourceTypePK == null) {
549            update = false;
550        }
551        
552        if(update) {
553            this.glResourceTypePK = glResourceTypePK;
554            glResourceTypePKHasBeenModified = true;
555            clearHashAndString();
556        }
557    }
558    
559    public boolean getGlResourceTypePKHasBeenModified() {
560        return glResourceTypePKHasBeenModified;
561    }
562    
563    public CurrencyPK getCurrencyPK() {
564        return currencyPK;
565    }
566    
567    public void setCurrencyPK(CurrencyPK currencyPK)
568            throws PersistenceNotNullException {
569        checkForNull(currencyPK);
570        
571        boolean update = true;
572        
573        if(this.currencyPK != null) {
574            if(this.currencyPK.equals(currencyPK)) {
575                update = false;
576            }
577        } else if(currencyPK == null) {
578            update = false;
579        }
580        
581        if(update) {
582            this.currencyPK = currencyPK;
583            currencyPKHasBeenModified = true;
584            clearHashAndString();
585        }
586    }
587    
588    public boolean getCurrencyPKHasBeenModified() {
589        return currencyPKHasBeenModified;
590    }
591    
592    public Boolean getIsDefault() {
593        return isDefault;
594    }
595    
596    public void setIsDefault(Boolean isDefault) {
597        boolean update = true;
598        
599        if(this.isDefault != null) {
600            if(this.isDefault.equals(isDefault)) {
601                update = false;
602            }
603        } else if(isDefault == null) {
604            update = false;
605        }
606        
607        if(update) {
608            this.isDefault = isDefault;
609            isDefaultHasBeenModified = true;
610            clearHashAndString();
611        }
612    }
613    
614    public boolean getIsDefaultHasBeenModified() {
615        return isDefaultHasBeenModified;
616    }
617    
618    public Long getFromTime() {
619        return fromTime;
620    }
621    
622    public void setFromTime(Long fromTime)
623            throws PersistenceNotNullException {
624        checkForNull(fromTime);
625        
626        boolean update = true;
627        
628        if(this.fromTime != null) {
629            if(this.fromTime.equals(fromTime)) {
630                update = false;
631            }
632        } else if(fromTime == null) {
633            update = false;
634        }
635        
636        if(update) {
637            this.fromTime = fromTime;
638            fromTimeHasBeenModified = true;
639            clearHashAndString();
640        }
641    }
642    
643    public boolean getFromTimeHasBeenModified() {
644        return fromTimeHasBeenModified;
645    }
646    
647    public Long getThruTime() {
648        return thruTime;
649    }
650    
651    public void setThruTime(Long thruTime)
652            throws PersistenceNotNullException {
653        checkForNull(thruTime);
654        
655        boolean update = true;
656        
657        if(this.thruTime != null) {
658            if(this.thruTime.equals(thruTime)) {
659                update = false;
660            }
661        } else if(thruTime == null) {
662            update = false;
663        }
664        
665        if(update) {
666            this.thruTime = thruTime;
667            thruTimeHasBeenModified = true;
668            clearHashAndString();
669        }
670    }
671    
672    public boolean getThruTimeHasBeenModified() {
673        return thruTimeHasBeenModified;
674    }
675    
676}