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 * CommentDetailValue.java
021 */
022
023package com.echothree.model.data.comment.server.value;
024
025import com.echothree.model.data.comment.common.pk.CommentDetailPK;
026
027import com.echothree.model.data.comment.server.factory.CommentDetailFactory;
028
029import com.echothree.model.data.comment.common.pk.CommentPK;
030import com.echothree.model.data.comment.common.pk.CommentTypePK;
031import com.echothree.model.data.core.common.pk.EntityInstancePK;
032import com.echothree.model.data.party.common.pk.LanguagePK;
033import com.echothree.model.data.core.common.pk.MimeTypePK;
034
035import com.echothree.util.common.exception.PersistenceCloneException;
036import com.echothree.util.common.exception.PersistenceNotNullException;
037
038import com.echothree.util.server.persistence.BaseValue;
039
040import java.io.Serializable;
041
042public class CommentDetailValue
043        extends BaseValue<CommentDetailPK>
044        implements Cloneable, Serializable {
045    
046    private CommentPK commentPK;
047    private boolean commentPKHasBeenModified = false;
048    private String commentName;
049    private boolean commentNameHasBeenModified = false;
050    private CommentTypePK commentTypePK;
051    private boolean commentTypePKHasBeenModified = false;
052    private EntityInstancePK commentedEntityInstancePK;
053    private boolean commentedEntityInstancePKHasBeenModified = false;
054    private EntityInstancePK commentedByEntityInstancePK;
055    private boolean commentedByEntityInstancePKHasBeenModified = false;
056    private LanguagePK languagePK;
057    private boolean languagePKHasBeenModified = false;
058    private String description;
059    private boolean descriptionHasBeenModified = false;
060    private MimeTypePK mimeTypePK;
061    private boolean mimeTypePKHasBeenModified = false;
062    private Long fromTime;
063    private boolean fromTimeHasBeenModified = false;
064    private Long thruTime;
065    private boolean thruTimeHasBeenModified = false;
066    
067    private transient Integer _hashCode = null;
068    private transient String _stringValue = null;
069    
070    private void constructFields(CommentPK commentPK, String commentName, CommentTypePK commentTypePK, EntityInstancePK commentedEntityInstancePK, EntityInstancePK commentedByEntityInstancePK, LanguagePK languagePK, String description, MimeTypePK mimeTypePK, Long fromTime, Long thruTime)
071            throws PersistenceNotNullException {
072        checkForNull(commentPK);
073        this.commentPK = commentPK;
074        checkForNull(commentName);
075        this.commentName = commentName;
076        checkForNull(commentTypePK);
077        this.commentTypePK = commentTypePK;
078        checkForNull(commentedEntityInstancePK);
079        this.commentedEntityInstancePK = commentedEntityInstancePK;
080        checkForNull(commentedByEntityInstancePK);
081        this.commentedByEntityInstancePK = commentedByEntityInstancePK;
082        checkForNull(languagePK);
083        this.languagePK = languagePK;
084        this.description = description;
085        this.mimeTypePK = mimeTypePK;
086        checkForNull(fromTime);
087        this.fromTime = fromTime;
088        checkForNull(thruTime);
089        this.thruTime = thruTime;
090    }
091    
092    /** Creates a new instance of CommentDetailValue */
093    public CommentDetailValue(CommentDetailPK commentDetailPK, CommentPK commentPK, String commentName, CommentTypePK commentTypePK, EntityInstancePK commentedEntityInstancePK, EntityInstancePK commentedByEntityInstancePK, LanguagePK languagePK, String description, MimeTypePK mimeTypePK, Long fromTime, Long thruTime)
094            throws PersistenceNotNullException {
095        super(commentDetailPK);
096        constructFields(commentPK, commentName, commentTypePK, commentedEntityInstancePK, commentedByEntityInstancePK, languagePK, description, mimeTypePK, fromTime, thruTime);
097    }
098    
099    /** Creates a new instance of CommentDetailValue */
100    public CommentDetailValue(CommentPK commentPK, String commentName, CommentTypePK commentTypePK, EntityInstancePK commentedEntityInstancePK, EntityInstancePK commentedByEntityInstancePK, LanguagePK languagePK, String description, MimeTypePK mimeTypePK, Long fromTime, Long thruTime)
101            throws PersistenceNotNullException {
102        super();
103        constructFields(commentPK, commentName, commentTypePK, commentedEntityInstancePK, commentedByEntityInstancePK, languagePK, description, mimeTypePK, fromTime, thruTime);
104    }
105    
106   @Override
107   public CommentDetailFactory getBaseFactoryInstance() {
108        return CommentDetailFactory.getInstance();
109    }
110    
111    @Override
112    public CommentDetailValue clone() {
113        Object result;
114        
115        try {
116            result = super.clone();
117        } catch (CloneNotSupportedException cnse) {
118            // This shouldn't happen, fail when it does.
119            throw new PersistenceCloneException(cnse);
120        }
121        
122        return (CommentDetailValue)result;
123    }
124    
125   @Override
126    public CommentDetailPK getPrimaryKey() {
127        if(_primaryKey == null) {
128            _primaryKey = new CommentDetailPK(entityId);
129        }
130        
131        return _primaryKey;
132    }
133    
134    private void clearHashAndString() {
135        _hashCode = null;
136        _stringValue = null;
137    }
138    
139    @Override
140    public int hashCode() {
141        if(_hashCode == null) {
142            int hashCode = 17;
143            
144            hashCode = 37 * hashCode + ((entityId != null) ? entityId.hashCode() : 0);
145            
146            hashCode = 37 * hashCode + ((commentPK != null) ? commentPK.hashCode() : 0);
147            hashCode = 37 * hashCode + ((commentName != null) ? commentName.hashCode() : 0);
148            hashCode = 37 * hashCode + ((commentTypePK != null) ? commentTypePK.hashCode() : 0);
149            hashCode = 37 * hashCode + ((commentedEntityInstancePK != null) ? commentedEntityInstancePK.hashCode() : 0);
150            hashCode = 37 * hashCode + ((commentedByEntityInstancePK != null) ? commentedByEntityInstancePK.hashCode() : 0);
151            hashCode = 37 * hashCode + ((languagePK != null) ? languagePK.hashCode() : 0);
152            hashCode = 37 * hashCode + ((description != null) ? description.hashCode() : 0);
153            hashCode = 37 * hashCode + ((mimeTypePK != null) ? mimeTypePK.hashCode() : 0);
154            hashCode = 37 * hashCode + ((fromTime != null) ? fromTime.hashCode() : 0);
155            hashCode = 37 * hashCode + ((thruTime != null) ? thruTime.hashCode() : 0);
156            
157            _hashCode = hashCode;
158        }
159        
160        return _hashCode;
161    }
162    
163    @Override
164    public String toString() {
165        if(_stringValue == null) {
166            _stringValue = "{" + 
167                    "entityId=" + getEntityId() +
168                    ", commentPK=" + getCommentPK() +
169                    ", commentName=" + getCommentName() +
170                    ", commentTypePK=" + getCommentTypePK() +
171                    ", commentedEntityInstancePK=" + getCommentedEntityInstancePK() +
172                    ", commentedByEntityInstancePK=" + getCommentedByEntityInstancePK() +
173                    ", languagePK=" + getLanguagePK() +
174                    ", description=" + getDescription() +
175                    ", mimeTypePK=" + getMimeTypePK() +
176                    ", fromTime=" + getFromTime() +
177                    ", thruTime=" + getThruTime() +
178                    "}";
179        }
180        return _stringValue;
181    }
182    
183    @Override
184    public boolean equals(Object other) {
185        if(this == other)
186            return true;
187        
188        if(!hasIdentity())
189            return false;
190        
191        if(other instanceof  CommentDetailValue that) {
192            if(!that.hasIdentity())
193                return false;
194            
195            Long thisEntityId = getEntityId();
196            Long thatEntityId = that.getEntityId();
197            
198            boolean objectsEqual = thisEntityId.equals(thatEntityId);
199            if(objectsEqual)
200                objectsEqual = isIdentical(that);
201            
202            return objectsEqual;
203        } else {
204            return false;
205        }
206    }
207    
208    public boolean isIdentical(Object other) {
209        if(other instanceof CommentDetailValue that) {
210            boolean objectsEqual = true;
211            
212            
213            if(objectsEqual) {
214                CommentPK thisCommentPK = getCommentPK();
215                CommentPK thatCommentPK = that.getCommentPK();
216                
217                if(thisCommentPK == null) {
218                    objectsEqual = objectsEqual && (thatCommentPK == null);
219                } else {
220                    objectsEqual = objectsEqual && thisCommentPK.equals(thatCommentPK);
221                }
222            }
223            
224            if(objectsEqual) {
225                String thisCommentName = getCommentName();
226                String thatCommentName = that.getCommentName();
227                
228                if(thisCommentName == null) {
229                    objectsEqual = objectsEqual && (thatCommentName == null);
230                } else {
231                    objectsEqual = objectsEqual && thisCommentName.equals(thatCommentName);
232                }
233            }
234            
235            if(objectsEqual) {
236                CommentTypePK thisCommentTypePK = getCommentTypePK();
237                CommentTypePK thatCommentTypePK = that.getCommentTypePK();
238                
239                if(thisCommentTypePK == null) {
240                    objectsEqual = objectsEqual && (thatCommentTypePK == null);
241                } else {
242                    objectsEqual = objectsEqual && thisCommentTypePK.equals(thatCommentTypePK);
243                }
244            }
245            
246            if(objectsEqual) {
247                EntityInstancePK thisCommentedEntityInstancePK = getCommentedEntityInstancePK();
248                EntityInstancePK thatCommentedEntityInstancePK = that.getCommentedEntityInstancePK();
249                
250                if(thisCommentedEntityInstancePK == null) {
251                    objectsEqual = objectsEqual && (thatCommentedEntityInstancePK == null);
252                } else {
253                    objectsEqual = objectsEqual && thisCommentedEntityInstancePK.equals(thatCommentedEntityInstancePK);
254                }
255            }
256            
257            if(objectsEqual) {
258                EntityInstancePK thisCommentedByEntityInstancePK = getCommentedByEntityInstancePK();
259                EntityInstancePK thatCommentedByEntityInstancePK = that.getCommentedByEntityInstancePK();
260                
261                if(thisCommentedByEntityInstancePK == null) {
262                    objectsEqual = objectsEqual && (thatCommentedByEntityInstancePK == null);
263                } else {
264                    objectsEqual = objectsEqual && thisCommentedByEntityInstancePK.equals(thatCommentedByEntityInstancePK);
265                }
266            }
267            
268            if(objectsEqual) {
269                LanguagePK thisLanguagePK = getLanguagePK();
270                LanguagePK thatLanguagePK = that.getLanguagePK();
271                
272                if(thisLanguagePK == null) {
273                    objectsEqual = objectsEqual && (thatLanguagePK == null);
274                } else {
275                    objectsEqual = objectsEqual && thisLanguagePK.equals(thatLanguagePK);
276                }
277            }
278            
279            if(objectsEqual) {
280                String thisDescription = getDescription();
281                String thatDescription = that.getDescription();
282                
283                if(thisDescription == null) {
284                    objectsEqual = objectsEqual && (thatDescription == null);
285                } else {
286                    objectsEqual = objectsEqual && thisDescription.equals(thatDescription);
287                }
288            }
289            
290            if(objectsEqual) {
291                MimeTypePK thisMimeTypePK = getMimeTypePK();
292                MimeTypePK thatMimeTypePK = that.getMimeTypePK();
293                
294                if(thisMimeTypePK == null) {
295                    objectsEqual = objectsEqual && (thatMimeTypePK == null);
296                } else {
297                    objectsEqual = objectsEqual && thisMimeTypePK.equals(thatMimeTypePK);
298                }
299            }
300            
301            if(objectsEqual) {
302                Long thisFromTime = getFromTime();
303                Long thatFromTime = that.getFromTime();
304                
305                if(thisFromTime == null) {
306                    objectsEqual = objectsEqual && (thatFromTime == null);
307                } else {
308                    objectsEqual = objectsEqual && thisFromTime.equals(thatFromTime);
309                }
310            }
311            
312            if(objectsEqual) {
313                Long thisThruTime = getThruTime();
314                Long thatThruTime = that.getThruTime();
315                
316                if(thisThruTime == null) {
317                    objectsEqual = objectsEqual && (thatThruTime == null);
318                } else {
319                    objectsEqual = objectsEqual && thisThruTime.equals(thatThruTime);
320                }
321            }
322            
323            return objectsEqual;
324        } else {
325            return false;
326        }
327    }
328    
329    @Override
330    public boolean hasBeenModified() {
331        return commentPKHasBeenModified || commentNameHasBeenModified || commentTypePKHasBeenModified || commentedEntityInstancePKHasBeenModified || commentedByEntityInstancePKHasBeenModified || languagePKHasBeenModified || descriptionHasBeenModified || mimeTypePKHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified;
332    }
333    
334    @Override
335    public void clearHasBeenModified() {
336        commentPKHasBeenModified = false;
337        commentNameHasBeenModified = false;
338        commentTypePKHasBeenModified = false;
339        commentedEntityInstancePKHasBeenModified = false;
340        commentedByEntityInstancePKHasBeenModified = false;
341        languagePKHasBeenModified = false;
342        descriptionHasBeenModified = false;
343        mimeTypePKHasBeenModified = false;
344        fromTimeHasBeenModified = false;
345        thruTimeHasBeenModified = false;
346    }
347    
348    public CommentPK getCommentPK() {
349        return commentPK;
350    }
351    
352    public void setCommentPK(CommentPK commentPK)
353            throws PersistenceNotNullException {
354        checkForNull(commentPK);
355        
356        boolean update = true;
357        
358        if(this.commentPK != null) {
359            if(this.commentPK.equals(commentPK)) {
360                update = false;
361            }
362        } else if(commentPK == null) {
363            update = false;
364        }
365        
366        if(update) {
367            this.commentPK = commentPK;
368            commentPKHasBeenModified = true;
369            clearHashAndString();
370        }
371    }
372    
373    public boolean getCommentPKHasBeenModified() {
374        return commentPKHasBeenModified;
375    }
376    
377    public String getCommentName() {
378        return commentName;
379    }
380    
381    public void setCommentName(String commentName)
382            throws PersistenceNotNullException {
383        checkForNull(commentName);
384        
385        boolean update = true;
386        
387        if(this.commentName != null) {
388            if(this.commentName.equals(commentName)) {
389                update = false;
390            }
391        } else if(commentName == null) {
392            update = false;
393        }
394        
395        if(update) {
396            this.commentName = commentName;
397            commentNameHasBeenModified = true;
398            clearHashAndString();
399        }
400    }
401    
402    public boolean getCommentNameHasBeenModified() {
403        return commentNameHasBeenModified;
404    }
405    
406    public CommentTypePK getCommentTypePK() {
407        return commentTypePK;
408    }
409    
410    public void setCommentTypePK(CommentTypePK commentTypePK)
411            throws PersistenceNotNullException {
412        checkForNull(commentTypePK);
413        
414        boolean update = true;
415        
416        if(this.commentTypePK != null) {
417            if(this.commentTypePK.equals(commentTypePK)) {
418                update = false;
419            }
420        } else if(commentTypePK == null) {
421            update = false;
422        }
423        
424        if(update) {
425            this.commentTypePK = commentTypePK;
426            commentTypePKHasBeenModified = true;
427            clearHashAndString();
428        }
429    }
430    
431    public boolean getCommentTypePKHasBeenModified() {
432        return commentTypePKHasBeenModified;
433    }
434    
435    public EntityInstancePK getCommentedEntityInstancePK() {
436        return commentedEntityInstancePK;
437    }
438    
439    public void setCommentedEntityInstancePK(EntityInstancePK commentedEntityInstancePK)
440            throws PersistenceNotNullException {
441        checkForNull(commentedEntityInstancePK);
442        
443        boolean update = true;
444        
445        if(this.commentedEntityInstancePK != null) {
446            if(this.commentedEntityInstancePK.equals(commentedEntityInstancePK)) {
447                update = false;
448            }
449        } else if(commentedEntityInstancePK == null) {
450            update = false;
451        }
452        
453        if(update) {
454            this.commentedEntityInstancePK = commentedEntityInstancePK;
455            commentedEntityInstancePKHasBeenModified = true;
456            clearHashAndString();
457        }
458    }
459    
460    public boolean getCommentedEntityInstancePKHasBeenModified() {
461        return commentedEntityInstancePKHasBeenModified;
462    }
463    
464    public EntityInstancePK getCommentedByEntityInstancePK() {
465        return commentedByEntityInstancePK;
466    }
467    
468    public void setCommentedByEntityInstancePK(EntityInstancePK commentedByEntityInstancePK)
469            throws PersistenceNotNullException {
470        checkForNull(commentedByEntityInstancePK);
471        
472        boolean update = true;
473        
474        if(this.commentedByEntityInstancePK != null) {
475            if(this.commentedByEntityInstancePK.equals(commentedByEntityInstancePK)) {
476                update = false;
477            }
478        } else if(commentedByEntityInstancePK == null) {
479            update = false;
480        }
481        
482        if(update) {
483            this.commentedByEntityInstancePK = commentedByEntityInstancePK;
484            commentedByEntityInstancePKHasBeenModified = true;
485            clearHashAndString();
486        }
487    }
488    
489    public boolean getCommentedByEntityInstancePKHasBeenModified() {
490        return commentedByEntityInstancePKHasBeenModified;
491    }
492    
493    public LanguagePK getLanguagePK() {
494        return languagePK;
495    }
496    
497    public void setLanguagePK(LanguagePK languagePK)
498            throws PersistenceNotNullException {
499        checkForNull(languagePK);
500        
501        boolean update = true;
502        
503        if(this.languagePK != null) {
504            if(this.languagePK.equals(languagePK)) {
505                update = false;
506            }
507        } else if(languagePK == null) {
508            update = false;
509        }
510        
511        if(update) {
512            this.languagePK = languagePK;
513            languagePKHasBeenModified = true;
514            clearHashAndString();
515        }
516    }
517    
518    public boolean getLanguagePKHasBeenModified() {
519        return languagePKHasBeenModified;
520    }
521    
522    public String getDescription() {
523        return description;
524    }
525    
526    public void setDescription(String description) {
527        boolean update = true;
528        
529        if(this.description != null) {
530            if(this.description.equals(description)) {
531                update = false;
532            }
533        } else if(description == null) {
534            update = false;
535        }
536        
537        if(update) {
538            this.description = description;
539            descriptionHasBeenModified = true;
540            clearHashAndString();
541        }
542    }
543    
544    public boolean getDescriptionHasBeenModified() {
545        return descriptionHasBeenModified;
546    }
547    
548    public MimeTypePK getMimeTypePK() {
549        return mimeTypePK;
550    }
551    
552    public void setMimeTypePK(MimeTypePK mimeTypePK) {
553        boolean update = true;
554        
555        if(this.mimeTypePK != null) {
556            if(this.mimeTypePK.equals(mimeTypePK)) {
557                update = false;
558            }
559        } else if(mimeTypePK == null) {
560            update = false;
561        }
562        
563        if(update) {
564            this.mimeTypePK = mimeTypePK;
565            mimeTypePKHasBeenModified = true;
566            clearHashAndString();
567        }
568    }
569    
570    public boolean getMimeTypePKHasBeenModified() {
571        return mimeTypePKHasBeenModified;
572    }
573    
574    public Long getFromTime() {
575        return fromTime;
576    }
577    
578    public void setFromTime(Long fromTime)
579            throws PersistenceNotNullException {
580        checkForNull(fromTime);
581        
582        boolean update = true;
583        
584        if(this.fromTime != null) {
585            if(this.fromTime.equals(fromTime)) {
586                update = false;
587            }
588        } else if(fromTime == null) {
589            update = false;
590        }
591        
592        if(update) {
593            this.fromTime = fromTime;
594            fromTimeHasBeenModified = true;
595            clearHashAndString();
596        }
597    }
598    
599    public boolean getFromTimeHasBeenModified() {
600        return fromTimeHasBeenModified;
601    }
602    
603    public Long getThruTime() {
604        return thruTime;
605    }
606    
607    public void setThruTime(Long thruTime)
608            throws PersistenceNotNullException {
609        checkForNull(thruTime);
610        
611        boolean update = true;
612        
613        if(this.thruTime != null) {
614            if(this.thruTime.equals(thruTime)) {
615                update = false;
616            }
617        } else if(thruTime == null) {
618            update = false;
619        }
620        
621        if(update) {
622            this.thruTime = thruTime;
623            thruTimeHasBeenModified = true;
624            clearHashAndString();
625        }
626    }
627    
628    public boolean getThruTimeHasBeenModified() {
629        return thruTimeHasBeenModified;
630    }
631    
632}