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 * CarrierServiceDetailValue.java
021 */
022
023package com.echothree.model.data.carrier.server.value;
024
025import com.echothree.model.data.carrier.common.pk.CarrierServiceDetailPK;
026
027import com.echothree.model.data.carrier.server.factory.CarrierServiceDetailFactory;
028
029import com.echothree.model.data.carrier.common.pk.CarrierServicePK;
030import com.echothree.model.data.party.common.pk.PartyPK;
031import com.echothree.model.data.selector.common.pk.SelectorPK;
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
040import javax.annotation.Nonnull;
041import javax.annotation.Nullable;
042
043public class CarrierServiceDetailValue
044        extends BaseValue<CarrierServiceDetailPK>
045        implements Cloneable, Serializable {
046    
047    private CarrierServicePK carrierServicePK;
048    private boolean carrierServicePKHasBeenModified = false;
049    private PartyPK carrierPartyPK;
050    private boolean carrierPartyPKHasBeenModified = false;
051    private String carrierServiceName;
052    private boolean carrierServiceNameHasBeenModified = false;
053    private SelectorPK geoCodeSelectorPK;
054    private boolean geoCodeSelectorPKHasBeenModified = false;
055    private SelectorPK itemSelectorPK;
056    private boolean itemSelectorPKHasBeenModified = false;
057    private Boolean isDefault;
058    private boolean isDefaultHasBeenModified = false;
059    private Integer sortOrder;
060    private boolean sortOrderHasBeenModified = false;
061    private Long fromTime;
062    private boolean fromTimeHasBeenModified = false;
063    private Long thruTime;
064    private boolean thruTimeHasBeenModified = false;
065    
066    private transient Integer _hashCode = null;
067    private transient String _stringValue = null;
068    
069    private void constructFields(CarrierServicePK carrierServicePK, PartyPK carrierPartyPK, String carrierServiceName, SelectorPK geoCodeSelectorPK, SelectorPK itemSelectorPK, Boolean isDefault, Integer sortOrder, Long fromTime, Long thruTime)
070            throws PersistenceNotNullException {
071        checkForNull(carrierServicePK);
072        this.carrierServicePK = carrierServicePK;
073        checkForNull(carrierPartyPK);
074        this.carrierPartyPK = carrierPartyPK;
075        checkForNull(carrierServiceName);
076        this.carrierServiceName = carrierServiceName;
077        this.geoCodeSelectorPK = geoCodeSelectorPK;
078        this.itemSelectorPK = itemSelectorPK;
079        checkForNull(isDefault);
080        this.isDefault = isDefault;
081        checkForNull(sortOrder);
082        this.sortOrder = sortOrder;
083        checkForNull(fromTime);
084        this.fromTime = fromTime;
085        checkForNull(thruTime);
086        this.thruTime = thruTime;
087    }
088    
089    /** Creates a new instance of CarrierServiceDetailValue */
090    public CarrierServiceDetailValue(CarrierServiceDetailPK carrierServiceDetailPK, CarrierServicePK carrierServicePK, PartyPK carrierPartyPK, String carrierServiceName, SelectorPK geoCodeSelectorPK, SelectorPK itemSelectorPK, Boolean isDefault, Integer sortOrder, Long fromTime, Long thruTime)
091            throws PersistenceNotNullException {
092        super(carrierServiceDetailPK);
093        constructFields(carrierServicePK, carrierPartyPK, carrierServiceName, geoCodeSelectorPK, itemSelectorPK, isDefault, sortOrder, fromTime, thruTime);
094    }
095    
096    /** Creates a new instance of CarrierServiceDetailValue */
097    public CarrierServiceDetailValue(CarrierServicePK carrierServicePK, PartyPK carrierPartyPK, String carrierServiceName, SelectorPK geoCodeSelectorPK, SelectorPK itemSelectorPK, Boolean isDefault, Integer sortOrder, Long fromTime, Long thruTime)
098            throws PersistenceNotNullException {
099        super();
100        constructFields(carrierServicePK, carrierPartyPK, carrierServiceName, geoCodeSelectorPK, itemSelectorPK, isDefault, sortOrder, fromTime, thruTime);
101    }
102    
103    @Override
104    @Nonnull
105    public CarrierServiceDetailFactory getBaseFactoryInstance() {
106        return CarrierServiceDetailFactory.getInstance();
107    }
108    
109    @Override
110    @Nonnull
111    public CarrierServiceDetailValue clone() {
112        Object result;
113        
114        try {
115            result = super.clone();
116        } catch (CloneNotSupportedException cnse) {
117            // This shouldn't happen, fail when it does.
118            throw new PersistenceCloneException(cnse);
119        }
120        
121        return (CarrierServiceDetailValue)result;
122    }
123    
124    @Override
125    @Nonnull
126    public CarrierServiceDetailPK getPrimaryKey() {
127        if(_primaryKey == null) {
128            _primaryKey = new CarrierServiceDetailPK(entityId);
129        }
130        
131        return _primaryKey;
132    }
133    
134    private void clearHashAndString() {
135        _hashCode = null;
136        _stringValue = null;
137    }
138    
139    @Override
140    public int hashCode() {
141        if(_hashCode == null) {
142            int hashCode = 17;
143            
144            hashCode = 37 * hashCode + ((entityId != null) ? entityId.hashCode() : 0);
145            
146            hashCode = 37 * hashCode + ((carrierServicePK != null) ? carrierServicePK.hashCode() : 0);
147            hashCode = 37 * hashCode + ((carrierPartyPK != null) ? carrierPartyPK.hashCode() : 0);
148            hashCode = 37 * hashCode + ((carrierServiceName != null) ? carrierServiceName.hashCode() : 0);
149            hashCode = 37 * hashCode + ((geoCodeSelectorPK != null) ? geoCodeSelectorPK.hashCode() : 0);
150            hashCode = 37 * hashCode + ((itemSelectorPK != null) ? itemSelectorPK.hashCode() : 0);
151            hashCode = 37 * hashCode + ((isDefault != null) ? isDefault.hashCode() : 0);
152            hashCode = 37 * hashCode + ((sortOrder != null) ? sortOrder.hashCode() : 0);
153            hashCode = 37 * hashCode + ((fromTime != null) ? fromTime.hashCode() : 0);
154            hashCode = 37 * hashCode + ((thruTime != null) ? thruTime.hashCode() : 0);
155            
156            _hashCode = hashCode;
157        }
158        
159        return _hashCode;
160    }
161    
162    @Override
163    @Nonnull
164    public String toString() {
165        if(_stringValue == null) {
166            _stringValue = "{" + 
167                    "entityId=" + getEntityId() +
168                    ", carrierServicePK=" + getCarrierServicePK() +
169                    ", carrierPartyPK=" + getCarrierPartyPK() +
170                    ", carrierServiceName=" + getCarrierServiceName() +
171                    ", geoCodeSelectorPK=" + getGeoCodeSelectorPK() +
172                    ", itemSelectorPK=" + getItemSelectorPK() +
173                    ", isDefault=" + getIsDefault() +
174                    ", sortOrder=" + getSortOrder() +
175                    ", fromTime=" + getFromTime() +
176                    ", thruTime=" + getThruTime() +
177                    "}";
178        }
179        return _stringValue;
180    }
181    
182    @Override
183    public boolean equals(Object other) {
184        if(this == other)
185            return true;
186        
187        if(!hasIdentity())
188            return false;
189        
190        if(other instanceof  CarrierServiceDetailValue that) {
191            if(!that.hasIdentity())
192                return false;
193            
194            Long thisEntityId = getEntityId();
195            Long thatEntityId = that.getEntityId();
196            
197            boolean objectsEqual = thisEntityId.equals(thatEntityId);
198            if(objectsEqual)
199                objectsEqual = isIdentical(that);
200            
201            return objectsEqual;
202        } else {
203            return false;
204        }
205    }
206    
207    public boolean isIdentical(Object other) {
208        if(other instanceof CarrierServiceDetailValue that) {
209            boolean objectsEqual = true;
210            
211            
212            if(objectsEqual) {
213                CarrierServicePK thisCarrierServicePK = getCarrierServicePK();
214                CarrierServicePK thatCarrierServicePK = that.getCarrierServicePK();
215                
216                if(thisCarrierServicePK == null) {
217                    objectsEqual = objectsEqual && (thatCarrierServicePK == null);
218                } else {
219                    objectsEqual = objectsEqual && thisCarrierServicePK.equals(thatCarrierServicePK);
220                }
221            }
222            
223            if(objectsEqual) {
224                PartyPK thisCarrierPartyPK = getCarrierPartyPK();
225                PartyPK thatCarrierPartyPK = that.getCarrierPartyPK();
226                
227                if(thisCarrierPartyPK == null) {
228                    objectsEqual = objectsEqual && (thatCarrierPartyPK == null);
229                } else {
230                    objectsEqual = objectsEqual && thisCarrierPartyPK.equals(thatCarrierPartyPK);
231                }
232            }
233            
234            if(objectsEqual) {
235                String thisCarrierServiceName = getCarrierServiceName();
236                String thatCarrierServiceName = that.getCarrierServiceName();
237                
238                if(thisCarrierServiceName == null) {
239                    objectsEqual = objectsEqual && (thatCarrierServiceName == null);
240                } else {
241                    objectsEqual = objectsEqual && thisCarrierServiceName.equals(thatCarrierServiceName);
242                }
243            }
244            
245            if(objectsEqual) {
246                SelectorPK thisGeoCodeSelectorPK = getGeoCodeSelectorPK();
247                SelectorPK thatGeoCodeSelectorPK = that.getGeoCodeSelectorPK();
248                
249                if(thisGeoCodeSelectorPK == null) {
250                    objectsEqual = objectsEqual && (thatGeoCodeSelectorPK == null);
251                } else {
252                    objectsEqual = objectsEqual && thisGeoCodeSelectorPK.equals(thatGeoCodeSelectorPK);
253                }
254            }
255            
256            if(objectsEqual) {
257                SelectorPK thisItemSelectorPK = getItemSelectorPK();
258                SelectorPK thatItemSelectorPK = that.getItemSelectorPK();
259                
260                if(thisItemSelectorPK == null) {
261                    objectsEqual = objectsEqual && (thatItemSelectorPK == null);
262                } else {
263                    objectsEqual = objectsEqual && thisItemSelectorPK.equals(thatItemSelectorPK);
264                }
265            }
266            
267            if(objectsEqual) {
268                Boolean thisIsDefault = getIsDefault();
269                Boolean thatIsDefault = that.getIsDefault();
270                
271                if(thisIsDefault == null) {
272                    objectsEqual = objectsEqual && (thatIsDefault == null);
273                } else {
274                    objectsEqual = objectsEqual && thisIsDefault.equals(thatIsDefault);
275                }
276            }
277            
278            if(objectsEqual) {
279                Integer thisSortOrder = getSortOrder();
280                Integer thatSortOrder = that.getSortOrder();
281                
282                if(thisSortOrder == null) {
283                    objectsEqual = objectsEqual && (thatSortOrder == null);
284                } else {
285                    objectsEqual = objectsEqual && thisSortOrder.equals(thatSortOrder);
286                }
287            }
288            
289            if(objectsEqual) {
290                Long thisFromTime = getFromTime();
291                Long thatFromTime = that.getFromTime();
292                
293                if(thisFromTime == null) {
294                    objectsEqual = objectsEqual && (thatFromTime == null);
295                } else {
296                    objectsEqual = objectsEqual && thisFromTime.equals(thatFromTime);
297                }
298            }
299            
300            if(objectsEqual) {
301                Long thisThruTime = getThruTime();
302                Long thatThruTime = that.getThruTime();
303                
304                if(thisThruTime == null) {
305                    objectsEqual = objectsEqual && (thatThruTime == null);
306                } else {
307                    objectsEqual = objectsEqual && thisThruTime.equals(thatThruTime);
308                }
309            }
310            
311            return objectsEqual;
312        } else {
313            return false;
314        }
315    }
316    
317    @Override
318    public boolean hasBeenModified() {
319        return carrierServicePKHasBeenModified || carrierPartyPKHasBeenModified || carrierServiceNameHasBeenModified || geoCodeSelectorPKHasBeenModified || itemSelectorPKHasBeenModified || isDefaultHasBeenModified || sortOrderHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified;
320    }
321    
322    @Override
323    public void clearHasBeenModified() {
324        carrierServicePKHasBeenModified = false;
325        carrierPartyPKHasBeenModified = false;
326        carrierServiceNameHasBeenModified = false;
327        geoCodeSelectorPKHasBeenModified = false;
328        itemSelectorPKHasBeenModified = false;
329        isDefaultHasBeenModified = false;
330        sortOrderHasBeenModified = false;
331        fromTimeHasBeenModified = false;
332        thruTimeHasBeenModified = false;
333    }
334    
335    @Nonnull
336    public CarrierServicePK getCarrierServicePK() {
337        return carrierServicePK;
338    }
339    
340    public void setCarrierServicePK(@Nonnull CarrierServicePK carrierServicePK)
341            throws PersistenceNotNullException {
342        checkForNull(carrierServicePK);
343        
344        boolean update = true;
345        
346        if(this.carrierServicePK != null) {
347            if(this.carrierServicePK.equals(carrierServicePK)) {
348                update = false;
349            }
350        } else if(carrierServicePK == null) {
351            update = false;
352        }
353        
354        if(update) {
355            this.carrierServicePK = carrierServicePK;
356            carrierServicePKHasBeenModified = true;
357            clearHashAndString();
358        }
359    }
360    
361    public boolean getCarrierServicePKHasBeenModified() {
362        return carrierServicePKHasBeenModified;
363    }
364    
365    @Nonnull
366    public PartyPK getCarrierPartyPK() {
367        return carrierPartyPK;
368    }
369    
370    public void setCarrierPartyPK(@Nonnull PartyPK carrierPartyPK)
371            throws PersistenceNotNullException {
372        checkForNull(carrierPartyPK);
373        
374        boolean update = true;
375        
376        if(this.carrierPartyPK != null) {
377            if(this.carrierPartyPK.equals(carrierPartyPK)) {
378                update = false;
379            }
380        } else if(carrierPartyPK == null) {
381            update = false;
382        }
383        
384        if(update) {
385            this.carrierPartyPK = carrierPartyPK;
386            carrierPartyPKHasBeenModified = true;
387            clearHashAndString();
388        }
389    }
390    
391    public boolean getCarrierPartyPKHasBeenModified() {
392        return carrierPartyPKHasBeenModified;
393    }
394    
395    @Nonnull
396    public String getCarrierServiceName() {
397        return carrierServiceName;
398    }
399    
400    public void setCarrierServiceName(@Nonnull String carrierServiceName)
401            throws PersistenceNotNullException {
402        checkForNull(carrierServiceName);
403        
404        boolean update = true;
405        
406        if(this.carrierServiceName != null) {
407            if(this.carrierServiceName.equals(carrierServiceName)) {
408                update = false;
409            }
410        } else if(carrierServiceName == null) {
411            update = false;
412        }
413        
414        if(update) {
415            this.carrierServiceName = carrierServiceName;
416            carrierServiceNameHasBeenModified = true;
417            clearHashAndString();
418        }
419    }
420    
421    public boolean getCarrierServiceNameHasBeenModified() {
422        return carrierServiceNameHasBeenModified;
423    }
424    
425    @Nullable
426    public SelectorPK getGeoCodeSelectorPK() {
427        return geoCodeSelectorPK;
428    }
429    
430    public void setGeoCodeSelectorPK(@Nullable SelectorPK geoCodeSelectorPK) {
431        boolean update = true;
432        
433        if(this.geoCodeSelectorPK != null) {
434            if(this.geoCodeSelectorPK.equals(geoCodeSelectorPK)) {
435                update = false;
436            }
437        } else if(geoCodeSelectorPK == null) {
438            update = false;
439        }
440        
441        if(update) {
442            this.geoCodeSelectorPK = geoCodeSelectorPK;
443            geoCodeSelectorPKHasBeenModified = true;
444            clearHashAndString();
445        }
446    }
447    
448    public boolean getGeoCodeSelectorPKHasBeenModified() {
449        return geoCodeSelectorPKHasBeenModified;
450    }
451    
452    @Nullable
453    public SelectorPK getItemSelectorPK() {
454        return itemSelectorPK;
455    }
456    
457    public void setItemSelectorPK(@Nullable SelectorPK itemSelectorPK) {
458        boolean update = true;
459        
460        if(this.itemSelectorPK != null) {
461            if(this.itemSelectorPK.equals(itemSelectorPK)) {
462                update = false;
463            }
464        } else if(itemSelectorPK == null) {
465            update = false;
466        }
467        
468        if(update) {
469            this.itemSelectorPK = itemSelectorPK;
470            itemSelectorPKHasBeenModified = true;
471            clearHashAndString();
472        }
473    }
474    
475    public boolean getItemSelectorPKHasBeenModified() {
476        return itemSelectorPKHasBeenModified;
477    }
478    
479    @Nonnull
480    public Boolean getIsDefault() {
481        return isDefault;
482    }
483    
484    public void setIsDefault(@Nonnull Boolean isDefault)
485            throws PersistenceNotNullException {
486        checkForNull(isDefault);
487        
488        boolean update = true;
489        
490        if(this.isDefault != null) {
491            if(this.isDefault.equals(isDefault)) {
492                update = false;
493            }
494        } else if(isDefault == null) {
495            update = false;
496        }
497        
498        if(update) {
499            this.isDefault = isDefault;
500            isDefaultHasBeenModified = true;
501            clearHashAndString();
502        }
503    }
504    
505    public boolean getIsDefaultHasBeenModified() {
506        return isDefaultHasBeenModified;
507    }
508    
509    @Nonnull
510    public Integer getSortOrder() {
511        return sortOrder;
512    }
513    
514    public void setSortOrder(@Nonnull Integer sortOrder)
515            throws PersistenceNotNullException {
516        checkForNull(sortOrder);
517        
518        boolean update = true;
519        
520        if(this.sortOrder != null) {
521            if(this.sortOrder.equals(sortOrder)) {
522                update = false;
523            }
524        } else if(sortOrder == null) {
525            update = false;
526        }
527        
528        if(update) {
529            this.sortOrder = sortOrder;
530            sortOrderHasBeenModified = true;
531            clearHashAndString();
532        }
533    }
534    
535    public boolean getSortOrderHasBeenModified() {
536        return sortOrderHasBeenModified;
537    }
538    
539    @Nonnull
540    public Long getFromTime() {
541        return fromTime;
542    }
543    
544    public void setFromTime(@Nonnull Long fromTime)
545            throws PersistenceNotNullException {
546        checkForNull(fromTime);
547        
548        boolean update = true;
549        
550        if(this.fromTime != null) {
551            if(this.fromTime.equals(fromTime)) {
552                update = false;
553            }
554        } else if(fromTime == null) {
555            update = false;
556        }
557        
558        if(update) {
559            this.fromTime = fromTime;
560            fromTimeHasBeenModified = true;
561            clearHashAndString();
562        }
563    }
564    
565    public boolean getFromTimeHasBeenModified() {
566        return fromTimeHasBeenModified;
567    }
568    
569    @Nonnull
570    public Long getThruTime() {
571        return thruTime;
572    }
573    
574    public void setThruTime(@Nonnull Long thruTime)
575            throws PersistenceNotNullException {
576        checkForNull(thruTime);
577        
578        boolean update = true;
579        
580        if(this.thruTime != null) {
581            if(this.thruTime.equals(thruTime)) {
582                update = false;
583            }
584        } else if(thruTime == null) {
585            update = false;
586        }
587        
588        if(update) {
589            this.thruTime = thruTime;
590            thruTimeHasBeenModified = true;
591            clearHashAndString();
592        }
593    }
594    
595    public boolean getThruTimeHasBeenModified() {
596        return thruTimeHasBeenModified;
597    }
598    
599}