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