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 * 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            StringBuilder stringValue = new StringBuilder("{");
167            
168            stringValue.append("entityId=").append(getEntityId());
169            
170            stringValue.append(", commentPK=").append(getCommentPK());
171            stringValue.append(", commentName=").append(getCommentName());
172            stringValue.append(", commentTypePK=").append(getCommentTypePK());
173            stringValue.append(", commentedEntityInstancePK=").append(getCommentedEntityInstancePK());
174            stringValue.append(", commentedByEntityInstancePK=").append(getCommentedByEntityInstancePK());
175            stringValue.append(", languagePK=").append(getLanguagePK());
176            stringValue.append(", description=").append(getDescription());
177            stringValue.append(", mimeTypePK=").append(getMimeTypePK());
178            stringValue.append(", fromTime=").append(getFromTime());
179            stringValue.append(", thruTime=").append(getThruTime());
180            
181            stringValue.append('}');
182            
183            _stringValue = stringValue.toString();
184        }
185        return _stringValue;
186    }
187    
188    @Override
189    public boolean equals(Object other) {
190        if(this == other)
191            return true;
192        
193        if(!hasIdentity())
194            return false;
195        
196        if(other instanceof  CommentDetailValue) {
197            CommentDetailValue that = (CommentDetailValue)other;
198            
199            if(!that.hasIdentity())
200                return false;
201            
202            Long thisEntityId = getEntityId();
203            Long thatEntityId = that.getEntityId();
204            
205            boolean objectsEqual = thisEntityId.equals(thatEntityId);
206            if(objectsEqual)
207                objectsEqual = objectsEqual && isIdentical(that);
208            
209            return objectsEqual;
210        } else {
211            return false;
212        }
213    }
214    
215    public boolean isIdentical(Object other) {
216        if(other instanceof CommentDetailValue) {
217            CommentDetailValue that = (CommentDetailValue)other;
218            boolean objectsEqual = true;
219            
220            
221            if(objectsEqual) {
222                CommentPK thisCommentPK = getCommentPK();
223                CommentPK thatCommentPK = that.getCommentPK();
224                
225                if(thisCommentPK == null) {
226                    objectsEqual = objectsEqual && (thatCommentPK == null);
227                } else {
228                    objectsEqual = objectsEqual && thisCommentPK.equals(thatCommentPK);
229                }
230            }
231            
232            if(objectsEqual) {
233                String thisCommentName = getCommentName();
234                String thatCommentName = that.getCommentName();
235                
236                if(thisCommentName == null) {
237                    objectsEqual = objectsEqual && (thatCommentName == null);
238                } else {
239                    objectsEqual = objectsEqual && thisCommentName.equals(thatCommentName);
240                }
241            }
242            
243            if(objectsEqual) {
244                CommentTypePK thisCommentTypePK = getCommentTypePK();
245                CommentTypePK thatCommentTypePK = that.getCommentTypePK();
246                
247                if(thisCommentTypePK == null) {
248                    objectsEqual = objectsEqual && (thatCommentTypePK == null);
249                } else {
250                    objectsEqual = objectsEqual && thisCommentTypePK.equals(thatCommentTypePK);
251                }
252            }
253            
254            if(objectsEqual) {
255                EntityInstancePK thisCommentedEntityInstancePK = getCommentedEntityInstancePK();
256                EntityInstancePK thatCommentedEntityInstancePK = that.getCommentedEntityInstancePK();
257                
258                if(thisCommentedEntityInstancePK == null) {
259                    objectsEqual = objectsEqual && (thatCommentedEntityInstancePK == null);
260                } else {
261                    objectsEqual = objectsEqual && thisCommentedEntityInstancePK.equals(thatCommentedEntityInstancePK);
262                }
263            }
264            
265            if(objectsEqual) {
266                EntityInstancePK thisCommentedByEntityInstancePK = getCommentedByEntityInstancePK();
267                EntityInstancePK thatCommentedByEntityInstancePK = that.getCommentedByEntityInstancePK();
268                
269                if(thisCommentedByEntityInstancePK == null) {
270                    objectsEqual = objectsEqual && (thatCommentedByEntityInstancePK == null);
271                } else {
272                    objectsEqual = objectsEqual && thisCommentedByEntityInstancePK.equals(thatCommentedByEntityInstancePK);
273                }
274            }
275            
276            if(objectsEqual) {
277                LanguagePK thisLanguagePK = getLanguagePK();
278                LanguagePK thatLanguagePK = that.getLanguagePK();
279                
280                if(thisLanguagePK == null) {
281                    objectsEqual = objectsEqual && (thatLanguagePK == null);
282                } else {
283                    objectsEqual = objectsEqual && thisLanguagePK.equals(thatLanguagePK);
284                }
285            }
286            
287            if(objectsEqual) {
288                String thisDescription = getDescription();
289                String thatDescription = that.getDescription();
290                
291                if(thisDescription == null) {
292                    objectsEqual = objectsEqual && (thatDescription == null);
293                } else {
294                    objectsEqual = objectsEqual && thisDescription.equals(thatDescription);
295                }
296            }
297            
298            if(objectsEqual) {
299                MimeTypePK thisMimeTypePK = getMimeTypePK();
300                MimeTypePK thatMimeTypePK = that.getMimeTypePK();
301                
302                if(thisMimeTypePK == null) {
303                    objectsEqual = objectsEqual && (thatMimeTypePK == null);
304                } else {
305                    objectsEqual = objectsEqual && thisMimeTypePK.equals(thatMimeTypePK);
306                }
307            }
308            
309            if(objectsEqual) {
310                Long thisFromTime = getFromTime();
311                Long thatFromTime = that.getFromTime();
312                
313                if(thisFromTime == null) {
314                    objectsEqual = objectsEqual && (thatFromTime == null);
315                } else {
316                    objectsEqual = objectsEqual && thisFromTime.equals(thatFromTime);
317                }
318            }
319            
320            if(objectsEqual) {
321                Long thisThruTime = getThruTime();
322                Long thatThruTime = that.getThruTime();
323                
324                if(thisThruTime == null) {
325                    objectsEqual = objectsEqual && (thatThruTime == null);
326                } else {
327                    objectsEqual = objectsEqual && thisThruTime.equals(thatThruTime);
328                }
329            }
330            
331            return objectsEqual;
332        } else {
333            return false;
334        }
335    }
336    
337    @Override
338    public boolean hasBeenModified() {
339        return commentPKHasBeenModified || commentNameHasBeenModified || commentTypePKHasBeenModified || commentedEntityInstancePKHasBeenModified || commentedByEntityInstancePKHasBeenModified || languagePKHasBeenModified || descriptionHasBeenModified || mimeTypePKHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified;
340    }
341    
342    @Override
343    public void clearHasBeenModified() {
344        commentPKHasBeenModified = false;
345        commentNameHasBeenModified = false;
346        commentTypePKHasBeenModified = false;
347        commentedEntityInstancePKHasBeenModified = false;
348        commentedByEntityInstancePKHasBeenModified = false;
349        languagePKHasBeenModified = false;
350        descriptionHasBeenModified = false;
351        mimeTypePKHasBeenModified = false;
352        fromTimeHasBeenModified = false;
353        thruTimeHasBeenModified = false;
354    }
355    
356    public CommentPK getCommentPK() {
357        return commentPK;
358    }
359    
360    public void setCommentPK(CommentPK commentPK)
361            throws PersistenceNotNullException {
362        checkForNull(commentPK);
363        
364        boolean update = true;
365        
366        if(this.commentPK != null) {
367            if(this.commentPK.equals(commentPK)) {
368                update = false;
369            }
370        } else if(commentPK == null) {
371            update = false;
372        }
373        
374        if(update) {
375            this.commentPK = commentPK;
376            commentPKHasBeenModified = true;
377            clearHashAndString();
378        }
379    }
380    
381    public boolean getCommentPKHasBeenModified() {
382        return commentPKHasBeenModified;
383    }
384    
385    public String getCommentName() {
386        return commentName;
387    }
388    
389    public void setCommentName(String commentName)
390            throws PersistenceNotNullException {
391        checkForNull(commentName);
392        
393        boolean update = true;
394        
395        if(this.commentName != null) {
396            if(this.commentName.equals(commentName)) {
397                update = false;
398            }
399        } else if(commentName == null) {
400            update = false;
401        }
402        
403        if(update) {
404            this.commentName = commentName;
405            commentNameHasBeenModified = true;
406            clearHashAndString();
407        }
408    }
409    
410    public boolean getCommentNameHasBeenModified() {
411        return commentNameHasBeenModified;
412    }
413    
414    public CommentTypePK getCommentTypePK() {
415        return commentTypePK;
416    }
417    
418    public void setCommentTypePK(CommentTypePK commentTypePK)
419            throws PersistenceNotNullException {
420        checkForNull(commentTypePK);
421        
422        boolean update = true;
423        
424        if(this.commentTypePK != null) {
425            if(this.commentTypePK.equals(commentTypePK)) {
426                update = false;
427            }
428        } else if(commentTypePK == null) {
429            update = false;
430        }
431        
432        if(update) {
433            this.commentTypePK = commentTypePK;
434            commentTypePKHasBeenModified = true;
435            clearHashAndString();
436        }
437    }
438    
439    public boolean getCommentTypePKHasBeenModified() {
440        return commentTypePKHasBeenModified;
441    }
442    
443    public EntityInstancePK getCommentedEntityInstancePK() {
444        return commentedEntityInstancePK;
445    }
446    
447    public void setCommentedEntityInstancePK(EntityInstancePK commentedEntityInstancePK)
448            throws PersistenceNotNullException {
449        checkForNull(commentedEntityInstancePK);
450        
451        boolean update = true;
452        
453        if(this.commentedEntityInstancePK != null) {
454            if(this.commentedEntityInstancePK.equals(commentedEntityInstancePK)) {
455                update = false;
456            }
457        } else if(commentedEntityInstancePK == null) {
458            update = false;
459        }
460        
461        if(update) {
462            this.commentedEntityInstancePK = commentedEntityInstancePK;
463            commentedEntityInstancePKHasBeenModified = true;
464            clearHashAndString();
465        }
466    }
467    
468    public boolean getCommentedEntityInstancePKHasBeenModified() {
469        return commentedEntityInstancePKHasBeenModified;
470    }
471    
472    public EntityInstancePK getCommentedByEntityInstancePK() {
473        return commentedByEntityInstancePK;
474    }
475    
476    public void setCommentedByEntityInstancePK(EntityInstancePK commentedByEntityInstancePK)
477            throws PersistenceNotNullException {
478        checkForNull(commentedByEntityInstancePK);
479        
480        boolean update = true;
481        
482        if(this.commentedByEntityInstancePK != null) {
483            if(this.commentedByEntityInstancePK.equals(commentedByEntityInstancePK)) {
484                update = false;
485            }
486        } else if(commentedByEntityInstancePK == null) {
487            update = false;
488        }
489        
490        if(update) {
491            this.commentedByEntityInstancePK = commentedByEntityInstancePK;
492            commentedByEntityInstancePKHasBeenModified = true;
493            clearHashAndString();
494        }
495    }
496    
497    public boolean getCommentedByEntityInstancePKHasBeenModified() {
498        return commentedByEntityInstancePKHasBeenModified;
499    }
500    
501    public LanguagePK getLanguagePK() {
502        return languagePK;
503    }
504    
505    public void setLanguagePK(LanguagePK languagePK)
506            throws PersistenceNotNullException {
507        checkForNull(languagePK);
508        
509        boolean update = true;
510        
511        if(this.languagePK != null) {
512            if(this.languagePK.equals(languagePK)) {
513                update = false;
514            }
515        } else if(languagePK == null) {
516            update = false;
517        }
518        
519        if(update) {
520            this.languagePK = languagePK;
521            languagePKHasBeenModified = true;
522            clearHashAndString();
523        }
524    }
525    
526    public boolean getLanguagePKHasBeenModified() {
527        return languagePKHasBeenModified;
528    }
529    
530    public String getDescription() {
531        return description;
532    }
533    
534    public void setDescription(String description) {
535        boolean update = true;
536        
537        if(this.description != null) {
538            if(this.description.equals(description)) {
539                update = false;
540            }
541        } else if(description == null) {
542            update = false;
543        }
544        
545        if(update) {
546            this.description = description;
547            descriptionHasBeenModified = true;
548            clearHashAndString();
549        }
550    }
551    
552    public boolean getDescriptionHasBeenModified() {
553        return descriptionHasBeenModified;
554    }
555    
556    public MimeTypePK getMimeTypePK() {
557        return mimeTypePK;
558    }
559    
560    public void setMimeTypePK(MimeTypePK mimeTypePK) {
561        boolean update = true;
562        
563        if(this.mimeTypePK != null) {
564            if(this.mimeTypePK.equals(mimeTypePK)) {
565                update = false;
566            }
567        } else if(mimeTypePK == null) {
568            update = false;
569        }
570        
571        if(update) {
572            this.mimeTypePK = mimeTypePK;
573            mimeTypePKHasBeenModified = true;
574            clearHashAndString();
575        }
576    }
577    
578    public boolean getMimeTypePKHasBeenModified() {
579        return mimeTypePKHasBeenModified;
580    }
581    
582    public Long getFromTime() {
583        return fromTime;
584    }
585    
586    public void setFromTime(Long fromTime)
587            throws PersistenceNotNullException {
588        checkForNull(fromTime);
589        
590        boolean update = true;
591        
592        if(this.fromTime != null) {
593            if(this.fromTime.equals(fromTime)) {
594                update = false;
595            }
596        } else if(fromTime == null) {
597            update = false;
598        }
599        
600        if(update) {
601            this.fromTime = fromTime;
602            fromTimeHasBeenModified = true;
603            clearHashAndString();
604        }
605    }
606    
607    public boolean getFromTimeHasBeenModified() {
608        return fromTimeHasBeenModified;
609    }
610    
611    public Long getThruTime() {
612        return thruTime;
613    }
614    
615    public void setThruTime(Long thruTime)
616            throws PersistenceNotNullException {
617        checkForNull(thruTime);
618        
619        boolean update = true;
620        
621        if(this.thruTime != null) {
622            if(this.thruTime.equals(thruTime)) {
623                update = false;
624            }
625        } else if(thruTime == null) {
626            update = false;
627        }
628        
629        if(update) {
630            this.thruTime = thruTime;
631            thruTimeHasBeenModified = true;
632            clearHashAndString();
633        }
634    }
635    
636    public boolean getThruTimeHasBeenModified() {
637        return thruTimeHasBeenModified;
638    }
639    
640}