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 * 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            StringBuilder stringValue = new StringBuilder("{");
172            
173            stringValue.append("entityId=").append(getEntityId());
174            
175            stringValue.append(", glAccountPK=").append(getGlAccountPK());
176            stringValue.append(", glAccountName=").append(getGlAccountName());
177            stringValue.append(", parentGlAccountPK=").append(getParentGlAccountPK());
178            stringValue.append(", glAccountTypePK=").append(getGlAccountTypePK());
179            stringValue.append(", glAccountClassPK=").append(getGlAccountClassPK());
180            stringValue.append(", glAccountCategoryPK=").append(getGlAccountCategoryPK());
181            stringValue.append(", glResourceTypePK=").append(getGlResourceTypePK());
182            stringValue.append(", currencyPK=").append(getCurrencyPK());
183            stringValue.append(", isDefault=").append(getIsDefault());
184            stringValue.append(", fromTime=").append(getFromTime());
185            stringValue.append(", thruTime=").append(getThruTime());
186            
187            stringValue.append('}');
188            
189            _stringValue = stringValue.toString();
190        }
191        return _stringValue;
192    }
193    
194    @Override
195    public boolean equals(Object other) {
196        if(this == other)
197            return true;
198        
199        if(!hasIdentity())
200            return false;
201        
202        if(other instanceof  GlAccountDetailValue) {
203            GlAccountDetailValue that = (GlAccountDetailValue)other;
204            
205            if(!that.hasIdentity())
206                return false;
207            
208            Long thisEntityId = getEntityId();
209            Long thatEntityId = that.getEntityId();
210            
211            boolean objectsEqual = thisEntityId.equals(thatEntityId);
212            if(objectsEqual)
213                objectsEqual = objectsEqual && isIdentical(that);
214            
215            return objectsEqual;
216        } else {
217            return false;
218        }
219    }
220    
221    public boolean isIdentical(Object other) {
222        if(other instanceof GlAccountDetailValue) {
223            GlAccountDetailValue that = (GlAccountDetailValue)other;
224            boolean objectsEqual = true;
225            
226            
227            if(objectsEqual) {
228                GlAccountPK thisGlAccountPK = getGlAccountPK();
229                GlAccountPK thatGlAccountPK = that.getGlAccountPK();
230                
231                if(thisGlAccountPK == null) {
232                    objectsEqual = objectsEqual && (thatGlAccountPK == null);
233                } else {
234                    objectsEqual = objectsEqual && thisGlAccountPK.equals(thatGlAccountPK);
235                }
236            }
237            
238            if(objectsEqual) {
239                String thisGlAccountName = getGlAccountName();
240                String thatGlAccountName = that.getGlAccountName();
241                
242                if(thisGlAccountName == null) {
243                    objectsEqual = objectsEqual && (thatGlAccountName == null);
244                } else {
245                    objectsEqual = objectsEqual && thisGlAccountName.equals(thatGlAccountName);
246                }
247            }
248            
249            if(objectsEqual) {
250                GlAccountPK thisParentGlAccountPK = getParentGlAccountPK();
251                GlAccountPK thatParentGlAccountPK = that.getParentGlAccountPK();
252                
253                if(thisParentGlAccountPK == null) {
254                    objectsEqual = objectsEqual && (thatParentGlAccountPK == null);
255                } else {
256                    objectsEqual = objectsEqual && thisParentGlAccountPK.equals(thatParentGlAccountPK);
257                }
258            }
259            
260            if(objectsEqual) {
261                GlAccountTypePK thisGlAccountTypePK = getGlAccountTypePK();
262                GlAccountTypePK thatGlAccountTypePK = that.getGlAccountTypePK();
263                
264                if(thisGlAccountTypePK == null) {
265                    objectsEqual = objectsEqual && (thatGlAccountTypePK == null);
266                } else {
267                    objectsEqual = objectsEqual && thisGlAccountTypePK.equals(thatGlAccountTypePK);
268                }
269            }
270            
271            if(objectsEqual) {
272                GlAccountClassPK thisGlAccountClassPK = getGlAccountClassPK();
273                GlAccountClassPK thatGlAccountClassPK = that.getGlAccountClassPK();
274                
275                if(thisGlAccountClassPK == null) {
276                    objectsEqual = objectsEqual && (thatGlAccountClassPK == null);
277                } else {
278                    objectsEqual = objectsEqual && thisGlAccountClassPK.equals(thatGlAccountClassPK);
279                }
280            }
281            
282            if(objectsEqual) {
283                GlAccountCategoryPK thisGlAccountCategoryPK = getGlAccountCategoryPK();
284                GlAccountCategoryPK thatGlAccountCategoryPK = that.getGlAccountCategoryPK();
285                
286                if(thisGlAccountCategoryPK == null) {
287                    objectsEqual = objectsEqual && (thatGlAccountCategoryPK == null);
288                } else {
289                    objectsEqual = objectsEqual && thisGlAccountCategoryPK.equals(thatGlAccountCategoryPK);
290                }
291            }
292            
293            if(objectsEqual) {
294                GlResourceTypePK thisGlResourceTypePK = getGlResourceTypePK();
295                GlResourceTypePK thatGlResourceTypePK = that.getGlResourceTypePK();
296                
297                if(thisGlResourceTypePK == null) {
298                    objectsEqual = objectsEqual && (thatGlResourceTypePK == null);
299                } else {
300                    objectsEqual = objectsEqual && thisGlResourceTypePK.equals(thatGlResourceTypePK);
301                }
302            }
303            
304            if(objectsEqual) {
305                CurrencyPK thisCurrencyPK = getCurrencyPK();
306                CurrencyPK thatCurrencyPK = that.getCurrencyPK();
307                
308                if(thisCurrencyPK == null) {
309                    objectsEqual = objectsEqual && (thatCurrencyPK == null);
310                } else {
311                    objectsEqual = objectsEqual && thisCurrencyPK.equals(thatCurrencyPK);
312                }
313            }
314            
315            if(objectsEqual) {
316                Boolean thisIsDefault = getIsDefault();
317                Boolean thatIsDefault = that.getIsDefault();
318                
319                if(thisIsDefault == null) {
320                    objectsEqual = objectsEqual && (thatIsDefault == null);
321                } else {
322                    objectsEqual = objectsEqual && thisIsDefault.equals(thatIsDefault);
323                }
324            }
325            
326            if(objectsEqual) {
327                Long thisFromTime = getFromTime();
328                Long thatFromTime = that.getFromTime();
329                
330                if(thisFromTime == null) {
331                    objectsEqual = objectsEqual && (thatFromTime == null);
332                } else {
333                    objectsEqual = objectsEqual && thisFromTime.equals(thatFromTime);
334                }
335            }
336            
337            if(objectsEqual) {
338                Long thisThruTime = getThruTime();
339                Long thatThruTime = that.getThruTime();
340                
341                if(thisThruTime == null) {
342                    objectsEqual = objectsEqual && (thatThruTime == null);
343                } else {
344                    objectsEqual = objectsEqual && thisThruTime.equals(thatThruTime);
345                }
346            }
347            
348            return objectsEqual;
349        } else {
350            return false;
351        }
352    }
353    
354    @Override
355    public boolean hasBeenModified() {
356        return glAccountPKHasBeenModified || glAccountNameHasBeenModified || parentGlAccountPKHasBeenModified || glAccountTypePKHasBeenModified || glAccountClassPKHasBeenModified || glAccountCategoryPKHasBeenModified || glResourceTypePKHasBeenModified || currencyPKHasBeenModified || isDefaultHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified;
357    }
358    
359    @Override
360    public void clearHasBeenModified() {
361        glAccountPKHasBeenModified = false;
362        glAccountNameHasBeenModified = false;
363        parentGlAccountPKHasBeenModified = false;
364        glAccountTypePKHasBeenModified = false;
365        glAccountClassPKHasBeenModified = false;
366        glAccountCategoryPKHasBeenModified = false;
367        glResourceTypePKHasBeenModified = false;
368        currencyPKHasBeenModified = false;
369        isDefaultHasBeenModified = false;
370        fromTimeHasBeenModified = false;
371        thruTimeHasBeenModified = false;
372    }
373    
374    public GlAccountPK getGlAccountPK() {
375        return glAccountPK;
376    }
377    
378    public void setGlAccountPK(GlAccountPK glAccountPK)
379            throws PersistenceNotNullException {
380        checkForNull(glAccountPK);
381        
382        boolean update = true;
383        
384        if(this.glAccountPK != null) {
385            if(this.glAccountPK.equals(glAccountPK)) {
386                update = false;
387            }
388        } else if(glAccountPK == null) {
389            update = false;
390        }
391        
392        if(update) {
393            this.glAccountPK = glAccountPK;
394            glAccountPKHasBeenModified = true;
395            clearHashAndString();
396        }
397    }
398    
399    public boolean getGlAccountPKHasBeenModified() {
400        return glAccountPKHasBeenModified;
401    }
402    
403    public String getGlAccountName() {
404        return glAccountName;
405    }
406    
407    public void setGlAccountName(String glAccountName)
408            throws PersistenceNotNullException {
409        checkForNull(glAccountName);
410        
411        boolean update = true;
412        
413        if(this.glAccountName != null) {
414            if(this.glAccountName.equals(glAccountName)) {
415                update = false;
416            }
417        } else if(glAccountName == null) {
418            update = false;
419        }
420        
421        if(update) {
422            this.glAccountName = glAccountName;
423            glAccountNameHasBeenModified = true;
424            clearHashAndString();
425        }
426    }
427    
428    public boolean getGlAccountNameHasBeenModified() {
429        return glAccountNameHasBeenModified;
430    }
431    
432    public GlAccountPK getParentGlAccountPK() {
433        return parentGlAccountPK;
434    }
435    
436    public void setParentGlAccountPK(GlAccountPK parentGlAccountPK) {
437        boolean update = true;
438        
439        if(this.parentGlAccountPK != null) {
440            if(this.parentGlAccountPK.equals(parentGlAccountPK)) {
441                update = false;
442            }
443        } else if(parentGlAccountPK == null) {
444            update = false;
445        }
446        
447        if(update) {
448            this.parentGlAccountPK = parentGlAccountPK;
449            parentGlAccountPKHasBeenModified = true;
450            clearHashAndString();
451        }
452    }
453    
454    public boolean getParentGlAccountPKHasBeenModified() {
455        return parentGlAccountPKHasBeenModified;
456    }
457    
458    public GlAccountTypePK getGlAccountTypePK() {
459        return glAccountTypePK;
460    }
461    
462    public void setGlAccountTypePK(GlAccountTypePK glAccountTypePK)
463            throws PersistenceNotNullException {
464        checkForNull(glAccountTypePK);
465        
466        boolean update = true;
467        
468        if(this.glAccountTypePK != null) {
469            if(this.glAccountTypePK.equals(glAccountTypePK)) {
470                update = false;
471            }
472        } else if(glAccountTypePK == null) {
473            update = false;
474        }
475        
476        if(update) {
477            this.glAccountTypePK = glAccountTypePK;
478            glAccountTypePKHasBeenModified = true;
479            clearHashAndString();
480        }
481    }
482    
483    public boolean getGlAccountTypePKHasBeenModified() {
484        return glAccountTypePKHasBeenModified;
485    }
486    
487    public GlAccountClassPK getGlAccountClassPK() {
488        return glAccountClassPK;
489    }
490    
491    public void setGlAccountClassPK(GlAccountClassPK glAccountClassPK)
492            throws PersistenceNotNullException {
493        checkForNull(glAccountClassPK);
494        
495        boolean update = true;
496        
497        if(this.glAccountClassPK != null) {
498            if(this.glAccountClassPK.equals(glAccountClassPK)) {
499                update = false;
500            }
501        } else if(glAccountClassPK == null) {
502            update = false;
503        }
504        
505        if(update) {
506            this.glAccountClassPK = glAccountClassPK;
507            glAccountClassPKHasBeenModified = true;
508            clearHashAndString();
509        }
510    }
511    
512    public boolean getGlAccountClassPKHasBeenModified() {
513        return glAccountClassPKHasBeenModified;
514    }
515    
516    public GlAccountCategoryPK getGlAccountCategoryPK() {
517        return glAccountCategoryPK;
518    }
519    
520    public void setGlAccountCategoryPK(GlAccountCategoryPK glAccountCategoryPK) {
521        boolean update = true;
522        
523        if(this.glAccountCategoryPK != null) {
524            if(this.glAccountCategoryPK.equals(glAccountCategoryPK)) {
525                update = false;
526            }
527        } else if(glAccountCategoryPK == null) {
528            update = false;
529        }
530        
531        if(update) {
532            this.glAccountCategoryPK = glAccountCategoryPK;
533            glAccountCategoryPKHasBeenModified = true;
534            clearHashAndString();
535        }
536    }
537    
538    public boolean getGlAccountCategoryPKHasBeenModified() {
539        return glAccountCategoryPKHasBeenModified;
540    }
541    
542    public GlResourceTypePK getGlResourceTypePK() {
543        return glResourceTypePK;
544    }
545    
546    public void setGlResourceTypePK(GlResourceTypePK glResourceTypePK)
547            throws PersistenceNotNullException {
548        checkForNull(glResourceTypePK);
549        
550        boolean update = true;
551        
552        if(this.glResourceTypePK != null) {
553            if(this.glResourceTypePK.equals(glResourceTypePK)) {
554                update = false;
555            }
556        } else if(glResourceTypePK == null) {
557            update = false;
558        }
559        
560        if(update) {
561            this.glResourceTypePK = glResourceTypePK;
562            glResourceTypePKHasBeenModified = true;
563            clearHashAndString();
564        }
565    }
566    
567    public boolean getGlResourceTypePKHasBeenModified() {
568        return glResourceTypePKHasBeenModified;
569    }
570    
571    public CurrencyPK getCurrencyPK() {
572        return currencyPK;
573    }
574    
575    public void setCurrencyPK(CurrencyPK currencyPK)
576            throws PersistenceNotNullException {
577        checkForNull(currencyPK);
578        
579        boolean update = true;
580        
581        if(this.currencyPK != null) {
582            if(this.currencyPK.equals(currencyPK)) {
583                update = false;
584            }
585        } else if(currencyPK == null) {
586            update = false;
587        }
588        
589        if(update) {
590            this.currencyPK = currencyPK;
591            currencyPKHasBeenModified = true;
592            clearHashAndString();
593        }
594    }
595    
596    public boolean getCurrencyPKHasBeenModified() {
597        return currencyPKHasBeenModified;
598    }
599    
600    public Boolean getIsDefault() {
601        return isDefault;
602    }
603    
604    public void setIsDefault(Boolean isDefault) {
605        boolean update = true;
606        
607        if(this.isDefault != null) {
608            if(this.isDefault.equals(isDefault)) {
609                update = false;
610            }
611        } else if(isDefault == null) {
612            update = false;
613        }
614        
615        if(update) {
616            this.isDefault = isDefault;
617            isDefaultHasBeenModified = true;
618            clearHashAndString();
619        }
620    }
621    
622    public boolean getIsDefaultHasBeenModified() {
623        return isDefaultHasBeenModified;
624    }
625    
626    public Long getFromTime() {
627        return fromTime;
628    }
629    
630    public void setFromTime(Long fromTime)
631            throws PersistenceNotNullException {
632        checkForNull(fromTime);
633        
634        boolean update = true;
635        
636        if(this.fromTime != null) {
637            if(this.fromTime.equals(fromTime)) {
638                update = false;
639            }
640        } else if(fromTime == null) {
641            update = false;
642        }
643        
644        if(update) {
645            this.fromTime = fromTime;
646            fromTimeHasBeenModified = true;
647            clearHashAndString();
648        }
649    }
650    
651    public boolean getFromTimeHasBeenModified() {
652        return fromTimeHasBeenModified;
653    }
654    
655    public Long getThruTime() {
656        return thruTime;
657    }
658    
659    public void setThruTime(Long thruTime)
660            throws PersistenceNotNullException {
661        checkForNull(thruTime);
662        
663        boolean update = true;
664        
665        if(this.thruTime != null) {
666            if(this.thruTime.equals(thruTime)) {
667                update = false;
668            }
669        } else if(thruTime == null) {
670            update = false;
671        }
672        
673        if(update) {
674            this.thruTime = thruTime;
675            thruTimeHasBeenModified = true;
676            clearHashAndString();
677        }
678    }
679    
680    public boolean getThruTimeHasBeenModified() {
681        return thruTimeHasBeenModified;
682    }
683    
684}