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 * FinancialAccountDetailValue.java
021 */
022
023package com.echothree.model.data.financial.server.value;
024
025import com.echothree.model.data.financial.common.pk.FinancialAccountDetailPK;
026
027import com.echothree.model.data.financial.server.factory.FinancialAccountDetailFactory;
028
029import com.echothree.model.data.financial.common.pk.FinancialAccountPK;
030import com.echothree.model.data.financial.common.pk.FinancialAccountTypePK;
031import com.echothree.model.data.accounting.common.pk.CurrencyPK;
032import com.echothree.model.data.accounting.common.pk.GlAccountPK;
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 FinancialAccountDetailValue
045        extends BaseValue<FinancialAccountDetailPK>
046        implements Cloneable, Serializable {
047    
048    private FinancialAccountPK financialAccountPK;
049    private boolean financialAccountPKHasBeenModified = false;
050    private FinancialAccountTypePK financialAccountTypePK;
051    private boolean financialAccountTypePKHasBeenModified = false;
052    private String financialAccountName;
053    private boolean financialAccountNameHasBeenModified = false;
054    private CurrencyPK currencyPK;
055    private boolean currencyPKHasBeenModified = false;
056    private GlAccountPK glAccountPK;
057    private boolean glAccountPKHasBeenModified = false;
058    private String reference;
059    private boolean referenceHasBeenModified = false;
060    private String description;
061    private boolean descriptionHasBeenModified = false;
062    private Long fromTime;
063    private boolean fromTimeHasBeenModified = false;
064    private Long thruTime;
065    private boolean thruTimeHasBeenModified = false;
066    
067    private transient Integer _hashCode = null;
068    private transient String _stringValue = null;
069    
070    private void constructFields(FinancialAccountPK financialAccountPK, FinancialAccountTypePK financialAccountTypePK, String financialAccountName, CurrencyPK currencyPK, GlAccountPK glAccountPK, String reference, String description, Long fromTime, Long thruTime)
071            throws PersistenceNotNullException {
072        checkForNull(financialAccountPK);
073        this.financialAccountPK = financialAccountPK;
074        checkForNull(financialAccountTypePK);
075        this.financialAccountTypePK = financialAccountTypePK;
076        checkForNull(financialAccountName);
077        this.financialAccountName = financialAccountName;
078        checkForNull(currencyPK);
079        this.currencyPK = currencyPK;
080        checkForNull(glAccountPK);
081        this.glAccountPK = glAccountPK;
082        this.reference = reference;
083        this.description = description;
084        checkForNull(fromTime);
085        this.fromTime = fromTime;
086        checkForNull(thruTime);
087        this.thruTime = thruTime;
088    }
089    
090    /** Creates a new instance of FinancialAccountDetailValue */
091    public FinancialAccountDetailValue(FinancialAccountDetailPK financialAccountDetailPK, FinancialAccountPK financialAccountPK, FinancialAccountTypePK financialAccountTypePK, String financialAccountName, CurrencyPK currencyPK, GlAccountPK glAccountPK, String reference, String description, Long fromTime, Long thruTime)
092            throws PersistenceNotNullException {
093        super(financialAccountDetailPK);
094        constructFields(financialAccountPK, financialAccountTypePK, financialAccountName, currencyPK, glAccountPK, reference, description, fromTime, thruTime);
095    }
096    
097    /** Creates a new instance of FinancialAccountDetailValue */
098    public FinancialAccountDetailValue(FinancialAccountPK financialAccountPK, FinancialAccountTypePK financialAccountTypePK, String financialAccountName, CurrencyPK currencyPK, GlAccountPK glAccountPK, String reference, String description, Long fromTime, Long thruTime)
099            throws PersistenceNotNullException {
100        super();
101        constructFields(financialAccountPK, financialAccountTypePK, financialAccountName, currencyPK, glAccountPK, reference, description, fromTime, thruTime);
102    }
103    
104    @Override
105    @Nonnull
106    public FinancialAccountDetailFactory getBaseFactoryInstance() {
107        return FinancialAccountDetailFactory.getInstance();
108    }
109    
110    @Override
111    @Nonnull
112    public FinancialAccountDetailValue clone() {
113        Object result;
114        
115        try {
116            result = super.clone();
117        } catch (CloneNotSupportedException cnse) {
118            // This shouldn't happen, fail when it does.
119            throw new PersistenceCloneException(cnse);
120        }
121        
122        return (FinancialAccountDetailValue)result;
123    }
124    
125    @Override
126    @Nonnull
127    public FinancialAccountDetailPK getPrimaryKey() {
128        if(_primaryKey == null) {
129            _primaryKey = new FinancialAccountDetailPK(entityId);
130        }
131        
132        return _primaryKey;
133    }
134    
135    private void clearHashAndString() {
136        _hashCode = null;
137        _stringValue = null;
138    }
139    
140    @Override
141    public int hashCode() {
142        if(_hashCode == null) {
143            int hashCode = 17;
144            
145            hashCode = 37 * hashCode + ((entityId != null) ? entityId.hashCode() : 0);
146            
147            hashCode = 37 * hashCode + ((financialAccountPK != null) ? financialAccountPK.hashCode() : 0);
148            hashCode = 37 * hashCode + ((financialAccountTypePK != null) ? financialAccountTypePK.hashCode() : 0);
149            hashCode = 37 * hashCode + ((financialAccountName != null) ? financialAccountName.hashCode() : 0);
150            hashCode = 37 * hashCode + ((currencyPK != null) ? currencyPK.hashCode() : 0);
151            hashCode = 37 * hashCode + ((glAccountPK != null) ? glAccountPK.hashCode() : 0);
152            hashCode = 37 * hashCode + ((reference != null) ? reference.hashCode() : 0);
153            hashCode = 37 * hashCode + ((description != null) ? description.hashCode() : 0);
154            hashCode = 37 * hashCode + ((fromTime != null) ? fromTime.hashCode() : 0);
155            hashCode = 37 * hashCode + ((thruTime != null) ? thruTime.hashCode() : 0);
156            
157            _hashCode = hashCode;
158        }
159        
160        return _hashCode;
161    }
162    
163    @Override
164    @Nonnull
165    public String toString() {
166        if(_stringValue == null) {
167            _stringValue = "{" + 
168                    "entityId=" + getEntityId() +
169                    ", financialAccountPK=" + getFinancialAccountPK() +
170                    ", financialAccountTypePK=" + getFinancialAccountTypePK() +
171                    ", financialAccountName=" + getFinancialAccountName() +
172                    ", currencyPK=" + getCurrencyPK() +
173                    ", glAccountPK=" + getGlAccountPK() +
174                    ", reference=" + getReference() +
175                    ", description=" + getDescription() +
176                    ", fromTime=" + getFromTime() +
177                    ", thruTime=" + getThruTime() +
178                    "}";
179        }
180        return _stringValue;
181    }
182    
183    @Override
184    public boolean equals(Object other) {
185        if(this == other)
186            return true;
187        
188        if(!hasIdentity())
189            return false;
190        
191        if(other instanceof  FinancialAccountDetailValue that) {
192            if(!that.hasIdentity())
193                return false;
194            
195            Long thisEntityId = getEntityId();
196            Long thatEntityId = that.getEntityId();
197            
198            boolean objectsEqual = thisEntityId.equals(thatEntityId);
199            if(objectsEqual)
200                objectsEqual = isIdentical(that);
201            
202            return objectsEqual;
203        } else {
204            return false;
205        }
206    }
207    
208    public boolean isIdentical(Object other) {
209        if(other instanceof FinancialAccountDetailValue that) {
210            boolean objectsEqual = true;
211            
212            
213            if(objectsEqual) {
214                FinancialAccountPK thisFinancialAccountPK = getFinancialAccountPK();
215                FinancialAccountPK thatFinancialAccountPK = that.getFinancialAccountPK();
216                
217                if(thisFinancialAccountPK == null) {
218                    objectsEqual = objectsEqual && (thatFinancialAccountPK == null);
219                } else {
220                    objectsEqual = objectsEqual && thisFinancialAccountPK.equals(thatFinancialAccountPK);
221                }
222            }
223            
224            if(objectsEqual) {
225                FinancialAccountTypePK thisFinancialAccountTypePK = getFinancialAccountTypePK();
226                FinancialAccountTypePK thatFinancialAccountTypePK = that.getFinancialAccountTypePK();
227                
228                if(thisFinancialAccountTypePK == null) {
229                    objectsEqual = objectsEqual && (thatFinancialAccountTypePK == null);
230                } else {
231                    objectsEqual = objectsEqual && thisFinancialAccountTypePK.equals(thatFinancialAccountTypePK);
232                }
233            }
234            
235            if(objectsEqual) {
236                String thisFinancialAccountName = getFinancialAccountName();
237                String thatFinancialAccountName = that.getFinancialAccountName();
238                
239                if(thisFinancialAccountName == null) {
240                    objectsEqual = objectsEqual && (thatFinancialAccountName == null);
241                } else {
242                    objectsEqual = objectsEqual && thisFinancialAccountName.equals(thatFinancialAccountName);
243                }
244            }
245            
246            if(objectsEqual) {
247                CurrencyPK thisCurrencyPK = getCurrencyPK();
248                CurrencyPK thatCurrencyPK = that.getCurrencyPK();
249                
250                if(thisCurrencyPK == null) {
251                    objectsEqual = objectsEqual && (thatCurrencyPK == null);
252                } else {
253                    objectsEqual = objectsEqual && thisCurrencyPK.equals(thatCurrencyPK);
254                }
255            }
256            
257            if(objectsEqual) {
258                GlAccountPK thisGlAccountPK = getGlAccountPK();
259                GlAccountPK thatGlAccountPK = that.getGlAccountPK();
260                
261                if(thisGlAccountPK == null) {
262                    objectsEqual = objectsEqual && (thatGlAccountPK == null);
263                } else {
264                    objectsEqual = objectsEqual && thisGlAccountPK.equals(thatGlAccountPK);
265                }
266            }
267            
268            if(objectsEqual) {
269                String thisReference = getReference();
270                String thatReference = that.getReference();
271                
272                if(thisReference == null) {
273                    objectsEqual = objectsEqual && (thatReference == null);
274                } else {
275                    objectsEqual = objectsEqual && thisReference.equals(thatReference);
276                }
277            }
278            
279            if(objectsEqual) {
280                String thisDescription = getDescription();
281                String thatDescription = that.getDescription();
282                
283                if(thisDescription == null) {
284                    objectsEqual = objectsEqual && (thatDescription == null);
285                } else {
286                    objectsEqual = objectsEqual && thisDescription.equals(thatDescription);
287                }
288            }
289            
290            if(objectsEqual) {
291                Long thisFromTime = getFromTime();
292                Long thatFromTime = that.getFromTime();
293                
294                if(thisFromTime == null) {
295                    objectsEqual = objectsEqual && (thatFromTime == null);
296                } else {
297                    objectsEqual = objectsEqual && thisFromTime.equals(thatFromTime);
298                }
299            }
300            
301            if(objectsEqual) {
302                Long thisThruTime = getThruTime();
303                Long thatThruTime = that.getThruTime();
304                
305                if(thisThruTime == null) {
306                    objectsEqual = objectsEqual && (thatThruTime == null);
307                } else {
308                    objectsEqual = objectsEqual && thisThruTime.equals(thatThruTime);
309                }
310            }
311            
312            return objectsEqual;
313        } else {
314            return false;
315        }
316    }
317    
318    @Override
319    public boolean hasBeenModified() {
320        return financialAccountPKHasBeenModified || financialAccountTypePKHasBeenModified || financialAccountNameHasBeenModified || currencyPKHasBeenModified || glAccountPKHasBeenModified || referenceHasBeenModified || descriptionHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified;
321    }
322    
323    @Override
324    public void clearHasBeenModified() {
325        financialAccountPKHasBeenModified = false;
326        financialAccountTypePKHasBeenModified = false;
327        financialAccountNameHasBeenModified = false;
328        currencyPKHasBeenModified = false;
329        glAccountPKHasBeenModified = false;
330        referenceHasBeenModified = false;
331        descriptionHasBeenModified = false;
332        fromTimeHasBeenModified = false;
333        thruTimeHasBeenModified = false;
334    }
335    
336    @Nonnull
337    public FinancialAccountPK getFinancialAccountPK() {
338        return financialAccountPK;
339    }
340    
341    public void setFinancialAccountPK(@Nonnull FinancialAccountPK financialAccountPK)
342            throws PersistenceNotNullException {
343        checkForNull(financialAccountPK);
344        
345        boolean update = true;
346        
347        if(this.financialAccountPK != null) {
348            if(this.financialAccountPK.equals(financialAccountPK)) {
349                update = false;
350            }
351        } else if(financialAccountPK == null) {
352            update = false;
353        }
354        
355        if(update) {
356            this.financialAccountPK = financialAccountPK;
357            financialAccountPKHasBeenModified = true;
358            clearHashAndString();
359        }
360    }
361    
362    public boolean getFinancialAccountPKHasBeenModified() {
363        return financialAccountPKHasBeenModified;
364    }
365    
366    @Nonnull
367    public FinancialAccountTypePK getFinancialAccountTypePK() {
368        return financialAccountTypePK;
369    }
370    
371    public void setFinancialAccountTypePK(@Nonnull FinancialAccountTypePK financialAccountTypePK)
372            throws PersistenceNotNullException {
373        checkForNull(financialAccountTypePK);
374        
375        boolean update = true;
376        
377        if(this.financialAccountTypePK != null) {
378            if(this.financialAccountTypePK.equals(financialAccountTypePK)) {
379                update = false;
380            }
381        } else if(financialAccountTypePK == null) {
382            update = false;
383        }
384        
385        if(update) {
386            this.financialAccountTypePK = financialAccountTypePK;
387            financialAccountTypePKHasBeenModified = true;
388            clearHashAndString();
389        }
390    }
391    
392    public boolean getFinancialAccountTypePKHasBeenModified() {
393        return financialAccountTypePKHasBeenModified;
394    }
395    
396    @Nonnull
397    public String getFinancialAccountName() {
398        return financialAccountName;
399    }
400    
401    public void setFinancialAccountName(@Nonnull String financialAccountName)
402            throws PersistenceNotNullException {
403        checkForNull(financialAccountName);
404        
405        boolean update = true;
406        
407        if(this.financialAccountName != null) {
408            if(this.financialAccountName.equals(financialAccountName)) {
409                update = false;
410            }
411        } else if(financialAccountName == null) {
412            update = false;
413        }
414        
415        if(update) {
416            this.financialAccountName = financialAccountName;
417            financialAccountNameHasBeenModified = true;
418            clearHashAndString();
419        }
420    }
421    
422    public boolean getFinancialAccountNameHasBeenModified() {
423        return financialAccountNameHasBeenModified;
424    }
425    
426    @Nonnull
427    public CurrencyPK getCurrencyPK() {
428        return currencyPK;
429    }
430    
431    public void setCurrencyPK(@Nonnull CurrencyPK currencyPK)
432            throws PersistenceNotNullException {
433        checkForNull(currencyPK);
434        
435        boolean update = true;
436        
437        if(this.currencyPK != null) {
438            if(this.currencyPK.equals(currencyPK)) {
439                update = false;
440            }
441        } else if(currencyPK == null) {
442            update = false;
443        }
444        
445        if(update) {
446            this.currencyPK = currencyPK;
447            currencyPKHasBeenModified = true;
448            clearHashAndString();
449        }
450    }
451    
452    public boolean getCurrencyPKHasBeenModified() {
453        return currencyPKHasBeenModified;
454    }
455    
456    @Nonnull
457    public GlAccountPK getGlAccountPK() {
458        return glAccountPK;
459    }
460    
461    public void setGlAccountPK(@Nonnull GlAccountPK glAccountPK)
462            throws PersistenceNotNullException {
463        checkForNull(glAccountPK);
464        
465        boolean update = true;
466        
467        if(this.glAccountPK != null) {
468            if(this.glAccountPK.equals(glAccountPK)) {
469                update = false;
470            }
471        } else if(glAccountPK == null) {
472            update = false;
473        }
474        
475        if(update) {
476            this.glAccountPK = glAccountPK;
477            glAccountPKHasBeenModified = true;
478            clearHashAndString();
479        }
480    }
481    
482    public boolean getGlAccountPKHasBeenModified() {
483        return glAccountPKHasBeenModified;
484    }
485    
486    @Nullable
487    public String getReference() {
488        return reference;
489    }
490    
491    public void setReference(@Nullable String reference) {
492        boolean update = true;
493        
494        if(this.reference != null) {
495            if(this.reference.equals(reference)) {
496                update = false;
497            }
498        } else if(reference == null) {
499            update = false;
500        }
501        
502        if(update) {
503            this.reference = reference;
504            referenceHasBeenModified = true;
505            clearHashAndString();
506        }
507    }
508    
509    public boolean getReferenceHasBeenModified() {
510        return referenceHasBeenModified;
511    }
512    
513    @Nullable
514    public String getDescription() {
515        return description;
516    }
517    
518    public void setDescription(@Nullable String description) {
519        boolean update = true;
520        
521        if(this.description != null) {
522            if(this.description.equals(description)) {
523                update = false;
524            }
525        } else if(description == null) {
526            update = false;
527        }
528        
529        if(update) {
530            this.description = description;
531            descriptionHasBeenModified = true;
532            clearHashAndString();
533        }
534    }
535    
536    public boolean getDescriptionHasBeenModified() {
537        return descriptionHasBeenModified;
538    }
539    
540    @Nonnull
541    public Long getFromTime() {
542        return fromTime;
543    }
544    
545    public void setFromTime(@Nonnull Long fromTime)
546            throws PersistenceNotNullException {
547        checkForNull(fromTime);
548        
549        boolean update = true;
550        
551        if(this.fromTime != null) {
552            if(this.fromTime.equals(fromTime)) {
553                update = false;
554            }
555        } else if(fromTime == null) {
556            update = false;
557        }
558        
559        if(update) {
560            this.fromTime = fromTime;
561            fromTimeHasBeenModified = true;
562            clearHashAndString();
563        }
564    }
565    
566    public boolean getFromTimeHasBeenModified() {
567        return fromTimeHasBeenModified;
568    }
569    
570    @Nonnull
571    public Long getThruTime() {
572        return thruTime;
573    }
574    
575    public void setThruTime(@Nonnull Long thruTime)
576            throws PersistenceNotNullException {
577        checkForNull(thruTime);
578        
579        boolean update = true;
580        
581        if(this.thruTime != null) {
582            if(this.thruTime.equals(thruTime)) {
583                update = false;
584            }
585        } else if(thruTime == null) {
586            update = false;
587        }
588        
589        if(update) {
590            this.thruTime = thruTime;
591            thruTimeHasBeenModified = true;
592            clearHashAndString();
593        }
594    }
595    
596    public boolean getThruTimeHasBeenModified() {
597        return thruTimeHasBeenModified;
598    }
599    
600}