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