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