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