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