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 * ContentCategoryDetailValue.java
021 */
022
023package com.echothree.model.data.content.server.value;
024
025import com.echothree.model.data.content.common.pk.ContentCategoryDetailPK;
026
027import com.echothree.model.data.content.server.factory.ContentCategoryDetailFactory;
028
029import com.echothree.model.data.content.common.pk.ContentCategoryPK;
030import com.echothree.model.data.content.common.pk.ContentCatalogPK;
031import com.echothree.model.data.offer.common.pk.OfferUsePK;
032import com.echothree.model.data.selector.common.pk.SelectorPK;
033
034import com.echothree.util.common.exception.PersistenceCloneException;
035import com.echothree.util.common.exception.PersistenceNotNullException;
036
037import com.echothree.util.server.persistence.BaseValue;
038
039import java.io.Serializable;
040
041import javax.annotation.Nonnull;
042import javax.annotation.Nullable;
043
044public class ContentCategoryDetailValue
045        extends BaseValue<ContentCategoryDetailPK>
046        implements Cloneable, Serializable {
047    
048    private ContentCategoryPK contentCategoryPK;
049    private boolean contentCategoryPKHasBeenModified = false;
050    private ContentCatalogPK contentCatalogPK;
051    private boolean contentCatalogPKHasBeenModified = false;
052    private String contentCategoryName;
053    private boolean contentCategoryNameHasBeenModified = false;
054    private ContentCategoryPK parentContentCategoryPK;
055    private boolean parentContentCategoryPKHasBeenModified = false;
056    private OfferUsePK defaultOfferUsePK;
057    private boolean defaultOfferUsePKHasBeenModified = false;
058    private SelectorPK contentCategoryItemSelectorPK;
059    private boolean contentCategoryItemSelectorPKHasBeenModified = false;
060    private Boolean isDefault;
061    private boolean isDefaultHasBeenModified = false;
062    private Integer sortOrder;
063    private boolean sortOrderHasBeenModified = false;
064    private Long fromTime;
065    private boolean fromTimeHasBeenModified = false;
066    private Long thruTime;
067    private boolean thruTimeHasBeenModified = false;
068    
069    private transient Integer _hashCode = null;
070    private transient String _stringValue = null;
071    
072    private void constructFields(ContentCategoryPK contentCategoryPK, ContentCatalogPK contentCatalogPK, String contentCategoryName, ContentCategoryPK parentContentCategoryPK, OfferUsePK defaultOfferUsePK, SelectorPK contentCategoryItemSelectorPK, Boolean isDefault, Integer sortOrder, Long fromTime, Long thruTime)
073            throws PersistenceNotNullException {
074        checkForNull(contentCategoryPK);
075        this.contentCategoryPK = contentCategoryPK;
076        checkForNull(contentCatalogPK);
077        this.contentCatalogPK = contentCatalogPK;
078        checkForNull(contentCategoryName);
079        this.contentCategoryName = contentCategoryName;
080        this.parentContentCategoryPK = parentContentCategoryPK;
081        this.defaultOfferUsePK = defaultOfferUsePK;
082        this.contentCategoryItemSelectorPK = contentCategoryItemSelectorPK;
083        checkForNull(isDefault);
084        this.isDefault = isDefault;
085        checkForNull(sortOrder);
086        this.sortOrder = sortOrder;
087        checkForNull(fromTime);
088        this.fromTime = fromTime;
089        checkForNull(thruTime);
090        this.thruTime = thruTime;
091    }
092    
093    /** Creates a new instance of ContentCategoryDetailValue */
094    public ContentCategoryDetailValue(ContentCategoryDetailPK contentCategoryDetailPK, ContentCategoryPK contentCategoryPK, ContentCatalogPK contentCatalogPK, String contentCategoryName, ContentCategoryPK parentContentCategoryPK, OfferUsePK defaultOfferUsePK, SelectorPK contentCategoryItemSelectorPK, Boolean isDefault, Integer sortOrder, Long fromTime, Long thruTime)
095            throws PersistenceNotNullException {
096        super(contentCategoryDetailPK);
097        constructFields(contentCategoryPK, contentCatalogPK, contentCategoryName, parentContentCategoryPK, defaultOfferUsePK, contentCategoryItemSelectorPK, isDefault, sortOrder, fromTime, thruTime);
098    }
099    
100    /** Creates a new instance of ContentCategoryDetailValue */
101    public ContentCategoryDetailValue(ContentCategoryPK contentCategoryPK, ContentCatalogPK contentCatalogPK, String contentCategoryName, ContentCategoryPK parentContentCategoryPK, OfferUsePK defaultOfferUsePK, SelectorPK contentCategoryItemSelectorPK, Boolean isDefault, Integer sortOrder, Long fromTime, Long thruTime)
102            throws PersistenceNotNullException {
103        super();
104        constructFields(contentCategoryPK, contentCatalogPK, contentCategoryName, parentContentCategoryPK, defaultOfferUsePK, contentCategoryItemSelectorPK, isDefault, sortOrder, fromTime, thruTime);
105    }
106    
107    @Override
108    @Nonnull
109    public ContentCategoryDetailFactory getBaseFactoryInstance() {
110        return ContentCategoryDetailFactory.getInstance();
111    }
112    
113    @Override
114    @Nonnull
115    public ContentCategoryDetailValue clone() {
116        Object result;
117        
118        try {
119            result = super.clone();
120        } catch (CloneNotSupportedException cnse) {
121            // This shouldn't happen, fail when it does.
122            throw new PersistenceCloneException(cnse);
123        }
124        
125        return (ContentCategoryDetailValue)result;
126    }
127    
128    @Override
129    @Nonnull
130    public ContentCategoryDetailPK getPrimaryKey() {
131        if(_primaryKey == null) {
132            _primaryKey = new ContentCategoryDetailPK(entityId);
133        }
134        
135        return _primaryKey;
136    }
137    
138    private void clearHashAndString() {
139        _hashCode = null;
140        _stringValue = null;
141    }
142    
143    @Override
144    public int hashCode() {
145        if(_hashCode == null) {
146            int hashCode = 17;
147            
148            hashCode = 37 * hashCode + ((entityId != null) ? entityId.hashCode() : 0);
149            
150            hashCode = 37 * hashCode + ((contentCategoryPK != null) ? contentCategoryPK.hashCode() : 0);
151            hashCode = 37 * hashCode + ((contentCatalogPK != null) ? contentCatalogPK.hashCode() : 0);
152            hashCode = 37 * hashCode + ((contentCategoryName != null) ? contentCategoryName.hashCode() : 0);
153            hashCode = 37 * hashCode + ((parentContentCategoryPK != null) ? parentContentCategoryPK.hashCode() : 0);
154            hashCode = 37 * hashCode + ((defaultOfferUsePK != null) ? defaultOfferUsePK.hashCode() : 0);
155            hashCode = 37 * hashCode + ((contentCategoryItemSelectorPK != null) ? contentCategoryItemSelectorPK.hashCode() : 0);
156            hashCode = 37 * hashCode + ((isDefault != null) ? isDefault.hashCode() : 0);
157            hashCode = 37 * hashCode + ((sortOrder != null) ? sortOrder.hashCode() : 0);
158            hashCode = 37 * hashCode + ((fromTime != null) ? fromTime.hashCode() : 0);
159            hashCode = 37 * hashCode + ((thruTime != null) ? thruTime.hashCode() : 0);
160            
161            _hashCode = hashCode;
162        }
163        
164        return _hashCode;
165    }
166    
167    @Override
168    @Nonnull
169    public String toString() {
170        if(_stringValue == null) {
171            _stringValue = "{" + 
172                    "entityId=" + getEntityId() +
173                    ", contentCategoryPK=" + getContentCategoryPK() +
174                    ", contentCatalogPK=" + getContentCatalogPK() +
175                    ", contentCategoryName=" + getContentCategoryName() +
176                    ", parentContentCategoryPK=" + getParentContentCategoryPK() +
177                    ", defaultOfferUsePK=" + getDefaultOfferUsePK() +
178                    ", contentCategoryItemSelectorPK=" + getContentCategoryItemSelectorPK() +
179                    ", isDefault=" + getIsDefault() +
180                    ", sortOrder=" + getSortOrder() +
181                    ", fromTime=" + getFromTime() +
182                    ", thruTime=" + getThruTime() +
183                    "}";
184        }
185        return _stringValue;
186    }
187    
188    @Override
189    public boolean equals(Object other) {
190        if(this == other)
191            return true;
192        
193        if(!hasIdentity())
194            return false;
195        
196        if(other instanceof  ContentCategoryDetailValue that) {
197            if(!that.hasIdentity())
198                return false;
199            
200            Long thisEntityId = getEntityId();
201            Long thatEntityId = that.getEntityId();
202            
203            boolean objectsEqual = thisEntityId.equals(thatEntityId);
204            if(objectsEqual)
205                objectsEqual = isIdentical(that);
206            
207            return objectsEqual;
208        } else {
209            return false;
210        }
211    }
212    
213    public boolean isIdentical(Object other) {
214        if(other instanceof ContentCategoryDetailValue that) {
215            boolean objectsEqual = true;
216            
217            
218            if(objectsEqual) {
219                ContentCategoryPK thisContentCategoryPK = getContentCategoryPK();
220                ContentCategoryPK thatContentCategoryPK = that.getContentCategoryPK();
221                
222                if(thisContentCategoryPK == null) {
223                    objectsEqual = objectsEqual && (thatContentCategoryPK == null);
224                } else {
225                    objectsEqual = objectsEqual && thisContentCategoryPK.equals(thatContentCategoryPK);
226                }
227            }
228            
229            if(objectsEqual) {
230                ContentCatalogPK thisContentCatalogPK = getContentCatalogPK();
231                ContentCatalogPK thatContentCatalogPK = that.getContentCatalogPK();
232                
233                if(thisContentCatalogPK == null) {
234                    objectsEqual = objectsEqual && (thatContentCatalogPK == null);
235                } else {
236                    objectsEqual = objectsEqual && thisContentCatalogPK.equals(thatContentCatalogPK);
237                }
238            }
239            
240            if(objectsEqual) {
241                String thisContentCategoryName = getContentCategoryName();
242                String thatContentCategoryName = that.getContentCategoryName();
243                
244                if(thisContentCategoryName == null) {
245                    objectsEqual = objectsEqual && (thatContentCategoryName == null);
246                } else {
247                    objectsEqual = objectsEqual && thisContentCategoryName.equals(thatContentCategoryName);
248                }
249            }
250            
251            if(objectsEqual) {
252                ContentCategoryPK thisParentContentCategoryPK = getParentContentCategoryPK();
253                ContentCategoryPK thatParentContentCategoryPK = that.getParentContentCategoryPK();
254                
255                if(thisParentContentCategoryPK == null) {
256                    objectsEqual = objectsEqual && (thatParentContentCategoryPK == null);
257                } else {
258                    objectsEqual = objectsEqual && thisParentContentCategoryPK.equals(thatParentContentCategoryPK);
259                }
260            }
261            
262            if(objectsEqual) {
263                OfferUsePK thisDefaultOfferUsePK = getDefaultOfferUsePK();
264                OfferUsePK thatDefaultOfferUsePK = that.getDefaultOfferUsePK();
265                
266                if(thisDefaultOfferUsePK == null) {
267                    objectsEqual = objectsEqual && (thatDefaultOfferUsePK == null);
268                } else {
269                    objectsEqual = objectsEqual && thisDefaultOfferUsePK.equals(thatDefaultOfferUsePK);
270                }
271            }
272            
273            if(objectsEqual) {
274                SelectorPK thisContentCategoryItemSelectorPK = getContentCategoryItemSelectorPK();
275                SelectorPK thatContentCategoryItemSelectorPK = that.getContentCategoryItemSelectorPK();
276                
277                if(thisContentCategoryItemSelectorPK == null) {
278                    objectsEqual = objectsEqual && (thatContentCategoryItemSelectorPK == null);
279                } else {
280                    objectsEqual = objectsEqual && thisContentCategoryItemSelectorPK.equals(thatContentCategoryItemSelectorPK);
281                }
282            }
283            
284            if(objectsEqual) {
285                Boolean thisIsDefault = getIsDefault();
286                Boolean thatIsDefault = that.getIsDefault();
287                
288                if(thisIsDefault == null) {
289                    objectsEqual = objectsEqual && (thatIsDefault == null);
290                } else {
291                    objectsEqual = objectsEqual && thisIsDefault.equals(thatIsDefault);
292                }
293            }
294            
295            if(objectsEqual) {
296                Integer thisSortOrder = getSortOrder();
297                Integer thatSortOrder = that.getSortOrder();
298                
299                if(thisSortOrder == null) {
300                    objectsEqual = objectsEqual && (thatSortOrder == null);
301                } else {
302                    objectsEqual = objectsEqual && thisSortOrder.equals(thatSortOrder);
303                }
304            }
305            
306            if(objectsEqual) {
307                Long thisFromTime = getFromTime();
308                Long thatFromTime = that.getFromTime();
309                
310                if(thisFromTime == null) {
311                    objectsEqual = objectsEqual && (thatFromTime == null);
312                } else {
313                    objectsEqual = objectsEqual && thisFromTime.equals(thatFromTime);
314                }
315            }
316            
317            if(objectsEqual) {
318                Long thisThruTime = getThruTime();
319                Long thatThruTime = that.getThruTime();
320                
321                if(thisThruTime == null) {
322                    objectsEqual = objectsEqual && (thatThruTime == null);
323                } else {
324                    objectsEqual = objectsEqual && thisThruTime.equals(thatThruTime);
325                }
326            }
327            
328            return objectsEqual;
329        } else {
330            return false;
331        }
332    }
333    
334    @Override
335    public boolean hasBeenModified() {
336        return contentCategoryPKHasBeenModified || contentCatalogPKHasBeenModified || contentCategoryNameHasBeenModified || parentContentCategoryPKHasBeenModified || defaultOfferUsePKHasBeenModified || contentCategoryItemSelectorPKHasBeenModified || isDefaultHasBeenModified || sortOrderHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified;
337    }
338    
339    @Override
340    public void clearHasBeenModified() {
341        contentCategoryPKHasBeenModified = false;
342        contentCatalogPKHasBeenModified = false;
343        contentCategoryNameHasBeenModified = false;
344        parentContentCategoryPKHasBeenModified = false;
345        defaultOfferUsePKHasBeenModified = false;
346        contentCategoryItemSelectorPKHasBeenModified = false;
347        isDefaultHasBeenModified = false;
348        sortOrderHasBeenModified = false;
349        fromTimeHasBeenModified = false;
350        thruTimeHasBeenModified = false;
351    }
352    
353    @Nonnull
354    public ContentCategoryPK getContentCategoryPK() {
355        return contentCategoryPK;
356    }
357    
358    public void setContentCategoryPK(@Nonnull ContentCategoryPK contentCategoryPK)
359            throws PersistenceNotNullException {
360        checkForNull(contentCategoryPK);
361        
362        boolean update = true;
363        
364        if(this.contentCategoryPK != null) {
365            if(this.contentCategoryPK.equals(contentCategoryPK)) {
366                update = false;
367            }
368        } else if(contentCategoryPK == null) {
369            update = false;
370        }
371        
372        if(update) {
373            this.contentCategoryPK = contentCategoryPK;
374            contentCategoryPKHasBeenModified = true;
375            clearHashAndString();
376        }
377    }
378    
379    public boolean getContentCategoryPKHasBeenModified() {
380        return contentCategoryPKHasBeenModified;
381    }
382    
383    @Nonnull
384    public ContentCatalogPK getContentCatalogPK() {
385        return contentCatalogPK;
386    }
387    
388    public void setContentCatalogPK(@Nonnull ContentCatalogPK contentCatalogPK)
389            throws PersistenceNotNullException {
390        checkForNull(contentCatalogPK);
391        
392        boolean update = true;
393        
394        if(this.contentCatalogPK != null) {
395            if(this.contentCatalogPK.equals(contentCatalogPK)) {
396                update = false;
397            }
398        } else if(contentCatalogPK == null) {
399            update = false;
400        }
401        
402        if(update) {
403            this.contentCatalogPK = contentCatalogPK;
404            contentCatalogPKHasBeenModified = true;
405            clearHashAndString();
406        }
407    }
408    
409    public boolean getContentCatalogPKHasBeenModified() {
410        return contentCatalogPKHasBeenModified;
411    }
412    
413    @Nonnull
414    public String getContentCategoryName() {
415        return contentCategoryName;
416    }
417    
418    public void setContentCategoryName(@Nonnull String contentCategoryName)
419            throws PersistenceNotNullException {
420        checkForNull(contentCategoryName);
421        
422        boolean update = true;
423        
424        if(this.contentCategoryName != null) {
425            if(this.contentCategoryName.equals(contentCategoryName)) {
426                update = false;
427            }
428        } else if(contentCategoryName == null) {
429            update = false;
430        }
431        
432        if(update) {
433            this.contentCategoryName = contentCategoryName;
434            contentCategoryNameHasBeenModified = true;
435            clearHashAndString();
436        }
437    }
438    
439    public boolean getContentCategoryNameHasBeenModified() {
440        return contentCategoryNameHasBeenModified;
441    }
442    
443    @Nullable
444    public ContentCategoryPK getParentContentCategoryPK() {
445        return parentContentCategoryPK;
446    }
447    
448    public void setParentContentCategoryPK(@Nullable ContentCategoryPK parentContentCategoryPK) {
449        boolean update = true;
450        
451        if(this.parentContentCategoryPK != null) {
452            if(this.parentContentCategoryPK.equals(parentContentCategoryPK)) {
453                update = false;
454            }
455        } else if(parentContentCategoryPK == null) {
456            update = false;
457        }
458        
459        if(update) {
460            this.parentContentCategoryPK = parentContentCategoryPK;
461            parentContentCategoryPKHasBeenModified = true;
462            clearHashAndString();
463        }
464    }
465    
466    public boolean getParentContentCategoryPKHasBeenModified() {
467        return parentContentCategoryPKHasBeenModified;
468    }
469    
470    @Nullable
471    public OfferUsePK getDefaultOfferUsePK() {
472        return defaultOfferUsePK;
473    }
474    
475    public void setDefaultOfferUsePK(@Nullable OfferUsePK defaultOfferUsePK) {
476        boolean update = true;
477        
478        if(this.defaultOfferUsePK != null) {
479            if(this.defaultOfferUsePK.equals(defaultOfferUsePK)) {
480                update = false;
481            }
482        } else if(defaultOfferUsePK == null) {
483            update = false;
484        }
485        
486        if(update) {
487            this.defaultOfferUsePK = defaultOfferUsePK;
488            defaultOfferUsePKHasBeenModified = true;
489            clearHashAndString();
490        }
491    }
492    
493    public boolean getDefaultOfferUsePKHasBeenModified() {
494        return defaultOfferUsePKHasBeenModified;
495    }
496    
497    @Nullable
498    public SelectorPK getContentCategoryItemSelectorPK() {
499        return contentCategoryItemSelectorPK;
500    }
501    
502    public void setContentCategoryItemSelectorPK(@Nullable SelectorPK contentCategoryItemSelectorPK) {
503        boolean update = true;
504        
505        if(this.contentCategoryItemSelectorPK != null) {
506            if(this.contentCategoryItemSelectorPK.equals(contentCategoryItemSelectorPK)) {
507                update = false;
508            }
509        } else if(contentCategoryItemSelectorPK == null) {
510            update = false;
511        }
512        
513        if(update) {
514            this.contentCategoryItemSelectorPK = contentCategoryItemSelectorPK;
515            contentCategoryItemSelectorPKHasBeenModified = true;
516            clearHashAndString();
517        }
518    }
519    
520    public boolean getContentCategoryItemSelectorPKHasBeenModified() {
521        return contentCategoryItemSelectorPKHasBeenModified;
522    }
523    
524    @Nonnull
525    public Boolean getIsDefault() {
526        return isDefault;
527    }
528    
529    public void setIsDefault(@Nonnull Boolean isDefault)
530            throws PersistenceNotNullException {
531        checkForNull(isDefault);
532        
533        boolean update = true;
534        
535        if(this.isDefault != null) {
536            if(this.isDefault.equals(isDefault)) {
537                update = false;
538            }
539        } else if(isDefault == null) {
540            update = false;
541        }
542        
543        if(update) {
544            this.isDefault = isDefault;
545            isDefaultHasBeenModified = true;
546            clearHashAndString();
547        }
548    }
549    
550    public boolean getIsDefaultHasBeenModified() {
551        return isDefaultHasBeenModified;
552    }
553    
554    @Nonnull
555    public Integer getSortOrder() {
556        return sortOrder;
557    }
558    
559    public void setSortOrder(@Nonnull Integer sortOrder)
560            throws PersistenceNotNullException {
561        checkForNull(sortOrder);
562        
563        boolean update = true;
564        
565        if(this.sortOrder != null) {
566            if(this.sortOrder.equals(sortOrder)) {
567                update = false;
568            }
569        } else if(sortOrder == null) {
570            update = false;
571        }
572        
573        if(update) {
574            this.sortOrder = sortOrder;
575            sortOrderHasBeenModified = true;
576            clearHashAndString();
577        }
578    }
579    
580    public boolean getSortOrderHasBeenModified() {
581        return sortOrderHasBeenModified;
582    }
583    
584    @Nonnull
585    public Long getFromTime() {
586        return fromTime;
587    }
588    
589    public void setFromTime(@Nonnull Long fromTime)
590            throws PersistenceNotNullException {
591        checkForNull(fromTime);
592        
593        boolean update = true;
594        
595        if(this.fromTime != null) {
596            if(this.fromTime.equals(fromTime)) {
597                update = false;
598            }
599        } else if(fromTime == null) {
600            update = false;
601        }
602        
603        if(update) {
604            this.fromTime = fromTime;
605            fromTimeHasBeenModified = true;
606            clearHashAndString();
607        }
608    }
609    
610    public boolean getFromTimeHasBeenModified() {
611        return fromTimeHasBeenModified;
612    }
613    
614    @Nonnull
615    public Long getThruTime() {
616        return thruTime;
617    }
618    
619    public void setThruTime(@Nonnull Long thruTime)
620            throws PersistenceNotNullException {
621        checkForNull(thruTime);
622        
623        boolean update = true;
624        
625        if(this.thruTime != null) {
626            if(this.thruTime.equals(thruTime)) {
627                update = false;
628            }
629        } else if(thruTime == null) {
630            update = false;
631        }
632        
633        if(update) {
634            this.thruTime = thruTime;
635            thruTimeHasBeenModified = true;
636            clearHashAndString();
637        }
638    }
639    
640    public boolean getThruTimeHasBeenModified() {
641        return thruTimeHasBeenModified;
642    }
643    
644}