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 * 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            StringBuilder stringValue = new StringBuilder("{");
164            
165            stringValue.append("entityId=").append(getEntityId());
166            
167            stringValue.append(", appearancePK=").append(getAppearancePK());
168            stringValue.append(", appearanceName=").append(getAppearanceName());
169            stringValue.append(", textColorPK=").append(getTextColorPK());
170            stringValue.append(", backgroundColorPK=").append(getBackgroundColorPK());
171            stringValue.append(", fontStylePK=").append(getFontStylePK());
172            stringValue.append(", fontWeightPK=").append(getFontWeightPK());
173            stringValue.append(", isDefault=").append(getIsDefault());
174            stringValue.append(", sortOrder=").append(getSortOrder());
175            stringValue.append(", fromTime=").append(getFromTime());
176            stringValue.append(", thruTime=").append(getThruTime());
177            
178            stringValue.append('}');
179            
180            _stringValue = stringValue.toString();
181        }
182        return _stringValue;
183    }
184    
185    @Override
186    public boolean equals(Object other) {
187        if(this == other)
188            return true;
189        
190        if(!hasIdentity())
191            return false;
192        
193        if(other instanceof  AppearanceDetailValue) {
194            AppearanceDetailValue that = (AppearanceDetailValue)other;
195            
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 = 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) {
214            AppearanceDetailValue that = (AppearanceDetailValue)other;
215            boolean objectsEqual = true;
216            
217            
218            if(objectsEqual) {
219                AppearancePK thisAppearancePK = getAppearancePK();
220                AppearancePK thatAppearancePK = that.getAppearancePK();
221                
222                if(thisAppearancePK == null) {
223                    objectsEqual = objectsEqual && (thatAppearancePK == null);
224                } else {
225                    objectsEqual = objectsEqual && thisAppearancePK.equals(thatAppearancePK);
226                }
227            }
228            
229            if(objectsEqual) {
230                String thisAppearanceName = getAppearanceName();
231                String thatAppearanceName = that.getAppearanceName();
232                
233                if(thisAppearanceName == null) {
234                    objectsEqual = objectsEqual && (thatAppearanceName == null);
235                } else {
236                    objectsEqual = objectsEqual && thisAppearanceName.equals(thatAppearanceName);
237                }
238            }
239            
240            if(objectsEqual) {
241                ColorPK thisTextColorPK = getTextColorPK();
242                ColorPK thatTextColorPK = that.getTextColorPK();
243                
244                if(thisTextColorPK == null) {
245                    objectsEqual = objectsEqual && (thatTextColorPK == null);
246                } else {
247                    objectsEqual = objectsEqual && thisTextColorPK.equals(thatTextColorPK);
248                }
249            }
250            
251            if(objectsEqual) {
252                ColorPK thisBackgroundColorPK = getBackgroundColorPK();
253                ColorPK thatBackgroundColorPK = that.getBackgroundColorPK();
254                
255                if(thisBackgroundColorPK == null) {
256                    objectsEqual = objectsEqual && (thatBackgroundColorPK == null);
257                } else {
258                    objectsEqual = objectsEqual && thisBackgroundColorPK.equals(thatBackgroundColorPK);
259                }
260            }
261            
262            if(objectsEqual) {
263                FontStylePK thisFontStylePK = getFontStylePK();
264                FontStylePK thatFontStylePK = that.getFontStylePK();
265                
266                if(thisFontStylePK == null) {
267                    objectsEqual = objectsEqual && (thatFontStylePK == null);
268                } else {
269                    objectsEqual = objectsEqual && thisFontStylePK.equals(thatFontStylePK);
270                }
271            }
272            
273            if(objectsEqual) {
274                FontWeightPK thisFontWeightPK = getFontWeightPK();
275                FontWeightPK thatFontWeightPK = that.getFontWeightPK();
276                
277                if(thisFontWeightPK == null) {
278                    objectsEqual = objectsEqual && (thatFontWeightPK == null);
279                } else {
280                    objectsEqual = objectsEqual && thisFontWeightPK.equals(thatFontWeightPK);
281                }
282            }
283            
284            if(objectsEqual) {
285                Boolean thisIsDefault = getIsDefault();
286                Boolean thatIsDefault = that.getIsDefault();
287                
288                if(thisIsDefault == null) {
289                    objectsEqual = objectsEqual && (thatIsDefault == null);
290                } else {
291                    objectsEqual = objectsEqual && thisIsDefault.equals(thatIsDefault);
292                }
293            }
294            
295            if(objectsEqual) {
296                Integer thisSortOrder = getSortOrder();
297                Integer thatSortOrder = that.getSortOrder();
298                
299                if(thisSortOrder == null) {
300                    objectsEqual = objectsEqual && (thatSortOrder == null);
301                } else {
302                    objectsEqual = objectsEqual && thisSortOrder.equals(thatSortOrder);
303                }
304            }
305            
306            if(objectsEqual) {
307                Long thisFromTime = getFromTime();
308                Long thatFromTime = that.getFromTime();
309                
310                if(thisFromTime == null) {
311                    objectsEqual = objectsEqual && (thatFromTime == null);
312                } else {
313                    objectsEqual = objectsEqual && thisFromTime.equals(thatFromTime);
314                }
315            }
316            
317            if(objectsEqual) {
318                Long thisThruTime = getThruTime();
319                Long thatThruTime = that.getThruTime();
320                
321                if(thisThruTime == null) {
322                    objectsEqual = objectsEqual && (thatThruTime == null);
323                } else {
324                    objectsEqual = objectsEqual && thisThruTime.equals(thatThruTime);
325                }
326            }
327            
328            return objectsEqual;
329        } else {
330            return false;
331        }
332    }
333    
334    @Override
335    public boolean hasBeenModified() {
336        return appearancePKHasBeenModified || appearanceNameHasBeenModified || textColorPKHasBeenModified || backgroundColorPKHasBeenModified || fontStylePKHasBeenModified || fontWeightPKHasBeenModified || isDefaultHasBeenModified || sortOrderHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified;
337    }
338    
339    @Override
340    public void clearHasBeenModified() {
341        appearancePKHasBeenModified = false;
342        appearanceNameHasBeenModified = false;
343        textColorPKHasBeenModified = false;
344        backgroundColorPKHasBeenModified = false;
345        fontStylePKHasBeenModified = false;
346        fontWeightPKHasBeenModified = false;
347        isDefaultHasBeenModified = false;
348        sortOrderHasBeenModified = false;
349        fromTimeHasBeenModified = false;
350        thruTimeHasBeenModified = false;
351    }
352    
353    public AppearancePK getAppearancePK() {
354        return appearancePK;
355    }
356    
357    public void setAppearancePK(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    public String getAppearanceName() {
383        return appearanceName;
384    }
385    
386    public void setAppearanceName(String appearanceName)
387            throws PersistenceNotNullException {
388        checkForNull(appearanceName);
389        
390        boolean update = true;
391        
392        if(this.appearanceName != null) {
393            if(this.appearanceName.equals(appearanceName)) {
394                update = false;
395            }
396        } else if(appearanceName == null) {
397            update = false;
398        }
399        
400        if(update) {
401            this.appearanceName = appearanceName;
402            appearanceNameHasBeenModified = true;
403            clearHashAndString();
404        }
405    }
406    
407    public boolean getAppearanceNameHasBeenModified() {
408        return appearanceNameHasBeenModified;
409    }
410    
411    public ColorPK getTextColorPK() {
412        return textColorPK;
413    }
414    
415    public void setTextColorPK(ColorPK textColorPK) {
416        boolean update = true;
417        
418        if(this.textColorPK != null) {
419            if(this.textColorPK.equals(textColorPK)) {
420                update = false;
421            }
422        } else if(textColorPK == null) {
423            update = false;
424        }
425        
426        if(update) {
427            this.textColorPK = textColorPK;
428            textColorPKHasBeenModified = true;
429            clearHashAndString();
430        }
431    }
432    
433    public boolean getTextColorPKHasBeenModified() {
434        return textColorPKHasBeenModified;
435    }
436    
437    public ColorPK getBackgroundColorPK() {
438        return backgroundColorPK;
439    }
440    
441    public void setBackgroundColorPK(ColorPK backgroundColorPK) {
442        boolean update = true;
443        
444        if(this.backgroundColorPK != null) {
445            if(this.backgroundColorPK.equals(backgroundColorPK)) {
446                update = false;
447            }
448        } else if(backgroundColorPK == null) {
449            update = false;
450        }
451        
452        if(update) {
453            this.backgroundColorPK = backgroundColorPK;
454            backgroundColorPKHasBeenModified = true;
455            clearHashAndString();
456        }
457    }
458    
459    public boolean getBackgroundColorPKHasBeenModified() {
460        return backgroundColorPKHasBeenModified;
461    }
462    
463    public FontStylePK getFontStylePK() {
464        return fontStylePK;
465    }
466    
467    public void setFontStylePK(FontStylePK fontStylePK) {
468        boolean update = true;
469        
470        if(this.fontStylePK != null) {
471            if(this.fontStylePK.equals(fontStylePK)) {
472                update = false;
473            }
474        } else if(fontStylePK == null) {
475            update = false;
476        }
477        
478        if(update) {
479            this.fontStylePK = fontStylePK;
480            fontStylePKHasBeenModified = true;
481            clearHashAndString();
482        }
483    }
484    
485    public boolean getFontStylePKHasBeenModified() {
486        return fontStylePKHasBeenModified;
487    }
488    
489    public FontWeightPK getFontWeightPK() {
490        return fontWeightPK;
491    }
492    
493    public void setFontWeightPK(FontWeightPK fontWeightPK) {
494        boolean update = true;
495        
496        if(this.fontWeightPK != null) {
497            if(this.fontWeightPK.equals(fontWeightPK)) {
498                update = false;
499            }
500        } else if(fontWeightPK == null) {
501            update = false;
502        }
503        
504        if(update) {
505            this.fontWeightPK = fontWeightPK;
506            fontWeightPKHasBeenModified = true;
507            clearHashAndString();
508        }
509    }
510    
511    public boolean getFontWeightPKHasBeenModified() {
512        return fontWeightPKHasBeenModified;
513    }
514    
515    public Boolean getIsDefault() {
516        return isDefault;
517    }
518    
519    public void setIsDefault(Boolean isDefault)
520            throws PersistenceNotNullException {
521        checkForNull(isDefault);
522        
523        boolean update = true;
524        
525        if(this.isDefault != null) {
526            if(this.isDefault.equals(isDefault)) {
527                update = false;
528            }
529        } else if(isDefault == null) {
530            update = false;
531        }
532        
533        if(update) {
534            this.isDefault = isDefault;
535            isDefaultHasBeenModified = true;
536            clearHashAndString();
537        }
538    }
539    
540    public boolean getIsDefaultHasBeenModified() {
541        return isDefaultHasBeenModified;
542    }
543    
544    public Integer getSortOrder() {
545        return sortOrder;
546    }
547    
548    public void setSortOrder(Integer sortOrder)
549            throws PersistenceNotNullException {
550        checkForNull(sortOrder);
551        
552        boolean update = true;
553        
554        if(this.sortOrder != null) {
555            if(this.sortOrder.equals(sortOrder)) {
556                update = false;
557            }
558        } else if(sortOrder == null) {
559            update = false;
560        }
561        
562        if(update) {
563            this.sortOrder = sortOrder;
564            sortOrderHasBeenModified = true;
565            clearHashAndString();
566        }
567    }
568    
569    public boolean getSortOrderHasBeenModified() {
570        return sortOrderHasBeenModified;
571    }
572    
573    public Long getFromTime() {
574        return fromTime;
575    }
576    
577    public void setFromTime(Long fromTime)
578            throws PersistenceNotNullException {
579        checkForNull(fromTime);
580        
581        boolean update = true;
582        
583        if(this.fromTime != null) {
584            if(this.fromTime.equals(fromTime)) {
585                update = false;
586            }
587        } else if(fromTime == null) {
588            update = false;
589        }
590        
591        if(update) {
592            this.fromTime = fromTime;
593            fromTimeHasBeenModified = true;
594            clearHashAndString();
595        }
596    }
597    
598    public boolean getFromTimeHasBeenModified() {
599        return fromTimeHasBeenModified;
600    }
601    
602    public Long getThruTime() {
603        return thruTime;
604    }
605    
606    public void setThruTime(Long thruTime)
607            throws PersistenceNotNullException {
608        checkForNull(thruTime);
609        
610        boolean update = true;
611        
612        if(this.thruTime != null) {
613            if(this.thruTime.equals(thruTime)) {
614                update = false;
615            }
616        } else if(thruTime == null) {
617            update = false;
618        }
619        
620        if(update) {
621            this.thruTime = thruTime;
622            thruTimeHasBeenModified = true;
623            clearHashAndString();
624        }
625    }
626    
627    public boolean getThruTimeHasBeenModified() {
628        return thruTimeHasBeenModified;
629    }
630    
631}