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