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