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 * FinancialAccountTransactionDetailValue.java
021 */
022
023package com.echothree.model.data.financial.server.value;
024
025import com.echothree.model.data.financial.common.pk.FinancialAccountTransactionDetailPK;
026
027import com.echothree.model.data.financial.server.factory.FinancialAccountTransactionDetailFactory;
028
029import com.echothree.model.data.financial.common.pk.FinancialAccountTransactionPK;
030import com.echothree.model.data.financial.common.pk.FinancialAccountPK;
031import com.echothree.model.data.financial.common.pk.FinancialAccountTransactionTypePK;
032
033import com.echothree.util.common.exception.PersistenceCloneException;
034import com.echothree.util.common.exception.PersistenceNotNullException;
035
036import com.echothree.util.server.persistence.BaseValue;
037
038import java.io.Serializable;
039
040public class FinancialAccountTransactionDetailValue
041        extends BaseValue<FinancialAccountTransactionDetailPK>
042        implements Cloneable, Serializable {
043    
044    private FinancialAccountTransactionPK financialAccountTransactionPK;
045    private boolean financialAccountTransactionPKHasBeenModified = false;
046    private String financialAccountTransactionName;
047    private boolean financialAccountTransactionNameHasBeenModified = false;
048    private FinancialAccountPK financialAccountPK;
049    private boolean financialAccountPKHasBeenModified = false;
050    private FinancialAccountTransactionTypePK financialAccountTransactionTypePK;
051    private boolean financialAccountTransactionTypePKHasBeenModified = false;
052    private Long amount;
053    private boolean amountHasBeenModified = false;
054    private String comment;
055    private boolean commentHasBeenModified = false;
056    private Long fromTime;
057    private boolean fromTimeHasBeenModified = false;
058    private Long thruTime;
059    private boolean thruTimeHasBeenModified = false;
060    
061    private transient Integer _hashCode = null;
062    private transient String _stringValue = null;
063    
064    private void constructFields(FinancialAccountTransactionPK financialAccountTransactionPK, String financialAccountTransactionName, FinancialAccountPK financialAccountPK, FinancialAccountTransactionTypePK financialAccountTransactionTypePK, Long amount, String comment, Long fromTime, Long thruTime)
065            throws PersistenceNotNullException {
066        checkForNull(financialAccountTransactionPK);
067        this.financialAccountTransactionPK = financialAccountTransactionPK;
068        checkForNull(financialAccountTransactionName);
069        this.financialAccountTransactionName = financialAccountTransactionName;
070        checkForNull(financialAccountPK);
071        this.financialAccountPK = financialAccountPK;
072        checkForNull(financialAccountTransactionTypePK);
073        this.financialAccountTransactionTypePK = financialAccountTransactionTypePK;
074        checkForNull(amount);
075        this.amount = amount;
076        this.comment = comment;
077        checkForNull(fromTime);
078        this.fromTime = fromTime;
079        checkForNull(thruTime);
080        this.thruTime = thruTime;
081    }
082    
083    /** Creates a new instance of FinancialAccountTransactionDetailValue */
084    public FinancialAccountTransactionDetailValue(FinancialAccountTransactionDetailPK financialAccountTransactionDetailPK, FinancialAccountTransactionPK financialAccountTransactionPK, String financialAccountTransactionName, FinancialAccountPK financialAccountPK, FinancialAccountTransactionTypePK financialAccountTransactionTypePK, Long amount, String comment, Long fromTime, Long thruTime)
085            throws PersistenceNotNullException {
086        super(financialAccountTransactionDetailPK);
087        constructFields(financialAccountTransactionPK, financialAccountTransactionName, financialAccountPK, financialAccountTransactionTypePK, amount, comment, fromTime, thruTime);
088    }
089    
090    /** Creates a new instance of FinancialAccountTransactionDetailValue */
091    public FinancialAccountTransactionDetailValue(FinancialAccountTransactionPK financialAccountTransactionPK, String financialAccountTransactionName, FinancialAccountPK financialAccountPK, FinancialAccountTransactionTypePK financialAccountTransactionTypePK, Long amount, String comment, Long fromTime, Long thruTime)
092            throws PersistenceNotNullException {
093        super();
094        constructFields(financialAccountTransactionPK, financialAccountTransactionName, financialAccountPK, financialAccountTransactionTypePK, amount, comment, fromTime, thruTime);
095    }
096    
097   @Override
098   public FinancialAccountTransactionDetailFactory getBaseFactoryInstance() {
099        return FinancialAccountTransactionDetailFactory.getInstance();
100    }
101    
102    @Override
103    public FinancialAccountTransactionDetailValue clone() {
104        Object result;
105        
106        try {
107            result = super.clone();
108        } catch (CloneNotSupportedException cnse) {
109            // This shouldn't happen, fail when it does.
110            throw new PersistenceCloneException(cnse);
111        }
112        
113        return (FinancialAccountTransactionDetailValue)result;
114    }
115    
116   @Override
117    public FinancialAccountTransactionDetailPK getPrimaryKey() {
118        if(_primaryKey == null) {
119            _primaryKey = new FinancialAccountTransactionDetailPK(entityId);
120        }
121        
122        return _primaryKey;
123    }
124    
125    private void clearHashAndString() {
126        _hashCode = null;
127        _stringValue = null;
128    }
129    
130    @Override
131    public int hashCode() {
132        if(_hashCode == null) {
133            int hashCode = 17;
134            
135            hashCode = 37 * hashCode + ((entityId != null) ? entityId.hashCode() : 0);
136            
137            hashCode = 37 * hashCode + ((financialAccountTransactionPK != null) ? financialAccountTransactionPK.hashCode() : 0);
138            hashCode = 37 * hashCode + ((financialAccountTransactionName != null) ? financialAccountTransactionName.hashCode() : 0);
139            hashCode = 37 * hashCode + ((financialAccountPK != null) ? financialAccountPK.hashCode() : 0);
140            hashCode = 37 * hashCode + ((financialAccountTransactionTypePK != null) ? financialAccountTransactionTypePK.hashCode() : 0);
141            hashCode = 37 * hashCode + ((amount != null) ? amount.hashCode() : 0);
142            hashCode = 37 * hashCode + ((comment != null) ? comment.hashCode() : 0);
143            hashCode = 37 * hashCode + ((fromTime != null) ? fromTime.hashCode() : 0);
144            hashCode = 37 * hashCode + ((thruTime != null) ? thruTime.hashCode() : 0);
145            
146            _hashCode = hashCode;
147        }
148        
149        return _hashCode;
150    }
151    
152    @Override
153    public String toString() {
154        if(_stringValue == null) {
155            _stringValue = "{" + 
156                    "entityId=" + getEntityId() +
157                    ", financialAccountTransactionPK=" + getFinancialAccountTransactionPK() +
158                    ", financialAccountTransactionName=" + getFinancialAccountTransactionName() +
159                    ", financialAccountPK=" + getFinancialAccountPK() +
160                    ", financialAccountTransactionTypePK=" + getFinancialAccountTransactionTypePK() +
161                    ", amount=" + getAmount() +
162                    ", comment=" + getComment() +
163                    ", fromTime=" + getFromTime() +
164                    ", thruTime=" + getThruTime() +
165                    "}";
166        }
167        return _stringValue;
168    }
169    
170    @Override
171    public boolean equals(Object other) {
172        if(this == other)
173            return true;
174        
175        if(!hasIdentity())
176            return false;
177        
178        if(other instanceof  FinancialAccountTransactionDetailValue that) {
179            if(!that.hasIdentity())
180                return false;
181            
182            Long thisEntityId = getEntityId();
183            Long thatEntityId = that.getEntityId();
184            
185            boolean objectsEqual = thisEntityId.equals(thatEntityId);
186            if(objectsEqual)
187                objectsEqual = isIdentical(that);
188            
189            return objectsEqual;
190        } else {
191            return false;
192        }
193    }
194    
195    public boolean isIdentical(Object other) {
196        if(other instanceof FinancialAccountTransactionDetailValue that) {
197            boolean objectsEqual = true;
198            
199            
200            if(objectsEqual) {
201                FinancialAccountTransactionPK thisFinancialAccountTransactionPK = getFinancialAccountTransactionPK();
202                FinancialAccountTransactionPK thatFinancialAccountTransactionPK = that.getFinancialAccountTransactionPK();
203                
204                if(thisFinancialAccountTransactionPK == null) {
205                    objectsEqual = objectsEqual && (thatFinancialAccountTransactionPK == null);
206                } else {
207                    objectsEqual = objectsEqual && thisFinancialAccountTransactionPK.equals(thatFinancialAccountTransactionPK);
208                }
209            }
210            
211            if(objectsEqual) {
212                String thisFinancialAccountTransactionName = getFinancialAccountTransactionName();
213                String thatFinancialAccountTransactionName = that.getFinancialAccountTransactionName();
214                
215                if(thisFinancialAccountTransactionName == null) {
216                    objectsEqual = objectsEqual && (thatFinancialAccountTransactionName == null);
217                } else {
218                    objectsEqual = objectsEqual && thisFinancialAccountTransactionName.equals(thatFinancialAccountTransactionName);
219                }
220            }
221            
222            if(objectsEqual) {
223                FinancialAccountPK thisFinancialAccountPK = getFinancialAccountPK();
224                FinancialAccountPK thatFinancialAccountPK = that.getFinancialAccountPK();
225                
226                if(thisFinancialAccountPK == null) {
227                    objectsEqual = objectsEqual && (thatFinancialAccountPK == null);
228                } else {
229                    objectsEqual = objectsEqual && thisFinancialAccountPK.equals(thatFinancialAccountPK);
230                }
231            }
232            
233            if(objectsEqual) {
234                FinancialAccountTransactionTypePK thisFinancialAccountTransactionTypePK = getFinancialAccountTransactionTypePK();
235                FinancialAccountTransactionTypePK thatFinancialAccountTransactionTypePK = that.getFinancialAccountTransactionTypePK();
236                
237                if(thisFinancialAccountTransactionTypePK == null) {
238                    objectsEqual = objectsEqual && (thatFinancialAccountTransactionTypePK == null);
239                } else {
240                    objectsEqual = objectsEqual && thisFinancialAccountTransactionTypePK.equals(thatFinancialAccountTransactionTypePK);
241                }
242            }
243            
244            if(objectsEqual) {
245                Long thisAmount = getAmount();
246                Long thatAmount = that.getAmount();
247                
248                if(thisAmount == null) {
249                    objectsEqual = objectsEqual && (thatAmount == null);
250                } else {
251                    objectsEqual = objectsEqual && thisAmount.equals(thatAmount);
252                }
253            }
254            
255            if(objectsEqual) {
256                String thisComment = getComment();
257                String thatComment = that.getComment();
258                
259                if(thisComment == null) {
260                    objectsEqual = objectsEqual && (thatComment == null);
261                } else {
262                    objectsEqual = objectsEqual && thisComment.equals(thatComment);
263                }
264            }
265            
266            if(objectsEqual) {
267                Long thisFromTime = getFromTime();
268                Long thatFromTime = that.getFromTime();
269                
270                if(thisFromTime == null) {
271                    objectsEqual = objectsEqual && (thatFromTime == null);
272                } else {
273                    objectsEqual = objectsEqual && thisFromTime.equals(thatFromTime);
274                }
275            }
276            
277            if(objectsEqual) {
278                Long thisThruTime = getThruTime();
279                Long thatThruTime = that.getThruTime();
280                
281                if(thisThruTime == null) {
282                    objectsEqual = objectsEqual && (thatThruTime == null);
283                } else {
284                    objectsEqual = objectsEqual && thisThruTime.equals(thatThruTime);
285                }
286            }
287            
288            return objectsEqual;
289        } else {
290            return false;
291        }
292    }
293    
294    @Override
295    public boolean hasBeenModified() {
296        return financialAccountTransactionPKHasBeenModified || financialAccountTransactionNameHasBeenModified || financialAccountPKHasBeenModified || financialAccountTransactionTypePKHasBeenModified || amountHasBeenModified || commentHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified;
297    }
298    
299    @Override
300    public void clearHasBeenModified() {
301        financialAccountTransactionPKHasBeenModified = false;
302        financialAccountTransactionNameHasBeenModified = false;
303        financialAccountPKHasBeenModified = false;
304        financialAccountTransactionTypePKHasBeenModified = false;
305        amountHasBeenModified = false;
306        commentHasBeenModified = false;
307        fromTimeHasBeenModified = false;
308        thruTimeHasBeenModified = false;
309    }
310    
311    public FinancialAccountTransactionPK getFinancialAccountTransactionPK() {
312        return financialAccountTransactionPK;
313    }
314    
315    public void setFinancialAccountTransactionPK(FinancialAccountTransactionPK financialAccountTransactionPK)
316            throws PersistenceNotNullException {
317        checkForNull(financialAccountTransactionPK);
318        
319        boolean update = true;
320        
321        if(this.financialAccountTransactionPK != null) {
322            if(this.financialAccountTransactionPK.equals(financialAccountTransactionPK)) {
323                update = false;
324            }
325        } else if(financialAccountTransactionPK == null) {
326            update = false;
327        }
328        
329        if(update) {
330            this.financialAccountTransactionPK = financialAccountTransactionPK;
331            financialAccountTransactionPKHasBeenModified = true;
332            clearHashAndString();
333        }
334    }
335    
336    public boolean getFinancialAccountTransactionPKHasBeenModified() {
337        return financialAccountTransactionPKHasBeenModified;
338    }
339    
340    public String getFinancialAccountTransactionName() {
341        return financialAccountTransactionName;
342    }
343    
344    public void setFinancialAccountTransactionName(String financialAccountTransactionName)
345            throws PersistenceNotNullException {
346        checkForNull(financialAccountTransactionName);
347        
348        boolean update = true;
349        
350        if(this.financialAccountTransactionName != null) {
351            if(this.financialAccountTransactionName.equals(financialAccountTransactionName)) {
352                update = false;
353            }
354        } else if(financialAccountTransactionName == null) {
355            update = false;
356        }
357        
358        if(update) {
359            this.financialAccountTransactionName = financialAccountTransactionName;
360            financialAccountTransactionNameHasBeenModified = true;
361            clearHashAndString();
362        }
363    }
364    
365    public boolean getFinancialAccountTransactionNameHasBeenModified() {
366        return financialAccountTransactionNameHasBeenModified;
367    }
368    
369    public FinancialAccountPK getFinancialAccountPK() {
370        return financialAccountPK;
371    }
372    
373    public void setFinancialAccountPK(FinancialAccountPK financialAccountPK)
374            throws PersistenceNotNullException {
375        checkForNull(financialAccountPK);
376        
377        boolean update = true;
378        
379        if(this.financialAccountPK != null) {
380            if(this.financialAccountPK.equals(financialAccountPK)) {
381                update = false;
382            }
383        } else if(financialAccountPK == null) {
384            update = false;
385        }
386        
387        if(update) {
388            this.financialAccountPK = financialAccountPK;
389            financialAccountPKHasBeenModified = true;
390            clearHashAndString();
391        }
392    }
393    
394    public boolean getFinancialAccountPKHasBeenModified() {
395        return financialAccountPKHasBeenModified;
396    }
397    
398    public FinancialAccountTransactionTypePK getFinancialAccountTransactionTypePK() {
399        return financialAccountTransactionTypePK;
400    }
401    
402    public void setFinancialAccountTransactionTypePK(FinancialAccountTransactionTypePK financialAccountTransactionTypePK)
403            throws PersistenceNotNullException {
404        checkForNull(financialAccountTransactionTypePK);
405        
406        boolean update = true;
407        
408        if(this.financialAccountTransactionTypePK != null) {
409            if(this.financialAccountTransactionTypePK.equals(financialAccountTransactionTypePK)) {
410                update = false;
411            }
412        } else if(financialAccountTransactionTypePK == null) {
413            update = false;
414        }
415        
416        if(update) {
417            this.financialAccountTransactionTypePK = financialAccountTransactionTypePK;
418            financialAccountTransactionTypePKHasBeenModified = true;
419            clearHashAndString();
420        }
421    }
422    
423    public boolean getFinancialAccountTransactionTypePKHasBeenModified() {
424        return financialAccountTransactionTypePKHasBeenModified;
425    }
426    
427    public Long getAmount() {
428        return amount;
429    }
430    
431    public void setAmount(Long amount)
432            throws PersistenceNotNullException {
433        checkForNull(amount);
434        
435        boolean update = true;
436        
437        if(this.amount != null) {
438            if(this.amount.equals(amount)) {
439                update = false;
440            }
441        } else if(amount == null) {
442            update = false;
443        }
444        
445        if(update) {
446            this.amount = amount;
447            amountHasBeenModified = true;
448            clearHashAndString();
449        }
450    }
451    
452    public boolean getAmountHasBeenModified() {
453        return amountHasBeenModified;
454    }
455    
456    public String getComment() {
457        return comment;
458    }
459    
460    public void setComment(String comment) {
461        boolean update = true;
462        
463        if(this.comment != null) {
464            if(this.comment.equals(comment)) {
465                update = false;
466            }
467        } else if(comment == null) {
468            update = false;
469        }
470        
471        if(update) {
472            this.comment = comment;
473            commentHasBeenModified = true;
474            clearHashAndString();
475        }
476    }
477    
478    public boolean getCommentHasBeenModified() {
479        return commentHasBeenModified;
480    }
481    
482    public Long getFromTime() {
483        return fromTime;
484    }
485    
486    public void setFromTime(Long fromTime)
487            throws PersistenceNotNullException {
488        checkForNull(fromTime);
489        
490        boolean update = true;
491        
492        if(this.fromTime != null) {
493            if(this.fromTime.equals(fromTime)) {
494                update = false;
495            }
496        } else if(fromTime == null) {
497            update = false;
498        }
499        
500        if(update) {
501            this.fromTime = fromTime;
502            fromTimeHasBeenModified = true;
503            clearHashAndString();
504        }
505    }
506    
507    public boolean getFromTimeHasBeenModified() {
508        return fromTimeHasBeenModified;
509    }
510    
511    public Long getThruTime() {
512        return thruTime;
513    }
514    
515    public void setThruTime(Long thruTime)
516            throws PersistenceNotNullException {
517        checkForNull(thruTime);
518        
519        boolean update = true;
520        
521        if(this.thruTime != null) {
522            if(this.thruTime.equals(thruTime)) {
523                update = false;
524            }
525        } else if(thruTime == null) {
526            update = false;
527        }
528        
529        if(update) {
530            this.thruTime = thruTime;
531            thruTimeHasBeenModified = true;
532            clearHashAndString();
533        }
534    }
535    
536    public boolean getThruTimeHasBeenModified() {
537        return thruTimeHasBeenModified;
538    }
539    
540}