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 * OfferDetailValue.java
021 */
022
023package com.echothree.model.data.offer.server.value;
024
025import com.echothree.model.data.offer.common.pk.OfferDetailPK;
026
027import com.echothree.model.data.offer.server.factory.OfferDetailFactory;
028
029import com.echothree.model.data.offer.common.pk.OfferPK;
030import com.echothree.model.data.sequence.common.pk.SequencePK;
031import com.echothree.model.data.party.common.pk.PartyPK;
032import com.echothree.model.data.selector.common.pk.SelectorPK;
033import com.echothree.model.data.filter.common.pk.FilterPK;
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 OfferDetailValue
043        extends BaseValue<OfferDetailPK>
044        implements Cloneable, Serializable {
045    
046    private OfferPK offerPK;
047    private boolean offerPKHasBeenModified = false;
048    private String offerName;
049    private boolean offerNameHasBeenModified = false;
050    private SequencePK salesOrderSequencePK;
051    private boolean salesOrderSequencePKHasBeenModified = false;
052    private PartyPK departmentPartyPK;
053    private boolean departmentPartyPKHasBeenModified = false;
054    private SelectorPK offerItemSelectorPK;
055    private boolean offerItemSelectorPKHasBeenModified = false;
056    private FilterPK offerItemPriceFilterPK;
057    private boolean offerItemPriceFilterPKHasBeenModified = false;
058    private Boolean isDefault;
059    private boolean isDefaultHasBeenModified = false;
060    private Integer sortOrder;
061    private boolean sortOrderHasBeenModified = false;
062    private Long fromTime;
063    private boolean fromTimeHasBeenModified = false;
064    private Long thruTime;
065    private boolean thruTimeHasBeenModified = false;
066    
067    private transient Integer _hashCode = null;
068    private transient String _stringValue = null;
069    
070    private void constructFields(OfferPK offerPK, String offerName, SequencePK salesOrderSequencePK, PartyPK departmentPartyPK, SelectorPK offerItemSelectorPK, FilterPK offerItemPriceFilterPK, Boolean isDefault, Integer sortOrder, Long fromTime, Long thruTime)
071            throws PersistenceNotNullException {
072        checkForNull(offerPK);
073        this.offerPK = offerPK;
074        checkForNull(offerName);
075        this.offerName = offerName;
076        this.salesOrderSequencePK = salesOrderSequencePK;
077        checkForNull(departmentPartyPK);
078        this.departmentPartyPK = departmentPartyPK;
079        this.offerItemSelectorPK = offerItemSelectorPK;
080        this.offerItemPriceFilterPK = offerItemPriceFilterPK;
081        checkForNull(isDefault);
082        this.isDefault = isDefault;
083        checkForNull(sortOrder);
084        this.sortOrder = sortOrder;
085        checkForNull(fromTime);
086        this.fromTime = fromTime;
087        checkForNull(thruTime);
088        this.thruTime = thruTime;
089    }
090    
091    /** Creates a new instance of OfferDetailValue */
092    public OfferDetailValue(OfferDetailPK offerDetailPK, OfferPK offerPK, String offerName, SequencePK salesOrderSequencePK, PartyPK departmentPartyPK, SelectorPK offerItemSelectorPK, FilterPK offerItemPriceFilterPK, Boolean isDefault, Integer sortOrder, Long fromTime, Long thruTime)
093            throws PersistenceNotNullException {
094        super(offerDetailPK);
095        constructFields(offerPK, offerName, salesOrderSequencePK, departmentPartyPK, offerItemSelectorPK, offerItemPriceFilterPK, isDefault, sortOrder, fromTime, thruTime);
096    }
097    
098    /** Creates a new instance of OfferDetailValue */
099    public OfferDetailValue(OfferPK offerPK, String offerName, SequencePK salesOrderSequencePK, PartyPK departmentPartyPK, SelectorPK offerItemSelectorPK, FilterPK offerItemPriceFilterPK, Boolean isDefault, Integer sortOrder, Long fromTime, Long thruTime)
100            throws PersistenceNotNullException {
101        super();
102        constructFields(offerPK, offerName, salesOrderSequencePK, departmentPartyPK, offerItemSelectorPK, offerItemPriceFilterPK, isDefault, sortOrder, fromTime, thruTime);
103    }
104    
105   @Override
106   public OfferDetailFactory getBaseFactoryInstance() {
107        return OfferDetailFactory.getInstance();
108    }
109    
110    @Override
111    public OfferDetailValue 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 (OfferDetailValue)result;
122    }
123    
124   @Override
125    public OfferDetailPK getPrimaryKey() {
126        if(_primaryKey == null) {
127            _primaryKey = new OfferDetailPK(entityId);
128        }
129        
130        return _primaryKey;
131    }
132    
133    private void clearHashAndString() {
134        _hashCode = null;
135        _stringValue = null;
136    }
137    
138    @Override
139    public int hashCode() {
140        if(_hashCode == null) {
141            int hashCode = 17;
142            
143            hashCode = 37 * hashCode + ((entityId != null) ? entityId.hashCode() : 0);
144            
145            hashCode = 37 * hashCode + ((offerPK != null) ? offerPK.hashCode() : 0);
146            hashCode = 37 * hashCode + ((offerName != null) ? offerName.hashCode() : 0);
147            hashCode = 37 * hashCode + ((salesOrderSequencePK != null) ? salesOrderSequencePK.hashCode() : 0);
148            hashCode = 37 * hashCode + ((departmentPartyPK != null) ? departmentPartyPK.hashCode() : 0);
149            hashCode = 37 * hashCode + ((offerItemSelectorPK != null) ? offerItemSelectorPK.hashCode() : 0);
150            hashCode = 37 * hashCode + ((offerItemPriceFilterPK != null) ? offerItemPriceFilterPK.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    public String toString() {
164        if(_stringValue == null) {
165            _stringValue = "{" + 
166                    "entityId=" + getEntityId() +
167                    ", offerPK=" + getOfferPK() +
168                    ", offerName=" + getOfferName() +
169                    ", salesOrderSequencePK=" + getSalesOrderSequencePK() +
170                    ", departmentPartyPK=" + getDepartmentPartyPK() +
171                    ", offerItemSelectorPK=" + getOfferItemSelectorPK() +
172                    ", offerItemPriceFilterPK=" + getOfferItemPriceFilterPK() +
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  OfferDetailValue 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 OfferDetailValue that) {
209            boolean objectsEqual = true;
210            
211            
212            if(objectsEqual) {
213                OfferPK thisOfferPK = getOfferPK();
214                OfferPK thatOfferPK = that.getOfferPK();
215                
216                if(thisOfferPK == null) {
217                    objectsEqual = objectsEqual && (thatOfferPK == null);
218                } else {
219                    objectsEqual = objectsEqual && thisOfferPK.equals(thatOfferPK);
220                }
221            }
222            
223            if(objectsEqual) {
224                String thisOfferName = getOfferName();
225                String thatOfferName = that.getOfferName();
226                
227                if(thisOfferName == null) {
228                    objectsEqual = objectsEqual && (thatOfferName == null);
229                } else {
230                    objectsEqual = objectsEqual && thisOfferName.equals(thatOfferName);
231                }
232            }
233            
234            if(objectsEqual) {
235                SequencePK thisSalesOrderSequencePK = getSalesOrderSequencePK();
236                SequencePK thatSalesOrderSequencePK = that.getSalesOrderSequencePK();
237                
238                if(thisSalesOrderSequencePK == null) {
239                    objectsEqual = objectsEqual && (thatSalesOrderSequencePK == null);
240                } else {
241                    objectsEqual = objectsEqual && thisSalesOrderSequencePK.equals(thatSalesOrderSequencePK);
242                }
243            }
244            
245            if(objectsEqual) {
246                PartyPK thisDepartmentPartyPK = getDepartmentPartyPK();
247                PartyPK thatDepartmentPartyPK = that.getDepartmentPartyPK();
248                
249                if(thisDepartmentPartyPK == null) {
250                    objectsEqual = objectsEqual && (thatDepartmentPartyPK == null);
251                } else {
252                    objectsEqual = objectsEqual && thisDepartmentPartyPK.equals(thatDepartmentPartyPK);
253                }
254            }
255            
256            if(objectsEqual) {
257                SelectorPK thisOfferItemSelectorPK = getOfferItemSelectorPK();
258                SelectorPK thatOfferItemSelectorPK = that.getOfferItemSelectorPK();
259                
260                if(thisOfferItemSelectorPK == null) {
261                    objectsEqual = objectsEqual && (thatOfferItemSelectorPK == null);
262                } else {
263                    objectsEqual = objectsEqual && thisOfferItemSelectorPK.equals(thatOfferItemSelectorPK);
264                }
265            }
266            
267            if(objectsEqual) {
268                FilterPK thisOfferItemPriceFilterPK = getOfferItemPriceFilterPK();
269                FilterPK thatOfferItemPriceFilterPK = that.getOfferItemPriceFilterPK();
270                
271                if(thisOfferItemPriceFilterPK == null) {
272                    objectsEqual = objectsEqual && (thatOfferItemPriceFilterPK == null);
273                } else {
274                    objectsEqual = objectsEqual && thisOfferItemPriceFilterPK.equals(thatOfferItemPriceFilterPK);
275                }
276            }
277            
278            if(objectsEqual) {
279                Boolean thisIsDefault = getIsDefault();
280                Boolean thatIsDefault = that.getIsDefault();
281                
282                if(thisIsDefault == null) {
283                    objectsEqual = objectsEqual && (thatIsDefault == null);
284                } else {
285                    objectsEqual = objectsEqual && thisIsDefault.equals(thatIsDefault);
286                }
287            }
288            
289            if(objectsEqual) {
290                Integer thisSortOrder = getSortOrder();
291                Integer thatSortOrder = that.getSortOrder();
292                
293                if(thisSortOrder == null) {
294                    objectsEqual = objectsEqual && (thatSortOrder == null);
295                } else {
296                    objectsEqual = objectsEqual && thisSortOrder.equals(thatSortOrder);
297                }
298            }
299            
300            if(objectsEqual) {
301                Long thisFromTime = getFromTime();
302                Long thatFromTime = that.getFromTime();
303                
304                if(thisFromTime == null) {
305                    objectsEqual = objectsEqual && (thatFromTime == null);
306                } else {
307                    objectsEqual = objectsEqual && thisFromTime.equals(thatFromTime);
308                }
309            }
310            
311            if(objectsEqual) {
312                Long thisThruTime = getThruTime();
313                Long thatThruTime = that.getThruTime();
314                
315                if(thisThruTime == null) {
316                    objectsEqual = objectsEqual && (thatThruTime == null);
317                } else {
318                    objectsEqual = objectsEqual && thisThruTime.equals(thatThruTime);
319                }
320            }
321            
322            return objectsEqual;
323        } else {
324            return false;
325        }
326    }
327    
328    @Override
329    public boolean hasBeenModified() {
330        return offerPKHasBeenModified || offerNameHasBeenModified || salesOrderSequencePKHasBeenModified || departmentPartyPKHasBeenModified || offerItemSelectorPKHasBeenModified || offerItemPriceFilterPKHasBeenModified || isDefaultHasBeenModified || sortOrderHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified;
331    }
332    
333    @Override
334    public void clearHasBeenModified() {
335        offerPKHasBeenModified = false;
336        offerNameHasBeenModified = false;
337        salesOrderSequencePKHasBeenModified = false;
338        departmentPartyPKHasBeenModified = false;
339        offerItemSelectorPKHasBeenModified = false;
340        offerItemPriceFilterPKHasBeenModified = false;
341        isDefaultHasBeenModified = false;
342        sortOrderHasBeenModified = false;
343        fromTimeHasBeenModified = false;
344        thruTimeHasBeenModified = false;
345    }
346    
347    public OfferPK getOfferPK() {
348        return offerPK;
349    }
350    
351    public void setOfferPK(OfferPK offerPK)
352            throws PersistenceNotNullException {
353        checkForNull(offerPK);
354        
355        boolean update = true;
356        
357        if(this.offerPK != null) {
358            if(this.offerPK.equals(offerPK)) {
359                update = false;
360            }
361        } else if(offerPK == null) {
362            update = false;
363        }
364        
365        if(update) {
366            this.offerPK = offerPK;
367            offerPKHasBeenModified = true;
368            clearHashAndString();
369        }
370    }
371    
372    public boolean getOfferPKHasBeenModified() {
373        return offerPKHasBeenModified;
374    }
375    
376    public String getOfferName() {
377        return offerName;
378    }
379    
380    public void setOfferName(String offerName)
381            throws PersistenceNotNullException {
382        checkForNull(offerName);
383        
384        boolean update = true;
385        
386        if(this.offerName != null) {
387            if(this.offerName.equals(offerName)) {
388                update = false;
389            }
390        } else if(offerName == null) {
391            update = false;
392        }
393        
394        if(update) {
395            this.offerName = offerName;
396            offerNameHasBeenModified = true;
397            clearHashAndString();
398        }
399    }
400    
401    public boolean getOfferNameHasBeenModified() {
402        return offerNameHasBeenModified;
403    }
404    
405    public SequencePK getSalesOrderSequencePK() {
406        return salesOrderSequencePK;
407    }
408    
409    public void setSalesOrderSequencePK(SequencePK salesOrderSequencePK) {
410        boolean update = true;
411        
412        if(this.salesOrderSequencePK != null) {
413            if(this.salesOrderSequencePK.equals(salesOrderSequencePK)) {
414                update = false;
415            }
416        } else if(salesOrderSequencePK == null) {
417            update = false;
418        }
419        
420        if(update) {
421            this.salesOrderSequencePK = salesOrderSequencePK;
422            salesOrderSequencePKHasBeenModified = true;
423            clearHashAndString();
424        }
425    }
426    
427    public boolean getSalesOrderSequencePKHasBeenModified() {
428        return salesOrderSequencePKHasBeenModified;
429    }
430    
431    public PartyPK getDepartmentPartyPK() {
432        return departmentPartyPK;
433    }
434    
435    public void setDepartmentPartyPK(PartyPK departmentPartyPK)
436            throws PersistenceNotNullException {
437        checkForNull(departmentPartyPK);
438        
439        boolean update = true;
440        
441        if(this.departmentPartyPK != null) {
442            if(this.departmentPartyPK.equals(departmentPartyPK)) {
443                update = false;
444            }
445        } else if(departmentPartyPK == null) {
446            update = false;
447        }
448        
449        if(update) {
450            this.departmentPartyPK = departmentPartyPK;
451            departmentPartyPKHasBeenModified = true;
452            clearHashAndString();
453        }
454    }
455    
456    public boolean getDepartmentPartyPKHasBeenModified() {
457        return departmentPartyPKHasBeenModified;
458    }
459    
460    public SelectorPK getOfferItemSelectorPK() {
461        return offerItemSelectorPK;
462    }
463    
464    public void setOfferItemSelectorPK(SelectorPK offerItemSelectorPK) {
465        boolean update = true;
466        
467        if(this.offerItemSelectorPK != null) {
468            if(this.offerItemSelectorPK.equals(offerItemSelectorPK)) {
469                update = false;
470            }
471        } else if(offerItemSelectorPK == null) {
472            update = false;
473        }
474        
475        if(update) {
476            this.offerItemSelectorPK = offerItemSelectorPK;
477            offerItemSelectorPKHasBeenModified = true;
478            clearHashAndString();
479        }
480    }
481    
482    public boolean getOfferItemSelectorPKHasBeenModified() {
483        return offerItemSelectorPKHasBeenModified;
484    }
485    
486    public FilterPK getOfferItemPriceFilterPK() {
487        return offerItemPriceFilterPK;
488    }
489    
490    public void setOfferItemPriceFilterPK(FilterPK offerItemPriceFilterPK) {
491        boolean update = true;
492        
493        if(this.offerItemPriceFilterPK != null) {
494            if(this.offerItemPriceFilterPK.equals(offerItemPriceFilterPK)) {
495                update = false;
496            }
497        } else if(offerItemPriceFilterPK == null) {
498            update = false;
499        }
500        
501        if(update) {
502            this.offerItemPriceFilterPK = offerItemPriceFilterPK;
503            offerItemPriceFilterPKHasBeenModified = true;
504            clearHashAndString();
505        }
506    }
507    
508    public boolean getOfferItemPriceFilterPKHasBeenModified() {
509        return offerItemPriceFilterPKHasBeenModified;
510    }
511    
512    public Boolean getIsDefault() {
513        return isDefault;
514    }
515    
516    public void setIsDefault(Boolean isDefault)
517            throws PersistenceNotNullException {
518        checkForNull(isDefault);
519        
520        boolean update = true;
521        
522        if(this.isDefault != null) {
523            if(this.isDefault.equals(isDefault)) {
524                update = false;
525            }
526        } else if(isDefault == null) {
527            update = false;
528        }
529        
530        if(update) {
531            this.isDefault = isDefault;
532            isDefaultHasBeenModified = true;
533            clearHashAndString();
534        }
535    }
536    
537    public boolean getIsDefaultHasBeenModified() {
538        return isDefaultHasBeenModified;
539    }
540    
541    public Integer getSortOrder() {
542        return sortOrder;
543    }
544    
545    public void setSortOrder(Integer sortOrder)
546            throws PersistenceNotNullException {
547        checkForNull(sortOrder);
548        
549        boolean update = true;
550        
551        if(this.sortOrder != null) {
552            if(this.sortOrder.equals(sortOrder)) {
553                update = false;
554            }
555        } else if(sortOrder == null) {
556            update = false;
557        }
558        
559        if(update) {
560            this.sortOrder = sortOrder;
561            sortOrderHasBeenModified = true;
562            clearHashAndString();
563        }
564    }
565    
566    public boolean getSortOrderHasBeenModified() {
567        return sortOrderHasBeenModified;
568    }
569    
570    public Long getFromTime() {
571        return fromTime;
572    }
573    
574    public void setFromTime(Long fromTime)
575            throws PersistenceNotNullException {
576        checkForNull(fromTime);
577        
578        boolean update = true;
579        
580        if(this.fromTime != null) {
581            if(this.fromTime.equals(fromTime)) {
582                update = false;
583            }
584        } else if(fromTime == null) {
585            update = false;
586        }
587        
588        if(update) {
589            this.fromTime = fromTime;
590            fromTimeHasBeenModified = true;
591            clearHashAndString();
592        }
593    }
594    
595    public boolean getFromTimeHasBeenModified() {
596        return fromTimeHasBeenModified;
597    }
598    
599    public Long getThruTime() {
600        return thruTime;
601    }
602    
603    public void setThruTime(Long thruTime)
604            throws PersistenceNotNullException {
605        checkForNull(thruTime);
606        
607        boolean update = true;
608        
609        if(this.thruTime != null) {
610            if(this.thruTime.equals(thruTime)) {
611                update = false;
612            }
613        } else if(thruTime == null) {
614            update = false;
615        }
616        
617        if(update) {
618            this.thruTime = thruTime;
619            thruTimeHasBeenModified = true;
620            clearHashAndString();
621        }
622    }
623    
624    public boolean getThruTimeHasBeenModified() {
625        return thruTimeHasBeenModified;
626    }
627    
628}