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