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