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