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 * HarmonizedTariffScheduleCodeTranslationValue.java
021 */
022
023package com.echothree.model.data.item.server.value;
024
025import com.echothree.model.data.item.common.pk.HarmonizedTariffScheduleCodeTranslationPK;
026
027import com.echothree.model.data.item.server.factory.HarmonizedTariffScheduleCodeTranslationFactory;
028
029import com.echothree.model.data.item.common.pk.HarmonizedTariffScheduleCodePK;
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 HarmonizedTariffScheduleCodeTranslationValue
041        extends BaseValue<HarmonizedTariffScheduleCodeTranslationPK>
042        implements Cloneable, Serializable {
043    
044    private HarmonizedTariffScheduleCodePK harmonizedTariffScheduleCodePK;
045    private boolean harmonizedTariffScheduleCodePKHasBeenModified = 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 Long fromTime;
055    private boolean fromTimeHasBeenModified = false;
056    private Long thruTime;
057    private boolean thruTimeHasBeenModified = false;
058    
059    private transient Integer _hashCode = null;
060    private transient String _stringValue = null;
061    
062    private void constructFields(HarmonizedTariffScheduleCodePK harmonizedTariffScheduleCodePK, LanguagePK languagePK, String description, MimeTypePK overviewMimeTypePK, String overview, Long fromTime, Long thruTime)
063            throws PersistenceNotNullException {
064        checkForNull(harmonizedTariffScheduleCodePK);
065        this.harmonizedTariffScheduleCodePK = harmonizedTariffScheduleCodePK;
066        checkForNull(languagePK);
067        this.languagePK = languagePK;
068        checkForNull(description);
069        this.description = description;
070        this.overviewMimeTypePK = overviewMimeTypePK;
071        this.overview = overview;
072        checkForNull(fromTime);
073        this.fromTime = fromTime;
074        checkForNull(thruTime);
075        this.thruTime = thruTime;
076    }
077    
078    /** Creates a new instance of HarmonizedTariffScheduleCodeTranslationValue */
079    public HarmonizedTariffScheduleCodeTranslationValue(HarmonizedTariffScheduleCodeTranslationPK harmonizedTariffScheduleCodeTranslationPK, HarmonizedTariffScheduleCodePK harmonizedTariffScheduleCodePK, LanguagePK languagePK, String description, MimeTypePK overviewMimeTypePK, String overview, Long fromTime, Long thruTime)
080            throws PersistenceNotNullException {
081        super(harmonizedTariffScheduleCodeTranslationPK);
082        constructFields(harmonizedTariffScheduleCodePK, languagePK, description, overviewMimeTypePK, overview, fromTime, thruTime);
083    }
084    
085    /** Creates a new instance of HarmonizedTariffScheduleCodeTranslationValue */
086    public HarmonizedTariffScheduleCodeTranslationValue(HarmonizedTariffScheduleCodePK harmonizedTariffScheduleCodePK, LanguagePK languagePK, String description, MimeTypePK overviewMimeTypePK, String overview, Long fromTime, Long thruTime)
087            throws PersistenceNotNullException {
088        super();
089        constructFields(harmonizedTariffScheduleCodePK, languagePK, description, overviewMimeTypePK, overview, fromTime, thruTime);
090    }
091    
092   @Override
093   public HarmonizedTariffScheduleCodeTranslationFactory getBaseFactoryInstance() {
094        return HarmonizedTariffScheduleCodeTranslationFactory.getInstance();
095    }
096    
097    @Override
098    public HarmonizedTariffScheduleCodeTranslationValue clone() {
099        Object result;
100        
101        try {
102            result = super.clone();
103        } catch (CloneNotSupportedException cnse) {
104            // This shouldn't happen, fail when it does.
105            throw new PersistenceCloneException(cnse);
106        }
107        
108        return (HarmonizedTariffScheduleCodeTranslationValue)result;
109    }
110    
111   @Override
112    public HarmonizedTariffScheduleCodeTranslationPK getPrimaryKey() {
113        if(_primaryKey == null) {
114            _primaryKey = new HarmonizedTariffScheduleCodeTranslationPK(entityId);
115        }
116        
117        return _primaryKey;
118    }
119    
120    private void clearHashAndString() {
121        _hashCode = null;
122        _stringValue = null;
123    }
124    
125    @Override
126    public int hashCode() {
127        if(_hashCode == null) {
128            int hashCode = 17;
129            
130            hashCode = 37 * hashCode + ((entityId != null) ? entityId.hashCode() : 0);
131            
132            hashCode = 37 * hashCode + ((harmonizedTariffScheduleCodePK != null) ? harmonizedTariffScheduleCodePK.hashCode() : 0);
133            hashCode = 37 * hashCode + ((languagePK != null) ? languagePK.hashCode() : 0);
134            hashCode = 37 * hashCode + ((description != null) ? description.hashCode() : 0);
135            hashCode = 37 * hashCode + ((overviewMimeTypePK != null) ? overviewMimeTypePK.hashCode() : 0);
136            hashCode = 37 * hashCode + ((overview != null) ? overview.hashCode() : 0);
137            hashCode = 37 * hashCode + ((fromTime != null) ? fromTime.hashCode() : 0);
138            hashCode = 37 * hashCode + ((thruTime != null) ? thruTime.hashCode() : 0);
139            
140            _hashCode = hashCode;
141        }
142        
143        return _hashCode;
144    }
145    
146    @Override
147    public String toString() {
148        if(_stringValue == null) {
149            _stringValue = "{" + 
150                    "entityId=" + getEntityId() +
151                    ", harmonizedTariffScheduleCodePK=" + getHarmonizedTariffScheduleCodePK() +
152                    ", languagePK=" + getLanguagePK() +
153                    ", description=" + getDescription() +
154                    ", overviewMimeTypePK=" + getOverviewMimeTypePK() +
155                    ", overview=" + getOverview() +
156                    ", fromTime=" + getFromTime() +
157                    ", thruTime=" + getThruTime() +
158                    "}";
159        }
160        return _stringValue;
161    }
162    
163    @Override
164    public boolean equals(Object other) {
165        if(this == other)
166            return true;
167        
168        if(!hasIdentity())
169            return false;
170        
171        if(other instanceof  HarmonizedTariffScheduleCodeTranslationValue that) {
172            if(!that.hasIdentity())
173                return false;
174            
175            Long thisEntityId = getEntityId();
176            Long thatEntityId = that.getEntityId();
177            
178            boolean objectsEqual = thisEntityId.equals(thatEntityId);
179            if(objectsEqual)
180                objectsEqual = isIdentical(that);
181            
182            return objectsEqual;
183        } else {
184            return false;
185        }
186    }
187    
188    public boolean isIdentical(Object other) {
189        if(other instanceof HarmonizedTariffScheduleCodeTranslationValue that) {
190            boolean objectsEqual = true;
191            
192            
193            if(objectsEqual) {
194                HarmonizedTariffScheduleCodePK thisHarmonizedTariffScheduleCodePK = getHarmonizedTariffScheduleCodePK();
195                HarmonizedTariffScheduleCodePK thatHarmonizedTariffScheduleCodePK = that.getHarmonizedTariffScheduleCodePK();
196                
197                if(thisHarmonizedTariffScheduleCodePK == null) {
198                    objectsEqual = objectsEqual && (thatHarmonizedTariffScheduleCodePK == null);
199                } else {
200                    objectsEqual = objectsEqual && thisHarmonizedTariffScheduleCodePK.equals(thatHarmonizedTariffScheduleCodePK);
201                }
202            }
203            
204            if(objectsEqual) {
205                LanguagePK thisLanguagePK = getLanguagePK();
206                LanguagePK thatLanguagePK = that.getLanguagePK();
207                
208                if(thisLanguagePK == null) {
209                    objectsEqual = objectsEqual && (thatLanguagePK == null);
210                } else {
211                    objectsEqual = objectsEqual && thisLanguagePK.equals(thatLanguagePK);
212                }
213            }
214            
215            if(objectsEqual) {
216                String thisDescription = getDescription();
217                String thatDescription = that.getDescription();
218                
219                if(thisDescription == null) {
220                    objectsEqual = objectsEqual && (thatDescription == null);
221                } else {
222                    objectsEqual = objectsEqual && thisDescription.equals(thatDescription);
223                }
224            }
225            
226            if(objectsEqual) {
227                MimeTypePK thisOverviewMimeTypePK = getOverviewMimeTypePK();
228                MimeTypePK thatOverviewMimeTypePK = that.getOverviewMimeTypePK();
229                
230                if(thisOverviewMimeTypePK == null) {
231                    objectsEqual = objectsEqual && (thatOverviewMimeTypePK == null);
232                } else {
233                    objectsEqual = objectsEqual && thisOverviewMimeTypePK.equals(thatOverviewMimeTypePK);
234                }
235            }
236            
237            if(objectsEqual) {
238                String thisOverview = getOverview();
239                String thatOverview = that.getOverview();
240                
241                if(thisOverview == null) {
242                    objectsEqual = objectsEqual && (thatOverview == null);
243                } else {
244                    objectsEqual = objectsEqual && thisOverview.equals(thatOverview);
245                }
246            }
247            
248            if(objectsEqual) {
249                Long thisFromTime = getFromTime();
250                Long thatFromTime = that.getFromTime();
251                
252                if(thisFromTime == null) {
253                    objectsEqual = objectsEqual && (thatFromTime == null);
254                } else {
255                    objectsEqual = objectsEqual && thisFromTime.equals(thatFromTime);
256                }
257            }
258            
259            if(objectsEqual) {
260                Long thisThruTime = getThruTime();
261                Long thatThruTime = that.getThruTime();
262                
263                if(thisThruTime == null) {
264                    objectsEqual = objectsEqual && (thatThruTime == null);
265                } else {
266                    objectsEqual = objectsEqual && thisThruTime.equals(thatThruTime);
267                }
268            }
269            
270            return objectsEqual;
271        } else {
272            return false;
273        }
274    }
275    
276    @Override
277    public boolean hasBeenModified() {
278        return harmonizedTariffScheduleCodePKHasBeenModified || languagePKHasBeenModified || descriptionHasBeenModified || overviewMimeTypePKHasBeenModified || overviewHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified;
279    }
280    
281    @Override
282    public void clearHasBeenModified() {
283        harmonizedTariffScheduleCodePKHasBeenModified = false;
284        languagePKHasBeenModified = false;
285        descriptionHasBeenModified = false;
286        overviewMimeTypePKHasBeenModified = false;
287        overviewHasBeenModified = false;
288        fromTimeHasBeenModified = false;
289        thruTimeHasBeenModified = false;
290    }
291    
292    public HarmonizedTariffScheduleCodePK getHarmonizedTariffScheduleCodePK() {
293        return harmonizedTariffScheduleCodePK;
294    }
295    
296    public void setHarmonizedTariffScheduleCodePK(HarmonizedTariffScheduleCodePK harmonizedTariffScheduleCodePK)
297            throws PersistenceNotNullException {
298        checkForNull(harmonizedTariffScheduleCodePK);
299        
300        boolean update = true;
301        
302        if(this.harmonizedTariffScheduleCodePK != null) {
303            if(this.harmonizedTariffScheduleCodePK.equals(harmonizedTariffScheduleCodePK)) {
304                update = false;
305            }
306        } else if(harmonizedTariffScheduleCodePK == null) {
307            update = false;
308        }
309        
310        if(update) {
311            this.harmonizedTariffScheduleCodePK = harmonizedTariffScheduleCodePK;
312            harmonizedTariffScheduleCodePKHasBeenModified = true;
313            clearHashAndString();
314        }
315    }
316    
317    public boolean getHarmonizedTariffScheduleCodePKHasBeenModified() {
318        return harmonizedTariffScheduleCodePKHasBeenModified;
319    }
320    
321    public LanguagePK getLanguagePK() {
322        return languagePK;
323    }
324    
325    public void setLanguagePK(LanguagePK languagePK)
326            throws PersistenceNotNullException {
327        checkForNull(languagePK);
328        
329        boolean update = true;
330        
331        if(this.languagePK != null) {
332            if(this.languagePK.equals(languagePK)) {
333                update = false;
334            }
335        } else if(languagePK == null) {
336            update = false;
337        }
338        
339        if(update) {
340            this.languagePK = languagePK;
341            languagePKHasBeenModified = true;
342            clearHashAndString();
343        }
344    }
345    
346    public boolean getLanguagePKHasBeenModified() {
347        return languagePKHasBeenModified;
348    }
349    
350    public String getDescription() {
351        return description;
352    }
353    
354    public void setDescription(String description)
355            throws PersistenceNotNullException {
356        checkForNull(description);
357        
358        boolean update = true;
359        
360        if(this.description != null) {
361            if(this.description.equals(description)) {
362                update = false;
363            }
364        } else if(description == null) {
365            update = false;
366        }
367        
368        if(update) {
369            this.description = description;
370            descriptionHasBeenModified = true;
371            clearHashAndString();
372        }
373    }
374    
375    public boolean getDescriptionHasBeenModified() {
376        return descriptionHasBeenModified;
377    }
378    
379    public MimeTypePK getOverviewMimeTypePK() {
380        return overviewMimeTypePK;
381    }
382    
383    public void setOverviewMimeTypePK(MimeTypePK overviewMimeTypePK) {
384        boolean update = true;
385        
386        if(this.overviewMimeTypePK != null) {
387            if(this.overviewMimeTypePK.equals(overviewMimeTypePK)) {
388                update = false;
389            }
390        } else if(overviewMimeTypePK == null) {
391            update = false;
392        }
393        
394        if(update) {
395            this.overviewMimeTypePK = overviewMimeTypePK;
396            overviewMimeTypePKHasBeenModified = true;
397            clearHashAndString();
398        }
399    }
400    
401    public boolean getOverviewMimeTypePKHasBeenModified() {
402        return overviewMimeTypePKHasBeenModified;
403    }
404    
405    public String getOverview() {
406        return overview;
407    }
408    
409    public void setOverview(String overview) {
410        boolean update = true;
411        
412        if(this.overview != null) {
413            if(this.overview.equals(overview)) {
414                update = false;
415            }
416        } else if(overview == null) {
417            update = false;
418        }
419        
420        if(update) {
421            this.overview = overview;
422            overviewHasBeenModified = true;
423            clearHashAndString();
424        }
425    }
426    
427    public boolean getOverviewHasBeenModified() {
428        return overviewHasBeenModified;
429    }
430    
431    public Long getFromTime() {
432        return fromTime;
433    }
434    
435    public void setFromTime(Long fromTime)
436            throws PersistenceNotNullException {
437        checkForNull(fromTime);
438        
439        boolean update = true;
440        
441        if(this.fromTime != null) {
442            if(this.fromTime.equals(fromTime)) {
443                update = false;
444            }
445        } else if(fromTime == null) {
446            update = false;
447        }
448        
449        if(update) {
450            this.fromTime = fromTime;
451            fromTimeHasBeenModified = true;
452            clearHashAndString();
453        }
454    }
455    
456    public boolean getFromTimeHasBeenModified() {
457        return fromTimeHasBeenModified;
458    }
459    
460    public Long getThruTime() {
461        return thruTime;
462    }
463    
464    public void setThruTime(Long thruTime)
465            throws PersistenceNotNullException {
466        checkForNull(thruTime);
467        
468        boolean update = true;
469        
470        if(this.thruTime != null) {
471            if(this.thruTime.equals(thruTime)) {
472                update = false;
473            }
474        } else if(thruTime == null) {
475            update = false;
476        }
477        
478        if(update) {
479            this.thruTime = thruTime;
480            thruTimeHasBeenModified = true;
481            clearHashAndString();
482        }
483    }
484    
485    public boolean getThruTimeHasBeenModified() {
486        return thruTimeHasBeenModified;
487    }
488    
489}