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 * ForumThreadDetailValue.java
021 */
022
023package com.echothree.model.data.forum.server.value;
024
025import com.echothree.model.data.forum.common.pk.ForumThreadDetailPK;
026
027import com.echothree.model.data.forum.server.factory.ForumThreadDetailFactory;
028
029import com.echothree.model.data.forum.common.pk.ForumThreadPK;
030import com.echothree.model.data.icon.common.pk.IconPK;
031
032import com.echothree.util.common.exception.PersistenceCloneException;
033import com.echothree.util.common.exception.PersistenceNotNullException;
034
035import com.echothree.util.server.persistence.BaseValue;
036
037import java.io.Serializable;
038
039public class ForumThreadDetailValue
040        extends BaseValue<ForumThreadDetailPK>
041        implements Cloneable, Serializable {
042    
043    private ForumThreadPK forumThreadPK;
044    private boolean forumThreadPKHasBeenModified = false;
045    private String forumThreadName;
046    private boolean forumThreadNameHasBeenModified = false;
047    private IconPK iconPK;
048    private boolean iconPKHasBeenModified = false;
049    private Long postedTime;
050    private boolean postedTimeHasBeenModified = false;
051    private Integer sortOrder;
052    private boolean sortOrderHasBeenModified = false;
053    private Long fromTime;
054    private boolean fromTimeHasBeenModified = false;
055    private Long thruTime;
056    private boolean thruTimeHasBeenModified = false;
057    
058    private transient Integer _hashCode = null;
059    private transient String _stringValue = null;
060    
061    private void constructFields(ForumThreadPK forumThreadPK, String forumThreadName, IconPK iconPK, Long postedTime, Integer sortOrder, Long fromTime, Long thruTime)
062            throws PersistenceNotNullException {
063        checkForNull(forumThreadPK);
064        this.forumThreadPK = forumThreadPK;
065        checkForNull(forumThreadName);
066        this.forumThreadName = forumThreadName;
067        this.iconPK = iconPK;
068        checkForNull(postedTime);
069        this.postedTime = postedTime;
070        checkForNull(sortOrder);
071        this.sortOrder = sortOrder;
072        checkForNull(fromTime);
073        this.fromTime = fromTime;
074        checkForNull(thruTime);
075        this.thruTime = thruTime;
076    }
077    
078    /** Creates a new instance of ForumThreadDetailValue */
079    public ForumThreadDetailValue(ForumThreadDetailPK forumThreadDetailPK, ForumThreadPK forumThreadPK, String forumThreadName, IconPK iconPK, Long postedTime, Integer sortOrder, Long fromTime, Long thruTime)
080            throws PersistenceNotNullException {
081        super(forumThreadDetailPK);
082        constructFields(forumThreadPK, forumThreadName, iconPK, postedTime, sortOrder, fromTime, thruTime);
083    }
084    
085    /** Creates a new instance of ForumThreadDetailValue */
086    public ForumThreadDetailValue(ForumThreadPK forumThreadPK, String forumThreadName, IconPK iconPK, Long postedTime, Integer sortOrder, Long fromTime, Long thruTime)
087            throws PersistenceNotNullException {
088        super();
089        constructFields(forumThreadPK, forumThreadName, iconPK, postedTime, sortOrder, fromTime, thruTime);
090    }
091    
092   @Override
093   public ForumThreadDetailFactory getBaseFactoryInstance() {
094        return ForumThreadDetailFactory.getInstance();
095    }
096    
097    @Override
098    public ForumThreadDetailValue clone() {
099        Object result;
100        
101        try {
102            result = super.clone();
103        } catch (CloneNotSupportedException cnse) {
104            // This shouldn't happen, fail when it does.
105            throw new PersistenceCloneException(cnse);
106        }
107        
108        return (ForumThreadDetailValue)result;
109    }
110    
111   @Override
112    public ForumThreadDetailPK getPrimaryKey() {
113        if(_primaryKey == null) {
114            _primaryKey = new ForumThreadDetailPK(entityId);
115        }
116        
117        return _primaryKey;
118    }
119    
120    private void clearHashAndString() {
121        _hashCode = null;
122        _stringValue = null;
123    }
124    
125    @Override
126    public int hashCode() {
127        if(_hashCode == null) {
128            int hashCode = 17;
129            
130            hashCode = 37 * hashCode + ((entityId != null) ? entityId.hashCode() : 0);
131            
132            hashCode = 37 * hashCode + ((forumThreadPK != null) ? forumThreadPK.hashCode() : 0);
133            hashCode = 37 * hashCode + ((forumThreadName != null) ? forumThreadName.hashCode() : 0);
134            hashCode = 37 * hashCode + ((iconPK != null) ? iconPK.hashCode() : 0);
135            hashCode = 37 * hashCode + ((postedTime != null) ? postedTime.hashCode() : 0);
136            hashCode = 37 * hashCode + ((sortOrder != null) ? sortOrder.hashCode() : 0);
137            hashCode = 37 * hashCode + ((fromTime != null) ? fromTime.hashCode() : 0);
138            hashCode = 37 * hashCode + ((thruTime != null) ? thruTime.hashCode() : 0);
139            
140            _hashCode = hashCode;
141        }
142        
143        return _hashCode;
144    }
145    
146    @Override
147    public String toString() {
148        if(_stringValue == null) {
149            StringBuilder stringValue = new StringBuilder("{");
150            
151            stringValue.append("entityId=").append(getEntityId());
152            
153            stringValue.append(", forumThreadPK=").append(getForumThreadPK());
154            stringValue.append(", forumThreadName=").append(getForumThreadName());
155            stringValue.append(", iconPK=").append(getIconPK());
156            stringValue.append(", postedTime=").append(getPostedTime());
157            stringValue.append(", sortOrder=").append(getSortOrder());
158            stringValue.append(", fromTime=").append(getFromTime());
159            stringValue.append(", thruTime=").append(getThruTime());
160            
161            stringValue.append('}');
162            
163            _stringValue = stringValue.toString();
164        }
165        return _stringValue;
166    }
167    
168    @Override
169    public boolean equals(Object other) {
170        if(this == other)
171            return true;
172        
173        if(!hasIdentity())
174            return false;
175        
176        if(other instanceof  ForumThreadDetailValue) {
177            ForumThreadDetailValue that = (ForumThreadDetailValue)other;
178            
179            if(!that.hasIdentity())
180                return false;
181            
182            Long thisEntityId = getEntityId();
183            Long thatEntityId = that.getEntityId();
184            
185            boolean objectsEqual = thisEntityId.equals(thatEntityId);
186            if(objectsEqual)
187                objectsEqual = objectsEqual && isIdentical(that);
188            
189            return objectsEqual;
190        } else {
191            return false;
192        }
193    }
194    
195    public boolean isIdentical(Object other) {
196        if(other instanceof ForumThreadDetailValue) {
197            ForumThreadDetailValue that = (ForumThreadDetailValue)other;
198            boolean objectsEqual = true;
199            
200            
201            if(objectsEqual) {
202                ForumThreadPK thisForumThreadPK = getForumThreadPK();
203                ForumThreadPK thatForumThreadPK = that.getForumThreadPK();
204                
205                if(thisForumThreadPK == null) {
206                    objectsEqual = objectsEqual && (thatForumThreadPK == null);
207                } else {
208                    objectsEqual = objectsEqual && thisForumThreadPK.equals(thatForumThreadPK);
209                }
210            }
211            
212            if(objectsEqual) {
213                String thisForumThreadName = getForumThreadName();
214                String thatForumThreadName = that.getForumThreadName();
215                
216                if(thisForumThreadName == null) {
217                    objectsEqual = objectsEqual && (thatForumThreadName == null);
218                } else {
219                    objectsEqual = objectsEqual && thisForumThreadName.equals(thatForumThreadName);
220                }
221            }
222            
223            if(objectsEqual) {
224                IconPK thisIconPK = getIconPK();
225                IconPK thatIconPK = that.getIconPK();
226                
227                if(thisIconPK == null) {
228                    objectsEqual = objectsEqual && (thatIconPK == null);
229                } else {
230                    objectsEqual = objectsEqual && thisIconPK.equals(thatIconPK);
231                }
232            }
233            
234            if(objectsEqual) {
235                Long thisPostedTime = getPostedTime();
236                Long thatPostedTime = that.getPostedTime();
237                
238                if(thisPostedTime == null) {
239                    objectsEqual = objectsEqual && (thatPostedTime == null);
240                } else {
241                    objectsEqual = objectsEqual && thisPostedTime.equals(thatPostedTime);
242                }
243            }
244            
245            if(objectsEqual) {
246                Integer thisSortOrder = getSortOrder();
247                Integer thatSortOrder = that.getSortOrder();
248                
249                if(thisSortOrder == null) {
250                    objectsEqual = objectsEqual && (thatSortOrder == null);
251                } else {
252                    objectsEqual = objectsEqual && thisSortOrder.equals(thatSortOrder);
253                }
254            }
255            
256            if(objectsEqual) {
257                Long thisFromTime = getFromTime();
258                Long thatFromTime = that.getFromTime();
259                
260                if(thisFromTime == null) {
261                    objectsEqual = objectsEqual && (thatFromTime == null);
262                } else {
263                    objectsEqual = objectsEqual && thisFromTime.equals(thatFromTime);
264                }
265            }
266            
267            if(objectsEqual) {
268                Long thisThruTime = getThruTime();
269                Long thatThruTime = that.getThruTime();
270                
271                if(thisThruTime == null) {
272                    objectsEqual = objectsEqual && (thatThruTime == null);
273                } else {
274                    objectsEqual = objectsEqual && thisThruTime.equals(thatThruTime);
275                }
276            }
277            
278            return objectsEqual;
279        } else {
280            return false;
281        }
282    }
283    
284    @Override
285    public boolean hasBeenModified() {
286        return forumThreadPKHasBeenModified || forumThreadNameHasBeenModified || iconPKHasBeenModified || postedTimeHasBeenModified || sortOrderHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified;
287    }
288    
289    @Override
290    public void clearHasBeenModified() {
291        forumThreadPKHasBeenModified = false;
292        forumThreadNameHasBeenModified = false;
293        iconPKHasBeenModified = false;
294        postedTimeHasBeenModified = false;
295        sortOrderHasBeenModified = false;
296        fromTimeHasBeenModified = false;
297        thruTimeHasBeenModified = false;
298    }
299    
300    public ForumThreadPK getForumThreadPK() {
301        return forumThreadPK;
302    }
303    
304    public void setForumThreadPK(ForumThreadPK forumThreadPK)
305            throws PersistenceNotNullException {
306        checkForNull(forumThreadPK);
307        
308        boolean update = true;
309        
310        if(this.forumThreadPK != null) {
311            if(this.forumThreadPK.equals(forumThreadPK)) {
312                update = false;
313            }
314        } else if(forumThreadPK == null) {
315            update = false;
316        }
317        
318        if(update) {
319            this.forumThreadPK = forumThreadPK;
320            forumThreadPKHasBeenModified = true;
321            clearHashAndString();
322        }
323    }
324    
325    public boolean getForumThreadPKHasBeenModified() {
326        return forumThreadPKHasBeenModified;
327    }
328    
329    public String getForumThreadName() {
330        return forumThreadName;
331    }
332    
333    public void setForumThreadName(String forumThreadName)
334            throws PersistenceNotNullException {
335        checkForNull(forumThreadName);
336        
337        boolean update = true;
338        
339        if(this.forumThreadName != null) {
340            if(this.forumThreadName.equals(forumThreadName)) {
341                update = false;
342            }
343        } else if(forumThreadName == null) {
344            update = false;
345        }
346        
347        if(update) {
348            this.forumThreadName = forumThreadName;
349            forumThreadNameHasBeenModified = true;
350            clearHashAndString();
351        }
352    }
353    
354    public boolean getForumThreadNameHasBeenModified() {
355        return forumThreadNameHasBeenModified;
356    }
357    
358    public IconPK getIconPK() {
359        return iconPK;
360    }
361    
362    public void setIconPK(IconPK iconPK) {
363        boolean update = true;
364        
365        if(this.iconPK != null) {
366            if(this.iconPK.equals(iconPK)) {
367                update = false;
368            }
369        } else if(iconPK == null) {
370            update = false;
371        }
372        
373        if(update) {
374            this.iconPK = iconPK;
375            iconPKHasBeenModified = true;
376            clearHashAndString();
377        }
378    }
379    
380    public boolean getIconPKHasBeenModified() {
381        return iconPKHasBeenModified;
382    }
383    
384    public Long getPostedTime() {
385        return postedTime;
386    }
387    
388    public void setPostedTime(Long postedTime)
389            throws PersistenceNotNullException {
390        checkForNull(postedTime);
391        
392        boolean update = true;
393        
394        if(this.postedTime != null) {
395            if(this.postedTime.equals(postedTime)) {
396                update = false;
397            }
398        } else if(postedTime == null) {
399            update = false;
400        }
401        
402        if(update) {
403            this.postedTime = postedTime;
404            postedTimeHasBeenModified = true;
405            clearHashAndString();
406        }
407    }
408    
409    public boolean getPostedTimeHasBeenModified() {
410        return postedTimeHasBeenModified;
411    }
412    
413    public Integer getSortOrder() {
414        return sortOrder;
415    }
416    
417    public void setSortOrder(Integer sortOrder)
418            throws PersistenceNotNullException {
419        checkForNull(sortOrder);
420        
421        boolean update = true;
422        
423        if(this.sortOrder != null) {
424            if(this.sortOrder.equals(sortOrder)) {
425                update = false;
426            }
427        } else if(sortOrder == null) {
428            update = false;
429        }
430        
431        if(update) {
432            this.sortOrder = sortOrder;
433            sortOrderHasBeenModified = true;
434            clearHashAndString();
435        }
436    }
437    
438    public boolean getSortOrderHasBeenModified() {
439        return sortOrderHasBeenModified;
440    }
441    
442    public Long getFromTime() {
443        return fromTime;
444    }
445    
446    public void setFromTime(Long fromTime)
447            throws PersistenceNotNullException {
448        checkForNull(fromTime);
449        
450        boolean update = true;
451        
452        if(this.fromTime != null) {
453            if(this.fromTime.equals(fromTime)) {
454                update = false;
455            }
456        } else if(fromTime == null) {
457            update = false;
458        }
459        
460        if(update) {
461            this.fromTime = fromTime;
462            fromTimeHasBeenModified = true;
463            clearHashAndString();
464        }
465    }
466    
467    public boolean getFromTimeHasBeenModified() {
468        return fromTimeHasBeenModified;
469    }
470    
471    public Long getThruTime() {
472        return thruTime;
473    }
474    
475    public void setThruTime(Long thruTime)
476            throws PersistenceNotNullException {
477        checkForNull(thruTime);
478        
479        boolean update = true;
480        
481        if(this.thruTime != null) {
482            if(this.thruTime.equals(thruTime)) {
483                update = false;
484            }
485        } else if(thruTime == null) {
486            update = false;
487        }
488        
489        if(update) {
490            this.thruTime = thruTime;
491            thruTimeHasBeenModified = true;
492            clearHashAndString();
493        }
494    }
495    
496    public boolean getThruTimeHasBeenModified() {
497        return thruTimeHasBeenModified;
498    }
499    
500}