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