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