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