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 * TrainingClassSectionTranslationValue.java
021 */
022
023package com.echothree.model.data.training.server.value;
024
025import com.echothree.model.data.training.common.pk.TrainingClassSectionTranslationPK;
026
027import com.echothree.model.data.training.server.factory.TrainingClassSectionTranslationFactory;
028
029import com.echothree.model.data.training.common.pk.TrainingClassSectionPK;
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 TrainingClassSectionTranslationValue
041        extends BaseValue<TrainingClassSectionTranslationPK>
042        implements Cloneable, Serializable {
043    
044    private TrainingClassSectionPK trainingClassSectionPK;
045    private boolean trainingClassSectionPKHasBeenModified = 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(TrainingClassSectionPK trainingClassSectionPK, LanguagePK languagePK, String description, MimeTypePK overviewMimeTypePK, String overview, MimeTypePK introductionMimeTypePK, String introduction, Long fromTime, Long thruTime)
067            throws PersistenceNotNullException {
068        checkForNull(trainingClassSectionPK);
069        this.trainingClassSectionPK = trainingClassSectionPK;
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 TrainingClassSectionTranslationValue */
085    public TrainingClassSectionTranslationValue(TrainingClassSectionTranslationPK trainingClassSectionTranslationPK, TrainingClassSectionPK trainingClassSectionPK, LanguagePK languagePK, String description, MimeTypePK overviewMimeTypePK, String overview, MimeTypePK introductionMimeTypePK, String introduction, Long fromTime, Long thruTime)
086            throws PersistenceNotNullException {
087        super(trainingClassSectionTranslationPK);
088        constructFields(trainingClassSectionPK, languagePK, description, overviewMimeTypePK, overview, introductionMimeTypePK, introduction, fromTime, thruTime);
089    }
090    
091    /** Creates a new instance of TrainingClassSectionTranslationValue */
092    public TrainingClassSectionTranslationValue(TrainingClassSectionPK trainingClassSectionPK, LanguagePK languagePK, String description, MimeTypePK overviewMimeTypePK, String overview, MimeTypePK introductionMimeTypePK, String introduction, Long fromTime, Long thruTime)
093            throws PersistenceNotNullException {
094        super();
095        constructFields(trainingClassSectionPK, languagePK, description, overviewMimeTypePK, overview, introductionMimeTypePK, introduction, fromTime, thruTime);
096    }
097    
098   @Override
099   public TrainingClassSectionTranslationFactory getBaseFactoryInstance() {
100        return TrainingClassSectionTranslationFactory.getInstance();
101    }
102    
103    @Override
104    public TrainingClassSectionTranslationValue 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 (TrainingClassSectionTranslationValue)result;
115    }
116    
117   @Override
118    public TrainingClassSectionTranslationPK getPrimaryKey() {
119        if(_primaryKey == null) {
120            _primaryKey = new TrainingClassSectionTranslationPK(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 + ((trainingClassSectionPK != null) ? trainingClassSectionPK.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            StringBuilder stringValue = new StringBuilder("{");
158            
159            stringValue.append("entityId=").append(getEntityId());
160            
161            stringValue.append(", trainingClassSectionPK=").append(getTrainingClassSectionPK());
162            stringValue.append(", languagePK=").append(getLanguagePK());
163            stringValue.append(", description=").append(getDescription());
164            stringValue.append(", overviewMimeTypePK=").append(getOverviewMimeTypePK());
165            stringValue.append(", overview=").append(getOverview());
166            stringValue.append(", introductionMimeTypePK=").append(getIntroductionMimeTypePK());
167            stringValue.append(", introduction=").append(getIntroduction());
168            stringValue.append(", fromTime=").append(getFromTime());
169            stringValue.append(", thruTime=").append(getThruTime());
170            
171            stringValue.append('}');
172            
173            _stringValue = stringValue.toString();
174        }
175        return _stringValue;
176    }
177    
178    @Override
179    public boolean equals(Object other) {
180        if(this == other)
181            return true;
182        
183        if(!hasIdentity())
184            return false;
185        
186        if(other instanceof  TrainingClassSectionTranslationValue) {
187            TrainingClassSectionTranslationValue that = (TrainingClassSectionTranslationValue)other;
188            
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 = 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 TrainingClassSectionTranslationValue) {
207            TrainingClassSectionTranslationValue that = (TrainingClassSectionTranslationValue)other;
208            boolean objectsEqual = true;
209            
210            
211            if(objectsEqual) {
212                TrainingClassSectionPK thisTrainingClassSectionPK = getTrainingClassSectionPK();
213                TrainingClassSectionPK thatTrainingClassSectionPK = that.getTrainingClassSectionPK();
214                
215                if(thisTrainingClassSectionPK == null) {
216                    objectsEqual = objectsEqual && (thatTrainingClassSectionPK == null);
217                } else {
218                    objectsEqual = objectsEqual && thisTrainingClassSectionPK.equals(thatTrainingClassSectionPK);
219                }
220            }
221            
222            if(objectsEqual) {
223                LanguagePK thisLanguagePK = getLanguagePK();
224                LanguagePK thatLanguagePK = that.getLanguagePK();
225                
226                if(thisLanguagePK == null) {
227                    objectsEqual = objectsEqual && (thatLanguagePK == null);
228                } else {
229                    objectsEqual = objectsEqual && thisLanguagePK.equals(thatLanguagePK);
230                }
231            }
232            
233            if(objectsEqual) {
234                String thisDescription = getDescription();
235                String thatDescription = that.getDescription();
236                
237                if(thisDescription == null) {
238                    objectsEqual = objectsEqual && (thatDescription == null);
239                } else {
240                    objectsEqual = objectsEqual && thisDescription.equals(thatDescription);
241                }
242            }
243            
244            if(objectsEqual) {
245                MimeTypePK thisOverviewMimeTypePK = getOverviewMimeTypePK();
246                MimeTypePK thatOverviewMimeTypePK = that.getOverviewMimeTypePK();
247                
248                if(thisOverviewMimeTypePK == null) {
249                    objectsEqual = objectsEqual && (thatOverviewMimeTypePK == null);
250                } else {
251                    objectsEqual = objectsEqual && thisOverviewMimeTypePK.equals(thatOverviewMimeTypePK);
252                }
253            }
254            
255            if(objectsEqual) {
256                String thisOverview = getOverview();
257                String thatOverview = that.getOverview();
258                
259                if(thisOverview == null) {
260                    objectsEqual = objectsEqual && (thatOverview == null);
261                } else {
262                    objectsEqual = objectsEqual && thisOverview.equals(thatOverview);
263                }
264            }
265            
266            if(objectsEqual) {
267                MimeTypePK thisIntroductionMimeTypePK = getIntroductionMimeTypePK();
268                MimeTypePK thatIntroductionMimeTypePK = that.getIntroductionMimeTypePK();
269                
270                if(thisIntroductionMimeTypePK == null) {
271                    objectsEqual = objectsEqual && (thatIntroductionMimeTypePK == null);
272                } else {
273                    objectsEqual = objectsEqual && thisIntroductionMimeTypePK.equals(thatIntroductionMimeTypePK);
274                }
275            }
276            
277            if(objectsEqual) {
278                String thisIntroduction = getIntroduction();
279                String thatIntroduction = that.getIntroduction();
280                
281                if(thisIntroduction == null) {
282                    objectsEqual = objectsEqual && (thatIntroduction == null);
283                } else {
284                    objectsEqual = objectsEqual && thisIntroduction.equals(thatIntroduction);
285                }
286            }
287            
288            if(objectsEqual) {
289                Long thisFromTime = getFromTime();
290                Long thatFromTime = that.getFromTime();
291                
292                if(thisFromTime == null) {
293                    objectsEqual = objectsEqual && (thatFromTime == null);
294                } else {
295                    objectsEqual = objectsEqual && thisFromTime.equals(thatFromTime);
296                }
297            }
298            
299            if(objectsEqual) {
300                Long thisThruTime = getThruTime();
301                Long thatThruTime = that.getThruTime();
302                
303                if(thisThruTime == null) {
304                    objectsEqual = objectsEqual && (thatThruTime == null);
305                } else {
306                    objectsEqual = objectsEqual && thisThruTime.equals(thatThruTime);
307                }
308            }
309            
310            return objectsEqual;
311        } else {
312            return false;
313        }
314    }
315    
316    @Override
317    public boolean hasBeenModified() {
318        return trainingClassSectionPKHasBeenModified || languagePKHasBeenModified || descriptionHasBeenModified || overviewMimeTypePKHasBeenModified || overviewHasBeenModified || introductionMimeTypePKHasBeenModified || introductionHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified;
319    }
320    
321    @Override
322    public void clearHasBeenModified() {
323        trainingClassSectionPKHasBeenModified = false;
324        languagePKHasBeenModified = false;
325        descriptionHasBeenModified = false;
326        overviewMimeTypePKHasBeenModified = false;
327        overviewHasBeenModified = false;
328        introductionMimeTypePKHasBeenModified = false;
329        introductionHasBeenModified = false;
330        fromTimeHasBeenModified = false;
331        thruTimeHasBeenModified = false;
332    }
333    
334    public TrainingClassSectionPK getTrainingClassSectionPK() {
335        return trainingClassSectionPK;
336    }
337    
338    public void setTrainingClassSectionPK(TrainingClassSectionPK trainingClassSectionPK)
339            throws PersistenceNotNullException {
340        checkForNull(trainingClassSectionPK);
341        
342        boolean update = true;
343        
344        if(this.trainingClassSectionPK != null) {
345            if(this.trainingClassSectionPK.equals(trainingClassSectionPK)) {
346                update = false;
347            }
348        } else if(trainingClassSectionPK == null) {
349            update = false;
350        }
351        
352        if(update) {
353            this.trainingClassSectionPK = trainingClassSectionPK;
354            trainingClassSectionPKHasBeenModified = true;
355            clearHashAndString();
356        }
357    }
358    
359    public boolean getTrainingClassSectionPKHasBeenModified() {
360        return trainingClassSectionPKHasBeenModified;
361    }
362    
363    public LanguagePK getLanguagePK() {
364        return languagePK;
365    }
366    
367    public void setLanguagePK(LanguagePK languagePK)
368            throws PersistenceNotNullException {
369        checkForNull(languagePK);
370        
371        boolean update = true;
372        
373        if(this.languagePK != null) {
374            if(this.languagePK.equals(languagePK)) {
375                update = false;
376            }
377        } else if(languagePK == null) {
378            update = false;
379        }
380        
381        if(update) {
382            this.languagePK = languagePK;
383            languagePKHasBeenModified = true;
384            clearHashAndString();
385        }
386    }
387    
388    public boolean getLanguagePKHasBeenModified() {
389        return languagePKHasBeenModified;
390    }
391    
392    public String getDescription() {
393        return description;
394    }
395    
396    public void setDescription(String description)
397            throws PersistenceNotNullException {
398        checkForNull(description);
399        
400        boolean update = true;
401        
402        if(this.description != null) {
403            if(this.description.equals(description)) {
404                update = false;
405            }
406        } else if(description == null) {
407            update = false;
408        }
409        
410        if(update) {
411            this.description = description;
412            descriptionHasBeenModified = true;
413            clearHashAndString();
414        }
415    }
416    
417    public boolean getDescriptionHasBeenModified() {
418        return descriptionHasBeenModified;
419    }
420    
421    public MimeTypePK getOverviewMimeTypePK() {
422        return overviewMimeTypePK;
423    }
424    
425    public void setOverviewMimeTypePK(MimeTypePK overviewMimeTypePK) {
426        boolean update = true;
427        
428        if(this.overviewMimeTypePK != null) {
429            if(this.overviewMimeTypePK.equals(overviewMimeTypePK)) {
430                update = false;
431            }
432        } else if(overviewMimeTypePK == null) {
433            update = false;
434        }
435        
436        if(update) {
437            this.overviewMimeTypePK = overviewMimeTypePK;
438            overviewMimeTypePKHasBeenModified = true;
439            clearHashAndString();
440        }
441    }
442    
443    public boolean getOverviewMimeTypePKHasBeenModified() {
444        return overviewMimeTypePKHasBeenModified;
445    }
446    
447    public String getOverview() {
448        return overview;
449    }
450    
451    public void setOverview(String overview) {
452        boolean update = true;
453        
454        if(this.overview != null) {
455            if(this.overview.equals(overview)) {
456                update = false;
457            }
458        } else if(overview == null) {
459            update = false;
460        }
461        
462        if(update) {
463            this.overview = overview;
464            overviewHasBeenModified = true;
465            clearHashAndString();
466        }
467    }
468    
469    public boolean getOverviewHasBeenModified() {
470        return overviewHasBeenModified;
471    }
472    
473    public MimeTypePK getIntroductionMimeTypePK() {
474        return introductionMimeTypePK;
475    }
476    
477    public void setIntroductionMimeTypePK(MimeTypePK introductionMimeTypePK) {
478        boolean update = true;
479        
480        if(this.introductionMimeTypePK != null) {
481            if(this.introductionMimeTypePK.equals(introductionMimeTypePK)) {
482                update = false;
483            }
484        } else if(introductionMimeTypePK == null) {
485            update = false;
486        }
487        
488        if(update) {
489            this.introductionMimeTypePK = introductionMimeTypePK;
490            introductionMimeTypePKHasBeenModified = true;
491            clearHashAndString();
492        }
493    }
494    
495    public boolean getIntroductionMimeTypePKHasBeenModified() {
496        return introductionMimeTypePKHasBeenModified;
497    }
498    
499    public String getIntroduction() {
500        return introduction;
501    }
502    
503    public void setIntroduction(String introduction) {
504        boolean update = true;
505        
506        if(this.introduction != null) {
507            if(this.introduction.equals(introduction)) {
508                update = false;
509            }
510        } else if(introduction == null) {
511            update = false;
512        }
513        
514        if(update) {
515            this.introduction = introduction;
516            introductionHasBeenModified = true;
517            clearHashAndString();
518        }
519    }
520    
521    public boolean getIntroductionHasBeenModified() {
522        return introductionHasBeenModified;
523    }
524    
525    public Long getFromTime() {
526        return fromTime;
527    }
528    
529    public void setFromTime(Long fromTime)
530            throws PersistenceNotNullException {
531        checkForNull(fromTime);
532        
533        boolean update = true;
534        
535        if(this.fromTime != null) {
536            if(this.fromTime.equals(fromTime)) {
537                update = false;
538            }
539        } else if(fromTime == null) {
540            update = false;
541        }
542        
543        if(update) {
544            this.fromTime = fromTime;
545            fromTimeHasBeenModified = true;
546            clearHashAndString();
547        }
548    }
549    
550    public boolean getFromTimeHasBeenModified() {
551        return fromTimeHasBeenModified;
552    }
553    
554    public Long getThruTime() {
555        return thruTime;
556    }
557    
558    public void setThruTime(Long thruTime)
559            throws PersistenceNotNullException {
560        checkForNull(thruTime);
561        
562        boolean update = true;
563        
564        if(this.thruTime != null) {
565            if(this.thruTime.equals(thruTime)) {
566                update = false;
567            }
568        } else if(thruTime == null) {
569            update = false;
570        }
571        
572        if(update) {
573            this.thruTime = thruTime;
574            thruTimeHasBeenModified = true;
575            clearHashAndString();
576        }
577    }
578    
579    public boolean getThruTimeHasBeenModified() {
580        return thruTimeHasBeenModified;
581    }
582    
583}