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 * 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            StringBuilder stringValue = new StringBuilder("{");
161            
162            stringValue.append("entityId=").append(getEntityId());
163            
164            stringValue.append(", financialAccountPK=").append(getFinancialAccountPK());
165            stringValue.append(", financialAccountTypePK=").append(getFinancialAccountTypePK());
166            stringValue.append(", financialAccountName=").append(getFinancialAccountName());
167            stringValue.append(", currencyPK=").append(getCurrencyPK());
168            stringValue.append(", glAccountPK=").append(getGlAccountPK());
169            stringValue.append(", reference=").append(getReference());
170            stringValue.append(", description=").append(getDescription());
171            stringValue.append(", fromTime=").append(getFromTime());
172            stringValue.append(", thruTime=").append(getThruTime());
173            
174            stringValue.append('}');
175            
176            _stringValue = stringValue.toString();
177        }
178        return _stringValue;
179    }
180    
181    @Override
182    public boolean equals(Object other) {
183        if(this == other)
184            return true;
185        
186        if(!hasIdentity())
187            return false;
188        
189        if(other instanceof  FinancialAccountDetailValue) {
190            FinancialAccountDetailValue that = (FinancialAccountDetailValue)other;
191            
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 = 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) {
210            FinancialAccountDetailValue that = (FinancialAccountDetailValue)other;
211            boolean objectsEqual = true;
212            
213            
214            if(objectsEqual) {
215                FinancialAccountPK thisFinancialAccountPK = getFinancialAccountPK();
216                FinancialAccountPK thatFinancialAccountPK = that.getFinancialAccountPK();
217                
218                if(thisFinancialAccountPK == null) {
219                    objectsEqual = objectsEqual && (thatFinancialAccountPK == null);
220                } else {
221                    objectsEqual = objectsEqual && thisFinancialAccountPK.equals(thatFinancialAccountPK);
222                }
223            }
224            
225            if(objectsEqual) {
226                FinancialAccountTypePK thisFinancialAccountTypePK = getFinancialAccountTypePK();
227                FinancialAccountTypePK thatFinancialAccountTypePK = that.getFinancialAccountTypePK();
228                
229                if(thisFinancialAccountTypePK == null) {
230                    objectsEqual = objectsEqual && (thatFinancialAccountTypePK == null);
231                } else {
232                    objectsEqual = objectsEqual && thisFinancialAccountTypePK.equals(thatFinancialAccountTypePK);
233                }
234            }
235            
236            if(objectsEqual) {
237                String thisFinancialAccountName = getFinancialAccountName();
238                String thatFinancialAccountName = that.getFinancialAccountName();
239                
240                if(thisFinancialAccountName == null) {
241                    objectsEqual = objectsEqual && (thatFinancialAccountName == null);
242                } else {
243                    objectsEqual = objectsEqual && thisFinancialAccountName.equals(thatFinancialAccountName);
244                }
245            }
246            
247            if(objectsEqual) {
248                CurrencyPK thisCurrencyPK = getCurrencyPK();
249                CurrencyPK thatCurrencyPK = that.getCurrencyPK();
250                
251                if(thisCurrencyPK == null) {
252                    objectsEqual = objectsEqual && (thatCurrencyPK == null);
253                } else {
254                    objectsEqual = objectsEqual && thisCurrencyPK.equals(thatCurrencyPK);
255                }
256            }
257            
258            if(objectsEqual) {
259                GlAccountPK thisGlAccountPK = getGlAccountPK();
260                GlAccountPK thatGlAccountPK = that.getGlAccountPK();
261                
262                if(thisGlAccountPK == null) {
263                    objectsEqual = objectsEqual && (thatGlAccountPK == null);
264                } else {
265                    objectsEqual = objectsEqual && thisGlAccountPK.equals(thatGlAccountPK);
266                }
267            }
268            
269            if(objectsEqual) {
270                String thisReference = getReference();
271                String thatReference = that.getReference();
272                
273                if(thisReference == null) {
274                    objectsEqual = objectsEqual && (thatReference == null);
275                } else {
276                    objectsEqual = objectsEqual && thisReference.equals(thatReference);
277                }
278            }
279            
280            if(objectsEqual) {
281                String thisDescription = getDescription();
282                String thatDescription = that.getDescription();
283                
284                if(thisDescription == null) {
285                    objectsEqual = objectsEqual && (thatDescription == null);
286                } else {
287                    objectsEqual = objectsEqual && thisDescription.equals(thatDescription);
288                }
289            }
290            
291            if(objectsEqual) {
292                Long thisFromTime = getFromTime();
293                Long thatFromTime = that.getFromTime();
294                
295                if(thisFromTime == null) {
296                    objectsEqual = objectsEqual && (thatFromTime == null);
297                } else {
298                    objectsEqual = objectsEqual && thisFromTime.equals(thatFromTime);
299                }
300            }
301            
302            if(objectsEqual) {
303                Long thisThruTime = getThruTime();
304                Long thatThruTime = that.getThruTime();
305                
306                if(thisThruTime == null) {
307                    objectsEqual = objectsEqual && (thatThruTime == null);
308                } else {
309                    objectsEqual = objectsEqual && thisThruTime.equals(thatThruTime);
310                }
311            }
312            
313            return objectsEqual;
314        } else {
315            return false;
316        }
317    }
318    
319    @Override
320    public boolean hasBeenModified() {
321        return financialAccountPKHasBeenModified || financialAccountTypePKHasBeenModified || financialAccountNameHasBeenModified || currencyPKHasBeenModified || glAccountPKHasBeenModified || referenceHasBeenModified || descriptionHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified;
322    }
323    
324    @Override
325    public void clearHasBeenModified() {
326        financialAccountPKHasBeenModified = false;
327        financialAccountTypePKHasBeenModified = false;
328        financialAccountNameHasBeenModified = false;
329        currencyPKHasBeenModified = false;
330        glAccountPKHasBeenModified = false;
331        referenceHasBeenModified = false;
332        descriptionHasBeenModified = false;
333        fromTimeHasBeenModified = false;
334        thruTimeHasBeenModified = false;
335    }
336    
337    public FinancialAccountPK getFinancialAccountPK() {
338        return financialAccountPK;
339    }
340    
341    public void setFinancialAccountPK(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    public FinancialAccountTypePK getFinancialAccountTypePK() {
367        return financialAccountTypePK;
368    }
369    
370    public void setFinancialAccountTypePK(FinancialAccountTypePK financialAccountTypePK)
371            throws PersistenceNotNullException {
372        checkForNull(financialAccountTypePK);
373        
374        boolean update = true;
375        
376        if(this.financialAccountTypePK != null) {
377            if(this.financialAccountTypePK.equals(financialAccountTypePK)) {
378                update = false;
379            }
380        } else if(financialAccountTypePK == null) {
381            update = false;
382        }
383        
384        if(update) {
385            this.financialAccountTypePK = financialAccountTypePK;
386            financialAccountTypePKHasBeenModified = true;
387            clearHashAndString();
388        }
389    }
390    
391    public boolean getFinancialAccountTypePKHasBeenModified() {
392        return financialAccountTypePKHasBeenModified;
393    }
394    
395    public String getFinancialAccountName() {
396        return financialAccountName;
397    }
398    
399    public void setFinancialAccountName(String financialAccountName)
400            throws PersistenceNotNullException {
401        checkForNull(financialAccountName);
402        
403        boolean update = true;
404        
405        if(this.financialAccountName != null) {
406            if(this.financialAccountName.equals(financialAccountName)) {
407                update = false;
408            }
409        } else if(financialAccountName == null) {
410            update = false;
411        }
412        
413        if(update) {
414            this.financialAccountName = financialAccountName;
415            financialAccountNameHasBeenModified = true;
416            clearHashAndString();
417        }
418    }
419    
420    public boolean getFinancialAccountNameHasBeenModified() {
421        return financialAccountNameHasBeenModified;
422    }
423    
424    public CurrencyPK getCurrencyPK() {
425        return currencyPK;
426    }
427    
428    public void setCurrencyPK(CurrencyPK currencyPK)
429            throws PersistenceNotNullException {
430        checkForNull(currencyPK);
431        
432        boolean update = true;
433        
434        if(this.currencyPK != null) {
435            if(this.currencyPK.equals(currencyPK)) {
436                update = false;
437            }
438        } else if(currencyPK == null) {
439            update = false;
440        }
441        
442        if(update) {
443            this.currencyPK = currencyPK;
444            currencyPKHasBeenModified = true;
445            clearHashAndString();
446        }
447    }
448    
449    public boolean getCurrencyPKHasBeenModified() {
450        return currencyPKHasBeenModified;
451    }
452    
453    public GlAccountPK getGlAccountPK() {
454        return glAccountPK;
455    }
456    
457    public void setGlAccountPK(GlAccountPK glAccountPK)
458            throws PersistenceNotNullException {
459        checkForNull(glAccountPK);
460        
461        boolean update = true;
462        
463        if(this.glAccountPK != null) {
464            if(this.glAccountPK.equals(glAccountPK)) {
465                update = false;
466            }
467        } else if(glAccountPK == null) {
468            update = false;
469        }
470        
471        if(update) {
472            this.glAccountPK = glAccountPK;
473            glAccountPKHasBeenModified = true;
474            clearHashAndString();
475        }
476    }
477    
478    public boolean getGlAccountPKHasBeenModified() {
479        return glAccountPKHasBeenModified;
480    }
481    
482    public String getReference() {
483        return reference;
484    }
485    
486    public void setReference(String reference) {
487        boolean update = true;
488        
489        if(this.reference != null) {
490            if(this.reference.equals(reference)) {
491                update = false;
492            }
493        } else if(reference == null) {
494            update = false;
495        }
496        
497        if(update) {
498            this.reference = reference;
499            referenceHasBeenModified = true;
500            clearHashAndString();
501        }
502    }
503    
504    public boolean getReferenceHasBeenModified() {
505        return referenceHasBeenModified;
506    }
507    
508    public String getDescription() {
509        return description;
510    }
511    
512    public void setDescription(String description) {
513        boolean update = true;
514        
515        if(this.description != null) {
516            if(this.description.equals(description)) {
517                update = false;
518            }
519        } else if(description == null) {
520            update = false;
521        }
522        
523        if(update) {
524            this.description = description;
525            descriptionHasBeenModified = true;
526            clearHashAndString();
527        }
528    }
529    
530    public boolean getDescriptionHasBeenModified() {
531        return descriptionHasBeenModified;
532    }
533    
534    public Long getFromTime() {
535        return fromTime;
536    }
537    
538    public void setFromTime(Long fromTime)
539            throws PersistenceNotNullException {
540        checkForNull(fromTime);
541        
542        boolean update = true;
543        
544        if(this.fromTime != null) {
545            if(this.fromTime.equals(fromTime)) {
546                update = false;
547            }
548        } else if(fromTime == null) {
549            update = false;
550        }
551        
552        if(update) {
553            this.fromTime = fromTime;
554            fromTimeHasBeenModified = true;
555            clearHashAndString();
556        }
557    }
558    
559    public boolean getFromTimeHasBeenModified() {
560        return fromTimeHasBeenModified;
561    }
562    
563    public Long getThruTime() {
564        return thruTime;
565    }
566    
567    public void setThruTime(Long thruTime)
568            throws PersistenceNotNullException {
569        checkForNull(thruTime);
570        
571        boolean update = true;
572        
573        if(this.thruTime != null) {
574            if(this.thruTime.equals(thruTime)) {
575                update = false;
576            }
577        } else if(thruTime == null) {
578            update = false;
579        }
580        
581        if(update) {
582            this.thruTime = thruTime;
583            thruTimeHasBeenModified = true;
584            clearHashAndString();
585        }
586    }
587    
588    public boolean getThruTimeHasBeenModified() {
589        return thruTimeHasBeenModified;
590    }
591    
592}