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