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