001// --------------------------------------------------------------------------------
002// Copyright 2002-2024 Echo Three, LLC
003//
004// Licensed under the Apache License, Version 2.0 (the "License");
005// you may not use this file except in compliance with the License.
006// You may obtain a copy of the License at
007//
008//     http://www.apache.org/licenses/LICENSE-2.0
009//
010// Unless required by applicable law or agreed to in writing, software
011// distributed under the License is distributed on an "AS IS" BASIS,
012// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013// See the License for the specific language governing permissions and
014// limitations under the License.
015// --------------------------------------------------------------------------------
016// Generated File -- DO NOT EDIT BY HAND
017// --------------------------------------------------------------------------------
018
019/**
020 * 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            StringBuilder stringValue = new StringBuilder("{");
165            
166            stringValue.append("entityId=").append(getEntityId());
167            
168            stringValue.append(", contentCategoryPK=").append(getContentCategoryPK());
169            stringValue.append(", contentCatalogPK=").append(getContentCatalogPK());
170            stringValue.append(", contentCategoryName=").append(getContentCategoryName());
171            stringValue.append(", parentContentCategoryPK=").append(getParentContentCategoryPK());
172            stringValue.append(", defaultOfferUsePK=").append(getDefaultOfferUsePK());
173            stringValue.append(", contentCategoryItemSelectorPK=").append(getContentCategoryItemSelectorPK());
174            stringValue.append(", isDefault=").append(getIsDefault());
175            stringValue.append(", sortOrder=").append(getSortOrder());
176            stringValue.append(", fromTime=").append(getFromTime());
177            stringValue.append(", thruTime=").append(getThruTime());
178            
179            stringValue.append('}');
180            
181            _stringValue = stringValue.toString();
182        }
183        return _stringValue;
184    }
185    
186    @Override
187    public boolean equals(Object other) {
188        if(this == other)
189            return true;
190        
191        if(!hasIdentity())
192            return false;
193        
194        if(other instanceof  ContentCategoryDetailValue) {
195            ContentCategoryDetailValue that = (ContentCategoryDetailValue)other;
196            
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 = 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) {
215            ContentCategoryDetailValue that = (ContentCategoryDetailValue)other;
216            boolean objectsEqual = true;
217            
218            
219            if(objectsEqual) {
220                ContentCategoryPK thisContentCategoryPK = getContentCategoryPK();
221                ContentCategoryPK thatContentCategoryPK = that.getContentCategoryPK();
222                
223                if(thisContentCategoryPK == null) {
224                    objectsEqual = objectsEqual && (thatContentCategoryPK == null);
225                } else {
226                    objectsEqual = objectsEqual && thisContentCategoryPK.equals(thatContentCategoryPK);
227                }
228            }
229            
230            if(objectsEqual) {
231                ContentCatalogPK thisContentCatalogPK = getContentCatalogPK();
232                ContentCatalogPK thatContentCatalogPK = that.getContentCatalogPK();
233                
234                if(thisContentCatalogPK == null) {
235                    objectsEqual = objectsEqual && (thatContentCatalogPK == null);
236                } else {
237                    objectsEqual = objectsEqual && thisContentCatalogPK.equals(thatContentCatalogPK);
238                }
239            }
240            
241            if(objectsEqual) {
242                String thisContentCategoryName = getContentCategoryName();
243                String thatContentCategoryName = that.getContentCategoryName();
244                
245                if(thisContentCategoryName == null) {
246                    objectsEqual = objectsEqual && (thatContentCategoryName == null);
247                } else {
248                    objectsEqual = objectsEqual && thisContentCategoryName.equals(thatContentCategoryName);
249                }
250            }
251            
252            if(objectsEqual) {
253                ContentCategoryPK thisParentContentCategoryPK = getParentContentCategoryPK();
254                ContentCategoryPK thatParentContentCategoryPK = that.getParentContentCategoryPK();
255                
256                if(thisParentContentCategoryPK == null) {
257                    objectsEqual = objectsEqual && (thatParentContentCategoryPK == null);
258                } else {
259                    objectsEqual = objectsEqual && thisParentContentCategoryPK.equals(thatParentContentCategoryPK);
260                }
261            }
262            
263            if(objectsEqual) {
264                OfferUsePK thisDefaultOfferUsePK = getDefaultOfferUsePK();
265                OfferUsePK thatDefaultOfferUsePK = that.getDefaultOfferUsePK();
266                
267                if(thisDefaultOfferUsePK == null) {
268                    objectsEqual = objectsEqual && (thatDefaultOfferUsePK == null);
269                } else {
270                    objectsEqual = objectsEqual && thisDefaultOfferUsePK.equals(thatDefaultOfferUsePK);
271                }
272            }
273            
274            if(objectsEqual) {
275                SelectorPK thisContentCategoryItemSelectorPK = getContentCategoryItemSelectorPK();
276                SelectorPK thatContentCategoryItemSelectorPK = that.getContentCategoryItemSelectorPK();
277                
278                if(thisContentCategoryItemSelectorPK == null) {
279                    objectsEqual = objectsEqual && (thatContentCategoryItemSelectorPK == null);
280                } else {
281                    objectsEqual = objectsEqual && thisContentCategoryItemSelectorPK.equals(thatContentCategoryItemSelectorPK);
282                }
283            }
284            
285            if(objectsEqual) {
286                Boolean thisIsDefault = getIsDefault();
287                Boolean thatIsDefault = that.getIsDefault();
288                
289                if(thisIsDefault == null) {
290                    objectsEqual = objectsEqual && (thatIsDefault == null);
291                } else {
292                    objectsEqual = objectsEqual && thisIsDefault.equals(thatIsDefault);
293                }
294            }
295            
296            if(objectsEqual) {
297                Integer thisSortOrder = getSortOrder();
298                Integer thatSortOrder = that.getSortOrder();
299                
300                if(thisSortOrder == null) {
301                    objectsEqual = objectsEqual && (thatSortOrder == null);
302                } else {
303                    objectsEqual = objectsEqual && thisSortOrder.equals(thatSortOrder);
304                }
305            }
306            
307            if(objectsEqual) {
308                Long thisFromTime = getFromTime();
309                Long thatFromTime = that.getFromTime();
310                
311                if(thisFromTime == null) {
312                    objectsEqual = objectsEqual && (thatFromTime == null);
313                } else {
314                    objectsEqual = objectsEqual && thisFromTime.equals(thatFromTime);
315                }
316            }
317            
318            if(objectsEqual) {
319                Long thisThruTime = getThruTime();
320                Long thatThruTime = that.getThruTime();
321                
322                if(thisThruTime == null) {
323                    objectsEqual = objectsEqual && (thatThruTime == null);
324                } else {
325                    objectsEqual = objectsEqual && thisThruTime.equals(thatThruTime);
326                }
327            }
328            
329            return objectsEqual;
330        } else {
331            return false;
332        }
333    }
334    
335    @Override
336    public boolean hasBeenModified() {
337        return contentCategoryPKHasBeenModified || contentCatalogPKHasBeenModified || contentCategoryNameHasBeenModified || parentContentCategoryPKHasBeenModified || defaultOfferUsePKHasBeenModified || contentCategoryItemSelectorPKHasBeenModified || isDefaultHasBeenModified || sortOrderHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified;
338    }
339    
340    @Override
341    public void clearHasBeenModified() {
342        contentCategoryPKHasBeenModified = false;
343        contentCatalogPKHasBeenModified = false;
344        contentCategoryNameHasBeenModified = false;
345        parentContentCategoryPKHasBeenModified = false;
346        defaultOfferUsePKHasBeenModified = false;
347        contentCategoryItemSelectorPKHasBeenModified = false;
348        isDefaultHasBeenModified = false;
349        sortOrderHasBeenModified = false;
350        fromTimeHasBeenModified = false;
351        thruTimeHasBeenModified = false;
352    }
353    
354    public ContentCategoryPK getContentCategoryPK() {
355        return contentCategoryPK;
356    }
357    
358    public void setContentCategoryPK(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    public ContentCatalogPK getContentCatalogPK() {
384        return contentCatalogPK;
385    }
386    
387    public void setContentCatalogPK(ContentCatalogPK contentCatalogPK)
388            throws PersistenceNotNullException {
389        checkForNull(contentCatalogPK);
390        
391        boolean update = true;
392        
393        if(this.contentCatalogPK != null) {
394            if(this.contentCatalogPK.equals(contentCatalogPK)) {
395                update = false;
396            }
397        } else if(contentCatalogPK == null) {
398            update = false;
399        }
400        
401        if(update) {
402            this.contentCatalogPK = contentCatalogPK;
403            contentCatalogPKHasBeenModified = true;
404            clearHashAndString();
405        }
406    }
407    
408    public boolean getContentCatalogPKHasBeenModified() {
409        return contentCatalogPKHasBeenModified;
410    }
411    
412    public String getContentCategoryName() {
413        return contentCategoryName;
414    }
415    
416    public void setContentCategoryName(String contentCategoryName)
417            throws PersistenceNotNullException {
418        checkForNull(contentCategoryName);
419        
420        boolean update = true;
421        
422        if(this.contentCategoryName != null) {
423            if(this.contentCategoryName.equals(contentCategoryName)) {
424                update = false;
425            }
426        } else if(contentCategoryName == null) {
427            update = false;
428        }
429        
430        if(update) {
431            this.contentCategoryName = contentCategoryName;
432            contentCategoryNameHasBeenModified = true;
433            clearHashAndString();
434        }
435    }
436    
437    public boolean getContentCategoryNameHasBeenModified() {
438        return contentCategoryNameHasBeenModified;
439    }
440    
441    public ContentCategoryPK getParentContentCategoryPK() {
442        return parentContentCategoryPK;
443    }
444    
445    public void setParentContentCategoryPK(ContentCategoryPK parentContentCategoryPK) {
446        boolean update = true;
447        
448        if(this.parentContentCategoryPK != null) {
449            if(this.parentContentCategoryPK.equals(parentContentCategoryPK)) {
450                update = false;
451            }
452        } else if(parentContentCategoryPK == null) {
453            update = false;
454        }
455        
456        if(update) {
457            this.parentContentCategoryPK = parentContentCategoryPK;
458            parentContentCategoryPKHasBeenModified = true;
459            clearHashAndString();
460        }
461    }
462    
463    public boolean getParentContentCategoryPKHasBeenModified() {
464        return parentContentCategoryPKHasBeenModified;
465    }
466    
467    public OfferUsePK getDefaultOfferUsePK() {
468        return defaultOfferUsePK;
469    }
470    
471    public void setDefaultOfferUsePK(OfferUsePK defaultOfferUsePK) {
472        boolean update = true;
473        
474        if(this.defaultOfferUsePK != null) {
475            if(this.defaultOfferUsePK.equals(defaultOfferUsePK)) {
476                update = false;
477            }
478        } else if(defaultOfferUsePK == null) {
479            update = false;
480        }
481        
482        if(update) {
483            this.defaultOfferUsePK = defaultOfferUsePK;
484            defaultOfferUsePKHasBeenModified = true;
485            clearHashAndString();
486        }
487    }
488    
489    public boolean getDefaultOfferUsePKHasBeenModified() {
490        return defaultOfferUsePKHasBeenModified;
491    }
492    
493    public SelectorPK getContentCategoryItemSelectorPK() {
494        return contentCategoryItemSelectorPK;
495    }
496    
497    public void setContentCategoryItemSelectorPK(SelectorPK contentCategoryItemSelectorPK) {
498        boolean update = true;
499        
500        if(this.contentCategoryItemSelectorPK != null) {
501            if(this.contentCategoryItemSelectorPK.equals(contentCategoryItemSelectorPK)) {
502                update = false;
503            }
504        } else if(contentCategoryItemSelectorPK == null) {
505            update = false;
506        }
507        
508        if(update) {
509            this.contentCategoryItemSelectorPK = contentCategoryItemSelectorPK;
510            contentCategoryItemSelectorPKHasBeenModified = true;
511            clearHashAndString();
512        }
513    }
514    
515    public boolean getContentCategoryItemSelectorPKHasBeenModified() {
516        return contentCategoryItemSelectorPKHasBeenModified;
517    }
518    
519    public Boolean getIsDefault() {
520        return isDefault;
521    }
522    
523    public void setIsDefault(Boolean isDefault)
524            throws PersistenceNotNullException {
525        checkForNull(isDefault);
526        
527        boolean update = true;
528        
529        if(this.isDefault != null) {
530            if(this.isDefault.equals(isDefault)) {
531                update = false;
532            }
533        } else if(isDefault == null) {
534            update = false;
535        }
536        
537        if(update) {
538            this.isDefault = isDefault;
539            isDefaultHasBeenModified = true;
540            clearHashAndString();
541        }
542    }
543    
544    public boolean getIsDefaultHasBeenModified() {
545        return isDefaultHasBeenModified;
546    }
547    
548    public Integer getSortOrder() {
549        return sortOrder;
550    }
551    
552    public void setSortOrder(Integer sortOrder)
553            throws PersistenceNotNullException {
554        checkForNull(sortOrder);
555        
556        boolean update = true;
557        
558        if(this.sortOrder != null) {
559            if(this.sortOrder.equals(sortOrder)) {
560                update = false;
561            }
562        } else if(sortOrder == null) {
563            update = false;
564        }
565        
566        if(update) {
567            this.sortOrder = sortOrder;
568            sortOrderHasBeenModified = true;
569            clearHashAndString();
570        }
571    }
572    
573    public boolean getSortOrderHasBeenModified() {
574        return sortOrderHasBeenModified;
575    }
576    
577    public Long getFromTime() {
578        return fromTime;
579    }
580    
581    public void setFromTime(Long fromTime)
582            throws PersistenceNotNullException {
583        checkForNull(fromTime);
584        
585        boolean update = true;
586        
587        if(this.fromTime != null) {
588            if(this.fromTime.equals(fromTime)) {
589                update = false;
590            }
591        } else if(fromTime == null) {
592            update = false;
593        }
594        
595        if(update) {
596            this.fromTime = fromTime;
597            fromTimeHasBeenModified = true;
598            clearHashAndString();
599        }
600    }
601    
602    public boolean getFromTimeHasBeenModified() {
603        return fromTimeHasBeenModified;
604    }
605    
606    public Long getThruTime() {
607        return thruTime;
608    }
609    
610    public void setThruTime(Long thruTime)
611            throws PersistenceNotNullException {
612        checkForNull(thruTime);
613        
614        boolean update = true;
615        
616        if(this.thruTime != null) {
617            if(this.thruTime.equals(thruTime)) {
618                update = false;
619            }
620        } else if(thruTime == null) {
621            update = false;
622        }
623        
624        if(update) {
625            this.thruTime = thruTime;
626            thruTimeHasBeenModified = true;
627            clearHashAndString();
628        }
629    }
630    
631    public boolean getThruTimeHasBeenModified() {
632        return thruTimeHasBeenModified;
633    }
634    
635}