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