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