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 * 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            StringBuilder stringValue = new StringBuilder("{");
160            
161            stringValue.append("entityId=").append(getEntityId());
162            
163            stringValue.append(", forumPK=").append(getForumPK());
164            stringValue.append(", forumName=").append(getForumName());
165            stringValue.append(", forumTypePK=").append(getForumTypePK());
166            stringValue.append(", iconPK=").append(getIconPK());
167            stringValue.append(", forumThreadSequencePK=").append(getForumThreadSequencePK());
168            stringValue.append(", forumMessageSequencePK=").append(getForumMessageSequencePK());
169            stringValue.append(", sortOrder=").append(getSortOrder());
170            stringValue.append(", fromTime=").append(getFromTime());
171            stringValue.append(", thruTime=").append(getThruTime());
172            
173            stringValue.append('}');
174            
175            _stringValue = stringValue.toString();
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  ForumDetailValue) {
189            ForumDetailValue that = (ForumDetailValue)other;
190            
191            if(!that.hasIdentity())
192                return false;
193            
194            Long thisEntityId = getEntityId();
195            Long thatEntityId = that.getEntityId();
196            
197            boolean objectsEqual = thisEntityId.equals(thatEntityId);
198            if(objectsEqual)
199                objectsEqual = objectsEqual && isIdentical(that);
200            
201            return objectsEqual;
202        } else {
203            return false;
204        }
205    }
206    
207    public boolean isIdentical(Object other) {
208        if(other instanceof ForumDetailValue) {
209            ForumDetailValue that = (ForumDetailValue)other;
210            boolean objectsEqual = true;
211            
212            
213            if(objectsEqual) {
214                ForumPK thisForumPK = getForumPK();
215                ForumPK thatForumPK = that.getForumPK();
216                
217                if(thisForumPK == null) {
218                    objectsEqual = objectsEqual && (thatForumPK == null);
219                } else {
220                    objectsEqual = objectsEqual && thisForumPK.equals(thatForumPK);
221                }
222            }
223            
224            if(objectsEqual) {
225                String thisForumName = getForumName();
226                String thatForumName = that.getForumName();
227                
228                if(thisForumName == null) {
229                    objectsEqual = objectsEqual && (thatForumName == null);
230                } else {
231                    objectsEqual = objectsEqual && thisForumName.equals(thatForumName);
232                }
233            }
234            
235            if(objectsEqual) {
236                ForumTypePK thisForumTypePK = getForumTypePK();
237                ForumTypePK thatForumTypePK = that.getForumTypePK();
238                
239                if(thisForumTypePK == null) {
240                    objectsEqual = objectsEqual && (thatForumTypePK == null);
241                } else {
242                    objectsEqual = objectsEqual && thisForumTypePK.equals(thatForumTypePK);
243                }
244            }
245            
246            if(objectsEqual) {
247                IconPK thisIconPK = getIconPK();
248                IconPK thatIconPK = that.getIconPK();
249                
250                if(thisIconPK == null) {
251                    objectsEqual = objectsEqual && (thatIconPK == null);
252                } else {
253                    objectsEqual = objectsEqual && thisIconPK.equals(thatIconPK);
254                }
255            }
256            
257            if(objectsEqual) {
258                SequencePK thisForumThreadSequencePK = getForumThreadSequencePK();
259                SequencePK thatForumThreadSequencePK = that.getForumThreadSequencePK();
260                
261                if(thisForumThreadSequencePK == null) {
262                    objectsEqual = objectsEqual && (thatForumThreadSequencePK == null);
263                } else {
264                    objectsEqual = objectsEqual && thisForumThreadSequencePK.equals(thatForumThreadSequencePK);
265                }
266            }
267            
268            if(objectsEqual) {
269                SequencePK thisForumMessageSequencePK = getForumMessageSequencePK();
270                SequencePK thatForumMessageSequencePK = that.getForumMessageSequencePK();
271                
272                if(thisForumMessageSequencePK == null) {
273                    objectsEqual = objectsEqual && (thatForumMessageSequencePK == null);
274                } else {
275                    objectsEqual = objectsEqual && thisForumMessageSequencePK.equals(thatForumMessageSequencePK);
276                }
277            }
278            
279            if(objectsEqual) {
280                Integer thisSortOrder = getSortOrder();
281                Integer thatSortOrder = that.getSortOrder();
282                
283                if(thisSortOrder == null) {
284                    objectsEqual = objectsEqual && (thatSortOrder == null);
285                } else {
286                    objectsEqual = objectsEqual && thisSortOrder.equals(thatSortOrder);
287                }
288            }
289            
290            if(objectsEqual) {
291                Long thisFromTime = getFromTime();
292                Long thatFromTime = that.getFromTime();
293                
294                if(thisFromTime == null) {
295                    objectsEqual = objectsEqual && (thatFromTime == null);
296                } else {
297                    objectsEqual = objectsEqual && thisFromTime.equals(thatFromTime);
298                }
299            }
300            
301            if(objectsEqual) {
302                Long thisThruTime = getThruTime();
303                Long thatThruTime = that.getThruTime();
304                
305                if(thisThruTime == null) {
306                    objectsEqual = objectsEqual && (thatThruTime == null);
307                } else {
308                    objectsEqual = objectsEqual && thisThruTime.equals(thatThruTime);
309                }
310            }
311            
312            return objectsEqual;
313        } else {
314            return false;
315        }
316    }
317    
318    @Override
319    public boolean hasBeenModified() {
320        return forumPKHasBeenModified || forumNameHasBeenModified || forumTypePKHasBeenModified || iconPKHasBeenModified || forumThreadSequencePKHasBeenModified || forumMessageSequencePKHasBeenModified || sortOrderHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified;
321    }
322    
323    @Override
324    public void clearHasBeenModified() {
325        forumPKHasBeenModified = false;
326        forumNameHasBeenModified = false;
327        forumTypePKHasBeenModified = false;
328        iconPKHasBeenModified = false;
329        forumThreadSequencePKHasBeenModified = false;
330        forumMessageSequencePKHasBeenModified = false;
331        sortOrderHasBeenModified = false;
332        fromTimeHasBeenModified = false;
333        thruTimeHasBeenModified = false;
334    }
335    
336    public ForumPK getForumPK() {
337        return forumPK;
338    }
339    
340    public void setForumPK(ForumPK forumPK)
341            throws PersistenceNotNullException {
342        checkForNull(forumPK);
343        
344        boolean update = true;
345        
346        if(this.forumPK != null) {
347            if(this.forumPK.equals(forumPK)) {
348                update = false;
349            }
350        } else if(forumPK == null) {
351            update = false;
352        }
353        
354        if(update) {
355            this.forumPK = forumPK;
356            forumPKHasBeenModified = true;
357            clearHashAndString();
358        }
359    }
360    
361    public boolean getForumPKHasBeenModified() {
362        return forumPKHasBeenModified;
363    }
364    
365    public String getForumName() {
366        return forumName;
367    }
368    
369    public void setForumName(String forumName)
370            throws PersistenceNotNullException {
371        checkForNull(forumName);
372        
373        boolean update = true;
374        
375        if(this.forumName != null) {
376            if(this.forumName.equals(forumName)) {
377                update = false;
378            }
379        } else if(forumName == null) {
380            update = false;
381        }
382        
383        if(update) {
384            this.forumName = forumName;
385            forumNameHasBeenModified = true;
386            clearHashAndString();
387        }
388    }
389    
390    public boolean getForumNameHasBeenModified() {
391        return forumNameHasBeenModified;
392    }
393    
394    public ForumTypePK getForumTypePK() {
395        return forumTypePK;
396    }
397    
398    public void setForumTypePK(ForumTypePK forumTypePK)
399            throws PersistenceNotNullException {
400        checkForNull(forumTypePK);
401        
402        boolean update = true;
403        
404        if(this.forumTypePK != null) {
405            if(this.forumTypePK.equals(forumTypePK)) {
406                update = false;
407            }
408        } else if(forumTypePK == null) {
409            update = false;
410        }
411        
412        if(update) {
413            this.forumTypePK = forumTypePK;
414            forumTypePKHasBeenModified = true;
415            clearHashAndString();
416        }
417    }
418    
419    public boolean getForumTypePKHasBeenModified() {
420        return forumTypePKHasBeenModified;
421    }
422    
423    public IconPK getIconPK() {
424        return iconPK;
425    }
426    
427    public void setIconPK(IconPK iconPK) {
428        boolean update = true;
429        
430        if(this.iconPK != null) {
431            if(this.iconPK.equals(iconPK)) {
432                update = false;
433            }
434        } else if(iconPK == null) {
435            update = false;
436        }
437        
438        if(update) {
439            this.iconPK = iconPK;
440            iconPKHasBeenModified = true;
441            clearHashAndString();
442        }
443    }
444    
445    public boolean getIconPKHasBeenModified() {
446        return iconPKHasBeenModified;
447    }
448    
449    public SequencePK getForumThreadSequencePK() {
450        return forumThreadSequencePK;
451    }
452    
453    public void setForumThreadSequencePK(SequencePK forumThreadSequencePK) {
454        boolean update = true;
455        
456        if(this.forumThreadSequencePK != null) {
457            if(this.forumThreadSequencePK.equals(forumThreadSequencePK)) {
458                update = false;
459            }
460        } else if(forumThreadSequencePK == null) {
461            update = false;
462        }
463        
464        if(update) {
465            this.forumThreadSequencePK = forumThreadSequencePK;
466            forumThreadSequencePKHasBeenModified = true;
467            clearHashAndString();
468        }
469    }
470    
471    public boolean getForumThreadSequencePKHasBeenModified() {
472        return forumThreadSequencePKHasBeenModified;
473    }
474    
475    public SequencePK getForumMessageSequencePK() {
476        return forumMessageSequencePK;
477    }
478    
479    public void setForumMessageSequencePK(SequencePK forumMessageSequencePK) {
480        boolean update = true;
481        
482        if(this.forumMessageSequencePK != null) {
483            if(this.forumMessageSequencePK.equals(forumMessageSequencePK)) {
484                update = false;
485            }
486        } else if(forumMessageSequencePK == null) {
487            update = false;
488        }
489        
490        if(update) {
491            this.forumMessageSequencePK = forumMessageSequencePK;
492            forumMessageSequencePKHasBeenModified = true;
493            clearHashAndString();
494        }
495    }
496    
497    public boolean getForumMessageSequencePKHasBeenModified() {
498        return forumMessageSequencePKHasBeenModified;
499    }
500    
501    public Integer getSortOrder() {
502        return sortOrder;
503    }
504    
505    public void setSortOrder(Integer sortOrder)
506            throws PersistenceNotNullException {
507        checkForNull(sortOrder);
508        
509        boolean update = true;
510        
511        if(this.sortOrder != null) {
512            if(this.sortOrder.equals(sortOrder)) {
513                update = false;
514            }
515        } else if(sortOrder == null) {
516            update = false;
517        }
518        
519        if(update) {
520            this.sortOrder = sortOrder;
521            sortOrderHasBeenModified = true;
522            clearHashAndString();
523        }
524    }
525    
526    public boolean getSortOrderHasBeenModified() {
527        return sortOrderHasBeenModified;
528    }
529    
530    public Long getFromTime() {
531        return fromTime;
532    }
533    
534    public void setFromTime(Long fromTime)
535            throws PersistenceNotNullException {
536        checkForNull(fromTime);
537        
538        boolean update = true;
539        
540        if(this.fromTime != null) {
541            if(this.fromTime.equals(fromTime)) {
542                update = false;
543            }
544        } else if(fromTime == null) {
545            update = false;
546        }
547        
548        if(update) {
549            this.fromTime = fromTime;
550            fromTimeHasBeenModified = true;
551            clearHashAndString();
552        }
553    }
554    
555    public boolean getFromTimeHasBeenModified() {
556        return fromTimeHasBeenModified;
557    }
558    
559    public Long getThruTime() {
560        return thruTime;
561    }
562    
563    public void setThruTime(Long thruTime)
564            throws PersistenceNotNullException {
565        checkForNull(thruTime);
566        
567        boolean update = true;
568        
569        if(this.thruTime != null) {
570            if(this.thruTime.equals(thruTime)) {
571                update = false;
572            }
573        } else if(thruTime == null) {
574            update = false;
575        }
576        
577        if(update) {
578            this.thruTime = thruTime;
579            thruTimeHasBeenModified = true;
580            clearHashAndString();
581        }
582    }
583    
584    public boolean getThruTimeHasBeenModified() {
585        return thruTimeHasBeenModified;
586    }
587    
588}